mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
manual merge of leiweibau and TeroRERO changes
This commit is contained in:
@@ -71,7 +71,7 @@ def main ():
|
||||
|
||||
# Check parameters
|
||||
if len(sys.argv) != 2 :
|
||||
print ('usage pialert [scan_cycle] | internet_IP | update_vendors' )
|
||||
print ('usage pialert [scan_cycle] | internet_IP | update_vendors | cleanup' )
|
||||
return
|
||||
cycle = str(sys.argv[1])
|
||||
|
||||
@@ -81,6 +81,8 @@ def main ():
|
||||
## Main Commands
|
||||
if cycle == 'internet_IP':
|
||||
res = check_internet_IP()
|
||||
elif cycle == 'cleanup':
|
||||
res = cleanup_database()
|
||||
elif cycle == 'update_vendors':
|
||||
res = update_devices_MAC_vendors()
|
||||
elif cycle == 'update_vendors_silent':
|
||||
@@ -256,6 +258,28 @@ def check_IP_format (pIP):
|
||||
return IP.group(0)
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Cleanup Online History chart
|
||||
#===============================================================================
|
||||
def cleanup_database ():
|
||||
# Header
|
||||
print ('Cleanup Database')
|
||||
print (' Timestamp:', startTime )
|
||||
|
||||
openDB()
|
||||
|
||||
# Cleanup Online History
|
||||
print ('\nCleanup Online_History...')
|
||||
sql.execute ("""DELETE FROM Online_History WHERE Scan_Date <= date('now', '-1 day')""")
|
||||
print ('\nOptimize Database...')
|
||||
sql.execute ("VACUUM;")
|
||||
|
||||
closeDB()
|
||||
|
||||
# OK
|
||||
return 0
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# UPDATE DEVICE MAC VENDORS
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user