Page 1 of 3

Visualizing site coverage with Google Earth (slow for dial-up)

PostPosted: Wed Feb 08, 2006 5:42 pm
by Dutch
In this thread up in the Scripts section, I promised to post a pic of the output from the Google Earth conversion script I posted there.

I've decided to make it into a small how-to use Google Earth for WiFi Site Surveys. The thread will have some large pictures posted, and before people start to complain : RHIP, as well as I got the permission from our very own Voice Of Reason, Thorn.

First of all, you need Google Earth. Pick it up from http://earth.google.com/ , then install it.
Then download and install the PHP5 engine from http://www.php.net/ (For Windows, take hhe full package, not the installer. The installer only have the php-cgi executable, not the php standalone executable).
Finally copy the php script I posted in the above thread and paste it into a notepad document, and save it as kismet-to-kml.php
For the php script to work, you also need to have the ap_manuf and the client_manuf files from kismet in the same folder as the php script. These two files comes with the kismet package, and are normally located with the kismet configuration files (depending on your distro : /etc/kismet, or /usr/share/kismet).

Now you have the tools for generating the output of the site survey. So lets go do one. In this case I've used kismet to check out the local school, who just got WiFi last year.
I fired up Google Earth, and zoomed in on the area of the site I wanted to check, emailed the picture to myself, and opened it in my favourite graphicseditor. I then made an educated guess on what route I needed to go down, in order to see if the school's WiFi radiated down there.

The green area is the school grounds and buildings. The red line is the route I decided to take, based on where there might be LOS to the school buildings and grounds. I then printed out the edited picture, and went to the starting point of my route.

PostPosted: Wed Feb 08, 2006 5:44 pm
by Dutch
The gear used for the site survey was :
Dell C600 laptop with an Atheros based 802.11b/g PCCard WiFi nic.
No external antenna.
A Holux GM210 USB GPS puck.
Kismet running under Debian Linux.
Laptop placed in a Targus PC Backpack, with the PC card pointing up. GPS Puck placed under one shoulderstrap.

Kismet had been configured to only scan channels 1, 6, 11, 13, with a 4 channels pr second scan time. (kismet.conf, channelvelocity and sourcechannels statements)
Kismet had been configured to only detect and track the MAC adresses in use at the school, or actually only detect and track the OUI of the equipment that the school uses. In this case Zyxel gear, filtered in kismet.conf with the filtertracker statement - filter_tracker=BSSID(00:A0:0C:C5:8F:00:00/FF:FF:FF:FF:00:00).
These parameters had been checked out in advance, i.e. which channels and which MAC's that the schools WiFi network utilized.

Kismet had also been configured to speak out detected network SSID's as well as sounding off everytime kismet detected a packet. (kismet_ui.conf file, sound, sound_new, sound_traffic, and speech parameters).



After following the route mapped out on the Google Earth picture, I took the resulting kismet.xml, kismet.gps, and kismet.csv files, to post process into a Google Earth kml file.
The first step is to run the php script. In the example below the php engine is installed in \program files\php\, the kismetfiles are in \kismetdata\ and the php script is also in \kismetdata\

Open a command prompt on your windows box.
Enter the following commandlines :

cd \kismetdata<enter>
"\program files\php\php.exe" -f kismet-to-kml.php kismet kmz<enter>

The first command changes to the folder containing the kismet.gps, kismet.xml, kismet.csv and the php script files
The second command executes the PHP5 engine, telling it to compile and run the kismet-to-kml script file, with the filename (without any suffix) of the kismet.gps and kismet.xml files, and to output both a kml and and zipped kmz file.

Please note that if the .gps file contains errors, such as missing the closing </gps-run> tag or having malformed <gps-point=........> lines, there will be warnings and errors.
Remember that kismet .csv, and .xml files are written afresh at every data cycle, but .gps files are appended to. If you didn't exit kismet properly, then chances are high, that the .gps file will contain a malformed <gps-point=....> line and missing the </gps-run>.
Just open the .gps file in any texteditor that can handle large files, move to the bottom of the file, delete the erroneous <gps-point=...> line and add a closing </gps-run> tag on the last line.

