bix fixes and added adsb map
authorRuss Handorf <rhandorf@handorf.org>
Sat, 14 Jan 2023 02:38:40 +0000 (21:38 -0500)
committerRuss Handorf <rhandorf@handorf.org>
Sat, 14 Jan 2023 02:38:40 +0000 (21:38 -0500)
20 files changed:
logviewer/adsbmap/__init__.py [new file with mode: 0644]
logviewer/adsbmap/__pycache__/__init__.cpython-38.pyc [new file with mode: 0644]
logviewer/adsbmap/__pycache__/urls.cpython-38.pyc [new file with mode: 0644]
logviewer/adsbmap/__pycache__/views.cpython-38.pyc [new file with mode: 0644]
logviewer/adsbmap/admin.py [new file with mode: 0644]
logviewer/adsbmap/apps.py [new file with mode: 0644]
logviewer/adsbmap/migrations/__init__.py [new file with mode: 0644]
logviewer/adsbmap/models.py [new file with mode: 0644]
logviewer/adsbmap/tests.py [new file with mode: 0644]
logviewer/adsbmap/urls.py [new file with mode: 0644]
logviewer/adsbmap/views.py [new file with mode: 0644]
logviewer/dbview/.views.py.swp
logviewer/dbview/__pycache__/views.cpython-38.pyc
logviewer/dbview/views.py
logviewer/kiscontent/__pycache__/views.cpython-38.pyc
logviewer/logviewer/__pycache__/settings.cpython-38.pyc
logviewer/logviewer/__pycache__/urls.cpython-38.pyc
logviewer/logviewer/settings.py
logviewer/logviewer/urls.py
logviewer/static/dynamic.js

diff --git a/logviewer/adsbmap/__init__.py b/logviewer/adsbmap/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/logviewer/adsbmap/__pycache__/__init__.cpython-38.pyc b/logviewer/adsbmap/__pycache__/__init__.cpython-38.pyc
new file mode 100644 (file)
index 0000000..605e22a
Binary files /dev/null and b/logviewer/adsbmap/__pycache__/__init__.cpython-38.pyc differ
diff --git a/logviewer/adsbmap/__pycache__/urls.cpython-38.pyc b/logviewer/adsbmap/__pycache__/urls.cpython-38.pyc
new file mode 100644 (file)
index 0000000..fbce56c
Binary files /dev/null and b/logviewer/adsbmap/__pycache__/urls.cpython-38.pyc differ
diff --git a/logviewer/adsbmap/__pycache__/views.cpython-38.pyc b/logviewer/adsbmap/__pycache__/views.cpython-38.pyc
new file mode 100644 (file)
index 0000000..d2c9efa
Binary files /dev/null and b/logviewer/adsbmap/__pycache__/views.cpython-38.pyc differ
diff --git a/logviewer/adsbmap/admin.py b/logviewer/adsbmap/admin.py
new file mode 100644 (file)
index 0000000..8c38f3f
--- /dev/null
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/logviewer/adsbmap/apps.py b/logviewer/adsbmap/apps.py
new file mode 100644 (file)
index 0000000..276dc8b
--- /dev/null
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AdsbmapConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'adsbmap'
diff --git a/logviewer/adsbmap/migrations/__init__.py b/logviewer/adsbmap/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/logviewer/adsbmap/models.py b/logviewer/adsbmap/models.py
new file mode 100644 (file)
index 0000000..71a8362
--- /dev/null
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/logviewer/adsbmap/tests.py b/logviewer/adsbmap/tests.py
new file mode 100644 (file)
index 0000000..7ce503c
--- /dev/null
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/logviewer/adsbmap/urls.py b/logviewer/adsbmap/urls.py
new file mode 100644 (file)
index 0000000..4c9189f
--- /dev/null
@@ -0,0 +1,8 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+    path('', views.index, name='index'),
+]
+
diff --git a/logviewer/adsbmap/views.py b/logviewer/adsbmap/views.py
new file mode 100644 (file)
index 0000000..a447c2c
--- /dev/null
@@ -0,0 +1,16 @@
+from django.shortcuts import render
+from django.http import HttpResponse, HttpRequest
+import os
+
+def index(request):
+    print("===")
+    print(request)
+    print("====")
+    if request.method == 'POST':
+        for key, value in request.POST.items():
+            print(key,value)
+
+    load_file = open('static/'+request.path, mode='rb')
+    if request.path == "/adsb_map_panel.html":
+        print("here")
+        return HttpResponse(load_file, content_type='text/html')
index 9ce4e593348c246828e4435af01777b55fb228c5..bbf41060fee8211dbeb25d14ce5f66378f6072ac 100644 (file)
Binary files a/logviewer/dbview/.views.py.swp and b/logviewer/dbview/.views.py.swp differ
index 672d86b281b56a00375fdebfb5aa5e2d5a7b8dd7..8d3e613005b18543b05fd8b68621c8ff44f6f887 100644 (file)
Binary files a/logviewer/dbview/__pycache__/views.cpython-38.pyc and b/logviewer/dbview/__pycache__/views.cpython-38.pyc differ
index c3ee82272f8ca333248531ff4fc28ce578b60690..6a899ee6658d617d580b330ddc152701ef85e03d 100644 (file)
@@ -187,7 +187,7 @@ def index(request):
                 dev_list = list(load_db("select cast(device as text) from devices LIMIT "+limit+" OFFSET "+start))
             else:
                 dev_list = list(load_db("select cast(device as text) from devices where cast(device as text) like '%"+search+"%' LIMIT "+limit+" OFFSET "+start))
