master
Daniel Berteaud 6 years ago
parent a02f8e81cf
commit d64fbdeeb4
  1. 2
      WAPT/control
  2. 35
      setup.py

@ -1,5 +1,5 @@
package : fws-fusioninventory package : fws-fusioninventory
version : 2.4.2-3 version : 2.4.2-4
architecture : all architecture : all
section : base section : base
priority : optional priority : optional

@ -5,13 +5,20 @@ import json
uninstallkey = [] 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(): def install():
print('Reading variables') print('Reading variables')
key = open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read() key = open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()
f = Fernet(key) f = Fernet(key)
variables = json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())) variables = json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))
if not 'fusinv_server' in variables: 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']) parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (variables['fusinv_server'])
if 'fusinv_user' in variables and 'fusinv_pass' in variables: if 'fusinv_user' in variables and 'fusinv_pass' in variables:
parameters = parameters + ' /user="%s" /password="%s"' % (variables['fusinv_user'],variables['fusinv_pass']) parameters = parameters + ' /user="%s" /password="%s"' % (variables['fusinv_user'],variables['fusinv_pass'])
@ -74,6 +81,32 @@ def update_package():
print('Download ' + url86) print('Download ' + url86)
wget(url86,filenamex86) 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__': if __name__ == '__main__':
update_package() update_package()

Loading…
Cancel
Save