|
|
|
@ -5,13 +5,20 @@ import json |
|
|
|
|
|
|
|
|
|
uninstallkey = [] |
|
|
|
|
|
|
|
|
|
print('Reading variables') |
|
|
|
|
key = open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read() |
|
|
|
|
f = Fernet(key) |
|
|
|
|
variables = json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())) |
|
|
|
|
if not 'fusinv_server' in variables: |
|
|
|
|
error('Missing fusinv_server variable') |
|
|
|
|
|
|
|
|
|
def install(): |
|
|
|
|
print('Reading variables') |
|
|
|
|
key = open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read() |
|
|
|
|
f = Fernet(key) |
|
|
|
|
variables = json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())) |
|
|
|
|
if not 'fusinv_server' in variables: |
|
|
|
|
error('Missing fusinv_server variable') |
|
|
|
|
error('Missing fusinv_server variable') |
|
|
|
|
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (variables['fusinv_server']) |
|
|
|
|
if 'fusinv_user' in variables and 'fusinv_pass' in variables: |
|
|
|
|
parameters = parameters + ' /user="%s" /password="%s"' % (variables['fusinv_user'],variables['fusinv_pass']) |
|
|
|
@ -74,6 +81,32 @@ def update_package(): |
|
|
|
|
print('Download ' + url86) |
|
|
|
|
wget(url86,filenamex86) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def audit(): |
|
|
|
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'server'): |
|
|
|
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\server doesn't exist") |
|
|
|
|
return "ERROR" |
|
|
|
|
val_server = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'server') |
|
|
|
|
if val_server != variables['fusinv_server'] : |
|
|
|
|
print("server config is not %, it's % instead" % (variables['fusinv_server'], val_server) ) |
|
|
|
|
return "WARNING" |
|
|
|
|
if 'fusinv_user' in variables and 'fusinv_pass' in variables: |
|
|
|
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'user'): |
|
|
|
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\user doesn't exist") |
|
|
|
|
return "ERROR" |
|
|
|
|
val_user = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'user') |
|
|
|
|
if val_user != variables['fusinv_user'] : |
|
|
|
|
print("user config is not %s, it's %s instead" % (variables['fusinv_user'],val_user) ) |
|
|
|
|
return "WARNING" |
|
|
|
|
if not registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'password'): |
|
|
|
|
print(r"key HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent\password doesn't exist") |
|
|
|
|
return "ERROR" |
|
|
|
|
val_pass = registry_readstring(HKEY_LOCAL_MACHINE,makepath('SOFTWARE','FusionInventory-Agent'),'password') |
|
|
|
|
if val_pass != variables['fusinv_pass'] : |
|
|
|
|
print("password doesn't match what's set") |
|
|
|
|
return "WARNING" |
|
|
|
|
return "OK" |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
update_package() |
|
|
|
|
|
|
|
|
|