moar
authorRuss Handorf <rhandorf@handorf.org>
Tue, 20 Dec 2022 00:23:00 +0000 (19:23 -0500)
committerRuss Handorf <rhandorf@handorf.org>
Tue, 20 Dec 2022 00:23:00 +0000 (19:23 -0500)
20 files changed:
logviewer/dbview/__pycache__/views.cpython-38.pyc
logviewer/dbview/ssids.json [new file with mode: 0644]
logviewer/dbview/views.py
logviewer/devices/__init__.py [new file with mode: 0644]
logviewer/devices/__pycache__/__init__.cpython-38.pyc [new file with mode: 0644]
logviewer/devices/__pycache__/urls.cpython-38.pyc [new file with mode: 0644]
logviewer/devices/__pycache__/views.cpython-38.pyc [new file with mode: 0644]
logviewer/devices/admin.py [new file with mode: 0644]
logviewer/devices/apps.py [new file with mode: 0644]
logviewer/devices/migrations/__init__.py [new file with mode: 0644]
logviewer/devices/models.py [new file with mode: 0644]
logviewer/devices/tests.py [new file with mode: 0644]
logviewer/devices/urls.py [new file with mode: 0644]
logviewer/devices/views.py [new file with mode: 0644]
logviewer/kiscontent/.views.py.swp [new file with mode: 0644]
logviewer/kiscontent/__pycache__/views.cpython-38.pyc
logviewer/kiscontent/views.py
logviewer/logs/Kismet-20221208-22-56-36-1.kismet [new file with mode: 0644]
logviewer/logviewer/__pycache__/urls.cpython-38.pyc
logviewer/logviewer/urls.py

index a3dcda134c6975a00c0143396310caeef0ad5cbb..b7b97946592a90b5cda3938a61311495c04cc34a 100644 (file)
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/ssids.json b/logviewer/dbview/ssids.json
new file mode 100644 (file)
index 0000000..fe51488
--- /dev/null
@@ -0,0 +1 @@
+[]
index a7d0f9a7e6e444f74a30ba8db617148524968ba2..c84f38b8d10769bec4ee063988cbb2216955714d 100644 (file)
@@ -9,7 +9,7 @@ import pprint
 from django.views.decorators.csrf import csrf_exempt
 
 def load_db(query):
-    connection = sqlite3.connect("/home/rhandorf/kismet-logviewer/logviewer/logs/Kismet-20221208-22-56-36-1.kismet")
+    connection = sqlite3.connect("logs/Kismet-20221208-22-56-36-1.kismet")
     #connection.row_factory = lambda cursor, row: row[0]
     cursor = connection.cursor()
     rows = cursor.execute(query).fetchall()
@@ -20,10 +20,10 @@ def index(request):
     #if request.method == 'POST':
     #    print("GOT A POST")
     if request.path == "/devices/views/all_views.json":
-        all_views = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/all_views.json')
+        all_views = open('dbview/all_views.json')
         return HttpResponse(all_views, content_type='text/json')
     elif request.path == "/system/user_status.json":
-        user_status = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/user_status.json')
+        user_status = open('dbview/user_status.json')
         return HttpResponse(user_status, content_type='text/json')
     elif request.path == "/session/check_setup_ok":
         return HttpResponse('Login configured in user config')
@@ -31,10 +31,10 @@ def index(request):
         return HttpResponse('Login valid')
     elif request.path == "/dynamic.js":
         devices = load_db("select distinct(typestring) from datasources")
-        load_file = open('/home/rhandorf/kismet-logviewer/logviewer/static/dynamic.js')
+        load_file = open('static/dynamic.js')
         return HttpResponse(load_file, content_type='application/javascript')
     elif request.path == "/gps/location.json":
-        user_status = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/gps_status.json')
+        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":
         alerts = list(load_db("select cast(json as text) from alerts"))
@@ -46,10 +46,10 @@ def index(request):
         alert_string = alert_string + "] ,\"kismet.alert.timestamp\": "+str(time.time())+"}"
         return HttpResponse(alert_string, content_type='text/json')
     elif request.path == "/phy/phy80211/ssids/views/ssids.json":
-        user_status = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/ssids.json')
+        user_status = open('dbview/ssids.json')
         return HttpResponse(user_status, content_type='text/json')
     elif request.path == "/system/status.json":
-        user_status = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/status.json')
+        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
@@ -87,7 +87,7 @@ def index(request):
         message_string = message_string + "], \"kismet.messagebus.timestamp\": "+str(time.time())+" }"
         return HttpResponse(message_string, content_type='text/json')
     elif request.path == "/channels/channels.json":
-        user_status = open('/home/rhandorf/kismet-logviewer/logviewer/dbview/channels.json')
+        user_status = open('dbview/channels.json')
         return HttpResponse(user_status, content_type='text/json')
     elif request.path == "/devices/views/all/devices.json":
         #gotta figure out paging
@@ -103,5 +103,11 @@ def index(request):
         return HttpResponse(dev_string, content_type='text/json')
     elif request.path == "/eventbus/events.ws":
         return HttpResponse("[]", content_type='text/json')
