Update agent in database when sleep setting is changed to display latest checkin correctly.

This commit is contained in:
Jakob Friedl
2025-05-28 11:14:30 +02:00
parent 4397f728de
commit d35b1d0a0d
6 changed files with 23 additions and 7 deletions

View File

@@ -122,6 +122,18 @@ proc dbUpdateCheckin*(cq: Conquest, agentName: string, timestamp: string): bool
conquestDb.exec("UPDATE agents SET latestCheckin = ? WHERE name = ?", timestamp, agentName)
conquestDb.close()
return true
except:
cq.writeLine(fgRed, styleBright, "[-] ", getCurrentExceptionMsg())
return false
proc dbUpdateSleep*(cq: Conquest, agentName: string, delay: int): bool =
try:
let conquestDb = openDatabase(cq.dbPath, mode=dbReadWrite)
conquestDb.exec("UPDATE agents SET sleep = ? WHERE name = ?", delay, agentName)
conquestDb.close()
return true
except: