Files
comi-rustdesk/setup.py
2024-03-04 16:15:41 +01:00

47 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
from setuphelpers import *
import subprocess
from waptcrypto import *
def install():
# Installing the software
install_exe_if_needed(
"rustdesk.exe",
silentflags="--silent-install",
key="RustDesk",
min_version=control.get_software_version(),
)
# Create the uninstall key
uninstallkey.clear()
def uninstall():
run_notfatal(r'"C:\Program Files\RustDesk\RustDesk.exe" --uninstall')
remove_tree(
r"C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk",
ignore_errors=True,
)
def audit():
## Pour ajouter dans les outils externe wapt : nom :Rustdesk, Executable : C:\Program Files\RustDesk\rustdesk.exe , --connect {{host_audit/RustDesk/id/value}}
def get_rustdesk_id():
# Run the command and capture its output
result = subprocess.run(["C:\\Program Files\\RustDesk\\rustdesk.exe", "--get-id"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
# Check if the command was successful
if result.returncode == 0:
# Store the output in a variable
rustdesk_id = result.stdout
final_id = rustdesk_id.rstrip()
# Print the output for verification
print(final_id)
else:
# If there was an error, print the error message
print("Error:", result.stderr)
return final_id
WAPT.write_audit_data("RustDesk", "id", get_rustdesk_id(), max_count=3)
return "OK"