You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.3 KiB
60 lines
2.3 KiB
# -*- coding: utf-8 -*-
|
|
from setuphelpers import *
|
|
from cryptography.fernet import Fernet
|
|
import json
|
|
import re
|
|
|
|
uninstallkey = []
|
|
|
|
variables = {
|
|
#'vnc_pass': 's3cr3t',
|
|
#'vnc_admin_pass': 'p@ssw0rd',
|
|
#'vnc_allowed_ip': ['1.2.3.4','192.168.2.1-192.168.2.10']
|
|
}
|
|
|
|
# Read local variables file if available
|
|
if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
|
|
print('Reading local encrypted variables file')
|
|
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())))
|
|
|
|
def install():
|
|
print('Installing TightVNC Server')
|
|
version = control['version'].split('-',1)[0]
|
|
if iswin64():
|
|
msi = 'tightvnc-%s-gpl-setup-64bit.msi' % version
|
|
else:
|
|
msi = 'tightvnc-%s-gpl-setup-32bit.msi' % version
|
|
|
|
props = {
|
|
'ADDLOCAL': 'Server',
|
|
'SET_ACCEPTHTTPCONNECTIONS': 1,
|
|
'VALUE_OF_ACCEPTHTTPCONNECTIONS': 0,
|
|
'SET_ACCEPTRFBCONNECTIONS': 1,
|
|
'VALUE_OF_ACCEPTRFBCONNECTIONS': 1,
|
|
'SET_LOGLEVEL': 1,
|
|
'VALUE_OF_LOGLEVEL': 3,
|
|
'SET_REMOVEWALLPAPER': 1,
|
|
'VALUE_OF_REMOVEWALLPAPER': 0
|
|
}
|
|
if 'vnc_allowed_ip' in variables:
|
|
print('Access will be restricted to %s' % ','.join(variables['vnc_allowed_ip']))
|
|
props['SET_IPACCESSCONTROL'] = 1,
|
|
props['VALUE_OF_IPACCESSCONTROL'] = ','.join( '%s-%s:0' % (ip,ip) if not re.search('\-',ip) else '%s:0' % ip for ip in ensure_list(variables['vnc_allowed_ip']) )
|
|
|
|
if 'vnc_pass' in variables:
|
|
print('Setting VNC password')
|
|
props['SET_USEVNCAUTHENTICATION'] = 1
|
|
props['VALUE_OF_USEVNCAUTHENTICATION'] = 1
|
|
props['SET_PASSWORD'] = 1
|
|
props['VALUE_OF_PASSWORD'] = variables['vnc_pass']
|
|
props['SET_USEVNCAUTHENTICATION'] = 1
|
|
|
|
if 'vnc_admin_pass' in variables:
|
|
print('Setting VNC control password')
|
|
props['SET_USECONTROLAUTHENTICATION'] = 1
|
|
props['VALUE_OF_USECONTROLAUTHENTICATION'] = 1
|
|
props['SET_CONTROLPASSWORD'] = 1
|
|
props['VALUE_OF_CONTROLPASSWORD'] = variables['vnc_admin_pass']
|
|
|
|
install_msi_if_needed(msi,min_version=version,properties=props) |