@@ -374,7 +374,7 @@ def scan_network ():
374374 read_DHCP_leases ()
375375
376376 # Load current scan data
377- print ('\n Procesising scan results...' )
377+ print ('\n Processing scan results...' )
378378 print_log ('Save scanned devices' )
379379 save_scanned_devices (arpscan_devices , cycle_interval )
380380
@@ -598,10 +598,12 @@ def save_scanned_devices (p_arpscan_devices, p_cycle_interval):
598598 # local_ip_cmd = ["ip route list default | awk {'print $7'}"]
599599 local_ip_cmd = ["ip -o route get 1 | sed 's/^.*src \\ ([^ ]*\\ ).*$/\\ 1/;q'" ]
600600 local_ip = subprocess .Popen (local_ip_cmd , shell = True , stdout = subprocess .PIPE , stderr = subprocess .STDOUT ).communicate ()[0 ].decode ().strip ()
601-
602- sql .execute ("INSERT INTO CurrentScan (cur_ScanCycle, cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod) " +
603- "VALUES ( ?, ?, ?, Null, 'local_MAC') " , (cycle , local_mac , local_ip ) )
604601
602+ # Check if local mac has been detected with other methods
603+ sql .execute ("SELECT COUNT(*) FROM CurrentScan WHERE cur_ScanCycle = ? AND cur_MAC = ? " , (cycle , local_mac ) )
604+ if sql .fetchone ()[0 ] == 0 :
605+ sql .execute ("INSERT INTO CurrentScan (cur_ScanCycle, cur_MAC, cur_IP, cur_Vendor, cur_ScanMethod) " +
606+ "VALUES ( ?, ?, ?, Null, 'local_MAC') " , (cycle , local_mac , local_ip ) )
605607
606608#-------------------------------------------------------------------------------
607609def print_scan_stats ():
0 commit comments