MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / wardriving_export

Function wardriving_export

webapp_modern.py:8259–8287  ·  view source on GitHub ↗

Export a wardriving session as WiGLE CSV or KML.

(session_id)

Source from the content-addressed store, hash-verified

8257 logger.error(f"Could not read netkb data for MAC enrichment: {e}")
8258
8259 if network_data:
8260 ip_to_mac = {}
8261 enrichment_map = {}
8262 for row in netkb_data:
8263 ip = _extract_value(row, ("IPs", "IP", "ip"))
8264 mac = _extract_value(row, ("MAC Address", "MAC", "mac"))
8265 vuln_summary = _extract_value(row, ("Nmap Vulnerabilities", "nmap_vulnerabilities"))
8266 vuln_status = _extract_value(row, ("NmapVulnScanner", "nmap_vuln_scanner"))
8267
8268 enrichment_payload = {
8269 'Nmap Vulnerabilities': vuln_summary or '',
8270 'NmapVulnScanner': vuln_status or ''
8271 }
8272
8273 if ip and mac and mac.upper() not in {"UNKNOWN", "STANDALONE"}:
8274 ip_to_mac[ip] = mac
8275
8276 if mac:
8277 enrichment_map[("mac", mac.lower())] = enrichment_payload
8278 if ip:
8279 enrichment_map[("ip", ip)] = enrichment_payload
8280
8281 for entry in network_data:
8282 mac = _extract_value(entry, ("MAC Address", "MAC", "mac"))
8283 ip = _extract_value(entry, ("IPs", "IP", "ip"))
8284 if not mac or mac.upper() in {"UNKNOWN", "STANDALONE", "00:00:00:00:00:00"}:
8285 fallback_mac = ip_to_mac.get(ip)
8286 if fallback_mac:
8287 mac = fallback_mac
8288
8289 mac = mac or ''
8290 entry['MAC Address'] = mac

Callers

nothing calls this directly

Calls 6

export_kmlMethod · 0.95
export_wigle_csvMethod · 0.95
WardrivingSessionClass · 0.90
_get_wardriving_engineFunction · 0.85
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected