BE: CurrentScan table leanup - column rename

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2026-01-25 16:38:45 +11:00
parent f173325b7b
commit d24411fa53
37 changed files with 450 additions and 450 deletions
+17 -17
View File
@@ -150,21 +150,21 @@ CREATE TABLE Plugins_Language_Strings(
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("Index" AUTOINCREMENT)
); );
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC STRING(50) NOT NULL COLLATE NOCASE, scanMac STRING(50) NOT NULL COLLATE NOCASE,
cur_IP STRING(50) NOT NULL COLLATE NOCASE, scanLastIP STRING(50) NOT NULL COLLATE NOCASE,
cur_Vendor STRING(250), scanVendor STRING(250),
cur_ScanMethod STRING(10), scanSourcePlugin STRING(10),
cur_Name STRING(250), scanName STRING(250),
cur_LastQuery STRING(250), scanLastQuery STRING(250),
cur_DateTime STRING(250), scanLastConnection STRING(250),
cur_SyncHubNodeName STRING(50), scanSyncHubNode STRING(50),
cur_NetworkSite STRING(250), scanSite STRING(250),
cur_SSID STRING(250), scanSSID STRING(250),
cur_devVlan STRING(250), scanVlan STRING(250),
cur_NetworkNodeMAC STRING(250), scanParentMAC STRING(250),
cur_PORT STRING(250), scanParentPort STRING(250),
cur_Type STRING(250), scanType STRING(250),
UNIQUE(cur_MAC) UNIQUE(scanMac)
); );
CREATE TABLE IF NOT EXISTS "AppEvents" ( CREATE TABLE IF NOT EXISTS "AppEvents" (
"Index" INTEGER PRIMARY KEY AUTOINCREMENT, "Index" INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -237,9 +237,9 @@ CREATE VIEW LatestEventsPerMAC AS
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.cur_MAC INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac
WHERE e.row_num = 1 WHERE e.row_num = 1
/* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,cur_MAC,cur_IP,cur_Vendor,cur_ScanMethod,cur_Name,cur_LastQuery,cur_DateTime,cur_SyncHubNodeName,cur_NetworkSite,cur_SSID,cur_NetworkNodeMAC,cur_PORT,cur_Type) */; /* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,scanMac,scanLastIP,scanVendor,scanSourcePlugin,scanName,scanLastQuery,scanLastConnection,scanSyncHubNode,scanSite,scanSSID,scanParentMAC,scanParentPort,scanType) */;
CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac
/* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */; /* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */;
CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC, CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC,
+1 -1
View File
@@ -54,7 +54,7 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo
17:31:05 [Plugin utils] In pluginObjects there are 2 events with the status "missing-in-last-scan" 17:31:05 [Plugin utils] In pluginObjects there are 2 events with the status "missing-in-last-scan"
17:31:05 [Plugin utils] In pluginObjects there are 2 events with the status "watched-not-changed" 17:31:05 [Plugin utils] In pluginObjects there are 2 events with the status "watched-not-changed"
17:31:05 [Plugins] Mapping objects to database table: CurrentScan 17:31:05 [Plugins] Mapping objects to database table: CurrentScan
17:31:05 [Plugins] SQL query for mapping: INSERT into CurrentScan ( "cur_MAC", "cur_IP", "cur_LastQuery", "cur_Name", "cur_Vendor", "cur_ScanMethod") VALUES ( ?, ?, ?, ?, ?, ?) 17:31:05 [Plugins] SQL query for mapping: INSERT into CurrentScan ( "scanMac", "scanLastIP", "scanLastQuery", "scanName", "scanVendor", "scanSourcePlugin") VALUES ( ?, ?, ?, ?, ?, ?)
17:31:05 [Plugins] SQL sqlParams for mapping: [('01:01:01:01:01:01', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'PIHOLE'), ('02:42:ac:1e:00:02', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'PIHOLE')] 17:31:05 [Plugins] SQL sqlParams for mapping: [('01:01:01:01:01:01', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'PIHOLE'), ('02:42:ac:1e:00:02', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'PIHOLE')]
🔺 🔺
17:31:05 [API] Update API starting 17:31:05 [API] Update API starting
+2 -2
View File
@@ -268,7 +268,7 @@ To import plugin data into NetAlertX tables for device discovery or notification
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
"localized": ["name"], "localized": ["name"],
@@ -287,7 +287,7 @@ To always map a static value (not read from plugin output):
```json ```json
{ {
"column": "NameDoesntMatter", "column": "NameDoesntMatter",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "MYPLN" "value": "MYPLN"
} }
+7 -7
View File
@@ -440,7 +440,7 @@ To import plugin data into the device scan pipeline (for notifications, heuristi
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
"localized": ["name"], "localized": ["name"],
@@ -448,7 +448,7 @@ To import plugin data into the device scan pipeline (for notifications, heuristi
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
"localized": ["name"], "localized": ["name"],
@@ -456,7 +456,7 @@ To import plugin data into the device scan pipeline (for notifications, heuristi
}, },
{ {
"column": "NameDoesntMatter", "column": "NameDoesntMatter",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "MYSCAN" "value": "MYSCAN"
}, },
@@ -478,7 +478,7 @@ Use `mapped_to_column_data` to map a static value instead of reading from a colu
```json ```json
{ {
"column": "NameDoesntMatter", "column": "NameDoesntMatter",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "MYSCAN" "value": "MYSCAN"
}, },
@@ -489,7 +489,7 @@ Use `mapped_to_column_data` to map a static value instead of reading from a colu
} }
``` ```
This always sets `cur_ScanMethod` to `"MYSCAN"` regardless of column data. This always sets `scanSourcePlugin` to `"MYSCAN"` regardless of column data.
--- ---
@@ -546,7 +546,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
"database_column_definitions": [ "database_column_definitions": [
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -556,7 +556,7 @@ When viewing a device detail page, the `txtMacFilter` field is populated with th
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
+1 -1
View File
@@ -105,7 +105,7 @@ a[target="_blank"] {
background-color: black !important; background-color: black !important;
font-family: 'Courier New', monospace; font-family: 'Courier New', monospace;
font-size: .85em; font-size: .85em;
cursor: pointer; cursor: pointer !important;
} }
.logs-row textarea .logs-row textarea
{ {
+6 -6
View File
@@ -419,7 +419,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -435,7 +435,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -451,7 +451,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -467,7 +467,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -483,7 +483,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -514,7 +514,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "Example Plugin" "value": "Example Plugin"
}, },
+2 -2
View File
@@ -51,8 +51,8 @@ def main():
# "database_column_definitions": [ # "database_column_definitions": [
# { # {
# "column": "Object_PrimaryID", <--------- the value I save into primaryId # "column": "Object_PrimaryID", <--------- the value I save into primaryId
# "mapped_to_column": "cur_MAC", <--------- gets inserted into the CurrentScan DB # "mapped_to_column": "scanMac", <--------- gets inserted into the CurrentScan DB
# table column cur_MAC # table column scanMac
# #
for device in device_data: for device in device_data:
plugin_objects.add_object( plugin_objects.add_object(
+5 -5
View File
@@ -392,7 +392,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -408,7 +408,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -424,7 +424,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -440,7 +440,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -486,7 +486,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "Example Plugin" "value": "Example Plugin"
}, },
+4 -4
View File
@@ -500,7 +500,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -516,7 +516,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -532,7 +532,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -556,7 +556,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "ARPSCAN" "value": "ARPSCAN"
}, },
+5 -5
View File
@@ -451,7 +451,7 @@
"localized": [ "localized": [
"name" "name"
], ],
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -477,7 +477,7 @@
"localized": [ "localized": [
"name" "name"
], ],
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -503,7 +503,7 @@
"localized": [ "localized": [
"name" "name"
], ],
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -524,7 +524,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": [ "localized": [
@@ -550,7 +550,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "ASUSWRT" "value": "ASUSWRT"
}, },
+5 -5
View File
@@ -103,7 +103,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -127,7 +127,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -174,7 +174,7 @@
}, },
{ {
"column": "DateTimeChanged", "column": "DateTimeChanged",
"mapped_to_column": "cur_DateTime", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -221,7 +221,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -337,7 +337,7 @@
}, },
{ {
"column": "ScanMethod", "column": "ScanMethod",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "DHCPLSS" "value": "DHCPLSS"
}, },
+6 -6
View File
@@ -391,7 +391,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -409,7 +409,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -427,7 +427,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -445,7 +445,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -463,7 +463,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -498,7 +498,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "Freebox" "value": "Freebox"
}, },
+4 -4
View File
@@ -382,7 +382,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -400,7 +400,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -418,7 +418,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -487,7 +487,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "ICMP" "value": "ICMP"
}, },
+5 -5
View File
@@ -494,7 +494,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -518,7 +518,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -591,7 +591,7 @@
}, },
{ {
"column": "Watched_Value4", "column": "Watched_Value4",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -607,7 +607,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "INTRNT" "value": "INTRNT"
}, },
@@ -657,7 +657,7 @@
}, },
{ {
"column": "DateTimeChanged", "column": "DateTimeChanged",
"mapped_to_column": "cur_DateTime", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
+6 -6
View File
@@ -287,7 +287,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -305,7 +305,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -323,7 +323,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -341,7 +341,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -359,7 +359,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -394,7 +394,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "IPNEIGH" "value": "IPNEIGH"
}, },
+3 -3
View File
@@ -470,7 +470,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -490,7 +490,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -549,7 +549,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "LUCIRPC" "value": "LUCIRPC"
}, },
+4 -4
View File
@@ -351,7 +351,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -382,7 +382,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -413,7 +413,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -474,7 +474,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "MTSCAN" "value": "MTSCAN"
}, },
+6 -6
View File
@@ -538,7 +538,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -556,7 +556,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -574,7 +574,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -592,7 +592,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -618,7 +618,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_LastQuery", "mapped_to_column": "scanLastQuery",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -640,7 +640,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "NMAPDEV" "value": "NMAPDEV"
}, },
+8 -8
View File
@@ -554,7 +554,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -578,7 +578,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -602,7 +602,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -618,7 +618,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_NetworkNodeMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -634,7 +634,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_PORT", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -650,7 +650,7 @@
}, },
{ {
"column": "Watched_Value4", "column": "Watched_Value4",
"mapped_to_column": "cur_SSID", "mapped_to_column": "scanSSID",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -666,7 +666,7 @@
}, },
{ {
"column": "Extra", "column": "Extra",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -682,7 +682,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "OMDSDN" "value": "OMDSDN"
}, },
+2 -2
View File
@@ -320,7 +320,7 @@ def main():
# "database_column_definitions": [ # "database_column_definitions": [
# { # {
# "column": "Object_PrimaryID", <--------- the value I save into primaryId # "column": "Object_PrimaryID", <--------- the value I save into primaryId
# "mapped_to_column": "cur_MAC", <--------- gets unserted into the CurrentScan DB table column cur_MAC # "mapped_to_column": "scanMac", <--------- gets unserted into the CurrentScan DB table column scanMac
# watched1 = 'null' , # watched1 = 'null' ,
# figure a way to run my udpate script delayed # figure a way to run my udpate script delayed
@@ -342,7 +342,7 @@ def main():
watched3=myport, # PORT watched3=myport, # PORT
watched4=myssid, # SSID watched4=myssid, # SSID
extra=device[TYPE], extra=device[TYPE],
# omada_site, # SITENAME (cur_NetworkSite) or VENDOR (cur_Vendor) (PICK one and adjust config.json -> "column": "Extra") # omada_site, # SITENAME (scanSite) or VENDOR (scanVendor) (PICK one and adjust config.json -> "column": "Extra")
foreignKey=device[MAC].lower().replace("-", ":"), foreignKey=device[MAC].lower().replace("-", ":"),
) # usually MAC ) # usually MAC
+9 -9
View File
@@ -528,7 +528,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -544,7 +544,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -560,7 +560,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -576,7 +576,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_NetworkNodeMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -592,7 +592,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_PORT", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -608,7 +608,7 @@
}, },
{ {
"column": "Watched_Value4", "column": "Watched_Value4",
"mapped_to_column": "cur_SSID", "mapped_to_column": "scanSSID",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -624,7 +624,7 @@
}, },
{ {
"column": "Extra", "column": "Extra",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": false, "show": false,
"type": "label", "type": "label",
@@ -640,7 +640,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "OMDSDNOPENAPI" "value": "OMDSDNOPENAPI"
}, },
@@ -704,7 +704,7 @@
}, },
{ {
"column": "HelpVal2", "column": "HelpVal2",
"mapped_to_column": "cur_NetworkSite", "mapped_to_column": "scanSite",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
+5 -5
View File
@@ -428,7 +428,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -444,7 +444,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -460,7 +460,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -476,7 +476,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -522,7 +522,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "PIHOLEAPI" "value": "PIHOLEAPI"
}, },
+6 -6
View File
@@ -385,7 +385,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -420,7 +420,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -440,7 +440,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_LastQuery", "mapped_to_column": "scanLastQuery",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -456,7 +456,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -472,7 +472,7 @@
}, },
{ {
"column": "Watched_Value4", "column": "Watched_Value4",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -488,7 +488,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "PIHOLE" "value": "PIHOLE"
}, },
+5 -5
View File
@@ -100,7 +100,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -120,7 +120,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -140,7 +140,7 @@
}, },
{ {
"column": "DateTimeCreated", "column": "DateTimeCreated",
"mapped_to_column": "cur_DateTime", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -160,7 +160,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -275,7 +275,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "SNMPDSC" "value": "SNMPDSC"
}, },
+6 -6
View File
@@ -684,7 +684,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -710,7 +710,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -736,7 +736,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -754,7 +754,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -772,7 +772,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_SyncHubNodeName", "mapped_to_column": "scanSyncHubNode",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -807,7 +807,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "sync" "value": "sync"
}, },
+6 -6
View File
@@ -587,7 +587,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-3", "css_classes": "col-sm-3",
"show": true, "show": true,
"type": "device_name_mac", "type": "device_name_mac",
@@ -605,7 +605,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -623,7 +623,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -641,7 +641,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -676,7 +676,7 @@
}, },
{ {
"column": "Watched_Value4", "column": "Watched_Value4",
"mapped_to_column": "cur_NetworkNodeMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -694,7 +694,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "UNIFIAPI" "value": "UNIFIAPI"
}, },
+9 -9
View File
@@ -123,7 +123,7 @@
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -147,7 +147,7 @@
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -194,7 +194,7 @@
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
"mapped_to_column": "cur_DateTime", "mapped_to_column": "scanLastConnection",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -218,7 +218,7 @@
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"name": [ "name": [
{ {
"language_code": "en_us", "language_code": "en_us",
@@ -239,7 +239,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -263,7 +263,7 @@
}, },
{ {
"column": "Watched_Value3", "column": "Watched_Value3",
"mapped_to_column": "cur_Type", "mapped_to_column": "scanType",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -336,7 +336,7 @@
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "UNFIMP" "value": "UNFIMP"
}, },
@@ -383,7 +383,7 @@
}, },
{ {
"column": "HelpVal1", "column": "HelpVal1",
"mapped_to_column": "cur_NetworkNodeMAC", "mapped_to_column": "scanParentMAC",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
@@ -399,7 +399,7 @@
}, },
{ {
"column": "HelpVal2", "column": "HelpVal2",
"mapped_to_column": "cur_PORT", "mapped_to_column": "scanParentPort",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"default_value": "", "default_value": "",
"localized": ["name"], "localized": ["name"],
+6 -6
View File
@@ -428,7 +428,7 @@
}, },
{ {
"column": "Object_PrimaryID", "column": "Object_PrimaryID",
"mapped_to_column": "cur_MAC", "mapped_to_column": "scanMac",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_mac", "type": "device_mac",
@@ -452,7 +452,7 @@
}, },
{ {
"column": "Object_SecondaryID", "column": "Object_SecondaryID",
"mapped_to_column": "cur_IP", "mapped_to_column": "scanLastIP",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "device_ip", "type": "device_ip",
@@ -499,7 +499,7 @@
}, },
{ {
"column": "DateTimeChanged", "column": "DateTimeChanged",
"mapped_to_column": "cur_DateTime", "mapped_to_column": "scanLastConnection",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -523,7 +523,7 @@
}, },
{ {
"column": "Dummy", "column": "Dummy",
"mapped_to_column": "cur_ScanMethod", "mapped_to_column": "scanSourcePlugin",
"mapped_to_column_data": { "mapped_to_column_data": {
"value": "VNDRPDT" "value": "VNDRPDT"
}, },
@@ -550,7 +550,7 @@
}, },
{ {
"column": "Watched_Value1", "column": "Watched_Value1",
"mapped_to_column": "cur_Vendor", "mapped_to_column": "scanVendor",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -570,7 +570,7 @@
}, },
{ {
"column": "Watched_Value2", "column": "Watched_Value2",
"mapped_to_column": "cur_Name", "mapped_to_column": "scanName",
"css_classes": "col-sm-2", "css_classes": "col-sm-2",
"show": true, "show": true,
"type": "label", "type": "label",
@@ -196,20 +196,20 @@ CREATE TABLE Plugins_Language_Strings(
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("Index" AUTOINCREMENT)
); );
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC STRING(50) NOT NULL COLLATE NOCASE, scanMac STRING(50) NOT NULL COLLATE NOCASE,
cur_IP STRING(50) NOT NULL COLLATE NOCASE, scanLastIP STRING(50) NOT NULL COLLATE NOCASE,
cur_Vendor STRING(250), scanVendor STRING(250),
cur_ScanMethod STRING(10), scanSourcePlugin STRING(10),
cur_Name STRING(250), scanName STRING(250),
cur_LastQuery STRING(250), scanLastQuery STRING(250),
cur_DateTime STRING(250), scanLastConnection STRING(250),
cur_SyncHubNodeName STRING(50), scanSyncHubNode STRING(50),
cur_NetworkSite STRING(250), scanSite STRING(250),
cur_SSID STRING(250), scanSSID STRING(250),
cur_NetworkNodeMAC STRING(250), scanParentMAC STRING(250),
cur_PORT STRING(250), scanParentPort STRING(250),
cur_Type STRING(250), scanType STRING(250),
UNIQUE(cur_MAC) UNIQUE(scanMac)
); );
CREATE TABLE IF NOT EXISTS "AppEvents" ( CREATE TABLE IF NOT EXISTS "AppEvents" (
"Index" INTEGER PRIMARY KEY AUTOINCREMENT, "Index" INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -282,9 +282,9 @@ CREATE VIEW LatestEventsPerMAC AS
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.cur_MAC INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac
WHERE e.row_num = 1 WHERE e.row_num = 1
/* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,cur_MAC,cur_IP,cur_Vendor,cur_ScanMethod,cur_Name,cur_LastQuery,cur_DateTime,cur_SyncHubNodeName,cur_NetworkSite,cur_SSID,cur_NetworkNodeMAC,cur_PORT,cur_Type) */; /* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,scanMac,scanLastIP,scanVendor,scanSourcePlugin,scanName,scanLastQuery,scanLastConnection,scanSyncHubNode,scanSite,scanSSID,scanParentMAC,scanParentPort,scanType) */;
CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac
/* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */; /* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */;
CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC, CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC,
+4 -4
View File
@@ -36,7 +36,7 @@ def check_and_clean_device():
tables_checks = [ tables_checks = [
f"SELECT 'Events' as source, * FROM Events WHERE eve_MAC='{mac}'", f"SELECT 'Events' as source, * FROM Events WHERE eve_MAC='{mac}'",
f"SELECT 'Devices' as source, * FROM Devices WHERE dev_MAC='{mac}'", f"SELECT 'Devices' as source, * FROM Devices WHERE dev_MAC='{mac}'",
f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE cur_MAC='{mac}'", f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanMac='{mac}'",
f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{mac}%'", f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{mac}%'",
f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'", f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'",
f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'" f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'"
@@ -56,7 +56,7 @@ def check_and_clean_device():
deletes = [ deletes = [
f"DELETE FROM Events WHERE eve_MAC='{mac}'", f"DELETE FROM Events WHERE eve_MAC='{mac}'",
f"DELETE FROM Devices WHERE dev_MAC='{mac}'", f"DELETE FROM Devices WHERE dev_MAC='{mac}'",
f"DELETE FROM CurrentScan WHERE cur_MAC='{mac}'", f"DELETE FROM CurrentScan WHERE scanMac='{mac}'",
f"DELETE FROM Notifications WHERE JSON LIKE '%{mac}%'", f"DELETE FROM Notifications WHERE JSON LIKE '%{mac}%'",
f"DELETE FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'", f"DELETE FROM AppEvents WHERE ObjectPrimaryID LIKE '%{mac}%' OR ObjectSecondaryID LIKE '%{mac}%'",
f"DELETE FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'" f"DELETE FROM Plugins_Objects WHERE Object_PrimaryID LIKE '%{mac}%'"
@@ -75,7 +75,7 @@ def check_and_clean_device():
tables_checks = [ tables_checks = [
f"SELECT 'Events' as source, * FROM Events WHERE eve_IP='{ip}'", f"SELECT 'Events' as source, * FROM Events WHERE eve_IP='{ip}'",
f"SELECT 'Devices' as source, * FROM Devices WHERE dev_LastIP='{ip}'", f"SELECT 'Devices' as source, * FROM Devices WHERE dev_LastIP='{ip}'",
f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE cur_IP='{ip}'", f"SELECT 'CurrentScan' as source, * FROM CurrentScan WHERE scanLastIP='{ip}'",
f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{ip}%'", f"SELECT 'Notifications' as source, * FROM Notifications WHERE JSON LIKE '%{ip}%'",
f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'", f"SELECT 'AppEvents' as source, * FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'",
f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'" f"SELECT 'Plugins_Objects' as source, * FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'"
@@ -95,7 +95,7 @@ def check_and_clean_device():
deletes = [ deletes = [
f"DELETE FROM Events WHERE eve_IP='{ip}'", f"DELETE FROM Events WHERE eve_IP='{ip}'",
f"DELETE FROM Devices WHERE dev_LastIP='{ip}'", f"DELETE FROM Devices WHERE dev_LastIP='{ip}'",
f"DELETE FROM CurrentScan WHERE cur_IP='{ip}'", f"DELETE FROM CurrentScan WHERE scanLastIP='{ip}'",
f"DELETE FROM Notifications WHERE JSON LIKE '%{ip}%'", f"DELETE FROM Notifications WHERE JSON LIKE '%{ip}%'",
f"DELETE FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'", f"DELETE FROM AppEvents WHERE ObjectSecondaryID LIKE '%{ip}%'",
f"DELETE FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'" f"DELETE FROM Plugins_Objects WHERE Object_SecondaryID LIKE '%{ip}%'"
+16 -16
View File
@@ -144,20 +144,20 @@ CREATE TABLE Plugins_Language_Strings(
PRIMARY KEY("Index" AUTOINCREMENT) PRIMARY KEY("Index" AUTOINCREMENT)
); );
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC STRING(50) NOT NULL COLLATE NOCASE, scanMac STRING(50) NOT NULL COLLATE NOCASE,
cur_IP STRING(50) NOT NULL COLLATE NOCASE, scanLastIP STRING(50) NOT NULL COLLATE NOCASE,
cur_Vendor STRING(250), scanVendor STRING(250),
cur_ScanMethod STRING(10), scanSourcePlugin STRING(10),
cur_Name STRING(250), scanName STRING(250),
cur_LastQuery STRING(250), scanLastQuery STRING(250),
cur_DateTime STRING(250), scanLastConnection STRING(250),
cur_SyncHubNodeName STRING(50), scanSyncHubNode STRING(50),
cur_NetworkSite STRING(250), scanSite STRING(250),
cur_SSID STRING(250), scanSSID STRING(250),
cur_NetworkNodeMAC STRING(250), scanParentMAC STRING(250),
cur_PORT STRING(250), scanParentPort STRING(250),
cur_Type STRING(250), scanType STRING(250),
UNIQUE(cur_MAC) UNIQUE(scanMac)
); );
CREATE TABLE IF NOT EXISTS "AppEvents" ( CREATE TABLE IF NOT EXISTS "AppEvents" (
"Index" INTEGER PRIMARY KEY AUTOINCREMENT, "Index" INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -230,9 +230,9 @@ CREATE VIEW LatestEventsPerMAC AS
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.cur_MAC INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac
WHERE e.row_num = 1 WHERE e.row_num = 1
/* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,cur_MAC,cur_IP,cur_Vendor,cur_ScanMethod,cur_Name,cur_LastQuery,cur_DateTime,cur_SyncHubNodeName,cur_NetworkSite,cur_SSID,cur_NetworkNodeMAC,cur_PORT,cur_Type) */; /* LatestEventsPerMAC(eve_MAC,eve_IP,eve_DateTime,eve_EventType,eve_AdditionalInfo,eve_PendingAlertEmail,eve_PairEventRowid,row_num,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps,scanMac,scanLastIP,scanVendor,scanSourcePlugin,scanName,scanLastQuery,scanLastConnection,scanSyncHubNode,scanSite,scanSSID,scanParentMAC,scanParentPort,scanType) */;
CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac CREATE VIEW Sessions_Devices AS SELECT * FROM Sessions LEFT JOIN "Devices" ON ses_MAC = devMac
/* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */; /* Sessions_Devices(ses_MAC,ses_IP,ses_EventTypeConnection,ses_DateTimeConnection,ses_EventTypeDisconnection,ses_DateTimeDisconnection,ses_StillConnected,ses_AdditionalInfo,devMac,devName,devOwner,devType,devVendor,devFavorite,devGroup,devComments,devFirstConnection,devLastConnection,devLastIP,devStaticIP,devScan,devLogEvents,devAlertEvents,devAlertDown,devSkipRepeated,devLastNotification,devPresentLastScan,devIsNew,devLocation,devIsArchived,devParentMAC,devParentPort,devIcon,devGUID,devSite,devSSID,devSyncHubNode,devSourcePlugin,devCustomProps) */;
CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC, CREATE VIEW Convert_Events_to_Sessions AS SELECT EVE1.eve_MAC,
+18 -18
View File
@@ -133,7 +133,7 @@ def ensure_views(sql) -> bool:
c.* c.*
FROM RankedEvents AS e FROM RankedEvents AS e
LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac LEFT JOIN Devices AS d ON e.eve_MAC = d.devMac
INNER JOIN CurrentScan AS c ON e.eve_MAC = c.cur_MAC INNER JOIN CurrentScan AS c ON e.eve_MAC = c.scanMac
WHERE e.row_num = 1;""") WHERE e.row_num = 1;""")
sql.execute(""" DROP VIEW IF EXISTS Sessions_Devices;""") sql.execute(""" DROP VIEW IF EXISTS Sessions_Devices;""")
@@ -177,8 +177,8 @@ def ensure_views(sql) -> bool:
SELECT SELECT
c.*, c.*,
ROW_NUMBER() OVER ( ROW_NUMBER() OVER (
PARTITION BY c.cur_MAC, c.cur_ScanMethod PARTITION BY c.scanMac, c.scanSourcePlugin
ORDER BY c.cur_DateTime DESC ORDER BY c.scanLastConnection DESC
) AS rn ) AS rn
FROM CurrentScan c FROM CurrentScan c
) )
@@ -187,7 +187,7 @@ def ensure_views(sql) -> bool:
r.* -- all CurrentScan fields (cur_*) r.* -- all CurrentScan fields (cur_*)
FROM Devices d FROM Devices d
LEFT JOIN RankedScans r LEFT JOIN RankedScans r
ON d.devMac = r.cur_MAC ON d.devMac = r.scanMac
WHERE r.rn = 1; WHERE r.rn = 1;
""") """)
@@ -282,20 +282,20 @@ def ensure_CurrentScan(sql) -> bool:
# 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes # 🐛 CurrentScan DEBUG: comment out below when debugging to keep the CurrentScan table after restarts/scan finishes
sql.execute("DROP TABLE IF EXISTS CurrentScan;") sql.execute("DROP TABLE IF EXISTS CurrentScan;")
sql.execute(""" CREATE TABLE IF NOT EXISTS CurrentScan ( sql.execute(""" CREATE TABLE IF NOT EXISTS CurrentScan (
cur_MAC STRING(50) NOT NULL COLLATE NOCASE, scanMac STRING(50) NOT NULL COLLATE NOCASE,
cur_IP STRING(50) NOT NULL COLLATE NOCASE, scanLastIP STRING(50) NOT NULL COLLATE NOCASE,
cur_Vendor STRING(250), scanVendor STRING(250),
cur_ScanMethod STRING(10), scanSourcePlugin STRING(10),
cur_Name STRING(250), scanName STRING(250),
cur_LastQuery STRING(250), scanLastQuery STRING(250),
cur_DateTime STRING(250), scanLastConnection STRING(250),
cur_SyncHubNodeName STRING(50), scanSyncHubNode STRING(50),
cur_NetworkSite STRING(250), scanSite STRING(250),
cur_SSID STRING(250), scanSSID STRING(250),
cur_devVlan STRING(250), scanVlan STRING(250),
cur_NetworkNodeMAC STRING(250), scanParentMAC STRING(250),
cur_PORT STRING(250), scanParentPort STRING(250),
cur_Type STRING(250) scanType STRING(250)
); );
""") """)
+85 -85
View File
@@ -56,10 +56,10 @@ def exclude_ignored_devices(db):
sql = db.sql # Database interface for executing queries sql = db.sql # Database interface for executing queries
mac_condition = list_to_where( mac_condition = list_to_where(
"OR", "cur_MAC", "LIKE", get_setting_value("NEWDEV_ignored_MACs") "OR", "scanMac", "LIKE", get_setting_value("NEWDEV_ignored_MACs")
) )
ip_condition = list_to_where( ip_condition = list_to_where(
"OR", "cur_IP", "LIKE", get_setting_value("NEWDEV_ignored_IPs") "OR", "scanLastIP", "LIKE", get_setting_value("NEWDEV_ignored_IPs")
) )
# Only delete if either the MAC or IP matches an ignored condition # Only delete if either the MAC or IP matches an ignored condition
@@ -93,7 +93,7 @@ FIELD_SPECS = {
# DEVICE NAME # DEVICE NAME
# ========================================================== # ==========================================================
"devName": { "devName": {
"scan_col": "cur_Name", "scan_col": "scanName",
"source_col": "devNameSource", "source_col": "devNameSource",
"empty_values": ["", "null", "(unknown)", "(name not found)"], "empty_values": ["", "null", "(unknown)", "(name not found)"],
"default_value": "(unknown)", "default_value": "(unknown)",
@@ -104,7 +104,7 @@ FIELD_SPECS = {
# DEVICE FQDN # DEVICE FQDN
# ========================================================== # ==========================================================
"devFQDN": { "devFQDN": {
"scan_col": "cur_Name", "scan_col": "scanName",
"source_col": "devNameSource", "source_col": "devNameSource",
"empty_values": ["", "null", "(unknown)", "(name not found)"], "empty_values": ["", "null", "(unknown)", "(name not found)"],
"priority": ["NSLOOKUP", "AVAHISCAN", "NBTSCAN", "DIGSCAN", "ARPSCAN", "DHCPLSS", "NEWDEV", "N/A"], "priority": ["NSLOOKUP", "AVAHISCAN", "NBTSCAN", "DIGSCAN", "ARPSCAN", "DHCPLSS", "NEWDEV", "N/A"],
@@ -114,7 +114,7 @@ FIELD_SPECS = {
# IP ADDRESS (last seen) # IP ADDRESS (last seen)
# ========================================================== # ==========================================================
"devLastIP": { "devLastIP": {
"scan_col": "cur_IP", "scan_col": "scanLastIP",
"source_col": "devLastIPSource", "source_col": "devLastIPSource",
"empty_values": ["", "null", "(unknown)", "(Unknown)"], "empty_values": ["", "null", "(unknown)", "(Unknown)"],
"priority": ["ARPSCAN", "NEWDEV", "N/A"], "priority": ["ARPSCAN", "NEWDEV", "N/A"],
@@ -125,7 +125,7 @@ FIELD_SPECS = {
# VENDOR # VENDOR
# ========================================================== # ==========================================================
"devVendor": { "devVendor": {
"scan_col": "cur_Vendor", "scan_col": "scanVendor",
"source_col": "devVendorSource", "source_col": "devVendorSource",
"empty_values": ["", "null", "(unknown)", "(Unknown)"], "empty_values": ["", "null", "(unknown)", "(Unknown)"],
"priority": ["VNDRPDT", "ARPSCAN", "NEWDEV", "N/A"], "priority": ["VNDRPDT", "ARPSCAN", "NEWDEV", "N/A"],
@@ -136,7 +136,7 @@ FIELD_SPECS = {
# SYNC HUB NODE NAME # SYNC HUB NODE NAME
# ========================================================== # ==========================================================
"devSyncHubNode": { "devSyncHubNode": {
"scan_col": "cur_SyncHubNodeName", "scan_col": "scanSyncHubNode",
"source_col": None, "source_col": None,
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": None, "priority": None,
@@ -146,7 +146,7 @@ FIELD_SPECS = {
# Network Site # Network Site
# ========================================================== # ==========================================================
"devSite": { "devSite": {
"scan_col": "cur_NetworkSite", "scan_col": "scanSite",
"source_col": None, "source_col": None,
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": None, "priority": None,
@@ -156,7 +156,7 @@ FIELD_SPECS = {
# VLAN # VLAN
# ========================================================== # ==========================================================
"devVlan": { "devVlan": {
"scan_col": "cur_devVlan", "scan_col": "scanVlan",
"source_col": "devVlanSource", "source_col": "devVlanSource",
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": None, "priority": None,
@@ -166,7 +166,7 @@ FIELD_SPECS = {
# devType # devType
# ========================================================== # ==========================================================
"devType": { "devType": {
"scan_col": "cur_Type", "scan_col": "scanType",
"source_col": None, "source_col": None,
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": None, "priority": None,
@@ -176,14 +176,14 @@ FIELD_SPECS = {
# TOPOLOGY (PARENT NODE) # TOPOLOGY (PARENT NODE)
# ========================================================== # ==========================================================
"devParentMAC": { "devParentMAC": {
"scan_col": "cur_NetworkNodeMAC", "scan_col": "scanParentMAC",
"source_col": "devParentMACSource", "source_col": "devParentMACSource",
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"], "priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"],
}, },
"devParentPort": { "devParentPort": {
"scan_col": "cur_PORT", "scan_col": "scanParentPort",
"source_col": None, "source_col": None,
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"], "priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"],
@@ -193,7 +193,7 @@ FIELD_SPECS = {
# WIFI SSID # WIFI SSID
# ========================================================== # ==========================================================
"devSSID": { "devSSID": {
"scan_col": "cur_SSID", "scan_col": "scanSSID",
"source_col": None, "source_col": None,
"empty_values": ["", "null"], "empty_values": ["", "null"],
"priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"], "priority": ["SNMPDSC", "UNIFIAPI", "UNFIMP", "NEWDEV", "N/A"],
@@ -214,7 +214,7 @@ def update_presence_from_CurrentScan(db):
SET devPresentLastScan = 1 SET devPresentLastScan = 1
WHERE EXISTS ( WHERE EXISTS (
SELECT 1 FROM CurrentScan SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
) )
""") """)
@@ -224,7 +224,7 @@ def update_presence_from_CurrentScan(db):
SET devPresentLastScan = 0 SET devPresentLastScan = 0
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM CurrentScan SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
) )
""") """)
@@ -242,7 +242,7 @@ def update_devLastConnection_from_CurrentScan(db):
SET devLastConnection = '{startTime}' SET devLastConnection = '{startTime}'
WHERE EXISTS ( WHERE EXISTS (
SELECT 1 FROM CurrentScan SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
) )
""") """)
@@ -253,7 +253,7 @@ def update_devices_data_from_scan(db):
# ---------------------------------------------------------------- # ----------------------------------------------------------------
# 1️⃣ Get plugin scan methods # 1️⃣ Get plugin scan methods
# ---------------------------------------------------------------- # ----------------------------------------------------------------
plugin_rows = sql.execute("SELECT DISTINCT cur_ScanMethod FROM CurrentScan").fetchall() plugin_rows = sql.execute("SELECT DISTINCT scanSourcePlugin FROM CurrentScan").fetchall()
plugin_prefixes = [row[0] for row in plugin_rows if row[0]] or [None] plugin_prefixes = [row[0] for row in plugin_rows if row[0]] or [None]
plugin_settings_cache = {} plugin_settings_cache = {}
@@ -275,7 +275,7 @@ def update_devices_data_from_scan(db):
sql_tmp = f""" sql_tmp = f"""
SELECT * SELECT *
FROM LatestDeviceScan FROM LatestDeviceScan
{"WHERE cur_ScanMethod = ?" if filter_by_scan_method else ""} {"WHERE scanSourcePlugin = ?" if filter_by_scan_method else ""}
""" """
rows = sql.execute(sql_tmp, (source_prefix,) if filter_by_scan_method else ()).fetchall() rows = sql.execute(sql_tmp, (source_prefix,) if filter_by_scan_method else ()).fetchall()
col_names = [desc[0] for desc in sql.description] col_names = [desc[0] for desc in sql.description]
@@ -444,8 +444,8 @@ def update_vendors_from_mac(db):
# Build mapping: devMac -> vendor (skip unknown or invalid) # Build mapping: devMac -> vendor (skip unknown or invalid)
vendor_map = {} vendor_map = {}
for row in sql.execute("SELECT DISTINCT cur_MAC FROM CurrentScan"): for row in sql.execute("SELECT DISTINCT scanMac FROM CurrentScan"):
mac = row["cur_MAC"] mac = row["scanMac"]
vendor = query_MAC_vendor(mac) vendor = query_MAC_vendor(mac)
if vendor not in (-1, -2): if vendor not in (-1, -2):
vendor_map[mac] = vendor vendor_map[mac] = vendor
@@ -518,7 +518,7 @@ def save_scanned_devices(db):
# Proceed if variable contains valid MAC # Proceed if variable contains valid MAC
if check_mac_or_internet(local_mac): if check_mac_or_internet(local_mac):
sql.execute( sql.execute(
f"""INSERT OR IGNORE INTO CurrentScan (cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod) VALUES ( '{local_mac}', '{local_ip}', Null, 'local_MAC') """ f"""INSERT OR IGNORE INTO CurrentScan (scanMac, scanLastIP, scanVendor, scanSourcePlugin) VALUES ( '{local_mac}', '{local_ip}', Null, 'local_MAC') """
) )
@@ -529,23 +529,23 @@ def print_scan_stats(db):
query = """ query = """
SELECT SELECT
(SELECT COUNT(*) FROM CurrentScan) AS devices_detected, (SELECT COUNT(*) FROM CurrentScan) AS devices_detected,
(SELECT COUNT(*) FROM CurrentScan WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE devMac = cur_MAC)) AS new_devices, (SELECT COUNT(*) FROM CurrentScan WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE devMac = scanMac)) AS new_devices,
(SELECT COUNT(*) FROM Devices WHERE devAlertDown != 0 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = cur_MAC)) AS down_alerts, (SELECT COUNT(*) FROM Devices WHERE devAlertDown != 0 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = scanMac)) AS down_alerts,
(SELECT COUNT(*) FROM Devices WHERE devAlertDown != 0 AND devPresentLastScan = 1 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = cur_MAC)) AS new_down_alerts, (SELECT COUNT(*) FROM Devices WHERE devAlertDown != 0 AND devPresentLastScan = 1 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = scanMac)) AS new_down_alerts,
(SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 0) AS new_connections, (SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 0) AS new_connections,
(SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 1 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = cur_MAC)) AS disconnections, (SELECT COUNT(*) FROM Devices WHERE devPresentLastScan = 1 AND NOT EXISTS (SELECT 1 FROM CurrentScan WHERE devMac = scanMac)) AS disconnections,
(SELECT COUNT(*) FROM Devices, CurrentScan (SELECT COUNT(*) FROM Devices, CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
AND cur_IP IS NOT NULL AND scanLastIP IS NOT NULL
AND cur_IP NOT IN ('', 'null', '(unknown)', '(Unknown)') AND scanLastIP NOT IN ('', 'null', '(unknown)', '(Unknown)')
AND cur_IP <> COALESCE(devPrimaryIPv4, '') AND scanLastIP <> COALESCE(devPrimaryIPv4, '')
AND cur_IP <> COALESCE(devPrimaryIPv6, '') AND scanLastIP <> COALESCE(devPrimaryIPv6, '')
AND cur_IP <> COALESCE(devLastIP, '') AND scanLastIP <> COALESCE(devLastIP, '')
) AS ip_changes, ) AS ip_changes,
cur_ScanMethod, scanSourcePlugin,
COUNT(*) AS scan_method_count COUNT(*) AS scan_method_count
FROM CurrentScan FROM CurrentScan
GROUP BY cur_ScanMethod GROUP BY scanSourcePlugin
""" """
sql.execute(query) sql.execute(query)
@@ -590,8 +590,8 @@ def print_scan_stats(db):
mylog("verbose", "[Scan Stats] Scan Method Statistics:") mylog("verbose", "[Scan Stats] Scan Method Statistics:")
for row in stats: for row in stats:
if row["cur_ScanMethod"] is not None: if row["scanSourcePlugin"] is not None:
mylog("verbose", f" {row['cur_ScanMethod']}: {row['scan_method_count']}") mylog("verbose", f" {row['scanSourcePlugin']}: {row['scan_method_count']}")
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
@@ -608,11 +608,11 @@ def create_new_devices(db):
eve_EventType, eve_AdditionalInfo, eve_EventType, eve_AdditionalInfo,
eve_PendingAlertEmail eve_PendingAlertEmail
) )
SELECT DISTINCT cur_MAC, cur_IP, '{startTime}', 'New Device', cur_Vendor, 1 SELECT DISTINCT scanMac, scanLastIP, '{startTime}', 'New Device', scanVendor, 1
FROM CurrentScan FROM CurrentScan
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM Devices SELECT 1 FROM Devices
WHERE devMac = cur_MAC WHERE devMac = scanMac
) )
""" """
@@ -627,15 +627,15 @@ def create_new_devices(db):
ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_EventTypeDisconnection, ses_DateTimeDisconnection,
ses_StillConnected, ses_AdditionalInfo ses_StillConnected, ses_AdditionalInfo
) )
SELECT cur_MAC, cur_IP, 'Connected', '{startTime}', NULL, NULL, 1, cur_Vendor SELECT scanMac, scanLastIP, 'Connected', '{startTime}', NULL, NULL, 1, scanVendor
FROM CurrentScan FROM CurrentScan
WHERE EXISTS ( WHERE EXISTS (
SELECT 1 FROM Devices SELECT 1 FROM Devices
WHERE devMac = cur_MAC WHERE devMac = scanMac
) )
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 FROM Sessions SELECT 1 FROM Sessions
WHERE ses_MAC = cur_MAC AND ses_StillConnected = 1 WHERE ses_MAC = scanMac AND ses_StillConnected = 1
) )
""") """)
@@ -680,7 +680,7 @@ def create_new_devices(db):
""" """
# Fetch data from CurrentScan skipping ignored devices by IP and MAC # Fetch data from CurrentScan skipping ignored devices by IP and MAC
query = """SELECT cur_MAC, cur_Name, cur_Vendor, cur_ScanMethod, cur_IP, cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, cur_NetworkSite, cur_SSID, cur_Type query = """SELECT scanMac, scanName, scanVendor, scanSourcePlugin, scanLastIP, scanSyncHubNode, scanParentMAC, scanParentPort, scanSite, scanSSID, scanType
FROM CurrentScan """ FROM CurrentScan """
mylog("debug", f"[New Devices] Collecting New Devices Query: {query}") mylog("debug", f"[New Devices] Collecting New Devices Query: {query}")
@@ -688,61 +688,61 @@ def create_new_devices(db):
for row in current_scan_data: for row in current_scan_data:
( (
cur_MAC, scanMac,
cur_Name, scanName,
cur_Vendor, scanVendor,
cur_ScanMethod, scanSourcePlugin,
cur_IP, scanLastIP,
cur_SyncHubNodeName, scanSyncHubNode,
cur_NetworkNodeMAC, scanParentMAC,
cur_PORT, scanParentPort,
cur_NetworkSite, scanSite,
cur_SSID, scanSSID,
cur_Type, scanType,
) = row ) = row
# Preserve raw values to determine source attribution # Preserve raw values to determine source attribution
raw_name = str(cur_Name).strip() if cur_Name else "" raw_name = str(scanName).strip() if scanName else ""
raw_vendor = str(cur_Vendor).strip() if cur_Vendor else "" raw_vendor = str(scanVendor).strip() if scanVendor else ""
raw_ip = str(cur_IP).strip() if cur_IP else "" raw_ip = str(scanLastIP).strip() if scanLastIP else ""
if raw_ip.lower() in ("null", "(unknown)"): if raw_ip.lower() in ("null", "(unknown)"):
raw_ip = "" raw_ip = ""
raw_ssid = str(cur_SSID).strip() if cur_SSID else "" raw_ssid = str(scanSSID).strip() if scanSSID else ""
if raw_ssid.lower() in ("null", "(unknown)"): if raw_ssid.lower() in ("null", "(unknown)"):
raw_ssid = "" raw_ssid = ""
raw_parent_mac = str(cur_NetworkNodeMAC).strip() if cur_NetworkNodeMAC else "" raw_parent_mac = str(scanParentMAC).strip() if scanParentMAC else ""
if raw_parent_mac.lower() in ("null", "(unknown)"): if raw_parent_mac.lower() in ("null", "(unknown)"):
raw_parent_mac = "" raw_parent_mac = ""
raw_parent_port = str(cur_PORT).strip() if cur_PORT else "" raw_parent_port = str(scanParentPort).strip() if scanParentPort else ""
if raw_parent_port.lower() in ("null", "(unknown)"): if raw_parent_port.lower() in ("null", "(unknown)"):
raw_parent_port = "" raw_parent_port = ""
# Handle NoneType # Handle NoneType
cur_Name = raw_name if raw_name else "(unknown)" scanName = raw_name if raw_name else "(unknown)"
cur_Type = ( scanType = (
str(cur_Type).strip() if cur_Type else get_setting_value("NEWDEV_devType") str(scanType).strip() if scanType else get_setting_value("NEWDEV_devType")
) )
cur_NetworkNodeMAC = raw_parent_mac scanParentMAC = raw_parent_mac
cur_NetworkNodeMAC = ( scanParentMAC = (
cur_NetworkNodeMAC scanParentMAC
if cur_NetworkNodeMAC and cur_MAC != "Internet" if scanParentMAC and scanMac != "Internet"
else ( else (
get_setting_value("NEWDEV_devParentMAC") get_setting_value("NEWDEV_devParentMAC")
if cur_MAC != "Internet" if scanMac != "Internet"
else "null" else "null"
) )
) )
cur_SyncHubNodeName = ( scanSyncHubNode = (
cur_SyncHubNodeName scanSyncHubNode
if cur_SyncHubNodeName and cur_SyncHubNodeName != "null" if scanSyncHubNode and scanSyncHubNode != "null"
else (get_setting_value("SYNC_node_name")) else (get_setting_value("SYNC_node_name"))
) )
# Derive primary IP family values # Derive primary IP family values
cur_IP = raw_ip scanLastIP = raw_ip
cur_SSID = raw_ssid scanSSID = raw_ssid
cur_PORT = raw_parent_port scanParentPort = raw_parent_port
cur_IP_normalized = check_IP_format(cur_IP) if ":" not in cur_IP else cur_IP cur_IP_normalized = check_IP_format(scanLastIP) if ":" not in scanLastIP else scanLastIP
# Validate IPv6 addresses using format_ip_long for consistency (do not store integer result) # Validate IPv6 addresses using format_ip_long for consistency (do not store integer result)
if cur_IP_normalized and ":" in cur_IP_normalized: if cur_IP_normalized and ":" in cur_IP_normalized:
@@ -753,10 +753,10 @@ def create_new_devices(db):
primary_ipv4 = cur_IP_normalized if cur_IP_normalized and ":" not in cur_IP_normalized else "" primary_ipv4 = cur_IP_normalized if cur_IP_normalized and ":" not in cur_IP_normalized else ""
primary_ipv6 = cur_IP_normalized if cur_IP_normalized and ":" in cur_IP_normalized else "" primary_ipv6 = cur_IP_normalized if cur_IP_normalized and ":" in cur_IP_normalized else ""
plugin_prefix = str(cur_ScanMethod).strip() if cur_ScanMethod else "NEWDEV" plugin_prefix = str(scanSourcePlugin).strip() if scanSourcePlugin else "NEWDEV"
dev_mac_source = get_source_for_field_update_with_value( dev_mac_source = get_source_for_field_update_with_value(
"devMac", plugin_prefix, cur_MAC, is_user_override=False "devMac", plugin_prefix, scanMac, is_user_override=False
) )
dev_name_source = get_source_for_field_update_with_value( dev_name_source = get_source_for_field_update_with_value(
"devName", plugin_prefix, raw_name, is_user_override=False "devName", plugin_prefix, raw_name, is_user_override=False
@@ -813,22 +813,22 @@ def create_new_devices(db):
) )
VALUES VALUES
( (
'{sanitize_SQL_input(cur_MAC)}', '{sanitize_SQL_input(scanMac)}',
'{sanitize_SQL_input(cur_Name)}', '{sanitize_SQL_input(scanName)}',
'{sanitize_SQL_input(cur_Vendor)}', '{sanitize_SQL_input(scanVendor)}',
'{sanitize_SQL_input(cur_IP_normalized)}', '{sanitize_SQL_input(cur_IP_normalized)}',
'{sanitize_SQL_input(primary_ipv4)}', '{sanitize_SQL_input(primary_ipv4)}',
'{sanitize_SQL_input(primary_ipv6)}', '{sanitize_SQL_input(primary_ipv6)}',
?, ?,
?, ?,
'{sanitize_SQL_input(cur_SyncHubNodeName)}', '{sanitize_SQL_input(scanSyncHubNode)}',
{sql_generateGuid}, {sql_generateGuid},
'{sanitize_SQL_input(cur_NetworkNodeMAC)}', '{sanitize_SQL_input(scanParentMAC)}',
'{sanitize_SQL_input(cur_PORT)}', '{sanitize_SQL_input(scanParentPort)}',
'{sanitize_SQL_input(cur_NetworkSite)}', '{sanitize_SQL_input(scanSite)}',
'{sanitize_SQL_input(cur_SSID)}', '{sanitize_SQL_input(scanSSID)}',
'{sanitize_SQL_input(cur_Type)}', '{sanitize_SQL_input(scanType)}',
'{sanitize_SQL_input(cur_ScanMethod)}', '{sanitize_SQL_input(scanSourcePlugin)}',
'{sanitize_SQL_input(dev_mac_source)}', '{sanitize_SQL_input(dev_mac_source)}',
'{sanitize_SQL_input(dev_name_source)}', '{sanitize_SQL_input(dev_name_source)}',
'{sanitize_SQL_input(dev_fqdn_source)}', '{sanitize_SQL_input(dev_fqdn_source)}',
+11 -11
View File
@@ -174,7 +174,7 @@ def insert_events(db):
WHERE devAlertDown != 0 WHERE devAlertDown != 0
AND devPresentLastScan = 1 AND devPresentLastScan = 1
AND NOT EXISTS (SELECT 1 FROM CurrentScan AND NOT EXISTS (SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
) """) ) """)
# Check new Connections or Down Reconnections # Check new Connections or Down Reconnections
@@ -182,7 +182,7 @@ def insert_events(db):
sql.execute(f""" INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f""" INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime,
eve_EventType, eve_AdditionalInfo, eve_EventType, eve_AdditionalInfo,
eve_PendingAlertEmail) eve_PendingAlertEmail)
SELECT DISTINCT c.cur_MAC, c.cur_IP, '{startTime}', SELECT DISTINCT c.scanMac, c.scanLastIP, '{startTime}',
CASE CASE
WHEN last_event.eve_EventType = 'Device Down' and last_event.eve_PendingAlertEmail = 0 THEN 'Down Reconnected' WHEN last_event.eve_EventType = 'Device Down' and last_event.eve_PendingAlertEmail = 0 THEN 'Down Reconnected'
ELSE 'Connected' ELSE 'Connected'
@@ -190,7 +190,7 @@ def insert_events(db):
'', '',
1 1
FROM CurrentScan AS c FROM CurrentScan AS c
LEFT JOIN LatestEventsPerMAC AS last_event ON c.cur_MAC = last_event.eve_MAC LEFT JOIN LatestEventsPerMAC AS last_event ON c.scanMac = last_event.eve_MAC
WHERE last_event.devPresentLastScan = 0 OR last_event.eve_MAC IS NULL WHERE last_event.devPresentLastScan = 0 OR last_event.eve_MAC IS NULL
""") """)
@@ -205,7 +205,7 @@ def insert_events(db):
WHERE devAlertDown = 0 WHERE devAlertDown = 0
AND devPresentLastScan = 1 AND devPresentLastScan = 1
AND NOT EXISTS (SELECT 1 FROM CurrentScan AND NOT EXISTS (SELECT 1 FROM CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
) """) ) """)
# Check IP Changed # Check IP Changed
@@ -213,15 +213,15 @@ def insert_events(db):
sql.execute(f"""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime, sql.execute(f"""INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime,
eve_EventType, eve_AdditionalInfo, eve_EventType, eve_AdditionalInfo,
eve_PendingAlertEmail) eve_PendingAlertEmail)
SELECT cur_MAC, cur_IP, '{startTime}', 'IP Changed', SELECT scanMac, scanLastIP, '{startTime}', 'IP Changed',
'Previous IP: '|| devLastIP, devAlertEvents 'Previous IP: '|| devLastIP, devAlertEvents
FROM Devices, CurrentScan FROM Devices, CurrentScan
WHERE devMac = cur_MAC WHERE devMac = scanMac
AND cur_IP IS NOT NULL AND scanLastIP IS NOT NULL
AND cur_IP NOT IN ('', 'null', '(unknown)', '(Unknown)') AND scanLastIP NOT IN ('', 'null', '(unknown)', '(Unknown)')
AND cur_IP <> COALESCE(devPrimaryIPv4, '') AND scanLastIP <> COALESCE(devPrimaryIPv4, '')
AND cur_IP <> COALESCE(devPrimaryIPv6, '') AND scanLastIP <> COALESCE(devPrimaryIPv6, '')
AND cur_IP <> COALESCE(devLastIP, '') """) AND scanLastIP <> COALESCE(devLastIP, '') """)
mylog("debug", "[Events] - Events end") mylog("debug", "[Events] - Events end")
@@ -66,19 +66,19 @@ def scan_db():
cur.execute( cur.execute(
""" """
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC TEXT, scanMac TEXT,
cur_IP TEXT, scanLastIP TEXT,
cur_Vendor TEXT, scanVendor TEXT,
cur_ScanMethod TEXT, scanSourcePlugin TEXT,
cur_Name TEXT, scanName TEXT,
cur_LastQuery TEXT, scanLastQuery TEXT,
cur_DateTime TEXT, scanLastConnection TEXT,
cur_SyncHubNodeName TEXT, scanSyncHubNode TEXT,
cur_NetworkSite TEXT, scanSite TEXT,
cur_SSID TEXT, scanSSID TEXT,
cur_NetworkNodeMAC TEXT, scanParentMAC TEXT,
cur_PORT TEXT, scanParentPort TEXT,
cur_Type TEXT scanType TEXT
) )
""" """
) )
@@ -196,17 +196,17 @@ def scan_db_for_new_devices():
cur.execute( cur.execute(
""" """
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC TEXT, scanMac TEXT,
cur_Name TEXT, scanName TEXT,
cur_Vendor TEXT, scanVendor TEXT,
cur_ScanMethod TEXT, scanSourcePlugin TEXT,
cur_IP TEXT, scanLastIP TEXT,
cur_SyncHubNodeName TEXT, scanSyncHubNode TEXT,
cur_NetworkNodeMAC TEXT, scanParentMAC TEXT,
cur_PORT TEXT, scanParentPort TEXT,
cur_NetworkSite TEXT, scanSite TEXT,
cur_SSID TEXT, scanSSID TEXT,
cur_Type TEXT scanType TEXT
) )
""" """
) )
@@ -250,9 +250,9 @@ def test_create_new_devices_sets_sources(scan_db_for_new_devices):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_Name, cur_Vendor, cur_ScanMethod, cur_IP, scanMac, scanName, scanVendor, scanSourcePlugin, scanLastIP,
cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, scanSyncHubNode, scanParentMAC, scanParentPort,
cur_NetworkSite, cur_SSID, cur_Type scanSite, scanSSID, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -364,9 +364,9 @@ def test_scan_updates_newdev_device_name(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -439,9 +439,9 @@ def test_scan_does_not_update_user_field_name(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -514,9 +514,9 @@ def test_scan_does_not_update_locked_field(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -589,9 +589,9 @@ def test_scan_updates_empty_vendor_field(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -667,9 +667,9 @@ def test_scan_updates_ip_addresses(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -747,9 +747,9 @@ def test_scan_updates_ipv6_without_changing_ipv4(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -890,9 +890,9 @@ def test_scan_multiple_devices_mixed_sources(scan_db, mock_device_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
(mac, ip, vendor, scan_method, name, "", "2025-01-01 01:00:00", "", "", "", "", "", ""), (mac, ip, vendor, scan_method, name, "", "2025-01-01 01:00:00", "", "", "", "", "", ""),
@@ -51,19 +51,19 @@ def ip_test_db():
cur.execute( cur.execute(
""" """
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC TEXT, scanMac TEXT,
cur_IP TEXT, scanLastIP TEXT,
cur_Vendor TEXT, scanVendor TEXT,
cur_ScanMethod TEXT, scanSourcePlugin TEXT,
cur_Name TEXT, scanName TEXT,
cur_LastQuery TEXT, scanLastQuery TEXT,
cur_DateTime TEXT, scanLastConnection TEXT,
cur_SyncHubNodeName TEXT, scanSyncHubNode TEXT,
cur_NetworkSite TEXT, scanSite TEXT,
cur_SSID TEXT, scanSSID TEXT,
cur_NetworkNodeMAC TEXT, scanParentMAC TEXT,
cur_PORT TEXT, scanParentPort TEXT,
cur_Type TEXT scanType TEXT
) )
""" """
) )
@@ -123,9 +123,9 @@ def test_valid_ipv4_format_accepted(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -197,9 +197,9 @@ def test_valid_ipv6_format_accepted(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -274,9 +274,9 @@ def test_invalid_ip_values_rejected(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -348,9 +348,9 @@ def test_ipv4_ipv6_mixed_in_multiple_scans(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -390,9 +390,9 @@ def test_ipv4_ipv6_mixed_in_multiple_scans(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -455,9 +455,9 @@ def test_ipv4_address_format_variations(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
(mac, ipv4, "Vendor", "ARPSCAN", "", "", "2025-01-01 01:00:00", "", "", "", "", "", ""), (mac, ipv4, "Vendor", "ARPSCAN", "", "", "2025-01-01 01:00:00", "", "", "", "", "", ""),
@@ -509,9 +509,9 @@ def test_ipv6_address_format_variations(ip_test_db, mock_ip_handlers):
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
(mac, ipv6, "Vendor", "ARPSCAN", "", "", "2025-01-01 01:00:00", "", "", "", "", "", ""), (mac, ipv6, "Vendor", "ARPSCAN", "", "", "2025-01-01 01:00:00", "", "", "", "", "", ""),
@@ -42,19 +42,19 @@ def in_memory_db():
cur.execute( cur.execute(
""" """
CREATE TABLE CurrentScan ( CREATE TABLE CurrentScan (
cur_MAC TEXT, scanMac TEXT,
cur_IP TEXT, scanLastIP TEXT,
cur_Vendor TEXT, scanVendor TEXT,
cur_ScanMethod TEXT, scanSourcePlugin TEXT,
cur_Name TEXT, scanName TEXT,
cur_LastQuery TEXT, scanLastQuery TEXT,
cur_DateTime TEXT, scanLastConnection TEXT,
cur_SyncHubNodeName TEXT, scanSyncHubNode TEXT,
cur_NetworkSite TEXT, scanSite TEXT,
cur_SSID TEXT, scanSSID TEXT,
cur_NetworkNodeMAC TEXT, scanParentMAC TEXT,
cur_PORT TEXT, scanParentPort TEXT,
cur_Type TEXT scanType TEXT
) )
""" """
) )
@@ -118,9 +118,9 @@ def test_primary_ipv6_is_set_and_ipv4_preserved(in_memory_db, mock_device_handli
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (
@@ -193,9 +193,9 @@ def test_primary_ipv4_is_set_and_ipv6_preserved(in_memory_db, mock_device_handli
cur.execute( cur.execute(
""" """
INSERT INTO CurrentScan ( INSERT INTO CurrentScan (
cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod, cur_Name, scanMac, scanLastIP, scanVendor, scanSourcePlugin, scanName,
cur_LastQuery, cur_DateTime, cur_SyncHubNodeName, scanLastQuery, scanLastConnection, scanSyncHubNode,
cur_NetworkSite, cur_SSID, cur_NetworkNodeMAC, cur_PORT, cur_Type scanSite, scanSSID, scanParentMAC, scanParentPort, scanType
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,
( (