-
-
+    elif request.path == "/devices/multikey/as-object/devices.json":
+        print("here")
+        for key, value in request.POST.items():
+            print("-----")
+            print(key)
+            print(value)
+            print("-----")
+        return HttpResponse("[]", content_type='text/json')
diff --git a/logviewer/devices/__init__.py b/logviewer/devices/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/logviewer/devices/__pycache__/__init__.cpython-38.pyc b/logviewer/devices/__pycache__/__init__.cpython-38.pyc
new file mode 100644 (file)
index 0000000..f9f6bb7
Binary files /dev/null and b/logviewer/devices/__pycache__/__init__.cpython-38.pyc differ
diff --git a/logviewer/devices/__pycache__/urls.cpython-38.pyc b/logviewer/devices/__pycache__/urls.cpython-38.pyc
new file mode 100644 (file)
index 0000000..1a74bdf
Binary files /dev/null and b/logviewer/devices/__pycache__/urls.cpython-38.pyc differ
diff --git a/logviewer/devices/__pycache__/views.cpython-38.pyc b/logviewer/devices/__pycache__/views.cpython-38.pyc
new file mode 100644 (file)
index 0000000..6b59af7
Binary files /dev/null and b/logviewer/devices/__pycache__/views.cpython-38.pyc differ
diff --git a/logviewer/devices/admin.py b/logviewer/devices/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/devices/apps.py b/logviewer/devices/apps.py
new file mode 100644 (file)
index 0000000..f1dad42
--- /dev/null
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class DevicesConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'devices'
diff --git a/logviewer/devices/migrations/__init__.py b/logviewer/devices/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/logviewer/devices/models.py b/logviewer/devices/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/devices/tests.py b/logviewer/devices/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/devices/urls.py b/logviewer/devices/urls.py
new file mode 100644 (file)
index 0000000..88a9cac
--- /dev/null
@@ -0,0 +1,7 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+    path('', views.index, name='index'),
+]
diff --git a/logviewer/devices/views.py b/logviewer/devices/views.py
new file mode 100644 (file)
index 0000000..5451dc8
--- /dev/null
@@ -0,0 +1,30 @@
+from django.shortcuts import render
+from django.http import HttpResponse, HttpRequest
+import os
+import sqlite3
+import time
+import json
+import pprint
+
+from django.views.decorators.csrf import csrf_exempt
+
+def load_db(query):
+    connection = sqlite3.connect("logs/Kismet-20221208-22-56-36-1.kismet")
+    #connection.row_factory = lambda cursor, row: row[0]
+    cursor = connection.cursor()
+    rows = cursor.execute(query).fetchall()
+    return(rows)
+
+@csrf_exempt
+def index(request,devicename):
+    dev=list(load_db("select cast(device as text) from devices where devkey = \""+devicename+"\""))
+    (dev_info,) = dev[0]
+    #dev_string = "{ \"recordsTotal\": "+str(dev_count)+", \"data\": ["
+    #dev_list = list(load_db("select cast(device as text) from devices limit 50"))
+    #for device in dev_list:
+    #    (dev,) = device
+    #    dev_string = dev_string + dev + ","
+    #dev_string = dev_string[:-1]
+    #dev_string = dev_string + "],\"draw\": 5,\"recordsFiltered\": "+str(dev_count)+"}"
+    return HttpResponse(dev_info, content_type='text/json')
+
diff --git a/logviewer/kiscontent/.views.py.swp b/logviewer/kiscontent/.views.py.swp
new file mode 100644 (file)
index 0000000..1ef3d78
Binary files /dev/null and b/logviewer/kiscontent/.views.py.swp differ
index bcc842abf24fb61ee607f64362dcf4f2a1094d45..f5cd2375f4f1e4ac8c04c05617f875f15818e951 100644 (file)
Binary files a/logviewer/kiscontent/__pycache__/views.cpython-38.pyc and b/logviewer/kiscontent/__pycache__/views.cpython-38.pyc differ
index 668b06ee7d0e08e8c79a625fd83a889b33e5b822..844862955b43ca500f5e909d9f8f65c64fc68b9b 100644 (file)
@@ -3,7 +3,7 @@ from django.http import HttpResponse, HttpRequest
 import os
 
 def index(request, loadfile):
-    load_file = open('/home/rhandorf/kismet-logviewer/logviewer/static/'+request.path, mode='rb')
+    load_file = open('static/'+request.path, mode='rb')
     if loadfile[-2:] == "js":
         return HttpResponse(load_file, content_type='application/javascript')
     elif loadfile[-3:] == "css":
diff --git a/logviewer/logs/Kismet-20221208-22-56-36-1.kismet b/logviewer/logs/Kismet-20221208-22-56-36-1.kismet
new file mode 100644 (file)
index 0000000..4b080d0
Binary files /dev/null and b/logviewer/logs/Kismet-20221208-22-56-36-1.kismet differ
index 199b310a11feecb2ca1216083379292ee7ec0ba5..5fc6884fc2ebe80f4e6f08013dc3008be61f506d 100644 (file)
Binary files a/logviewer/logviewer/__pycache__/urls.cpython-38.pyc and b/logviewer/logviewer/__pycache__/urls.cpython-38.pyc differ
index b23c30bcd9467ba56c63d53d8b9db8bf6e7e0995..584a77cb38ab15ccf78f2eae6870bb61fe56f048 100644 (file)
@@ -40,4 +40,6 @@ urlpatterns = [
     path('channels/channels.json', include('dbview.urls')),
     path('devices/views/all/devices.json', include('dbview.urls')),
     path('eventbus/events.ws', include('dbview.urls')),
+    path('devices/by-key/<str:devicename>/device.json', include('devices.urls')),
+    path('devices/multikey/as-object/devices.json', include('dbview.urls')),
 ]