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
ed03b793
authored
Dec 14, 2018
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added multi user support (thx to szebi)
parent
402cfbde
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
28 deletions
+23
-28
src/nsi/cloud.nsi
+0
-0
src/nsi/installer/cloud.py
+4
-2
src/nsi/installer/cloud_connect_from_windows.py
+19
-26
No files found.
src/nsi/cloud.nsi
View file @
ed03b793
This diff is collapsed.
Click to expand it.
src/nsi/installer/cloud.py
View file @
ed03b793
...
...
@@ -9,7 +9,9 @@ The Client job is to help the ease of use of the cloud system.
import
argparse
import
logging
import
platform
import
tempfile
from
time
import
gmtime
,
strftime
from
windowsclasses
import
ClientRegistry
...
...
@@ -49,8 +51,8 @@ def parse_arguments():
help
=
"Explicit location of the wanted logfile location and name"
,
type
=
unicode
,
default
=
(
"
%(directory)
s
\\
%(file)
s"
%
{
'directory'
:
ClientRegistry
.
directory
(),
'file'
:
'client.log'
}))
'directory'
:
tempfile
.
gettempdir
(),
'file'
:
'c
ircle_c
lient.log'
}))
args
=
parser
.
parse_args
()
return
args
...
...
src/nsi/installer/cloud_connect_from_windows.py
View file @
ed03b793
...
...
@@ -11,12 +11,13 @@ import binascii
import
glob
import
locale
import
logging
import
nxkey
import
os
import
subprocess
import
time
import
win32crypt
import
tempfile
import
nxkey
import
win32crypt
from
windowsclasses
import
ClientRegistry
...
...
@@ -76,36 +77,27 @@ def connect(vm):
subprocess
.
Popen
((
u'"
%
s"'
%
config_file
)
.
encode
(
locale
.
getpreferredencoding
()),
shell
=
True
)
elif
vm
.
protocol
==
"RDP"
:
logger
.
info
(
'RDP protocol received'
)
listdir
=
ClientRegistry
.
directory
()
+
"
\\
.rdp
\\
*.rdp"
found
=
False
logger
.
debug
(
'RDP protocol received'
)
full_address
=
"full address:s:
%
s:
%
s"
%
(
vm
.
host
,
vm
.
port
)
user
=
"username:s:
%
s"
%
vm
.
user
for
config_file
in
glob
.
glob
(
listdir
):
with
open
(
config_file
)
as
f
:
file
=
f
.
read
()
if
full_address
in
file
and
user
in
file
:
found
=
True
logger
.
info
(
'Config file found:
%
s'
,
config_file
)
break
if
not
found
:
logger
.
info
(
'No config file found, creating new one'
)
config_file
=
"
%
s
%
s
%
s"
%
((
ClientRegistry
.
directory
()
+
"
\\
.rdp
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
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
}
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
close
()
logger
.
info
(
'Config file created:
%
s'
,
config_file
)
config_file
=
"
%
s
%
s"
%
(
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
}
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
)
locale
.
getpreferredencoding
()),
shell
=
True
)
.
wait
()
os
.
remove
(
config_file
)
logger
.
info
(
'Client finished working'
)
NX_template
=
"""<!DOCTYPE NXClientSettings>
<NXClientSettings application="nxclient" version="1.3" >
<group name="General" >
...
...
@@ -125,4 +117,5 @@ NX_template = """<!DOCTYPE NXClientSettings>
RPD_template
=
"""username:s:
%(USERNAME)
s
full address:s:
%(HOST)
s:
%(PORT)
s
authentication level:i:0
password 51:b:
%(PASSWORD)
s"""
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