mywaps.kml
//WAP Icon based on Netstumbler's
// Filter help from http://www.analysisandsolutions.com/code/phpxml.htm
// Ver 1.1 Put WEPed WAPS in separate Folder so you do not have to view them.
// Ver 1.2 Changed how bad characters are stripped from the SSID so they would not mess up the XML.
//This script was modified by Ryan (bird603568) Richards see Irongeek's site for orginal
//please send emails to rlr5018 at psu dot edu
echo "
WiGLE Data
1
";
echo "
Wigle WiFi Map (WEP On)
0
";
for($count =0;$count<=7;$count++)
{
PrintKMLFolder($argv[1], 'Y', $count);
}
echo "\n\n";
echo "
Wigle WiFi Map (WEP Off)
0
";
for($count =0;$count<=7;$count++)
{
PrintKMLFolder($argv[1], 'N', $count);
}
echo "\n\n";
echo "
";
function PrintKMLFolder($InputFileName,$WEPStatus, $QOS)
{
$handle = fopen($InputFileName, "r");
$data = fgetcsv($handle, 1000, "~"); // Skip first line
echo"
QoS $QOS
0
";
while (($data = fgetcsv($handle, 1000, "~")) !== FALSE)
{
$ssid = $data[2];
//$QOS = $data[11]; // Escape ampersands that aren't part of entities.
$ssid= preg_replace('/&(?!\w{2,6};)/', '&', $ssid );
// Remove all non-visible characters except SP, TAB, LF and CR.
$ssid = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $ssid );
if($data[9]==$WEPStatus && $QOS == $data[11])
{
QOS($ssid,$data);
}
}
echo "\n\n";
fclose($handle);
return;
}
function QOS($ssid,$data)
{
echo "
BSSID: $data[3]
WEP: $data[9]
CHANNEL: $data[5]
QOS: $data[11]
]]>
$data[1],$data[0],0
";
return;
}
?>