Add audit
This commit is contained in:
parent
a02f8e81cf
commit
d64fbdeeb4
|
@ -1,5 +1,5 @@
|
|||
package : fws-fusioninventory
|
||||
version : 2.4.2-3
|
||||
version : 2.4.2-4
|
||||
architecture : all
|
||||
section : base
|
||||
priority : optional
|
||||
|
|
33
setup.py
33
setup.py
|
@ -5,6 +5,13 @@ 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()
|
||||
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user