-        elif device_request == "phy_RTLADSB":
+        elif device_request == "phy-RTLADSB":
             if search == "":
                 dev_list = list(load_db("select cast(device as text) from devices where phyname = 'ADSB' LIMIT "+limit+" OFFSET "+start))
             else:
@@ -242,7 +242,7 @@ def index(request):
                 dev_list = list(load_db("select cast(device as text) from devices where phyname = 'UAV' LIMIT "+limit+" OFFSET "+start))
             else:
                 dev_list = list(load_db("select cast(device as text) from devices where cast(device as text) like '%"+search+"%' and phyname = 'UAV' LIMIT "+limit+" OFFSET "+start))
-        elif device_request == "phy-Zwave":
+        elif device_request == "phy-Z-Wave":
             if search == "":
                 dev_list = list(load_db("select cast(device as text) from devices where phyname = 'Z-Wave' LIMIT "+limit+" OFFSET "+start))
             else:
@@ -329,3 +329,53 @@ def index(request):
         multikey = multikey[:-1]
         multikey = multikey + "}"
         return HttpResponse(multikey, content_type='text/json')
+    elif request.path == "/phy/ADSB/map_data.json":
+        #I had to do a stupid lat/long offset to draw the map grid because for some stupid reason python wouldnt do number scales right?
+        #limiting to 100 until i figure out paging
+        min_long = 361.0
+        max_long = 0.0
+        min_lat = 181.0
+        max_lat = 0.0
+        adsblist = "{ \"kismet.adsb.map.devices\": [ "
+        dev_list = list(load_db("select cast(device as text) from devices where phyname = 'ADSB' limit 100"))
+        for device in dev_list:
+            (dev,) = device
+            dev_json = json.loads(dev)
+            newdev = {}
+            newdev['kismet.device.base.first_time'] = dev_json['kismet.device.base.first_time']
+            if "kismet.device.base.location" in dev_json:
+                newdev['kismet.device.base.location'] = dev_json['kismet.device.base.location']
+                (tmp_min_long,tmp_min_lat) = newdev['kismet.device.base.location']['kismet.common.location.min_loc']['kismet.common.location.geopoint']
+                tmp_min_lat = round(tmp_min_lat + 91, 6)
+                tmp_min_long = round(tmp_min_long + 181, 6)
+                if (tmp_min_lat != 91 and tmp_min_long !=181): 
+                  if (tmp_min_lat < min_lat):
+                      min_lat = tmp_min_lat
+                  if (tmp_min_long < min_long):
+                      min_long = tmp_min_long
+                (tmp_max_long,tmp_max_lat) = newdev['kismet.device.base.location']['kismet.common.location.max_loc']['kismet.common.location.geopoint']
+                tmp_max_lat = round(tmp_max_lat + 91,6)
+                tmp_max_long = round(tmp_max_long +181,6)
+                if (tmp_max_lat != 91 and tmp_max_long !=181):
+                    if (tmp_max_lat > max_lat):
+                        max_lat = tmp_max_lat
+                    if (tmp_max_long > max_long):
+                        max_long = tmp_max_long
+            newdev['kismet.device.base.macaddr'] = dev_json['kismet.device.base.macaddr']
+            newdev['adsb.device'] = dev_json['adsb.device']
+            newdev['kismet.device.base.type'] = dev_json['kismet.device.base.type']
+            newdev['kismet.device.base.commonname'] = dev_json['kismet.device.base.commonname']
+            newdev['kismet.device.base.name'] = dev_json['kismet.device.base.name']
+            newdev['kismet.device.base.packets.data'] = dev_json['kismet.device.base.packets.data']
+            newdev['kismet.device.base.frequency'] = dev_json['kismet.device.base.frequency']
+            newdev['kismet.device.base.phyname'] = dev_json['kismet.device.base.phyname']
+            newdev['kismet.device.base.last_time'] = dev_json['kismet.device.base.last_time']
+            newdev['kismet.device.base.key'] = dev_json['kismet.device.base.key']
+            adsblist = adsblist + json.dumps(newdev) + ","
+        adsblist = adsblist[:-1]
+        min_lat = round(min_lat - 91, 6)
+        min_long = round(min_long - 181, 6)
+        max_lat = round(max_lat - 91, 6)
+        max_long = round(max_long - 181, 6)
+        adsblist = adsblist + " ], \"kismet.adsb.map.min_lon\": "+str(min_long) + ", \"kismet.adsb.map.max_lat\": "+str(max_lat)+", \"kismet.adsb.map.min_lat\": "+str(min_lat)+", \"kismet.adsb.map.max_lon\": "+str(max_long)+" }"
+        return HttpResponse(adsblist, content_type='text/json')
index 979c6d6e53e4bda9ce99545e11566517d436813d..510d74db810d96081eab1ebd03b3443d6433aae8 100644 (file)
Binary files a/logviewer/kiscontent/__pycache__/views.cpython-38.pyc and b/logviewer/kiscontent/__pycache__/views.cpython-38.pyc differ
index 9f4c0d58edd5d562498b0c204f6423aaac05aafa..10c756210767ee7cb77b37c4b13b401e75fb60eb 100644 (file)
Binary files a/logviewer/logviewer/__pycache__/settings.cpython-38.pyc and b/logviewer/logviewer/__pycache__/settings.cpython-38.pyc differ
index e31fe2f0bd20d4d0c653c261aef0575ca97aa3b3..31bf70d53943c511e65c39b94451c7a13b76a0e1 100644 (file)
Binary files a/logviewer/logviewer/__pycache__/urls.cpython-38.pyc and b/logviewer/logviewer/__pycache__/urls.cpython-38.pyc differ
index 9f67ffd330c97165b3f8219de91986d5ce5d0c6e..2df18a0ce16d4140f367603a404c70eeb03ab65b 100644 (file)
@@ -148,3 +148,5 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 ALLOWED_HOSTS = ['sdr-cabinet', 'sdr-cabinet.dyn.spangdorfia.com']
 
 ASGI_APPLICATION = 'logviewer.asgi.application'
