FIX SNMDSCV, NMAPSRV, UNFIDSCR bugs
This commit is contained in:
@@ -670,7 +670,7 @@ def main ():
|
||||
|
||||
# If thread is still active
|
||||
if p.is_alive():
|
||||
print "DEBUG scan_network running too long - let's kill it"
|
||||
print("DEBUG scan_network running too long - let\'s kill it")
|
||||
mylog('info', [' DEBUG scan_network running too long - let\'s kill it'])
|
||||
|
||||
# Terminate - may not work if process is stuck for good
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast('http://' || dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra, dv.dev_MAC as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
"default_value":"SELECT ns.MAC as Object_PrimaryID, cast('http://' || dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, dv.dev_Name as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra, ns.MAC as ForeignKey FROM (SELECT * FROM Nmap_Scan) ns left JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
|
||||
@@ -31,10 +31,11 @@ def main():
|
||||
# init global variables
|
||||
global ROUTERS
|
||||
|
||||
last_run_logfile = open(last_run, 'a')
|
||||
|
||||
# empty file
|
||||
last_run_logfile.write("")
|
||||
open(last_run , 'w').close()
|
||||
|
||||
last_run_logfile = open(last_run, 'a')
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch.')
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@
|
||||
"name" : "port",
|
||||
"type" : "setting",
|
||||
"value" : "UNFIMP_port"
|
||||
},
|
||||
{
|
||||
"name" : "version",
|
||||
"type" : "setting",
|
||||
"value" : "UNFIMP_version"
|
||||
}
|
||||
],
|
||||
"database_column_definitions":
|
||||
@@ -257,7 +262,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port}",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/unifi_import/script.py username={username} password={password} host={host} sites={sites} protocol={protocol} port={port} version={version}",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
@@ -344,6 +349,21 @@
|
||||
"string" : "The port number where the UNIFI controller is runnig. Usually it is <code>8443</code>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "version",
|
||||
"type": "text",
|
||||
"default_value":"",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
"language_code":"en_us",
|
||||
"string" : "API version"
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "The base version of the Unify controller API. Supported values as of time of writing are <code>v4|v5|unifiOS|UDMP-unifiOS</code>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
"function": "sites",
|
||||
"type": "list",
|
||||
|
||||
@@ -32,7 +32,7 @@ def main():
|
||||
|
||||
# init global variables
|
||||
global UNIFI_USERNAME, UNIFI_PASSWORD, UNIFI_HOST
|
||||
global UNIFI_SITES, PORT, PROTOCOL
|
||||
global UNIFI_SITES, PORT, PROTOCOL, VERSION
|
||||
|
||||
last_run_logfile = open(last_run, 'a')
|
||||
|
||||
@@ -47,6 +47,7 @@ def main():
|
||||
parser.add_argument('sites', action="store", help="Name of the sites (usually 'default', check the URL in your UniFi controller UI). Separated by comma (,) if passing multiple sites")
|
||||
parser.add_argument('protocol', action="store", help="https:// or http://")
|
||||
parser.add_argument('port', action="store", help="Usually 8443")
|
||||
parser.add_argument('version', action="store", help="The base version of the controller API [v4|v5|unifiOS|UDMP-unifiOS]")
|
||||
|
||||
values = parser.parse_args()
|
||||
|
||||
@@ -61,6 +62,7 @@ def main():
|
||||
UNIFI_SITES = values.sites.split('=')[1]
|
||||
PROTOCOL = values.protocol.split('=')[1]
|
||||
PORT = values.port.split('=')[1]
|
||||
VERSION = values.version.split('=')[1]
|
||||
|
||||
newEntries = get_entries(newEntries)
|
||||
|
||||
@@ -85,7 +87,7 @@ def get_entries(newEntries):
|
||||
|
||||
for site in sites:
|
||||
|
||||
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, ssl_verify=False, site_id=site )
|
||||
c = Controller(UNIFI_HOST, UNIFI_USERNAME, UNIFI_PASSWORD, version=VERSION, ssl_verify=False, site_id=site )
|
||||
|
||||
for ap in c.get_aps():
|
||||
|
||||
|
||||
Reference in New Issue
Block a user