TightVNC for WAPT
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.

46 lines
1.6 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': 0,
'SET_LOGLEVEL': 3,
'SET_REMOVEWALLPAPER': 0
}
if 'vnc_allowed_ip' in variables:
props['SET_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:
props['SET_PASSWORD'] = variables['vnc_pass']
props['SET_USEVNCAUTHENTICATION'] = 1
if 'vnc_admin_pass' in variables:
props['SET_CONTROLPASSWORD'] = variables['vnc_admin_pass']
props['SET_USECONTROLAUTHENTICATION'] = 1
install_msi_if_needed(msi,min_version=version,properties=props)