|
|
@ -1,7 +1,5 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
from setuphelpers import * |
|
|
|
from setuphelpers import * |
|
|
|
from cryptography.fernet import Fernet |
|
|
|
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uninstallkey = [] |
|
|
|
uninstallkey = [] |
|
|
|
|
|
|
|
|
|
|
@ -12,8 +10,10 @@ variables = { |
|
|
|
# Read local variables file if available |
|
|
|
# Read local variables file if available |
|
|
|
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): |
|
|
|
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): |
|
|
|
print('Reading local encrypted variables file') |
|
|
|
print('Reading local encrypted variables file') |
|
|
|
|
|
|
|
from cryptography.fernet import Fernet |
|
|
|
|
|
|
|
import yaml |
|
|
|
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) |
|
|
|
f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) |
|
|
|
variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) |
|
|
|
variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) |
|
|
|
|
|
|
|
|
|
|
|
def install(): |
|
|
|
def install(): |
|
|
|
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (','.join(variables['fusinv_servers'])) |
|
|
|
parameters = '/S /acceptlicense /server="%s" /execmode=service /runnow' % (','.join(variables['fusinv_servers'])) |
|
|
@ -29,19 +29,17 @@ def install(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_package(): |
|
|
|
def update_package(): |
|
|
|
import BeautifulSoup,requests,re |
|
|
|
import BeautifulSoup,re |
|
|
|
|
|
|
|
|
|
|
|
from waptpackage import PackageEntry |
|
|
|
from waptpackage import PackageEntry |
|
|
|
verify=True |
|
|
|
verify=True |
|
|
|
pe = PackageEntry() |
|
|
|
pe = PackageEntry() |
|
|
|
pe.load_control_from_wapt(os.getcwd()) |
|
|
|
pe.load_control_from_wapt(os.getcwd()) |
|
|
|
current_version = pe['version'].split('-',1)[0] |
|
|
|
current_version = pe['version'].split('-',1)[0] |
|
|
|
verify=True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
url = 'https://github.com/fusioninventory/fusioninventory-agent/releases' |
|
|
|
url = 'https://github.com/fusioninventory/fusioninventory-agent/releases' |
|
|
|
|
|
|
|
|
|
|
|
import requests,BeautifulSoup |
|
|
|
page = wgets(url + '/latest') |
|
|
|
page = requests.get(url + '/latest',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'},verify=verify).text |
|
|
|
|
|
|
|
bs = BeautifulSoup.BeautifulSoup(page) |
|
|
|
bs = BeautifulSoup.BeautifulSoup(page) |
|
|
|
|
|
|
|
|
|
|
|
bs_raw_string = str(bs.find('span',{'class':'css-truncate-target'}).text) |
|
|
|
bs_raw_string = str(bs.find('span',{'class':'css-truncate-target'}).text) |
|
|
|