44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
from setuphelpers import *
|
|
import sys
|
|
|
|
def install():
|
|
pass
|
|
|
|
|
|
def audit():
|
|
|
|
if sys.platform == "win32": #windows
|
|
teamviewer_id = registry_readstring(HKEY_LOCAL_MACHINE,r'SOFTWARE/TeamViewer','ClientID')
|
|
if teamviewer_id:
|
|
WAPT.write_audit_data_if_changed("TeamViewer", "id", teamviewer_id)
|
|
else:
|
|
print("Error while retrieving TeamViewer id.")
|
|
|
|
|
|
elif sys.platform == "darwin": #MacOS
|
|
import subprocess
|
|
cmd = ["/Applications/TeamViewer.app/Contents/MacOS/TeamViewer", "info"]
|
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
|
|
if result.returncode !=0:
|
|
print(f"Erreur lors de la requête: {result.stderr}")
|
|
#return 'Error'
|
|
|
|
for line in result.stdout.splitlines():
|
|
if "TeamViewer ID" in line:
|
|
teamviewer_id = line.split(":")[1].strip()
|
|
WAPT.write_audit_data_if_changed("TeamViewer", "id", teamviewer_id)
|
|
|
|
elif "linux" in sys.platform : #Linux (values can be linux or linux2)
|
|
result = run("teamviewer info")
|
|
|
|
for line in result.splitlines():
|
|
if "TeamViewer ID" in line:
|
|
teamviewer_id = line.split(":")[1].strip()
|
|
teamviewer_id = teamviewer_id.split(' ')
|
|
WAPT.write_audit_data_if_changed("TeamViewer", "id", teamviewer_id[2])
|
|
else:
|
|
print("Unsupported OS")
|
|
return 'ERROR'
|
|
return 'OK' |