After it has churned away for a bit (1½ min for the 24 networks and 5 Mb data in this example), there will be a kismet.kml and a kismet.kmz file in the \kismetdata\ folder.

Doubleclick the kismet.kmz file to open it in Google Earth. Google Earth will zoom to the location of the first AP, and show the icons for the detected AP's.
They will be way off, as the .xml file only contains the locations coordinates from when Kismet first detected the AP and when it last detected the AP.
Untill I get the the time to change the php script, we need to do some hand editing, in order to get the program to show the location where Kismet had the best signal of the AP, which is as close to the actual location we can get, without doing triangulation.
Enter the kismet.csv file. The last coordinate pair in each record here, is the location where Kismet detected the highest signal level.

Go through each displayed accesspoint in the My Places window in Google Earth, rightclicking the Access point, select Edit, and then click the Advanced checkmark, and then the Location tab, put in the corresponding Lat/Lon coodinates for each AP, then click apply.

Now the icons for the detected AP's will be more correctly placed.

PostPosted: Wed Feb 08, 2006 5:45 pm
by Dutch
Now the fun begins.. See the 3D Visualized view entry in the My Places window ? Expand it, and voila, you can mark the individual AP's, to get a visualized display of the coverage of each.
Mark them all off, and you have the area where the school's network is detecable. In this case, the school grounds, a 150 x 87 meter area (492 x 287 feet) is amply covered by the AP deployed.. Actually IMHO they have overdone it, and are bleeding signals much to far away...

PostPosted: Wed Feb 08, 2006 5:47 pm
by Dutch
In this picture I've unchecked the AP icons, thereby being able to see that the any area of the school grounds are covered by more than 1 AP.

PostPosted: Wed Feb 08, 2006 5:48 pm
by Dutch
And in the final picture, I've tilted the view closer to the ground, rotated the view so Copenhagen Airport and the bridge to Sweden is in view, selected only two of the AP's and their corresponding coverage maps.
As you can see, the heights of the coverage maps differ, giving a visual clue to the channel in use. Additionally, I've rightclicked on the coveragemap-entry for the second AP in My Places window, and edited the colour of the map to blue.

PostPosted: Wed Feb 08, 2006 5:49 pm
by Dutch
If you don't use kismet, fear not.. There are several scripts and applications that can generate Google Earth kml files from netstumbler data. One of the better ones, are made by beakmyn from this forum. His tagline contains a link to his program, and I'd be amazed if he doesn't include the coverage map function in the next version of his great Netstumbler utility.

So there you have it, a quick and easy way to visualize a site's coverage via Google Earth.
Enjoy and have fun...

Dutch

PostPosted: Wed Feb 08, 2006 7:08 pm
by theprez98
Nice work Dutch! If only it didn't place my AP in South America! (GPS snafu)

Actually, the rest of the map worked fine. I tried a second series of files, and they worked fine too. The only downside is that Google Earth has crap for State College. The images are worthless at a street level, and I doubt they'll do anything to update that anytime soon.

PostPosted: Wed Feb 08, 2006 7:19 pm
by theprez98
How do I crack wep with Google Earth?

Please help me, I can't find the "crack this AP" button.

;)

PostPosted: Wed Feb 08, 2006 7:20 pm
by Dutch
[quote="theprez98"]How do I crack wep with Google Earth?

Please help me, I can't find the "crack this AP" button.

]
You are SOOOOO banned....

Dutch

PostPosted: Wed Feb 08, 2006 7:26 pm
by streaker69
How does GoogleEarth know the exact location of all these AP's?

Do you think you could use it to find Blackwave or Devine? ;)

PostPosted: Wed Feb 08, 2006 7:37 pm
by Thorn
[quote="streaker69"]Do you think you could use it to find Blackwave or Devine? ]
You're next. :D

PostPosted: Wed Feb 08, 2006 7:45 pm
by Scruge
Dutch, that's damn slick.

After I get my desk cleared of my back log of projects I'd like to see how you did the 3ds.

PostPosted: Wed Feb 08, 2006 7:53 pm
by Dutch
Scruge wrote:Dutch, that's damn slick.

After I get my desk cleared of my back log of projects I'd like to see how you did the 3ds.

Not my work.. See the info in the script. I just made some minor changes and bugfixes so far.
The polygons aren't that hard to figure out.
Collate the gps-point data for each BSSID, and use them to make the boundaries of the polygon.
Code: Select all
/*******************
* parse .gps file and build gps coordinates index
********************/
foreach($gps->{'gps-point'} as $value)
{
$coordinates[(string) $value['bssid']][] = array((string) $value['lon'], (string) $value['lat'])]
Then make the polygon :
[code]
/*******************
* assemble polygon placemark
********************/

if($network['channel'] != '0') //we don't display networks with no height
{

$poly .= "<Placemark>\n<name><![CDATA[";
if(empty($network['SSID'])) $poly .= "no ssid";
else $poly .= $network['SSID'];
echo "SSID:".$network['SSID']." BSSID:".$network['BSSID']."\n";
$poly .= "]]></name>\n<visibility>0</visibility>\n<open>0</open>\n";
$poly .= "<Style>\n\t<LineStyle>\n\t<width>1.5</width></LineStyle>\n\t<PolyStyle>";

if($xml->{'wireless-network'}[$key]['wep'] == 'true') //set color
$poly .= "<color>8f00ff00</color>\n"; //green, closed
elseif($meta[$key]['cloaked'] == 'true')
$poly .= "<color>7dff0000</color>\n"; //blue, cloaked
else
$poly .= "<color>7d00ff00</color>\n"; //red, open

$poly .= "</PolyStyle>\n</Style>\n<Polygon>\n<extrude>1</extrude>\n<tessellate>0</tessellate>\n";
$poly .= "<altitudeMode>relativeToGround</altitudeMode>\n<outerBoundaryIs>\n<LinearRing>\n<extrude>0</extrude>";
$poly .= "<tessellate>0</tessellate>\n<altitudeMode>clampToGround</altitudeMode>\n<coordinates>";

$poly_alt = $network['channel']*10;

foreach($coordinates[$network['BSSID']] as $index => $gpoints)
{
if($gpoints[0] != $coordinates[$network['BSSID']][$index-1][0]
&& $gpoints[1] != $coordinates[$network['BSSID']][$index-1][1]) //remove duplicates
$poly .= $gpoints[0].", ".$gpoints[1].", ".$poly_alt." ";
}

$poly .= $coordinates[$network['BSSID']][0][0].", ".$coordinates[$network['BSSID']][0][1].", ".$poly_alt." "; //finish polygon at first coordinate
$poly .= "</coordinates>\n</LinearRing>\n</outerBoundaryIs>\n</Polygon>\n</Placemark>";

}
} //end foreach
[/code]
and finally output it to the kml file
[code]

//output 3D visualized polygons
$kml_final .= "<Folder>\n<name>3D visualized view</name><open>0</open>\n";
$kml_final .= $poly;
$kml_final .= "</Folder>\n";


Converting the above snippets of code to the language of your choice shouldn't be to hard, albeit I'm not so sure dBase 7.5 has the constructs for easy looping and temporary arrays.


Dutch

PostPosted: Wed Feb 08, 2006 8:05 pm
by wiresalot
Dutch, You the man!!!, Great job!!, thats awesome.

wiresalot

PostPosted: Thu Feb 09, 2006 5:06 am
by Monitr7
So if I'm in the coverage area, it's okay to use the inturweb, right?