Update database.py

main
Serizao 2022-03-02 08:07:20 +01:00 committed by GitHub
parent 998b6a4f36
commit 19523a75b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -161,11 +161,11 @@ class database:
results = cur.fetchall()
if not len(results):
cur.execute("INSERT INTO computers (ip, hostname, domain, os, dc) VALUES (?,?,?,?,?)", [ip, hostname, domain, os, dc])
cur.execute("INSERT INTO computers (ip, hostname, domain, os, dc, smbv1, signing) VALUES (?,?,?,?,?,?,?)", [ip, hostname, domain, os, dc, smbv1, signing])
else:
for host in results:
if (hostname != host[2]) or (domain != host[3]) or (os != host[4]):
cur.execute("UPDATE computers SET hostname=?, domain=?, os=? WHERE id=?", [hostname, domain, os, host[0]])
cur.execute("UPDATE computers SET hostname=?, domain=?, os=?, smbv1, signing WHERE id=?", [hostname, domain, os, smbv1, signing, host[0]])
if dc != None and (dc != host[5]):
cur.execute("UPDATE computers SET dc=? WHERE id=?", [dc, host[0]])