This commit is contained in:
2024-03-14 11:11:11 +01:00
parent bf7700fa42
commit ddff5b2d55

View File

@@ -30,17 +30,17 @@ def audit():
def session_setup():
# Avoiding user pop-up spamming
# check_timeout = 1800
# date_format = "%Y-%m-%d %H:%M:%S" # datetime.datetime.strptime(date_pwsh, "%Y/%m/%d %H:%M:%S")
# date = run_powershell('Get-Date -Format "yyyy-MM-dd HH:mm:ss"') # datetime.datetime.now()
# date_reg = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check")
# if date_reg != "":
# date_diff = datetime.datetime.strptime(date, date_format) - datetime.datetime.strptime(date_reg, date_format)
# if date_diff.total_seconds() < check_timeout:
# return "Already checked"
# registry_set(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Information", "Last Check", date)
# Send message to connected user
Avoiding user pop-up spamming
check_timeout = 1800
date_format = "%Y-%m-%d %H:%M:%S" # datetime.datetime.strptime(date_pwsh, "%Y/%m/%d %H:%M:%S")
date = run_powershell('Get-Date -Format "yyyy-MM-dd HH:mm:ss"') # datetime.datetime.now()
date_reg = registry_readstring(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Update", "Last Check")
if date_reg != "":
date_diff = datetime.datetime.strptime(date, date_format) - datetime.datetime.strptime(date_reg, date_format)
if date_diff.total_seconds() < check_timeout:
return "Already checked"
registry_set(HKEY_CURRENT_USER, r"SOFTWARE\WAPT\Shutdown Update", "Last Check", date)
Send message to connected user
version = installed_softwares("wapt")[0]["version"]
if version > Version("2.5"):
print("Envoi du message 2.5")