Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
35d6a80a
authored
6 years ago
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime py2to3
parent
8ac7e289
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
24 deletions
+13
-24
src/nsi/installer/cloud.py
+4
-10
src/nsi/installer/cloud_connect_from_windows.py
+6
-11
src/nsi/installer/requirements.txt
+2
-2
src/nsi/installer/windowsclasses.py
+1
-1
No files found.
src/nsi/installer/cloud.py
View file @
35d6a80a
...
...
@@ -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
()
parser
.
add_argument
(
"uri"
,
type
=
unicode
,
help
=
"Specific schema handler"
,
nargs
=
'?'
,
"uri"
,
type
=
str
,
help
=
"Specific schema handler"
,
nargs
=
'?'
,
default
=
None
)
parser
.
add_argument
(
"-l"
,
"--loglevel"
,
...
...
@@ -49,7 +46,7 @@ def parse_arguments():
parser
.
add_argument
(
"-f"
,
"--logfile"
,
help
=
"Explicit location of the wanted logfile location and name"
,
type
=
unicode
,
type
=
str
,
default
=
(
"
%(directory)
s
\\
%(file)
s"
%
{
'directory'
:
tempfile
.
gettempdir
(),
'file'
:
'circle_client.log'
}))
...
...
@@ -91,17 +88,14 @@ def main():
else
:
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
connect
(
vm
)
except
:
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__"
:
...
...
This diff is collapsed.
Click to expand it.
src/nsi/installer/cloud_connect_from_windows.py
View file @
35d6a80a
...
...
@@ -17,8 +17,6 @@ import time
import
tempfile
import
win32crypt
from
windowsclasses
import
ClientRegistry
def
connect
(
vm
):
"""
...
...
@@ -56,20 +54,17 @@ def connect(vm):
tempfile
.
gettempdir
(),
"
\\
circle_"
+
vm
.
user
+
str
(
int
(
time
.
time
()
*
1000
))
+
".rdp"
)
logger
.
info
(
'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'
:
vm
.
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
.
host
,
vm
.
port
,
password
)
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
close
()
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
)
logger
.
info
(
'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:
{}
"""
This diff is collapsed.
Click to expand it.
src/nsi/installer/requirements.txt
View file @
35d6a80a
winshell
==0.6
\ No newline at end of file
pypiwin32
==223
pywin32
==224
This diff is collapsed.
Click to expand it.
src/nsi/installer/windowsclasses.py
View file @
35d6a80a
...
...
@@ -185,7 +185,7 @@ class RegistryHandler:
needed_rights
|
architect
)
SetValueEx
(
new_key
,
None
,
0
,
REG_SZ
,
value
)
else
:
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
):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment