Commit 35d6a80a by Belákovics Ádám

runtime py2to3

parent 8ac7e289
......@@ -12,9 +12,6 @@ import platform
import tempfile
from time import gmtime, strftime
from windowsclasses import ClientRegistry
class Struct:
A struct used for parameter passing
......@@ -39,7 +36,7 @@ def parse_arguments():
parser = argparse.ArgumentParser()
"uri", type=unicode, help="Specific schema handler", nargs='?',
"uri", type=str, help="Specific schema handler", nargs='?',
"-l", "--loglevel",
......@@ -49,7 +46,7 @@ def parse_arguments():
"-f", "--logfile",
help="Explicit location of the wanted logfile location and name",
default=("%(directory)s\\%(file)s" % {
'directory': tempfile.gettempdir(),
'file': 'circle_client.log'}))
......@@ -91,17 +88,14 @@ def main():
logger.critical("Client did not receive an URI which would be "
"necessary to continue")
if platform.system() == "Linux":
logger.debug('Linux OS found, proceeding to connect methods')
from cloud_connect_from_linux import connect
elif platform.system() == "Windows":
if platform.system() == "Windows":
logger.debug('Windows OS found, proceeding to connect methods')
from cloud_connect_from_windows import connect
logger.exception("An exception was raised before connect methods"
"could be invoked")
print "Unknown error occurred! Please contact the developers!"
print("Unknown error occurred! Please contact the developers!")
if __name__ == "__main__":
......@@ -17,8 +17,6 @@ import time
import tempfile
import win32crypt
from windowsclasses import ClientRegistry
def connect(vm):
......@@ -56,20 +54,17 @@ def connect(vm):
"\\circle_" + vm.user + str(int(time.time() * 1000)) + ".rdp")'Creating config file %s' % config_file)
password = binascii.hexlify(win32crypt.CryptProtectData(
u"%s" % vm.password, u'psw', None, None, None, 0))
config = RPD_template % {'USERNAME': vm.user, 'PASSWORD': password,
'HOST':, 'PORT': vm.port}
password = win32crypt.CryptProtectData(vm.password.encode('utf-16-le'), 'psw', None, None, None, 0).hex()
config = RPD_template.format(vm.user,, vm.port, password)
f = open(config_file, 'w')
logger.debug('Popen the config file: %s', config_file)
subprocess.Popen((u'"%s"' % config_file).encode(
locale.getpreferredencoding()), shell=True).wait()
subprocess.Popen([config_file], shell=True).wait()
os.remove(config_file)'Client finished working')
RPD_template = """username:s:%(USERNAME)s
full address:s:%(HOST)s:%(PORT)s
RPD_template = """username:s:{}
full address:s:{}:{}
authentication level:i:0
password 51:b:%(PASSWORD)s"""
password 51:b:{}"""
......@@ -185,7 +185,7 @@ class RegistryHandler:
needed_rights | architect)
SetValueEx(new_key, None, 0, REG_SZ, value)
print "The provided attribute wasn't a dictionary chain"
print("The provided attribute wasn't a dictionary chain")
raise AttributeError
def get_key(self, key_name, needed_rights=KEY_ALL_ACCESS):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment