NSLOOKUP v0.1.7

This commit is contained in:
Jokob-sk
2024-02-01 07:56:57 +11:00
parent a6ac7991e5
commit f5e39b8281
4 changed files with 38 additions and 10 deletions

View File

@@ -370,20 +370,39 @@ def get_device_name_nslookup(db, pMAC, pIP):
name = nameNotFound
# get names from the NSLOOKUP plugin entries
# get names from the NSLOOKUP plugin entries vased on MAC
sql.execute(
f"""
SELECT Watched_Value2 FROM Plugins_Objects
WHERE
Plugin = 'NSLOOKUP' AND
(Object_PrimaryID = '{pMAC}' OR Object_SecondaryID = '{pIP}')
Object_PrimaryID = '{pMAC}'
"""
)
nslookupEntry = sql.fetchall()
db.commitDB()
if len(nslookupEntry) != 0:
name = cleanDeviceName(nslookupEntry[0][0])
name = cleanDeviceName(nslookupEntry[0][0], False)
return name
# get names from the NSLOOKUP plugin entries based on IP
sql.execute(
f"""
SELECT Watched_Value2 FROM Plugins_Objects
WHERE
Plugin = 'NSLOOKUP' AND
Object_SecondaryID = '{pIP}'
"""
)
nslookupEntry = sql.fetchall()
db.commitDB()
if len(nslookupEntry) != 0:
name = cleanDeviceName(nslookupEntry[0][0], True)
return name
return name