def export_networks_kmz_folders(self, count, networks): kml_placemark = """<Placemark><styleUrl>#%s</styleUrl><name>%s</name> <Point><coordinates>%s,%s</coordinates></Point> <description><![CDATA[ SSID: %s<br /> MAC: %s<br /> Manuf: %s<br /> Type: %s<br /> Channel: %s<br /> Encryption: <FONT color=%s>%s</FONT><br /> Last time: %s<br /> GPS: %s,%s]]></description></Placemark>""" folders = {"WPA": [], "WEP": [], "None": [], "Other": []} colors = { "WPA": "red", "WEP": "orange", "None": "green", "Other": "grey" } for mac in networks: network = self.networks[mac] if network["lat"] == 0 and network["lon"] == 0: continue ssid = network["ssid"].replace("<", "<").replace( ">", ">").replace("&", "&") crypts = decode_cryptset(network["cryptset"]) crypt = "Other" for c in crypts: if c.startswith("wpa"): crypt = "WPA" if crypt != "Other": pass elif "wep" in crypts: crypt = "WEP" elif "none" in crypts: crypt = "None" folders[crypt].append(kml_placemark % ( crypt, ssid, network["lon"], network["lat"], ssid, mac, network["manuf"], network["type"], network["channel"], colors[crypt], ",".join(crypts).upper(), show_timestamp(network["lasttime"]), network["lon"], network["lat"], )) count[crypt] += 1 return folders
def export_networks_mappoint(self, filename, networks): f = open(filename, "w") f.write('Latitude;Longitude;SSID;BSSID;Encryption;Channel;Last Seen;\n') for mac in networks: network = self.networks[mac] if network["lat"] == 0 and network["lon"] == 0: continue gps = "%s;%s" % (network["lat"], network["lon"]) f.write('%s;"%s";%s;%s;%s;%s;\n' % ( gps.replace(".",","), network["ssid"].replace(";"," ").replace('"'," "), mac, print_cryptset(network["cryptset"]), network["channel"], show_timestamp(network["lasttime"]) )) f.close()
def export_networks_mappoint(self, filename, networks): f = open(filename, "w") f.write( 'Latitude;Longitude;SSID;BSSID;Encryption;Channel;Last Seen;\n') for mac in networks: network = self.networks[mac] if network["lat"] == 0 and network["lon"] == 0: continue gps = "%s;%s" % (network["lat"], network["lon"]) f.write('%s;"%s";%s;%s;%s;%s;\n' % (gps.replace(".", ","), network["ssid"].replace( ";", " ").replace('"', " "), mac, print_cryptset(network["cryptset"]), network["channel"], show_timestamp(network["lasttime"]))) f.close()
def export_networks_kmz_folders(self, count, networks): kml_placemark = """<Placemark><styleUrl>#%s</styleUrl><name>%s</name> <Point><coordinates>%s,%s</coordinates></Point> <description><![CDATA[ SSID: %s<br /> MAC: %s<br /> Manuf: %s<br /> Type: %s<br /> Channel: %s<br /> Encryption: <FONT color=%s>%s</FONT><br /> Last time: %s<br /> GPS: %s,%s]]></description></Placemark>""" folders = {"WPA":[], "WEP":[], "None":[], "Other":[]} colors = {"WPA":"red", "WEP":"orange", "None":"green", "Other":"grey"} for mac in networks: network = self.networks[mac] if network["lat"] == 0 and network["lon"] == 0: continue ssid = network["ssid"].replace("<","<").replace(">",">").replace("&","&") crypts = decode_cryptset(network["cryptset"]) crypt = "Other" for c in crypts: if c.startswith("wpa"): crypt = "WPA" if crypt != "Other": pass elif "wep" in crypts: crypt = "WEP" elif "none" in crypts: crypt = "None" folders[crypt].append(kml_placemark %( crypt, ssid, network["lon"],network["lat"], ssid, mac, network["manuf"], network["type"], network["channel"], colors[crypt], ",".join(crypts).upper(), show_timestamp(network["lasttime"]), network["lon"], network["lat"], )) count[crypt] += 1 return folders