From c47c77ce2ef4bb38578b5fdbbddbe72fb18c8bb9 Mon Sep 17 00:00:00 2001 From: mpgn Date: Tue, 21 Jun 2022 05:45:30 -0400 Subject: [PATCH] Fix cmedb issue --- cme/protocols/smb/database.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cme/protocols/smb/database.py b/cme/protocols/smb/database.py index 324d8ae9..1ff3fb41 100755 --- a/cme/protocols/smb/database.py +++ b/cme/protocols/smb/database.py @@ -168,10 +168,11 @@ class database: cur.execute("INSERT INTO computers (ip, hostname, domain, os, dc) VALUES (?,?,?,?,?)", [ip, hostname, domain, os, dc]) else: for host in results: - if (hostname != host[2]) or (domain != host[3]) or (os != host[4]) or (smbv1 != host[6]) or (signing != host[7]): - try: + try: + if (hostname != host[2]) or (domain != host[3]) or (os != host[4]) or (smbv1 != host[6]) or (signing != host[7]): cur.execute("UPDATE computers SET hostname=?, domain=?, os=?, smbv1=?, signing=? WHERE id=?", [hostname, domain, os, smbv1, signing, host[0]]) - except: + except: + 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]]) if dc != None and (dc != host[5]): cur.execute("UPDATE computers SET dc=? WHERE id=?", [dc, host[0]])