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
35d1570e
authored
Sep 03, 2014
by
Csók Tamás
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: pythonw.exe instead of python.exe
parent
2f746a10
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
200 additions
and
160 deletions
+200
-160
src/iss/installer/OrderedDict.py
+1
-0
src/iss/installer/cloud.py
+5
-7
src/iss/installer/cloud_connect_from_windows.py
+16
-9
src/iss/installer/get-pip.py
+1
-0
src/iss/installer/nx_client_installer.py
+7
-7
src/iss/installer/nxkey.py
+10
-11
src/iss/installer/pywin_installer.py
+0
-0
src/iss/installer/win_install.py
+33
-25
src/iss/installer/windowsclasses.py
+27
-21
src/iss/installer/windowsclasses.pyc
+0
-0
src/python/OrderedDict.py
+1
-0
src/python/cloud.py
+5
-7
src/python/cloud_connect_from_windows.py
+16
-9
src/python/get-pip.py
+1
-0
src/python/nx_client_installer.py
+7
-7
src/python/nxkey.py
+10
-11
src/python/pywin_installer.py
+0
-0
src/python/win_install.py
+33
-25
src/python/windowsclasses.py
+27
-21
No files found.
src/iss/installer/OrderedDict.py
View file @
35d1570e
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# Passes Python2.7's test suite and incorporates all the latest updates.
# flake8: noqa
try
:
try
:
from
thread
import
get_ident
as
_get_ident
from
thread
import
get_ident
as
_get_ident
...
...
src/iss/installer/cloud.py
View file @
35d1570e
...
@@ -8,8 +8,6 @@ The Client job is to help the ease of use of the cloud system.
...
@@ -8,8 +8,6 @@ The Client job is to help the ease of use of the cloud system.
import
platform
import
platform
import
argparse
import
argparse
import
sys
import
time
try
:
try
:
from
selenium
import
webdriver
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
...
@@ -49,13 +47,14 @@ def parse_arguments():
...
@@ -49,13 +47,14 @@ def parse_arguments():
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
parser
.
add_argument
(
"-d"
,
"--driver"
,
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
default
=
"firefox"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
class
Browser
:
class
Browser
:
"""
"""
Browser initialisation
Browser initialisation
...
@@ -92,7 +91,6 @@ class Browser:
...
@@ -92,7 +91,6 @@ class Browser:
driver
.
find_element_by_css_selector
(
driver
.
find_element_by_css_selector
(
"input[type='submit']"
)
.
click
()
"input[type='submit']"
)
.
click
()
def
main
(
self
):
def
main
(
self
):
"""
"""
Use of the https://cloud.bme.hu/
Use of the https://cloud.bme.hu/
...
@@ -142,7 +140,7 @@ def main():
...
@@ -142,7 +140,7 @@ def main():
args
=
parse_arguments
()
args
=
parse_arguments
()
if
args
.
uri
is
not
None
:
if
args
.
uri
is
not
None
:
vm
=
Struct
()
vm
=
Struct
()
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
args
.
uri
.
split
(
':'
,
4
)
args
.
uri
.
split
(
':'
,
4
)
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
state
=
"RUN"
vm
.
state
=
"RUN"
...
...
src/iss/installer/cloud_connect_from_windows.py
View file @
35d1570e
...
@@ -29,8 +29,9 @@ def connect(vm):
...
@@ -29,8 +29,9 @@ def connect(vm):
vm.password -- Password used for the connection
vm.password -- Password used for the connection
"""
"""
if
vm
.
protocol
==
"SSH"
:
if
vm
.
protocol
==
"SSH"
:
arguments
=
"-ssh -P
%
s -pw
%
s
%
s@
%
s"
%
(
vm
.
port
,
vm
.
password
,
vm
.
user
,
vm
.
host
)
arguments
=
(
"-ssh -P
%
s -pw
%
s"
%
(
vm
.
port
,
vm
.
password
)
subprocess
.
Popen
(
"putty.exe "
+
arguments
,
shell
=
True
)
+
"
%
s@
%
s"
%
(
vm
.
user
,
vm
.
host
))
subprocess
.
Popen
(
"putty.exe "
+
arguments
,
shell
=
True
)
elif
vm
.
protocol
==
"NX"
:
elif
vm
.
protocol
==
"NX"
:
listdir
=
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
*.nxs"
)
listdir
=
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
*.nxs"
)
found
=
False
found
=
False
...
@@ -43,13 +44,15 @@ def connect(vm):
...
@@ -43,13 +44,15 @@ def connect(vm):
found
=
True
found
=
True
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
f
=
open
(
config_file
,
'w'
)
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
write
(
config
)
f
.
close
()
f
.
close
()
subprocess
.
Popen
(
config_file
,
shell
=
True
)
subprocess
.
Popen
(
config_file
,
shell
=
True
)
elif
vm
.
protocol
==
"RDP"
:
elif
vm
.
protocol
==
"RDP"
:
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
found
=
False
found
=
False
...
@@ -62,13 +65,17 @@ def connect(vm):
...
@@ -62,13 +65,17 @@ def connect(vm):
found
=
True
found
=
True
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
,
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
config_file
=
"
%
s
%
s
%
s"
%
((
os
.
path
.
dirname
(
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
),
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
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
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
write
(
config
)
f
.
close
()
f
.
close
()
subprocess
.
Popen
(
config_file
,
shell
=
True
)
subprocess
.
Popen
(
config_file
,
shell
=
True
)
NX_template
=
"""<!DOCTYPE NXClientSettings>
NX_template
=
"""<!DOCTYPE NXClientSettings>
...
...
src/iss/installer/get-pip.py
View file @
35d1570e
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#
#
# If you're wondering how this is created, the secret is
# If you're wondering how this is created, the secret is
# "contrib/build-installer" from the pip repository.
# "contrib/build-installer" from the pip repository.
# flake8: noqa
ZIPFILE
=
b
"""
ZIPFILE
=
b
"""
UEsDBBQAAAAIAHeDxEQMVWtseQwAAOokAAAPAAAAcGlwL19faW5pdF9fLnB5pRprb+M28rt/BTdp
UEsDBBQAAAAIAHeDxEQMVWtseQwAAOokAAAPAAAAcGlwL19faW5pdF9fLnB5pRprb+M28rt/BTdp
src/iss/installer/nx_client_installer.py
View file @
35d1570e
...
@@ -24,10 +24,10 @@ def parse_arguments():
...
@@ -24,10 +24,10 @@ def parse_arguments():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
else
:
else
:
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
...
@@ -38,17 +38,17 @@ def parse_arguments():
...
@@ -38,17 +38,17 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
main
():
def
main
():
try
:
try
:
args
=
parse_arguments
()
nx_install_location
=
None
nx_install_location
=
None
while
nx_install_location
is
None
:
while
nx_install_location
is
None
:
print
"Checking whether NX Client for Windows is installed"
print
"Checking whether NX Client for Windows is installed"
handler
=
windowsclasses
.
RegistryHandler
()
handler
=
windowsclasses
.
RegistryHandler
()
try
:
try
:
nx_install_location
=
handler
.
get_key_value
(
nx_install_location
=
handler
.
get_key_value
(
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
+
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
"Uninstall
\\
nxclient_is1"
,
+
"Uninstall
\\
nxclient_is1"
,
"InstallLocation"
,
"key"
)
"InstallLocation"
,
"key"
)
print
(
"NX Client for Windows is found at "
print
(
"NX Client for Windows is found at "
"'
%
s'"
%
nx_install_location
)
"'
%
s'"
%
nx_install_location
)
...
@@ -60,8 +60,8 @@ def main():
...
@@ -60,8 +60,8 @@ def main():
print
"NX Client for Windows isn't installed on the system."
print
"NX Client for Windows isn't installed on the system."
print
"
\t
Commencing the install"
print
"
\t
Commencing the install"
subprocess
.
Popen
(
os
.
path
.
dirname
(
subprocess
.
Popen
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
os
.
path
.
realpath
(
__file__
))
"
\\
nxclient-3.5.0-9.exe"
)
.
wait
()
+
"
\\
nxclient-3.5.0-9.exe"
)
.
wait
()
except
:
except
:
pass
pass
...
...
src/iss/installer/nxkey.py
View file @
35d1570e
...
@@ -8,9 +8,9 @@ https://www.nomachine.com/AR01C00125
...
@@ -8,9 +8,9 @@ https://www.nomachine.com/AR01C00125
import
sys
import
sys
import
random
import
random
import
re
from
xml.sax.saxutils
import
escape
from
xml.sax.saxutils
import
escape
class
NXKeyGen
:
class
NXKeyGen
:
"""
"""
NXKeyGen class
NXKeyGen class
...
@@ -18,6 +18,7 @@ class NXKeyGen:
...
@@ -18,6 +18,7 @@ class NXKeyGen:
"""
"""
numValidCharList
=
85
numValidCharList
=
85
dummyString
=
"{{{{"
dummyString
=
"{{{{"
def
__init__
(
self
,
password
):
def
__init__
(
self
,
password
):
"""
"""
Initialize the class
Initialize the class
...
@@ -53,8 +54,7 @@ class NXKeyGen:
...
@@ -53,8 +54,7 @@ class NXKeyGen:
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"{"
,
"|"
,
"}"
"y"
,
"z"
,
"{"
,
"|"
,
"}"
]
]
return
validcharlist
[
pos
]
return
validcharlist
[
pos
]
def
encodePassword
(
self
,
p
):
def
encodePassword
(
self
,
p
):
...
@@ -71,7 +71,7 @@ class NXKeyGen:
...
@@ -71,7 +71,7 @@ class NXKeyGen:
for
i
in
range
(
len
(
p
)):
for
i
in
range
(
len
(
p
)):
c
=
p
[
i
:
i
+
1
]
c
=
p
[
i
:
i
+
1
]
a
=
ord
(
c
)
a
=
ord
(
c
)
sTmp
=
str
(
a
+
i
+
1
)
+
":"
sTmp
=
str
(
a
+
i
+
1
)
+
":"
sPass
+=
sTmp
sPass
+=
sTmp
sTmp
=
""
sTmp
=
""
return
sPass
return
sPass
...
@@ -86,7 +86,7 @@ class NXKeyGen:
...
@@ -86,7 +86,7 @@ class NXKeyGen:
"""
"""
i
=
-
1
i
=
-
1
for
j
in
range
(
self
.
numValidCharList
):
for
j
in
range
(
self
.
numValidCharList
):
randchar
=
self
.
getvalidCharList
(
j
)
;
randchar
=
self
.
getvalidCharList
(
j
)
if
randchar
==
c
:
if
randchar
==
c
:
i
=
j
i
=
j
return
i
return
i
...
@@ -99,7 +99,7 @@ class NXKeyGen:
...
@@ -99,7 +99,7 @@ class NXKeyGen:
Keyword arguments:
Keyword arguments:
@return char -- Valid character placed 0-60 in the valid list
@return char -- Valid character placed 0-60 in the valid list
"""
"""
return
self
.
getvalidCharList
(
random
.
randint
(
0
,
60
))
return
self
.
getvalidCharList
(
random
.
randint
(
0
,
60
))
def
scrambleString
(
self
,
s
):
def
scrambleString
(
self
,
s
):
"""
"""
...
@@ -124,13 +124,13 @@ class NXKeyGen:
...
@@ -124,13 +124,13 @@ class NXKeyGen:
l
=
k
+
len
(
sRet
)
-
2
l
=
k
+
len
(
sRet
)
-
2
sRet
=
app
+
sRet
sRet
=
app
+
sRet
for
i1
in
range
(
1
,
len
(
sRet
)):
for
i1
in
range
(
1
,
len
(
sRet
)):
app2
=
sRet
[
i1
:
i1
+
1
]
app2
=
sRet
[
i1
:
i1
+
1
]
j
=
self
.
findCharInList
(
app2
)
j
=
self
.
findCharInList
(
app2
)
if
j
==
-
1
:
if
j
==
-
1
:
return
sRet
return
sRet
i
=
(
j
+
l
*
(
i1
+
1
))
%
self
.
numValidCharList
i
=
(
j
+
l
*
(
i1
+
1
))
%
self
.
numValidCharList
car
=
self
.
getvalidCharList
(
i
)
car
=
self
.
getvalidCharList
(
i
)
sRet
=
self
.
substr_replace
(
sRet
,
car
,
i1
,
1
)
sRet
=
self
.
substr_replace
(
sRet
,
car
,
i1
,
1
)
c
=
(
ord
(
self
.
getRandomValidCharFromList
()))
+
2
c
=
(
ord
(
self
.
getRandomValidCharFromList
()))
+
2
c2
=
chr
(
c
)
c2
=
chr
(
c
)
sRet
=
sRet
+
c2
sRet
=
sRet
+
c2
...
@@ -141,8 +141,8 @@ class NXKeyGen:
...
@@ -141,8 +141,8 @@ class NXKeyGen:
Replace a character at a special position
Replace a character at a special position
"""
"""
clist
=
list
(
in_str
)
clist
=
list
(
in_str
)
count
=
0
;
count
=
0
tmp_str
=
''
;
tmp_str
=
''
for
key
in
clist
:
for
key
in
clist
:
if
count
!=
pos
:
if
count
!=
pos
:
tmp_str
+=
key
tmp_str
+=
key
...
@@ -156,4 +156,3 @@ if __name__ == "__main__":
...
@@ -156,4 +156,3 @@ if __name__ == "__main__":
NXPass
=
NXKeyGen
(
sys
.
argv
[
1
])
NXPass
=
NXKeyGen
(
sys
.
argv
[
1
])
print
NXPass
.
password
print
NXPass
.
password
print
NXPass
.
getEncrypted
()
print
NXPass
.
getEncrypted
()
src/iss/installer/pywin_installer.py
View file @
35d1570e
src/iss/installer/win_install.py
View file @
35d1570e
...
@@ -13,11 +13,9 @@ import shutil
...
@@ -13,11 +13,9 @@ import shutil
from
win32com.shell
import
shell
,
shellcon
from
win32com.shell
import
shell
,
shellcon
import
windowsclasses
import
windowsclasses
try
:
try
:
from
collections
import
*
from
collections
import
*
# noqa
except
ImportError
:
except
ImportError
:
from
OrderedDict
import
*
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
def
parse_arguments
():
"""
"""
...
@@ -35,13 +33,13 @@ def parse_arguments():
...
@@ -35,13 +33,13 @@ def parse_arguments():
'iexplore'
,
'opera'
])
'iexplore'
,
'opera'
])
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
else
:
else
:
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
and
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
parser
.
add_argument
(
parser
.
add_argument
(
"-l"
,
"--location"
,
help
=
"Location of the client files in the system"
,
"-l"
,
"--location"
,
help
=
"Location of the client files in the system"
,
default
=
local_default
,
required
=
False
)
default
=
local_default
,
required
=
False
)
...
@@ -60,6 +58,7 @@ def parse_arguments():
...
@@ -60,6 +58,7 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
custom_protocol_register
(
custom_protocol
):
def
custom_protocol_register
(
custom_protocol
):
"""
"""
Custom protocol register based on RegistryHandler module
Custom protocol register based on RegistryHandler module
...
@@ -92,13 +91,13 @@ def main():
...
@@ -92,13 +91,13 @@ def main():
"""
"""
try
:
try
:
args
=
parse_arguments
()
args
=
parse_arguments
()
shortcut
=
pythoncom
.
CoCreateInstance
(
shortcut
=
pythoncom
.
CoCreateInstance
(
shell
.
CLSID_ShellLink
,
shell
.
CLSID_ShellLink
,
None
,
None
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
shell
.
IID_IShellLink
shell
.
IID_IShellLink
)
)
desktop_path
=
shell
.
SHGetFolderPath
(
desktop_path
=
shell
.
SHGetFolderPath
(
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
if
args
.
remove
:
if
args
.
remove
:
location
=
os
.
path
.
join
(
desktop_path
,
"Cloud GUI"
)
location
=
os
.
path
.
join
(
desktop_path
,
"Cloud GUI"
)
...
@@ -117,15 +116,15 @@ def main():
...
@@ -117,15 +116,15 @@ def main():
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
close
()
shortcut
.
close
()
else
:
else
:
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
if
args
.
driver
==
"chrome"
:
if
args
.
driver
==
"chrome"
:
shortcut
.
SetArguments
(
"-d chrome"
)
shortcut
.
SetArguments
(
"-d chrome"
)
elif
args
.
driver
==
"iexplore"
:
elif
args
.
driver
==
"iexplore"
:
shortcut
.
SetArguments
(
"-d ie"
)
shortcut
.
SetArguments
(
"-d ie"
)
elif
args
.
driver
==
"opera"
:
elif
args
.
driver
==
"opera"
:
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
desktop_path
=
shell
.
SHGetFolderPath
(
desktop_path
=
shell
.
SHGetFolderPath
(
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
persist_file
=
shortcut
.
QueryInterface
(
persist_file
=
shortcut
.
QueryInterface
(
...
@@ -137,28 +136,37 @@ def main():
...
@@ -137,28 +136,37 @@ def main():
print
"Creating custom URL protocol handlers"
print
"Creating custom URL protocol handlers"
try
:
try
:
custom_ssh
=
OrderedDict
(
custom_ssh
=
OrderedDict
(
[(
'ssh'
,
[
"default"
,
"URL:ssh Protocol"
,
"URL Protocol"
,
""
]),
[(
'ssh'
,
[
"default"
,
"URL:ssh Protocol"
,
"URL Protocol"
,
""
]),
(
'ssh
\\
URL Protocol'
,
""
),
(
'ssh
\\
URL Protocol'
,
""
),
(
'ssh
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'ssh
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'ssh
\\
shell'
,
{
'open'
:
{
(
'ssh
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_ssh
)
custom_protocol_register
(
custom_ssh
)
custom_rdp
=
OrderedDict
(
custom_rdp
=
OrderedDict
(
[(
'rdp'
,
[
"default"
,
"URL:rdp Protocol"
,
"URL Protocol"
,
""
]),
[(
'rdp'
,
[
"default"
,
"URL:rdp Protocol"
,
"URL Protocol"
,
""
]),
(
'rdp
\\
URL Protocol'
,
""
),
(
'rdp
\\
URL Protocol'
,
""
),
(
'rdp
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'rdp
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'rdp
\\
shell'
,
{
'open'
:
{
(
'rdp
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_rdp
)
custom_protocol_register
(
custom_rdp
)
custom_nx
=
OrderedDict
(
custom_nx
=
OrderedDict
(
[(
'nx'
,
[
"default"
,
"URL:nx Protocol"
,
"URL Protocol"
,
""
]),
[(
'nx'
,
[
"default"
,
"URL:nx Protocol"
,
"URL Protocol"
,
""
]),
(
'nx
\\
URL Protocol'
,
""
),
(
'nx
\\
URL Protocol'
,
""
),
(
'nx
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'nx
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'nx
\\
shell'
,
{
'open'
:
{
(
'nx
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_nx
)
custom_protocol_register
(
custom_nx
)
except
:
except
:
print
"Error! URL Protocol handler installation aborted!"
print
"Error! URL Protocol handler installation aborted!"
...
...
src/iss/installer/windowsclasses.py
View file @
35d1570e
...
@@ -11,11 +11,12 @@ Currently here:
...
@@ -11,11 +11,12 @@ Currently here:
import
os
import
os
import
argparse
import
argparse
import
errno
import
errno
from
_winreg
import
*
from
_winreg
import
*
# noqa
try
:
try
:
from
collections
import
*
from
collections
import
*
# noqa
except
ImporError
:
except
ImporError
:
from
OrderedDict
import
*
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
def
parse_arguments
():
"""
"""
...
@@ -41,9 +42,11 @@ def parse_arguments():
...
@@ -41,9 +42,11 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
main
():
def
main
():
return
RegistryHandler
(
parse_arguments
())
return
RegistryHandler
(
parse_arguments
())
class
Struct
:
class
Struct
:
"""
"""
Parameter bypassing struct
Parameter bypassing struct
...
@@ -59,7 +62,7 @@ class RegistryHandler:
...
@@ -59,7 +62,7 @@ class RegistryHandler:
differently (default)
differently (default)
"""
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
):
"""Initialise RegistryHandler
"""Initialise RegistryHandler
Keyword arguments:
Keyword arguments:
...
@@ -96,7 +99,7 @@ class RegistryHandler:
...
@@ -96,7 +99,7 @@ class RegistryHandler:
elif
self
.
args
.
registry
==
"HKCC"
:
elif
self
.
args
.
registry
==
"HKCC"
:
self
.
args
.
registry
=
HKEY_CURRENT_CONFIG
self
.
args
.
registry
=
HKEY_CURRENT_CONFIG
else
:
else
:
#print "Non supported registry type"
#
print "Non supported registry type"
raise
AttributeError
raise
AttributeError
def
connect_registry
(
self
):
def
connect_registry
(
self
):
...
@@ -107,11 +110,11 @@ class RegistryHandler:
...
@@ -107,11 +110,11 @@ class RegistryHandler:
@return connected_registy -- Reference to the newly opened
@return connected_registy -- Reference to the newly opened
registry
registry
"""
"""
return
ConnectRegistry
(
None
,
self
.
args
.
registry
)
return
ConnectRegistry
(
None
,
self
.
args
.
registry
)
def
create_registry_from_dict_chain
(
def
create_registry_from_dict_chain
(
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
needed_rights
=
KEY_ALL_ACCESS
):
needed_rights
=
KEY_ALL_ACCESS
):
""""
""""
Create registry key and value multilevel tree by chained
Create registry key and value multilevel tree by chained
dictionaries.
dictionaries.
...
@@ -208,8 +211,8 @@ class RegistryHandler:
...
@@ -208,8 +211,8 @@ class RegistryHandler:
return
[
key
,
architect
]
return
[
key
,
architect
]
def
get_key_values
(
def
get_key_values
(
self
,
key_name
,
subkey_list
,
subroutine
=
False
,
self
,
key_name
,
subkey_list
,
subroutine
=
False
,
depth
=
"subkeys"
):
depth
=
"subkeys"
):
"""
"""
Getting registry subkeys value by it's key's name and subkeys
Getting registry subkeys value by it's key's name and subkeys
name
name
...
@@ -243,9 +246,9 @@ class RegistryHandler:
...
@@ -243,9 +246,9 @@ class RegistryHandler:
key
=
key_and_architect
[
0
]
key
=
key_and_architect
[
0
]
architect
=
key_and_architect
[
1
]
architect
=
key_and_architect
[
1
]
except
KeyError
:
except
KeyError
:
#print "%s doesn't exist in the registry" % key_name
#
print "%s doesn't exist in the registry" % key_name
raise
LookupError
raise
LookupError
#print "%s found in the registry" % key_name
#
print "%s found in the registry" % key_name
results
=
{}
results
=
{}
if
int_depth
>=
1
:
if
int_depth
>=
1
:
for
i
in
xrange
(
0
,
QueryInfoKey
(
key
)[
0
]
-
1
):
for
i
in
xrange
(
0
,
QueryInfoKey
(
key
)[
0
]
-
1
):
...
@@ -261,7 +264,7 @@ class RegistryHandler:
...
@@ -261,7 +264,7 @@ class RegistryHandler:
skey
,
subkey_name
)[
0
]
skey
,
subkey_name
)[
0
]
except
OSError
as
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
if
e
.
errno
==
errno
.
ENOENT
:
#print ("%s doesn't exist in this" % subkey_name
#
print ("%s doesn't exist in this" % subkey_name
# " subkey")
# " subkey")
pass
pass
skey
.
Close
()
skey
.
Close
()
...
@@ -273,12 +276,12 @@ class RegistryHandler:
...
@@ -273,12 +276,12 @@ class RegistryHandler:
pass
pass
key
.
Close
()
key
.
Close
()
if
len
(
results
)
!=
len
(
subkey_list
):
if
len
(
results
)
!=
len
(
subkey_list
):
#print "We are missing important variables"
#
print "We are missing important variables"
raise
LookupError
raise
LookupError
return
results
return
results
def
get_key_value
(
def
get_key_value
(
self
,
key_name
,
subkey_name
,
subroutine
=
None
,
depth
=
None
):
self
,
key_name
,
subkey_name
,
subroutine
=
None
,
depth
=
None
):
"""
"""
This is a wrapper for the get_key_values to be easier to use
This is a wrapper for the get_key_values to be easier to use
for single subkeys.
for single subkeys.
...
@@ -296,14 +299,14 @@ class RegistryHandler:
...
@@ -296,14 +299,14 @@ class RegistryHandler:
"""
"""
try
:
try
:
if
subroutine
is
None
:
if
subroutine
is
None
:
return
self
.
get_key_values
(
key_name
,
return
self
.
get_key_values
(
[
subkey_name
])[
subkey_name
]
key_name
,
[
subkey_name
])[
subkey_name
]
elif
depth
is
None
:
elif
depth
is
None
:
return
self
.
get_key_values
(
key_name
,
[
subkey_name
],
return
self
.
get_key_values
(
subroutine
)[
subkey_name
]
key_name
,
[
subkey_name
],
subroutine
)[
subkey_name
]
else
:
else
:
return
self
.
get_key_values
(
key_name
,
[
subkey_name
],
return
self
.
get_key_values
(
subroutine
,
depth
)[
subkey_name
]
key_name
,
[
subkey_name
],
subroutine
,
depth
)[
subkey_name
]
except
:
except
:
raise
raise
...
@@ -313,15 +316,18 @@ class DecideArchitecture:
...
@@ -313,15 +316,18 @@ class DecideArchitecture:
Helper class to get the true ProgramFiles directory.
Helper class to get the true ProgramFiles directory.
This class doesn't depend on Phyton or Windows architecture.
This class doesn't depend on Phyton or Windows architecture.
"""
"""
@staticmethod
@staticmethod
def
Is64Windows
():
def
Is64Windows
():
return
'PROGRAMFILES(X86)'
in
os
.
environ
return
'PROGRAMFILES(X86)'
in
os
.
environ
@staticmethod
@staticmethod
def
GetProgramFiles32
():
def
GetProgramFiles32
():
if
DecideArchitecture
.
Is64Windows
():
if
DecideArchitecture
.
Is64Windows
():
return
os
.
environ
[
'PROGRAMFILES(X86)'
]
return
os
.
environ
[
'PROGRAMFILES(X86)'
]
else
:
else
:
return
os
.
environ
[
'PROGRAMFILES'
]
return
os
.
environ
[
'PROGRAMFILES'
]
@staticmethod
@staticmethod
def
GetProgramFiles64
():
def
GetProgramFiles64
():
if
DecideArchitecture
.
Is64Windows
():
if
DecideArchitecture
.
Is64Windows
():
...
...
src/iss/installer/windowsclasses.pyc
deleted
100644 → 0
View file @
2f746a10
File deleted
src/python/OrderedDict.py
View file @
35d1570e
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Backport of OrderedDict() class that runs on Python 2.4, 2.5, 2.6, 2.7 and pypy.
# Passes Python2.7's test suite and incorporates all the latest updates.
# Passes Python2.7's test suite and incorporates all the latest updates.
# flake8: noqa
try
:
try
:
from
thread
import
get_ident
as
_get_ident
from
thread
import
get_ident
as
_get_ident
...
...
src/python/cloud.py
View file @
35d1570e
...
@@ -8,8 +8,6 @@ The Client job is to help the ease of use of the cloud system.
...
@@ -8,8 +8,6 @@ The Client job is to help the ease of use of the cloud system.
import
platform
import
platform
import
argparse
import
argparse
import
sys
import
time
try
:
try
:
from
selenium
import
webdriver
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
...
@@ -49,13 +47,14 @@ def parse_arguments():
...
@@ -49,13 +47,14 @@ def parse_arguments():
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
parser
.
add_argument
(
"-d"
,
"--driver"
,
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
default
=
"firefox"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
class
Browser
:
class
Browser
:
"""
"""
Browser initialisation
Browser initialisation
...
@@ -92,7 +91,6 @@ class Browser:
...
@@ -92,7 +91,6 @@ class Browser:
driver
.
find_element_by_css_selector
(
driver
.
find_element_by_css_selector
(
"input[type='submit']"
)
.
click
()
"input[type='submit']"
)
.
click
()
def
main
(
self
):
def
main
(
self
):
"""
"""
Use of the https://cloud.bme.hu/
Use of the https://cloud.bme.hu/
...
@@ -142,7 +140,7 @@ def main():
...
@@ -142,7 +140,7 @@ def main():
args
=
parse_arguments
()
args
=
parse_arguments
()
if
args
.
uri
is
not
None
:
if
args
.
uri
is
not
None
:
vm
=
Struct
()
vm
=
Struct
()
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
args
.
uri
.
split
(
':'
,
4
)
args
.
uri
.
split
(
':'
,
4
)
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
state
=
"RUN"
vm
.
state
=
"RUN"
...
...
src/python/cloud_connect_from_windows.py
View file @
35d1570e
...
@@ -29,8 +29,9 @@ def connect(vm):
...
@@ -29,8 +29,9 @@ def connect(vm):
vm.password -- Password used for the connection
vm.password -- Password used for the connection
"""
"""
if
vm
.
protocol
==
"SSH"
:
if
vm
.
protocol
==
"SSH"
:
arguments
=
"-ssh -P
%
s -pw
%
s
%
s@
%
s"
%
(
vm
.
port
,
vm
.
password
,
vm
.
user
,
vm
.
host
)
arguments
=
(
"-ssh -P
%
s -pw
%
s"
%
(
vm
.
port
,
vm
.
password
)
subprocess
.
Popen
(
"putty.exe "
+
arguments
,
shell
=
True
)
+
"
%
s@
%
s"
%
(
vm
.
user
,
vm
.
host
))
subprocess
.
Popen
(
"putty.exe "
+
arguments
,
shell
=
True
)
elif
vm
.
protocol
==
"NX"
:
elif
vm
.
protocol
==
"NX"
:
listdir
=
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
*.nxs"
)
listdir
=
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
*.nxs"
)
found
=
False
found
=
False
...
@@ -43,13 +44,15 @@ def connect(vm):
...
@@ -43,13 +44,15 @@ def connect(vm):
found
=
True
found
=
True
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
expanduser
(
"~
\\
.nx
\\
config
\\
"
),
str
(
int
(
time
.
time
()
*
1000
)),
".nxs"
)
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
password
=
nxkey
.
NXKeyGen
(
vm
.
password
)
.
getEncrypted
()
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
config
=
NX_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
f
=
open
(
config_file
,
'w'
)
f
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
write
(
config
)
f
.
close
()
f
.
close
()
subprocess
.
Popen
(
config_file
,
shell
=
True
)
subprocess
.
Popen
(
config_file
,
shell
=
True
)
elif
vm
.
protocol
==
"RDP"
:
elif
vm
.
protocol
==
"RDP"
:
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
listdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
*.rdp"
found
=
False
found
=
False
...
@@ -62,13 +65,17 @@ def connect(vm):
...
@@ -62,13 +65,17 @@ def connect(vm):
found
=
True
found
=
True
break
break
if
not
found
:
if
not
found
:
config_file
=
"
%
s
%
s
%
s"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
,
str
(
int
(
time
.
time
()
*
1000
)),
".rdp"
)
config_file
=
"
%
s
%
s
%
s"
%
((
os
.
path
.
dirname
(
password
=
binascii
.
hexlify
(
win32crypt
.
CryptProtectData
(
u"
%
s"
%
vm
.
password
,
u'psw'
,
None
,
None
,
None
,
0
))
os
.
path
.
realpath
(
__file__
))
+
"
\\
.rdp
\\
"
),
config
=
RPD_template
%
{
'USERNAME'
:
vm
.
user
,
'PASSWORD'
:
password
,
'HOST'
:
vm
.
host
,
'PORT'
:
vm
.
port
}
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
=
open
(
config_file
,
'w'
)
f
.
write
(
config
)
f
.
write
(
config
)
f
.
close
()
f
.
close
()
subprocess
.
Popen
(
config_file
,
shell
=
True
)
subprocess
.
Popen
(
config_file
,
shell
=
True
)
NX_template
=
"""<!DOCTYPE NXClientSettings>
NX_template
=
"""<!DOCTYPE NXClientSettings>
...
...
src/python/get-pip.py
View file @
35d1570e
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#
#
# If you're wondering how this is created, the secret is
# If you're wondering how this is created, the secret is
# "contrib/build-installer" from the pip repository.
# "contrib/build-installer" from the pip repository.
# flake8: noqa
ZIPFILE
=
b
"""
ZIPFILE
=
b
"""
UEsDBBQAAAAIAHeDxEQMVWtseQwAAOokAAAPAAAAcGlwL19faW5pdF9fLnB5pRprb+M28rt/BTdp
UEsDBBQAAAAIAHeDxEQMVWtseQwAAOokAAAPAAAAcGlwL19faW5pdF9fLnB5pRprb+M28rt/BTdp
src/python/nx_client_installer.py
View file @
35d1570e
...
@@ -24,10 +24,10 @@ def parse_arguments():
...
@@ -24,10 +24,10 @@ def parse_arguments():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
else
:
else
:
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
...
@@ -38,17 +38,17 @@ def parse_arguments():
...
@@ -38,17 +38,17 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
main
():
def
main
():
try
:
try
:
args
=
parse_arguments
()
nx_install_location
=
None
nx_install_location
=
None
while
nx_install_location
is
None
:
while
nx_install_location
is
None
:
print
"Checking whether NX Client for Windows is installed"
print
"Checking whether NX Client for Windows is installed"
handler
=
windowsclasses
.
RegistryHandler
()
handler
=
windowsclasses
.
RegistryHandler
()
try
:
try
:
nx_install_location
=
handler
.
get_key_value
(
nx_install_location
=
handler
.
get_key_value
(
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
+
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
"Uninstall
\\
nxclient_is1"
,
+
"Uninstall
\\
nxclient_is1"
,
"InstallLocation"
,
"key"
)
"InstallLocation"
,
"key"
)
print
(
"NX Client for Windows is found at "
print
(
"NX Client for Windows is found at "
"'
%
s'"
%
nx_install_location
)
"'
%
s'"
%
nx_install_location
)
...
@@ -60,8 +60,8 @@ def main():
...
@@ -60,8 +60,8 @@ def main():
print
"NX Client for Windows isn't installed on the system."
print
"NX Client for Windows isn't installed on the system."
print
"
\t
Commencing the install"
print
"
\t
Commencing the install"
subprocess
.
Popen
(
os
.
path
.
dirname
(
subprocess
.
Popen
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
os
.
path
.
realpath
(
__file__
))
"
\\
nxclient-3.5.0-9.exe"
)
.
wait
()
+
"
\\
nxclient-3.5.0-9.exe"
)
.
wait
()
except
:
except
:
pass
pass
...
...
src/python/nxkey.py
View file @
35d1570e
...
@@ -8,9 +8,9 @@ https://www.nomachine.com/AR01C00125
...
@@ -8,9 +8,9 @@ https://www.nomachine.com/AR01C00125
import
sys
import
sys
import
random
import
random
import
re
from
xml.sax.saxutils
import
escape
from
xml.sax.saxutils
import
escape
class
NXKeyGen
:
class
NXKeyGen
:
"""
"""
NXKeyGen class
NXKeyGen class
...
@@ -18,6 +18,7 @@ class NXKeyGen:
...
@@ -18,6 +18,7 @@ class NXKeyGen:
"""
"""
numValidCharList
=
85
numValidCharList
=
85
dummyString
=
"{{{{"
dummyString
=
"{{{{"
def
__init__
(
self
,
password
):
def
__init__
(
self
,
password
):
"""
"""
Initialize the class
Initialize the class
...
@@ -53,8 +54,7 @@ class NXKeyGen:
...
@@ -53,8 +54,7 @@ class NXKeyGen:
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"X"
,
"Y"
,
"Z"
,
"["
,
"]"
,
"_"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
,
"{"
,
"|"
,
"}"
"y"
,
"z"
,
"{"
,
"|"
,
"}"
]
]
return
validcharlist
[
pos
]
return
validcharlist
[
pos
]
def
encodePassword
(
self
,
p
):
def
encodePassword
(
self
,
p
):
...
@@ -71,7 +71,7 @@ class NXKeyGen:
...
@@ -71,7 +71,7 @@ class NXKeyGen:
for
i
in
range
(
len
(
p
)):
for
i
in
range
(
len
(
p
)):
c
=
p
[
i
:
i
+
1
]
c
=
p
[
i
:
i
+
1
]
a
=
ord
(
c
)
a
=
ord
(
c
)
sTmp
=
str
(
a
+
i
+
1
)
+
":"
sTmp
=
str
(
a
+
i
+
1
)
+
":"
sPass
+=
sTmp
sPass
+=
sTmp
sTmp
=
""
sTmp
=
""
return
sPass
return
sPass
...
@@ -86,7 +86,7 @@ class NXKeyGen:
...
@@ -86,7 +86,7 @@ class NXKeyGen:
"""
"""
i
=
-
1
i
=
-
1
for
j
in
range
(
self
.
numValidCharList
):
for
j
in
range
(
self
.
numValidCharList
):
randchar
=
self
.
getvalidCharList
(
j
)
;
randchar
=
self
.
getvalidCharList
(
j
)
if
randchar
==
c
:
if
randchar
==
c
:
i
=
j
i
=
j
return
i
return
i
...
@@ -99,7 +99,7 @@ class NXKeyGen:
...
@@ -99,7 +99,7 @@ class NXKeyGen:
Keyword arguments:
Keyword arguments:
@return char -- Valid character placed 0-60 in the valid list
@return char -- Valid character placed 0-60 in the valid list
"""
"""
return
self
.
getvalidCharList
(
random
.
randint
(
0
,
60
))
return
self
.
getvalidCharList
(
random
.
randint
(
0
,
60
))
def
scrambleString
(
self
,
s
):
def
scrambleString
(
self
,
s
):
"""
"""
...
@@ -124,13 +124,13 @@ class NXKeyGen:
...
@@ -124,13 +124,13 @@ class NXKeyGen:
l
=
k
+
len
(
sRet
)
-
2
l
=
k
+
len
(
sRet
)
-
2
sRet
=
app
+
sRet
sRet
=
app
+
sRet
for
i1
in
range
(
1
,
len
(
sRet
)):
for
i1
in
range
(
1
,
len
(
sRet
)):
app2
=
sRet
[
i1
:
i1
+
1
]
app2
=
sRet
[
i1
:
i1
+
1
]
j
=
self
.
findCharInList
(
app2
)
j
=
self
.
findCharInList
(
app2
)
if
j
==
-
1
:
if
j
==
-
1
:
return
sRet
return
sRet
i
=
(
j
+
l
*
(
i1
+
1
))
%
self
.
numValidCharList
i
=
(
j
+
l
*
(
i1
+
1
))
%
self
.
numValidCharList
car
=
self
.
getvalidCharList
(
i
)
car
=
self
.
getvalidCharList
(
i
)
sRet
=
self
.
substr_replace
(
sRet
,
car
,
i1
,
1
)
sRet
=
self
.
substr_replace
(
sRet
,
car
,
i1
,
1
)
c
=
(
ord
(
self
.
getRandomValidCharFromList
()))
+
2
c
=
(
ord
(
self
.
getRandomValidCharFromList
()))
+
2
c2
=
chr
(
c
)
c2
=
chr
(
c
)
sRet
=
sRet
+
c2
sRet
=
sRet
+
c2
...
@@ -141,8 +141,8 @@ class NXKeyGen:
...
@@ -141,8 +141,8 @@ class NXKeyGen:
Replace a character at a special position
Replace a character at a special position
"""
"""
clist
=
list
(
in_str
)
clist
=
list
(
in_str
)
count
=
0
;
count
=
0
tmp_str
=
''
;
tmp_str
=
''
for
key
in
clist
:
for
key
in
clist
:
if
count
!=
pos
:
if
count
!=
pos
:
tmp_str
+=
key
tmp_str
+=
key
...
@@ -156,4 +156,3 @@ if __name__ == "__main__":
...
@@ -156,4 +156,3 @@ if __name__ == "__main__":
NXPass
=
NXKeyGen
(
sys
.
argv
[
1
])
NXPass
=
NXKeyGen
(
sys
.
argv
[
1
])
print
NXPass
.
password
print
NXPass
.
password
print
NXPass
.
getEncrypted
()
print
NXPass
.
getEncrypted
()
src/python/pywin_installer.py
View file @
35d1570e
src/python/win_install.py
View file @
35d1570e
...
@@ -13,11 +13,9 @@ import shutil
...
@@ -13,11 +13,9 @@ import shutil
from
win32com.shell
import
shell
,
shellcon
from
win32com.shell
import
shell
,
shellcon
import
windowsclasses
import
windowsclasses
try
:
try
:
from
collections
import
*
from
collections
import
*
# noqa
except
ImportError
:
except
ImportError
:
from
OrderedDict
import
*
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
def
parse_arguments
():
"""
"""
...
@@ -35,13 +33,13 @@ def parse_arguments():
...
@@ -35,13 +33,13 @@ def parse_arguments():
'iexplore'
,
'opera'
])
'iexplore'
,
'opera'
])
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
else
:
else
:
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles32
()
+
"
\\
CIRCLE
\\
"
)
+
"
\\
CIRCLE
\\
"
)
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
if
(
not
os
.
path
.
exists
(
local_default
[:
-
1
])
and
and
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
os
.
path
.
exists
(
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE"
)):
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
local_default
=
os
.
environ
[
'APPDATA'
]
+
"
\\
CIRCLE
\\
"
parser
.
add_argument
(
parser
.
add_argument
(
"-l"
,
"--location"
,
help
=
"Location of the client files in the system"
,
"-l"
,
"--location"
,
help
=
"Location of the client files in the system"
,
default
=
local_default
,
required
=
False
)
default
=
local_default
,
required
=
False
)
...
@@ -60,6 +58,7 @@ def parse_arguments():
...
@@ -60,6 +58,7 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
custom_protocol_register
(
custom_protocol
):
def
custom_protocol_register
(
custom_protocol
):
"""
"""
Custom protocol register based on RegistryHandler module
Custom protocol register based on RegistryHandler module
...
@@ -92,13 +91,13 @@ def main():
...
@@ -92,13 +91,13 @@ def main():
"""
"""
try
:
try
:
args
=
parse_arguments
()
args
=
parse_arguments
()
shortcut
=
pythoncom
.
CoCreateInstance
(
shortcut
=
pythoncom
.
CoCreateInstance
(
shell
.
CLSID_ShellLink
,
shell
.
CLSID_ShellLink
,
None
,
None
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
shell
.
IID_IShellLink
shell
.
IID_IShellLink
)
)
desktop_path
=
shell
.
SHGetFolderPath
(
desktop_path
=
shell
.
SHGetFolderPath
(
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
if
args
.
remove
:
if
args
.
remove
:
location
=
os
.
path
.
join
(
desktop_path
,
"Cloud GUI"
)
location
=
os
.
path
.
join
(
desktop_path
,
"Cloud GUI"
)
...
@@ -117,15 +116,15 @@ def main():
...
@@ -117,15 +116,15 @@ def main():
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
write
(
'URL='
+
args
.
target
)
shortcut
.
close
()
shortcut
.
close
()
else
:
else
:
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
shortcut
.
SetPath
(
args
.
location
+
"cloud.py"
)
if
args
.
driver
==
"chrome"
:
if
args
.
driver
==
"chrome"
:
shortcut
.
SetArguments
(
"-d chrome"
)
shortcut
.
SetArguments
(
"-d chrome"
)
elif
args
.
driver
==
"iexplore"
:
elif
args
.
driver
==
"iexplore"
:
shortcut
.
SetArguments
(
"-d ie"
)
shortcut
.
SetArguments
(
"-d ie"
)
elif
args
.
driver
==
"opera"
:
elif
args
.
driver
==
"opera"
:
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetArguments
(
"-d opera"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetDescription
(
"Tool to use CIRCLE Cloud"
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
shortcut
.
SetIconLocation
(
args
.
location
+
"cloud.ico"
,
0
)
desktop_path
=
shell
.
SHGetFolderPath
(
desktop_path
=
shell
.
SHGetFolderPath
(
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
0
,
shellcon
.
CSIDL_DESKTOP
,
0
,
0
)
persist_file
=
shortcut
.
QueryInterface
(
persist_file
=
shortcut
.
QueryInterface
(
...
@@ -137,28 +136,37 @@ def main():
...
@@ -137,28 +136,37 @@ def main():
print
"Creating custom URL protocol handlers"
print
"Creating custom URL protocol handlers"
try
:
try
:
custom_ssh
=
OrderedDict
(
custom_ssh
=
OrderedDict
(
[(
'ssh'
,
[
"default"
,
"URL:ssh Protocol"
,
"URL Protocol"
,
""
]),
[(
'ssh'
,
[
"default"
,
"URL:ssh Protocol"
,
"URL Protocol"
,
""
]),
(
'ssh
\\
URL Protocol'
,
""
),
(
'ssh
\\
URL Protocol'
,
""
),
(
'ssh
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'ssh
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'ssh
\\
shell'
,
{
'open'
:
{
(
'ssh
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_ssh
)
custom_protocol_register
(
custom_ssh
)
custom_rdp
=
OrderedDict
(
custom_rdp
=
OrderedDict
(
[(
'rdp'
,
[
"default"
,
"URL:rdp Protocol"
,
"URL Protocol"
,
""
]),
[(
'rdp'
,
[
"default"
,
"URL:rdp Protocol"
,
"URL Protocol"
,
""
]),
(
'rdp
\\
URL Protocol'
,
""
),
(
'rdp
\\
URL Protocol'
,
""
),
(
'rdp
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'rdp
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'rdp
\\
shell'
,
{
'open'
:
{
(
'rdp
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_rdp
)
custom_protocol_register
(
custom_rdp
)
custom_nx
=
OrderedDict
(
custom_nx
=
OrderedDict
(
[(
'nx'
,
[
"default"
,
"URL:nx Protocol"
,
"URL Protocol"
,
""
]),
[(
'nx'
,
[
"default"
,
"URL:nx Protocol"
,
"URL Protocol"
,
""
]),
(
'nx
\\
URL Protocol'
,
""
),
(
'nx
\\
URL Protocol'
,
""
),
(
'nx
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'nx
\\
DefaultIcon'
,
args
.
location
+
"cloud.ico"
),
(
'nx
\\
shell'
,
{
'open'
:
{
(
'nx
\\
shell'
,
{
'open'
:
{
'command'
:
"
\"
python
.exe
\"
\"
%
s"
%
args
.
location
+
'command'
:
"
\"
python
w.exe
\"
\"
%
s"
%
args
.
location
"cloud.py
\"
\"
%1
\"
"
}})])
+
"cloud.py
\"
\"
%1
\"
"
}})])
custom_protocol_register
(
custom_nx
)
custom_protocol_register
(
custom_nx
)
except
:
except
:
print
"Error! URL Protocol handler installation aborted!"
print
"Error! URL Protocol handler installation aborted!"
...
...
src/python/windowsclasses.py
View file @
35d1570e
...
@@ -11,11 +11,12 @@ Currently here:
...
@@ -11,11 +11,12 @@ Currently here:
import
os
import
os
import
argparse
import
argparse
import
errno
import
errno
from
_winreg
import
*
from
_winreg
import
*
# noqa
try
:
try
:
from
collections
import
*
from
collections
import
*
# noqa
except
ImporError
:
except
ImporError
:
from
OrderedDict
import
*
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
def
parse_arguments
():
"""
"""
...
@@ -41,9 +42,11 @@ def parse_arguments():
...
@@ -41,9 +42,11 @@ def parse_arguments():
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
def
main
():
def
main
():
return
RegistryHandler
(
parse_arguments
())
return
RegistryHandler
(
parse_arguments
())
class
Struct
:
class
Struct
:
"""
"""
Parameter bypassing struct
Parameter bypassing struct
...
@@ -59,7 +62,7 @@ class RegistryHandler:
...
@@ -59,7 +62,7 @@ class RegistryHandler:
differently (default)
differently (default)
"""
"""
def
__init__
(
self
,
args
=
None
):
def
__init__
(
self
,
args
=
None
):
"""Initialise RegistryHandler
"""Initialise RegistryHandler
Keyword arguments:
Keyword arguments:
...
@@ -96,7 +99,7 @@ class RegistryHandler:
...
@@ -96,7 +99,7 @@ class RegistryHandler:
elif
self
.
args
.
registry
==
"HKCC"
:
elif
self
.
args
.
registry
==
"HKCC"
:
self
.
args
.
registry
=
HKEY_CURRENT_CONFIG
self
.
args
.
registry
=
HKEY_CURRENT_CONFIG
else
:
else
:
#print "Non supported registry type"
#
print "Non supported registry type"
raise
AttributeError
raise
AttributeError
def
connect_registry
(
self
):
def
connect_registry
(
self
):
...
@@ -107,11 +110,11 @@ class RegistryHandler:
...
@@ -107,11 +110,11 @@ class RegistryHandler:
@return connected_registy -- Reference to the newly opened
@return connected_registy -- Reference to the newly opened
registry
registry
"""
"""
return
ConnectRegistry
(
None
,
self
.
args
.
registry
)
return
ConnectRegistry
(
None
,
self
.
args
.
registry
)
def
create_registry_from_dict_chain
(
def
create_registry_from_dict_chain
(
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
needed_rights
=
KEY_ALL_ACCESS
):
needed_rights
=
KEY_ALL_ACCESS
):
""""
""""
Create registry key and value multilevel tree by chained
Create registry key and value multilevel tree by chained
dictionaries.
dictionaries.
...
@@ -208,8 +211,8 @@ class RegistryHandler:
...
@@ -208,8 +211,8 @@ class RegistryHandler:
return
[
key
,
architect
]
return
[
key
,
architect
]
def
get_key_values
(
def
get_key_values
(
self
,
key_name
,
subkey_list
,
subroutine
=
False
,
self
,
key_name
,
subkey_list
,
subroutine
=
False
,
depth
=
"subkeys"
):
depth
=
"subkeys"
):
"""
"""
Getting registry subkeys value by it's key's name and subkeys
Getting registry subkeys value by it's key's name and subkeys
name
name
...
@@ -243,9 +246,9 @@ class RegistryHandler:
...
@@ -243,9 +246,9 @@ class RegistryHandler:
key
=
key_and_architect
[
0
]
key
=
key_and_architect
[
0
]
architect
=
key_and_architect
[
1
]
architect
=
key_and_architect
[
1
]
except
KeyError
:
except
KeyError
:
#print "%s doesn't exist in the registry" % key_name
#
print "%s doesn't exist in the registry" % key_name
raise
LookupError
raise
LookupError
#print "%s found in the registry" % key_name
#
print "%s found in the registry" % key_name
results
=
{}
results
=
{}
if
int_depth
>=
1
:
if
int_depth
>=
1
:
for
i
in
xrange
(
0
,
QueryInfoKey
(
key
)[
0
]
-
1
):
for
i
in
xrange
(
0
,
QueryInfoKey
(
key
)[
0
]
-
1
):
...
@@ -261,7 +264,7 @@ class RegistryHandler:
...
@@ -261,7 +264,7 @@ class RegistryHandler:
skey
,
subkey_name
)[
0
]
skey
,
subkey_name
)[
0
]
except
OSError
as
e
:
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
if
e
.
errno
==
errno
.
ENOENT
:
#print ("%s doesn't exist in this" % subkey_name
#
print ("%s doesn't exist in this" % subkey_name
# " subkey")
# " subkey")
pass
pass
skey
.
Close
()
skey
.
Close
()
...
@@ -273,12 +276,12 @@ class RegistryHandler:
...
@@ -273,12 +276,12 @@ class RegistryHandler:
pass
pass
key
.
Close
()
key
.
Close
()
if
len
(
results
)
!=
len
(
subkey_list
):
if
len
(
results
)
!=
len
(
subkey_list
):
#print "We are missing important variables"
#
print "We are missing important variables"
raise
LookupError
raise
LookupError
return
results
return
results
def
get_key_value
(
def
get_key_value
(
self
,
key_name
,
subkey_name
,
subroutine
=
None
,
depth
=
None
):
self
,
key_name
,
subkey_name
,
subroutine
=
None
,
depth
=
None
):
"""
"""
This is a wrapper for the get_key_values to be easier to use
This is a wrapper for the get_key_values to be easier to use
for single subkeys.
for single subkeys.
...
@@ -296,14 +299,14 @@ class RegistryHandler:
...
@@ -296,14 +299,14 @@ class RegistryHandler:
"""
"""
try
:
try
:
if
subroutine
is
None
:
if
subroutine
is
None
:
return
self
.
get_key_values
(
key_name
,
return
self
.
get_key_values
(
[
subkey_name
])[
subkey_name
]
key_name
,
[
subkey_name
])[
subkey_name
]
elif
depth
is
None
:
elif
depth
is
None
:
return
self
.
get_key_values
(
key_name
,
[
subkey_name
],
return
self
.
get_key_values
(
subroutine
)[
subkey_name
]
key_name
,
[
subkey_name
],
subroutine
)[
subkey_name
]
else
:
else
:
return
self
.
get_key_values
(
key_name
,
[
subkey_name
],
return
self
.
get_key_values
(
subroutine
,
depth
)[
subkey_name
]
key_name
,
[
subkey_name
],
subroutine
,
depth
)[
subkey_name
]
except
:
except
:
raise
raise
...
@@ -313,15 +316,18 @@ class DecideArchitecture:
...
@@ -313,15 +316,18 @@ class DecideArchitecture:
Helper class to get the true ProgramFiles directory.
Helper class to get the true ProgramFiles directory.
This class doesn't depend on Phyton or Windows architecture.
This class doesn't depend on Phyton or Windows architecture.
"""
"""
@staticmethod
@staticmethod
def
Is64Windows
():
def
Is64Windows
():
return
'PROGRAMFILES(X86)'
in
os
.
environ
return
'PROGRAMFILES(X86)'
in
os
.
environ
@staticmethod
@staticmethod
def
GetProgramFiles32
():
def
GetProgramFiles32
():
if
DecideArchitecture
.
Is64Windows
():
if
DecideArchitecture
.
Is64Windows
():
return
os
.
environ
[
'PROGRAMFILES(X86)'
]
return
os
.
environ
[
'PROGRAMFILES(X86)'
]
else
:
else
:
return
os
.
environ
[
'PROGRAMFILES'
]
return
os
.
environ
[
'PROGRAMFILES'
]
@staticmethod
@staticmethod
def
GetProgramFiles64
():
def
GetProgramFiles64
():
if
DecideArchitecture
.
Is64Windows
():
if
DecideArchitecture
.
Is64Windows
():
...
...
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