0% found this document useful (0 votes)
45 views8 pages

Wifi Scaning: HOMEWORK #3 Report

This document reports on a homework assignment to build a WiFi scanner app for Android and use it to map WiFi access points around Clemson, South Carolina. The app collects the SSID, signal level, encryption type, and GPS coordinates of each detected access point. Students implemented the scanner in Python for Android and tested it on a Nexus One phone. They collected data by walking around Clemson and saved the results to KML files. Their map identified 260 total access points, of which 54 used WEP encryption (unsafe), 127 used WPA2, and 79 used WPA.

Uploaded by

Luyao Cheng
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views8 pages

Wifi Scaning: HOMEWORK #3 Report

This document reports on a homework assignment to build a WiFi scanner app for Android and use it to map WiFi access points around Clemson, South Carolina. The app collects the SSID, signal level, encryption type, and GPS coordinates of each detected access point. Students implemented the scanner in Python for Android and tested it on a Nexus One phone. They collected data by walking around Clemson and saved the results to KML files. Their map identified 260 total access points, of which 54 used WEP encryption (unsafe), 127 used WPA2, and 79 used WPA.

Uploaded by

Luyao Cheng
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

HOMEWORK #3 Report

WIFI SCANING

Luyao Cheng and Yangyang He

Abstact:
In this homework, we are going to implement an android Wifi scanner and then go around the some part of the town to build a map of the wifi AP in Clemson. The steps are as follows: Use the Python for android to write a wifi scanner program that collects wifi information plus GPS coordinates. Going through Clemson city, collect data, plot a map and determine the distribution of WEP/WPA/Open wifi in town. Run the program on an Android phone and plot an interactive map of the data on Google Maps. This report will be divided into 4 parts: 1. Introduction to Python for Andriod 2. Implementation of the program 3. Data collection and result map
4.

Data Analysis

1.

Introduction

In this project, we will implement a wifi scanner which can run on an Android platform phone set and collect AP data. We are using sl4a and Python for Android app which allows user to run python scripts on the Android platform. The Python for Android library contains a lot of API to allow user to control the phone without any programming knowledge of Android SDK.

We will take the phone set which is running our program to get through Clemson downtown area and collect AP data and corresponding GPS data, put them into a KML file. And then we upload the KML file on to Google map and generate an AP data map of Clemson area.

The phone model : Google Nexus one (HTC) The Android version : MIUI 1.11.4

2.

Implementation

import android import sys import time import os droid = android.Android() droid.startLocating()

# For testing only loc_last = droid.getLastKnownLocation()

# The real time location loc = droid.readLocation()

# Waiting for GPS signal while not loc.result.has_key('gps') :

loc = droid.readLocation() print "waiting on gps" time.sleep(1) print "-------------Start scanning-------------------"

# Start scanning access_points = {} try : startTime = 0 #backup data every 5 mins cyclePeriod = 300 while True : if not droid.wifiStartScan()[1] : time.sleep(1) continue location = droid.readLocation().result

location = droid.getLastKnownLocation().result scan = droid.wifiGetScanResults()[1]

# Extract the data from the array for ap in scan : if not access_points.has_key(ap['bssid']) :

print int(time.time()), 'new ap', ap['bssid'], ap['ssid'] access_points[ap['bssid']] = {} access_points[ap['bssid']]['ssid'] = ap['ssid'] access_points[ap['bssid']]['level'] = ap['level'] access_points[ap['bssid']]['capabilities'] = ap['capabilities'] access_points[ap['bssid']]['longitude'] = location['gps'] ['longitude'] access_points[ap['bssid']]['latitude'] = location['gps'] ['latitude'] access_points[ap['bssid']]['time'] = int(time.time()) elif ap['level'] > access_points[ap['bssid']]['level'] : print int(time.time()), 'location update', ap['level'], ap['ssid'], ap['bssid'] access_points[ap['bssid']]['level'] = ap['level'] access_points[ap['bssid']]['latitude'] = location['gps'] ['latitude'] access_points[ap['bssid']]['longitude'] = location['gps'] ['longitude'] access_points[ap['bssid']]['time'] = int(time.time()) #time.sleep(0.1) startTime += 1 if startTime >= cyclePeriod: #backup = open('/sdcard/sl4a/backup.kml', 'w')

backup = open('/sdcard/sl4a/scan-'+str(int(time.time())) +'.kml', 'w') backup.write('<?xml version="1.0" encoding="UTF-8"? >\n') backup.write('<kml xmlns="http://www.opengis.net/kml/2.2">\n') backup.write('<Document>\n') for ap in access_points : backup.write(' backup.write(' access_points[ap]['ssid']) backup.write(' <Placemark>\n') <name>%s</name>\n' % <Point>\n')

backup.write(' <coordinates>%s, %s</coordinates>\n' % (access_points[ap]['longitude'], access_points[ap]['latitude'])) backup.write(' backup.write(' </Point>\n')

</Placemark>\n')

backup.write('</Document>\n') backup.write('</kml>\n') backup.close() startTime = 0

# When catching up keyboard interrupt, save all the data into KML #file. #

except KeyboardInterrupt : fh = open('/sdcard/sl4a/scan-'+str(int(time.time()))+'.txt', 'w') kmlfile = open('/sdcard/sl4a/scan-'+str(int(time.time()))+'.kml', 'w') kmlfile.write('<?xml version="1.0" encoding="UTF-8"?>\n') kmlfile.write('<kml xmlns="http://www.opengis.net/kml/2.2">\n') kmlfile.write('<Document>\n') for ap in access_points : fh.write(ap + '|' + access_points[ap]['ssid'] + '|') fh.write(str(access_points[ap]['level']) + '|') fh.write(access_points[ap]['capabilities'] + '|') fh.write(str(access_points[ap]['longitude']) + '|') fh.write(str(access_points[ap]['latitude']) + '|') fh.write(str(access_points[ap]['time']) + '\n') kmlfile.write(' kmlfile.write(' ['ssid']) kmlfile.write(' <Placemark>\n') <name>%s</name>\n' % access_points[ap] <Point>\n')

kmlfile.write(' <coordinates>%s,%s</coordinates>\n' % (access_points[ap]['longitude'], access_points[ap]['latitude'])) kmlfile.write(' kmlfile.write(' </Point>\n') </Placemark>\n')

kmlfile.write('</Document>\n') kmlfile.write('</kml>\n')

fh.close() kmlfile.close()

3. Data Collection and result map (See Appendix)


4.

Data Analysis
Total WEP WPA2 WPA 260 54 127 79 20.77% 48.85% 30.38% (unsafe)

You might also like