+
+X_FRAME_OPTIONS = 'SAMEORIGIN'
index 5758a5f562db581f1fa3c810378f74f06df7387e..ae573eab945fc35b860afb0d1834113cd41d61c2 100644 (file)
@@ -35,12 +35,12 @@ urlpatterns = [
     path('alerts/alerts_view.json', include('dbview.urls')),
     path('phy/phy80211/ssids/views/ssids.json', include('dbview.urls')),
     path('css/images/<str:loadfile>', include('kiscontent.urls')),
+    path('adsb_map_panel.html', include('adsbmap.urls')),
     path('system/status.json', include('dbview.urls')),
     path('alerts/wrapped/last-time/0/alerts.json', include('dbview.urls')),
     path('messagebus/last-time/0/messages.json', include('dbview.urls')),
     path('channels/channels.json', include('dbview.urls')),
     path('devices/views/all/devices.json', include('dbview.urls')),
-    #path('devices/views//devices.json', include('dbview.urls')),
     path('devices/views/phydot11_accesspoints/devices.json', include('dbview.urls')),
     path('devices/views/phy-RADIATION/devices.json', include('dbview.urls')),
     path('devices/views/phy-802.15.4/devices.json', include('dbview.urls')),
@@ -53,11 +53,9 @@ urlpatterns = [
     path('devices/views/phy-Z-Wave/devices.json', include('dbview.urls')),
     path('devices/views/phy-RTL433/devices.json', include('dbview.urls')),
     path('devices/views/phy-IEEE802.11/devices.json', include('dbview.urls')),
+    path('phy/ADSB/map_data.json', include('dbview.urls')),
     path('devices/by-key/<str:devicename>/device.json', include('devices.urls')),
     path('devices/multikey/as-object/devices.json', include('dbview.urls')),
-    #path('devices/views/phydot11_accesspoints/devices.json', include('dbview.urls')),
-    #path('devices/views/phy-RADIATION/devices.json', include('dbviews.urls')),
-    #path('devices/views/phy-802.15.4/devices.json', include('dbviews.utls')),
     path('datasource/by-uuid/<str:devicename>/source.json', include('devices.urls')),
     path('phy/phy80211/ssids/by-hash/<str:devicename>/ssid.json', include('devices.urls')),
     path('eventbus/', include('eventbus.urls')),
index d8e7b71591beb12056af0662090146865142057a..0bc785af7657a145e49d2610f1b590ffe1ad8829 100644 (file)
@@ -1,23 +1,23 @@
 var local_uri_prefix = "./";
 if (typeof(KISMET_URI_PREFIX) !== 'undefined')
 local_uri_prefix = KISMET_URI_PREFIX;
+var kismet_ui_adsb;
 var kismet_ui_bluetooth;
 var kismet_ui_btle;
 var kismet_ui_datasources;
 var kismet_ui_dot11;
+var kismet_ui_meter;
 var kismet_ui_rtl433;
-//var kismet_ui_rtladsb;
-//var kismet_ui_rtlamr;
 var kismet_ui_uav;
 var kismet_ui_zwave;
 async function load_dynamics() {
+kismet_ui_adsb = await import(`${local_uri_prefix}js/kismet.ui.adsb.js`);
 kismet_ui_bluetooth = await import(`${local_uri_prefix}js/kismet.ui.bluetooth.js`);
 kismet_ui_btle = await import(`${local_uri_prefix}js/kismet.ui.btle.js`);
 kismet_ui_datasources = await import(`${local_uri_prefix}js/kismet.ui.datasources.js`);
 kismet_ui_dot11 = await import(`${local_uri_prefix}js/kismet.ui.dot11.js`);
+kismet_ui_meter = await import(`${local_uri_prefix}js/kismet.ui.meter.js`);
 kismet_ui_rtl433 = await import(`${local_uri_prefix}js/kismet.ui.rtl433.js`);
-//kismet_ui_rtladsb = await import(`${local_uri_prefix}js/kismet.ui.rtladsb.js`);
-//kismet_ui_rtlamr = await import(`${local_uri_prefix}js/kismet.ui.rtlamr.js`);
 kismet_ui_uav = await import(`${local_uri_prefix}js/kismet.ui.uav.js`);
 kismet_ui_zwave = await import(`${local_uri_prefix}js/kismet.ui.zwave.js`);
 }