From: Russ Handorf Date: Wed, 21 Dec 2022 01:18:44 +0000 (-0500) Subject: more fixes, so many API endpoints X-Git-Url: https://handorf.org/code/?a=commitdiff_plain;h=93569ebd4cde1fb170314ec181c4e4351ac2de83;p=kismet-logviewer.git more fixes, so many API endpoints --- diff --git a/db.sqlite3 b/db.sqlite3 deleted file mode 100644 index e69de29..0000000 diff --git a/logviewer/dbview/__pycache__/views.cpython-38.pyc b/logviewer/dbview/__pycache__/views.cpython-38.pyc index af696ab..33366f4 100644 Binary files a/logviewer/dbview/__pycache__/views.cpython-38.pyc and b/logviewer/dbview/__pycache__/views.cpython-38.pyc differ diff --git a/logviewer/dbview/views.py b/logviewer/dbview/views.py index 3c51c3f..4efde62 100644 --- a/logviewer/dbview/views.py +++ b/logviewer/dbview/views.py @@ -11,7 +11,6 @@ from django.views.decorators.csrf import csrf_exempt def load_db(query): dir_list = os.listdir("logs/") connection = sqlite3.connect("logs/"+dir_list[0]) - #connection.row_factory = lambda cursor, row: row[0] cursor = connection.cursor() rows = cursor.execute(query).fetchall() return(rows) @@ -73,6 +72,7 @@ def index(request): uuid_members=uuid_members+"]" return HttpResponse(uuid_members, content_type='text/json') elif request.path == "/system/user_status.json": + #Hardcoded for now user_status = open('dbview/user_status.json') return HttpResponse(user_status, content_type='text/json') elif request.path == "/session/check_setup_ok": @@ -80,10 +80,12 @@ def index(request): elif request.path == "/session/check_login": return HttpResponse('Login valid') elif request.path == "/dynamic.js": + #INCOMPLETE - read the devices and create a dynamic.js output devices = load_db("select distinct(typestring) from datasources") load_file = open('static/dynamic.js') return HttpResponse(load_file, content_type='application/javascript') elif request.path == "/gps/location.json": + #hardcoded cus it doesnt matter user_status = open('dbview/gps_status.json') return HttpResponse(user_status, content_type='text/json') elif request.path == "/alerts/wrapped/last-time/0/alerts.json": @@ -107,6 +109,7 @@ def index(request): ssid_list = ssid_list + "\"dot11.ssidgroup.first_time\": \"" + str(ssid_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.first_time']) +"\"," ssid_list = ssid_list + "\"dot11.ssidgroup.ssid_len\": \"" + str(ssid_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.ssidlen'])+"\"," ssid_list = ssid_list + "\"dot11.ssidgroup.crypt_set\": \"" + str(ssid_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.crypt_set'])+"\"," + ssid_list = ssid_list + "\"dot11.ssidgroup.hash\": \"" + str(ssid_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.ssid_hash'])+"\"," ssid_list = ssid_list + "\"dot11.ssidgroup.advertising_devices_len\": \"" + str(ssid_json['dot11.device']['dot11.device.num_advertised_ssids'])+"\"," ssid_list = ssid_list + "\"dot11.ssidgroup.probing_devices_len\": \"" + str(ssid_json['dot11.device']['dot11.device.num_probed_ssids'])+"\"," ssid_list = ssid_list + "\"dot11.ssidgroup.ssid\": \"" + str(ssid_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.ssid'])+"\"," @@ -119,10 +122,11 @@ def index(request): ssid_list = ssid_list[:-2]+ "}], \"draw\": 3, \"recordsFiltered\": "+str(ssid_count[0][0])+" }" return HttpResponse(ssid_list, content_type='text/json') elif request.path == "/system/status.json": + #Hardcoded - Setup for other users user_status = open('dbview/status.json') return HttpResponse(user_status, content_type='text/json') elif request.path == "/alerts/alerts_view.json": - #MAY NOT BE COMPLETE + #INCOMPLETE - Check device Mappings total_alerts=list(load_db("select count(json) from alerts")) (alert_count,) = total_alerts[0] alerts = list(load_db("select cast(json as text) from alerts")) @@ -162,15 +166,6 @@ def index(request): user_status = open('dbview/channels.json') return HttpResponse(user_status, content_type='text/json') elif request.path == "/devices/views/all/devices.json": - #for key, value in request.POST.items(): - # #print("-----") - # print(key+" = "+value) - # #print(value) - # if key == "draw": - # print("-----") - # print("DRAW") - # print(value) - # print("-----") #gotta figure out paging total_dev=list(load_db("select count(device) from devices")) diff --git a/logviewer/devices.json b/logviewer/devices.json new file mode 100644 index 0000000..dbfb2a9 --- /dev/null +++ b/logviewer/devices.json @@ -0,0 +1 @@ +{"kismet.device.base.first_time": 1671477549,"kismet.device.base.seenby": [{"kismet.common.seenby.last_time": 1671506902,"kismet.common.seenby.num_packets": 8850,"kismet.common.seenby.uuid": "5FE308BD-0000-0000-0000-AAC40BB74997","kismet.common.seenby.first_time": 1671477549}],"kismet.device.base.related_devices": {"dot11_bssts_similar": ["4202770D00000000_3C95A453F862","4202770D00000000_72DCC553F8B8","4202770D00000000_3E95A453F8B8","4202770D00000000_8D72BD22A204","4202770D00000000_DFCFA22A204","4202770D00000000_4095A453F8B8","4202770D00000000_3F95A453F872","4202770D00000000_C141CF22A204","4202770D00000000_F4BAA4C5BD3C","4202770D00000000_4295A453F86A"]},"kismet.device.base.macaddr": "B8:F8:53:A4:95:3F","kismet.device.base.freq_khz_map": {"5660000": 6826,"5785000": 2},"kismet.device.base.crypt": "WPA2-PSK","kismet.device.base.key": "4202770D00000000_3F95A453F8B8","kismet.device.base.packets.crypt": 0,"kismet.device.base.packets.total": 6828,"kismet.device.base.manuf": "Arcadyan Corporation","kismet.device.base.basic_type_set": 3,"kismet.device.base.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 59177,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671506902,"kismet.common.location.fix": 3}},"dot11.device": {"dot11.device.last_bssid": "B8:F8:53:A4:95:3F","dot11.device.responded_ssid_map": [{"dot11.advertisedssid.last_time": 1671505497,"dot11.advertisedssid.ssid_hash": 177328588,"dot11.advertisedssid.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 546949,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671505497,"kismet.common.location.fix": 3}},"dot11.advertisedssid.beacons_sec": 0,"dot11.advertisedssid.crypt_set": 268436162,"dot11.advertisedssid.wpa_mfp_supported": 0,"dot11.advertisedssid.wps_uuid_e": "DEB49C84F4050562B3A22FE60C07BC1D","dot11.advertisedssid.wps_version": 16,"dot11.advertisedssid.beaconrate": 0,"dot11.advertisedssid.wps_manuf": "Arcadyan","dot11.advertisedssid.channel": "","dot11.advertisedssid.wpa_mfp_required": 0,"dot11.advertisedssid.probe_response": 1,"dot11.advertisedssid.ccx_txpower": 0,"dot11.advertisedssid.wps_state": 1,"dot11.advertisedssid.ssid": "2Fast2Furious","dot11.advertisedssid.ssidlen": 13,"dot11.advertisedssid.ht_center_1": 0,"dot11.advertisedssid.ht_mode": "","dot11.advertisedssid.wps_model_number": "G3100","dot11.advertisedssid.wps_serial_number": "G402120083019169","dot11.advertisedssid.wps_model_name": "G3100","dot11.advertisedssid.maxrate": 1733.300000,"dot11.advertisedssid.dot11e_qbss": 0,"dot11.advertisedssid.dot11r_mobility": 0,"dot11.advertisedssid.first_time": 1671481214,"dot11.advertisedssid.dot11e_channel_utilization_perc": 0,"dot11.advertisedssid.wps_config_methods": 260,"dot11.advertisedssid.dot11e_qbss_stations": 0,"dot11.advertisedssid.dot11r_mobility_domain_id": 0,"dot11.advertisedssid.wps_device_name": "G3100","dot11.advertisedssid.ietag_checksum": 3225616209,"dot11.advertisedssid.cloaked": 0,"dot11.advertisedssid.beacon": 0,"dot11.advertisedssid.cisco_client_mfp": 0,"dot11.advertisedssid.ht_center_2": 0}],"dot11.device.response_fingerprint": 0,"dot11.device.num_associated_clients": 16,"dot11.device.advertised_ssid_map": [{"dot11.advertisedssid.last_time": 1671506902,"dot11.advertisedssid.ssid_hash": 177328588,"dot11.advertisedssid.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 59815,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671506902,"kismet.common.location.fix": 3}},"dot11.advertisedssid.beacons_sec": 6468,"dot11.advertisedssid.crypt_set": 268436162,"dot11.advertisedssid.wpa_mfp_supported": 0,"dot11.advertisedssid.wps_version": 16,"dot11.advertisedssid.beaconrate": 10,"dot11.advertisedssid.channel": "132","dot11.advertisedssid.dot11d_country": "US","dot11.advertisedssid.wpa_mfp_required": 0,"dot11.advertisedssid.probe_response": 0,"dot11.advertisedssid.ccx_txpower": 0,"dot11.advertisedssid.wps_state": 1,"dot11.advertisedssid.ssid": "2Fast2Furious","dot11.advertisedssid.ssidlen": 13,"dot11.advertisedssid.ht_center_1": 5690,"dot11.advertisedssid.ht_mode": "HT80","dot11.advertisedssid.maxrate": 1733.300000,"dot11.advertisedssid.dot11e_qbss": 1,"dot11.advertisedssid.dot11r_mobility": 0,"dot11.advertisedssid.first_time": 1671477549,"dot11.advertisedssid.dot11e_channel_utilization_perc": 1.176471,"dot11.advertisedssid.wps_config_methods": 0,"dot11.advertisedssid.dot11e_qbss_stations": 3,"dot11.advertisedssid.dot11r_mobility_domain_id": 0,"dot11.advertisedssid.ietag_checksum": 4260933863,"dot11.advertisedssid.cloaked": 0,"dot11.advertisedssid.beacon": 1,"dot11.advertisedssid.cisco_client_mfp": 0,"dot11.advertisedssid.ht_center_2": 0}],"dot11.device.client_disconnects": 0,"dot11.device.beacon_fingerprint": 2660972565,"dot11.device.num_probed_ssids": 1,"dot11.device.link_measurement_capable": 0,"dot11.device.last_beaconed_ssid_record": {"dot11.advertisedssid.last_time": 1671506902,"dot11.advertisedssid.ssid_hash": 177328588,"dot11.advertisedssid.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 59815,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671506902,"kismet.common.location.fix": 3}},"dot11.advertisedssid.beacons_sec": 6468,"dot11.advertisedssid.crypt_set": 268436162,"dot11.advertisedssid.wpa_mfp_supported": 0,"dot11.advertisedssid.wps_version": 16,"dot11.advertisedssid.beaconrate": 10,"dot11.advertisedssid.channel": "132","dot11.advertisedssid.dot11d_country": "US","dot11.advertisedssid.wpa_mfp_required": 0,"dot11.advertisedssid.probe_response": 0,"dot11.advertisedssid.ccx_txpower": 0,"dot11.advertisedssid.wps_state": 1,"dot11.advertisedssid.ssid": "2Fast2Furious","dot11.advertisedssid.ssidlen": 13,"dot11.advertisedssid.ht_center_1": 5690,"dot11.advertisedssid.ht_mode": "HT80","dot11.advertisedssid.maxrate": 1733.300000,"dot11.advertisedssid.dot11e_qbss": 1,"dot11.advertisedssid.dot11r_mobility": 0,"dot11.advertisedssid.first_time": 1671477549,"dot11.advertisedssid.dot11e_channel_utilization_perc": 1.176471,"dot11.advertisedssid.wps_config_methods": 0,"dot11.advertisedssid.dot11e_qbss_stations": 3,"dot11.advertisedssid.dot11r_mobility_domain_id": 0,"dot11.advertisedssid.ietag_checksum": 4260933863,"dot11.advertisedssid.cloaked": 0,"dot11.advertisedssid.beacon": 1,"dot11.advertisedssid.cisco_client_mfp": 0,"dot11.advertisedssid.ht_center_2": 0},"dot11.device.last_probed_ssid_record": {"dot11.probedssid.first_time": 1671504983,"dot11.probedssid.ssidlen": 13,"dot11.probedssid.crypt_set": 0,"dot11.probedssid.bssid": "00:00:00:00:00:00","dot11.probedssid.wps_state": 0,"dot11.probedssid.wpa_mfp_required": 0,"dot11.probedssid.wps_config_methods": 0,"dot11.probedssid.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 640376,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671504983,"kismet.common.location.fix": 3}},"dot11.probedssid.wpa_mfp_supported": 0,"dot11.probedssid.last_time": 1671504983,"dot11.probedssid.wps_uuid_e": "","dot11.probedssid.ssid": "2Fast2Furious","dot11.probedssid.wps_version": 0},"dot11.device.neighbor_report_capable": 0,"dot11.device.probe_fingerprint": 2478522707,"dot11.device.num_fragments": 0,"dot11.device.typeset": 257,"dot11.device.client_disconnects_last": 0,"dot11.device.probed_ssid_map": [{"dot11.probedssid.first_time": 1671504983,"dot11.probedssid.ssidlen": 13,"dot11.probedssid.crypt_set": 0,"dot11.probedssid.bssid": "00:00:00:00:00:00","dot11.probedssid.wps_state": 0,"dot11.probedssid.wpa_mfp_required": 0,"dot11.probedssid.wps_config_methods": 0,"dot11.probedssid.location": {"kismet.common.location.loc_fix": 3,"kismet.common.location.min_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.max_loc": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920]},"kismet.common.location.last": {"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.fix": 3,"kismet.common.location.speed": 0,"kismet.common.location.heading": 0},"kismet.common.location.avg_loc": {"kismet.common.location.time_usec": 640376,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671504983,"kismet.common.location.fix": 3}},"dot11.probedssid.wpa_mfp_supported": 0,"dot11.probedssid.last_time": 1671504983,"dot11.probedssid.wps_uuid_e": "","dot11.probedssid.ssid": "2Fast2Furious","dot11.probedssid.wps_version": 0}],"dot11.device.wpa_present_handshake": 0,"dot11.device.max_tx_power": 0,"dot11.device.num_advertised_ssids": 1,"dot11.device.last_beacon_timestamp": 1671506902,"dot11.device.num_responded_ssids": 1,"dot11.device.associated_client_map": {"00:71:47:31:6A:03": "4202770D00000000_36A31477100","10:52:1C:D3:DB:40": "4202770D00000000_40DBD31C5210","10:52:1C:D4:26:9B": "4202770D00000000_9B26D41C5210","10:52:1C:FD:D1:64": "4202770D00000000_64D1FD1C5210","34:3E:A4:6B:B4:C9": "4202770D00000000_C9B46BA43E34","4C:3B:DF:43:35:4F": "4202770D00000000_4F3543DF3B4C","58:FD:B1:CA:D3:38": "4202770D00000000_38D3CAB1FD58","64:CB:E9:8B:89:AC": "4202770D00000000_AC898BE9CB64","68:9A:87:98:B8:D2": "4202770D00000000_D2B898879A68","84:2A:FD:9D:E0:51": "4202770D00000000_51E09DFD2A84","8E:39:C3:53:83:0F": "4202770D00000000_F8353C3398E","94:3A:91:A4:AA:96": "4202770D00000000_96AAA4913A94","AC:F1:08:59:D9:BE": "4202770D00000000_BED95908F1AC","B8:F8:53:A4:95:3D": "4202770D00000000_3D95A453F8B8","F4:D4:88:6E:CB:EA": "4202770D00000000_EACB6E88D4F4","FC:A1:83:E0:DD:51": "4202770D00000000_51DDE083A1FC"},"dot11.device.datasize": 545362,"dot11.device.num_client_aps": 1,"dot11.device.wps_m3_count": 0,"dot11.device.last_sequence": 0,"dot11.device.client_map": {"B8:F8:53:A4:95:40": {"dot11.client.datasize": 0,"dot11.client.num_fragments": 0,"dot11.client.bssid_key": "4202770D00000000_4095A453F8B8","dot11.client.decrypted": 0,"dot11.client.tx_cryptset": 0,"dot11.client.rx_cryptset": 0,"dot11.client.type": 0,"dot11.client.first_time": 1671505092,"dot11.client.last_time": 1671506552,"dot11.client.bssid": "B8:F8:53:A4:95:40","dot11.client.num_retries": 0,"dot11.client.datasize_retry": 0}},"dot11.device.num_retries": 0,"dot11.device.datasize_retry": 0,"dot11.device.wps_m3_last": 0,"dot11.device.min_tx_power": 0,"dot11.device.bss_timestamp": 1637483213450},"kismet.server.uuid": "AB5BA0C8-07F2-11E9-8A07-4B49534D4554","kismet.device.base.packets.llc": 6476,"kismet.device.base.type": "Wi-Fi AP","kismet.device.base.basic_crypt_set": 2,"kismet.device.base.frequency": 5660000,"kismet.device.base.packets.error": 0,"kismet.device.base.phyname": "IEEE802.11","kismet.device.base.channel": "136","kismet.device.base.mod_time": 1671506902,"kismet.device.base.packets.filtered": 0,"kismet.device.base.signal": {"kismet.common.signal.min_noise": 0,"kismet.common.signal.max_signal": -70,"kismet.common.signal.type": "dbm","kismet.common.signal.min_signal": -76,"kismet.common.signal.last_signal": -72,"kismet.common.signal.last_noise": 0,"kismet.common.signal.signal_rrd": {"kismet.common.rrd.blank_val": 0,"kismet.common.rrd.last_time": 1671506903,"kismet.common.rrd.serial_time": 1671506903,"kismet.common.rrd.minute_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"kismet.common.signal.encodingset": 3,"kismet.common.signal.carrierset": 3,"kismet.common.signal.max_noise": 0,"kismet.common.signal.maxseenrate": 60,"kismet.common.signal.peak_loc": {"kismet.common.location.time_usec": 276337,"kismet.common.location.alt": 260,"kismet.common.location.geopoint": [-75.177694, 40.119920],"kismet.common.location.time_sec": 1671477991,"kismet.common.location.fix": 3}},"kismet.device.base.datasize.rrd": {"kismet.common.rrd.day_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"kismet.common.rrd.blank_val": 0,"kismet.common.rrd.last_time": 1671506903,"kismet.common.rrd.serial_time": 1671506903,"kismet.common.rrd.minute_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"kismet.common.rrd.hour_vec": [0,1,0,0,0,2,0,0,1,1,1,0,1,3,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"kismet.device.base.last_time": 1671506902,"kismet.device.base.commonname": "2Fast2Furious","kismet.device.base.num_alerts": 0,"kismet.device.base.name": "2Fast2Furious","kismet.device.base.datasize": 17658,"kismet.device.base.packets.rrd": {"kismet.common.rrd.day_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"kismet.common.rrd.blank_val": 0,"kismet.common.rrd.last_time": 1671506903,"kismet.common.rrd.serial_time": 1671506903,"kismet.common.rrd.minute_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"kismet.common.rrd.hour_vec": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"kismet.device.base.packets.data": 352} diff --git a/logviewer/devices/__pycache__/views.cpython-38.pyc b/logviewer/devices/__pycache__/views.cpython-38.pyc index d6359a0..0edeba5 100644 Binary files a/logviewer/devices/__pycache__/views.cpython-38.pyc and b/logviewer/devices/__pycache__/views.cpython-38.pyc differ diff --git a/logviewer/devices/views.py b/logviewer/devices/views.py index e3c8c9d..481d520 100644 --- a/logviewer/devices/views.py +++ b/logviewer/devices/views.py @@ -11,17 +11,12 @@ from django.views.decorators.csrf import csrf_exempt def load_db(query): dir_list = os.listdir("logs/") connection = sqlite3.connect("logs/"+dir_list[0]) - #connection.row_factory = lambda cursor, row: row[0] cursor = connection.cursor() rows = cursor.execute(query).fetchall() return(rows) @csrf_exempt def index(request,devicename): - #print("-------------") - #print(request.path) - #print(devicename) - #print("-------------") if request.path[0:8] == "/devices": dev=list(load_db("select cast(device as text) from devices where devkey = \""+devicename+"\"")) (dev_info,) = dev[0] @@ -37,4 +32,16 @@ def index(request,devicename): datasource=list(load_db("select cast(json as text) from datasources where uuid = \""+str(devicename)+"\"")) (json_result,) = datasource[0] return HttpResponse(json_result, content_type='text/json') - + elif request.path[0:4] == "/phy": + #INCOMPLETE - Need to work out device mappings still + devices=list(load_db("select cast(device as text) from devices where type='Wi-Fi AP'")) + for device in devices: + (json_result,) = device + device_json = json.loads(json_result) + try: + if str(devicename) == str(device_json['dot11.device']['dot11.device.last_beaconed_ssid_record']['dot11.advertisedssid.ssid_hash']): + print("MATCH") + print(device_json) + except: + print("skipping") + return HttpResponse("{}", content_type='text/json') diff --git a/logviewer/logviewer/__pycache__/urls.cpython-38.pyc b/logviewer/logviewer/__pycache__/urls.cpython-38.pyc index 97eb932..73e581a 100644 Binary files a/logviewer/logviewer/__pycache__/urls.cpython-38.pyc and b/logviewer/logviewer/__pycache__/urls.cpython-38.pyc differ diff --git a/logviewer/logviewer/urls.py b/logviewer/logviewer/urls.py index 9736ac3..1343935 100644 --- a/logviewer/logviewer/urls.py +++ b/logviewer/logviewer/urls.py @@ -43,4 +43,5 @@ urlpatterns = [ path('devices/by-key//device.json', include('devices.urls')), path('devices/multikey/as-object/devices.json', include('dbview.urls')), path('datasource/by-uuid//source.json', include('devices.urls')), + path('phy/phy80211/ssids/by-hash//ssid.json', include('devices.urls')), ] diff --git a/logviewer/thang.json b/logviewer/thang.json new file mode 100644 index 0000000..5f07911 --- /dev/null +++ b/logviewer/thang.json @@ -0,0 +1 @@ +{"dot11.ssidgroup.hash": 3487826348,"dot11.ssidgroup.responding_devices_len": 0,"dot11.ssidgroup.first_time": 1671539004,"dot11.ssidgroup.advertising_devices_len": 1,"dot11.ssidgroup.responding_devices": [],"dot11.ssidgroup.last_time": 1671539004,"dot11.ssidgroup.ssid_len": 25,"dot11.ssidgroup.probing_devices": [],"dot11.ssidgroup.probing_devices_len": 0,"dot11.ssidgroup.advertising_devices": ["4202770D00000000_9E3676E9BC4C"],"dot11.ssidgroup.crypt_set": 268436162,"dot11.ssidgroup.ssid": "AD_101_2REF12EICD__2-369e"} diff --git a/logviewer/thang2.json b/logviewer/thang2.json new file mode 100644 index 0000000..b5d2091 --- /dev/null +++ b/logviewer/thang2.json @@ -0,0 +1 @@ +{'dot11.advertisedssid.last_time': 1671481768, 'dot11.advertisedssid.ssid_hash': 668092632, 'dot11.advertisedssid.location': {'kismet.common.location.loc_fix': 3, 'kismet.common.location.min_loc': {'kismet.common.location.alt': 260, 'kismet.common.location.geopoint': [-75.177694, 40.11992]}, 'kismet.common.location.max_loc': {'kismet.common.location.alt': 260, 'kismet.common.location.geopoint': [-75.177694, 40.11992]}, 'kismet.common.location.last': {'kismet.common.location.alt': 260, 'kismet.common.location.geopoint': [-75.177694, 40.11992], 'kismet.common.location.fix': 3, 'kismet.common.location.speed': 0, 'kismet.common.location.heading': 0}, 'kismet.common.location.avg_loc': {'kismet.common.location.time_usec': 120824, 'kismet.common.location.alt': 260, 'kismet.common.location.geopoint': [-75.177694, 40.11992], 'kismet.common.location.time_sec': 1671481768, 'kismet.common.location.fix': 3}}, 'dot11.advertisedssid.beacons_sec': 1, 'dot11.advertisedssid.crypt_set': 268436162, 'dot11.advertisedssid.wpa_mfp_supported': 0, 'dot11.advertisedssid.wps_uuid_e': '8E84CE1266C230CD9ABA2CDCF1CF5C15', 'dot11.advertisedssid.wps_version': 16, 'dot11.advertisedssid.beaconrate': 10, 'dot11.advertisedssid.channel': '11', 'dot11.advertisedssid.dot11d_country': 'US', 'dot11.advertisedssid.wpa_mfp_required': 0, 'dot11.advertisedssid.probe_response': 0, 'dot11.advertisedssid.ccx_txpower': 0, 'dot11.advertisedssid.wps_state': 1, 'dot11.advertisedssid.ssid': 'Fios-1MRC4', 'dot11.advertisedssid.ssidlen': 10, 'dot11.advertisedssid.ht_center_1': 0, 'dot11.advertisedssid.ht_mode': 'HT20', 'dot11.advertisedssid.maxrate': 216.7, 'dot11.advertisedssid.dot11e_qbss': 1, 'dot11.advertisedssid.dot11r_mobility': 0, 'dot11.advertisedssid.first_time': 1671481768, 'dot11.advertisedssid.dot11e_channel_utilization_perc': 16.470588, 'dot11.advertisedssid.wps_config_methods': 0, 'dot11.advertisedssid.dot11e_qbss_stations': 1, 'dot11.advertisedssid.dot11r_mobility_domain_id': 0, 'dot11.advertisedssid.ietag_checksum': 3137114380, 'dot11.advertisedssid.cloaked': 0, 'dot11.advertisedssid.beacon': 1, 'dot11.advertisedssid.cisco_client_mfp': 0, 'dot11.advertisedssid.ht_center_2': 0}