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
48fc4f71
authored
Sep 03, 2014
by
Csók Tamás
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: few flake8 correction
parent
35d1570e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
80 deletions
+84
-80
src/iss/installer/cloud.py
+7
-6
src/iss/installer/nxkey.py
+9
-9
src/iss/installer/win_install.py
+7
-6
src/iss/installer/windowsclasses.py
+19
-19
src/python/cloud.py
+7
-6
src/python/nxkey.py
+9
-9
src/python/win_install.py
+7
-6
src/python/windowsclasses.py
+19
-19
No files found.
src/iss/installer/cloud.py
View file @
48fc4f71
...
...
@@ -47,10 +47,10 @@ def parse_arguments():
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -108,7 +108,7 @@ class Browser:
vm
.
state
,
vm
.
protocol
=
""
,
"NONE"
try
:
while
vm
.
state
.
upper
()[:
3
]
not
in
(
"FUT"
,
"RUN"
):
element
=
WebDriverWait
(
driver
,
7200
)
.
until
(
WebDriverWait
(
driver
,
7200
)
.
until
(
EC
.
presence_of_element_located
((
By
.
CSS_SELECTOR
,
"#vm-details-pw-eye.fa.fa-eye-slash"
)))
...
...
@@ -132,6 +132,7 @@ class Browser:
raise
return
vm
def
main
():
"""
Main program
...
...
@@ -141,7 +142,7 @@ def main():
if
args
.
uri
is
not
None
:
vm
=
Struct
()
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
args
.
uri
.
split
(
':'
,
4
)
args
.
uri
.
split
(
':'
,
4
)
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
state
=
"RUN"
else
:
...
...
src/iss/installer/nxkey.py
View file @
48fc4f71
...
...
@@ -22,7 +22,7 @@ class NXKeyGen:
def
__init__
(
self
,
password
):
"""
Initialize the class
Keyword arguments:
@param password -- Password that will be scrambled
"""
...
...
@@ -31,7 +31,7 @@ class NXKeyGen:
def
getEncrypted
(
self
):
"""
Encrypt (scramble) the given password
Keyword arguments:
@return scrambleString -- Scrambled version of the original
password
...
...
@@ -41,7 +41,7 @@ class NXKeyGen:
def
getvalidCharList
(
self
,
pos
):
"""
Valid character list
Keyword arguments:
@return validcharlist -- List of the valid characters
"""
...
...
@@ -60,7 +60,7 @@ class NXKeyGen:
def
encodePassword
(
self
,
p
):
"""
Password encoder
Keyword arguments:
@return sPass -- Encoded password
"""
...
...
@@ -79,7 +79,7 @@ class NXKeyGen:
def
findCharInList
(
self
,
c
):
"""
Character position finder
Keyword arguments:
@param c -- Character that needs to be matched if valid
@return i -- Place where the character is in the valid list
...
...
@@ -91,11 +91,11 @@ class NXKeyGen:
i
=
j
return
i
return
i
def
getRandomValidCharFromList
(
self
):
"""
Random valid character getter
Keyword arguments:
@return char -- Valid character placed 0-60 in the valid list
"""
...
...
@@ -104,7 +104,7 @@ class NXKeyGen:
def
scrambleString
(
self
,
s
):
"""
Password scrambler
Keyword arguments:
@param s -- Password that needs to be scrambled
@return sRet -- NoMachine NX scrambled password
...
...
@@ -136,7 +136,7 @@ class NXKeyGen:
sRet
=
sRet
+
c2
return
escape
(
sRet
)
def
substr_replace
(
self
,
in_str
,
ch
,
pos
,
qt
):
def
substr_replace
(
self
,
in_str
,
ch
,
pos
,
qt
):
"""
Replace a character at a special position
"""
...
...
src/iss/installer/win_install.py
View file @
48fc4f71
...
...
@@ -13,9 +13,10 @@ import shutil
from
win32com.shell
import
shell
,
shellcon
import
windowsclasses
try
:
from
collections
import
*
# noqa
from
collections
import
*
# noqa
except
ImportError
:
from
OrderedDict
import
*
# noqa
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
"""
...
...
@@ -27,10 +28,10 @@ def parse_arguments():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
default
=
"firefox"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
default
=
"firefox"
,
required
=
False
,
choices
=
[
'firefox'
,
'chrome'
,
'iexplore'
,
'opera'
])
'iexplore'
,
'opera'
])
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
...
...
@@ -92,7 +93,7 @@ def main():
try
:
args
=
parse_arguments
()
shortcut
=
pythoncom
.
CoCreateInstance
(
shell
.
CLSID_ShellLink
,
shell
.
CLSID_ShellLink
,
None
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
shell
.
IID_IShellLink
...
...
src/iss/installer/windowsclasses.py
View file @
48fc4f71
...
...
@@ -11,11 +11,11 @@ Currently here:
import
os
import
argparse
import
errno
from
_winreg
import
*
# noqa
from
_winreg
import
*
# noqa
try
:
from
collections
import
*
# noqa
from
collections
import
*
# noqa
except
ImporError
:
from
OrderedDict
import
*
# noqa
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
...
...
@@ -36,7 +36,7 @@ def parse_arguments():
action
=
"store_true"
)
parser
.
add_argument
(
"-r"
,
"--registry"
,
help
=
"Which HKEY_* const registry type the program should use"
,
help
=
"Which HKEY_* const registry type the program should use"
,
type
=
str
,
choices
=
[
'HKLM'
,
'HKCR'
,
'HKCU'
,
'HKU'
,
'HKPD'
,
'HKCC'
],
default
=
"HKLM"
)
args
=
parser
.
parse_args
()
...
...
@@ -116,13 +116,13 @@ class RegistryHandler:
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
needed_rights
=
KEY_ALL_ACCESS
):
""""
Create registry key and value multilevel tree by chained
Create registry key and value multilevel tree by chained
dictionaries.
Can raise AttributeError if the provided dict chain isn't
correct
Keyword arguments:
@param key_value_chain -- The dict chain containing all the
@param key_value_chain -- The dict chain containing all the
information
@param both -- Whether create the registry in WOW64
node too
...
...
@@ -138,19 +138,19 @@ class RegistryHandler:
if
not
DecideArchitecture
.
Is64Windows
():
architect
=
0
connected_registy
=
self
.
connect_registry
()
if
(
isinstance
(
dict_chain
,
dict
)
if
(
isinstance
(
dict_chain
,
dict
)
or
isinstance
(
dict_chain
,
OrderedDict
)):
for
key
,
value
in
dict_chain
.
iteritems
():
if
isinstance
(
value
,
dict
)
or
isinstance
(
value
,
OrderedDict
):
temp_dict
=
OrderedDict
()
for
my_key
,
my_value
in
value
.
iteritems
():
temp_dict
[
key
+
"
\\
"
+
my_key
]
=
my_value
temp_dict
[
key
+
"
\\
"
+
my_key
]
=
my_value
self
.
create_registry_from_dict_chain
(
temp_dict
,
False
,
architect
,
needed_rights
)
else
:
if
isinstance
(
value
,
list
):
if
len
(
value
)
%
2
!=
0
:
#print "Not enough member in the list"
if
len
(
value
)
%
2
!=
0
:
#
print "Not enough member in the list"
raise
AttributeError
else
:
new_key
=
CreateKeyEx
(
...
...
@@ -164,7 +164,7 @@ class RegistryHandler:
my_key
=
None
SetValueEx
(
new_key
,
my_key
,
0
,
REG_SZ
,
my_value
)
else
:
else
:
new_key
=
CreateKeyEx
(
connected_registy
,
key
,
0
,
needed_rights
|
architect
)
...
...
@@ -173,7 +173,7 @@ class RegistryHandler:
print
"The provided attribute wasn't a dictionary chain"
raise
AttributeError
def
get_key
(
self
,
key_name
,
needed_rights
=
KEY_ALL_ACCESS
):
def
get_key
(
self
,
key_name
,
needed_rights
=
KEY_ALL_ACCESS
):
"""
Getting a registry value by it's key's name
Can raise KeyError if key is not found in the registry
...
...
@@ -194,8 +194,8 @@ class RegistryHandler:
connected_registy
=
self
.
connect_registry
()
architect
=
0
if
DecideArchitecture
.
Is64Windows
():
architect
=
KEY_WOW64_64KEY
try
:
architect
=
KEY_WOW64_64KEY
try
:
key
=
OpenKey
(
connected_registy
,
key_name
,
0
,
needed_rights
|
architect
)
except
WindowsError
:
...
...
@@ -222,23 +222,23 @@ class RegistryHandler:
Keyword arguments:
@param key_name -- The specific key name of which subkey's
we are interested in
@param subkey_list -- List containing all the subkeys names
@param subkey_list -- List containing all the subkeys names
which values we are interested in
@param subroutine -- Whether suppress exception about not
having enough results or not
(default: False)
@param depth -- How depth the search should go for
[options: key, subkeys, all]
[options: key, subkeys, all]
(default: subkeys)
@return results{} -- Dictionary with the subkey_name - value
combinations as keys and values
"""
if
depth
==
"key"
:
int_depth
=
0
;
int_depth
=
0
elif
depth
==
"subkeys"
:
int_depth
=
1
;
int_depth
=
1
elif
depth
==
"all"
:
int_depth
=
2
;
int_depth
=
2
else
:
raise
AttributeError
try
:
...
...
src/python/cloud.py
View file @
48fc4f71
...
...
@@ -47,10 +47,10 @@ def parse_arguments():
parser
.
add_argument
(
"-p"
,
"--password"
,
type
=
str
)
parser
.
add_argument
(
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
choices
=
[
'firefox'
,
'chrome'
,
'ie'
,
'opera'
],
default
=
"firefox"
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -108,7 +108,7 @@ class Browser:
vm
.
state
,
vm
.
protocol
=
""
,
"NONE"
try
:
while
vm
.
state
.
upper
()[:
3
]
not
in
(
"FUT"
,
"RUN"
):
element
=
WebDriverWait
(
driver
,
7200
)
.
until
(
WebDriverWait
(
driver
,
7200
)
.
until
(
EC
.
presence_of_element_located
((
By
.
CSS_SELECTOR
,
"#vm-details-pw-eye.fa.fa-eye-slash"
)))
...
...
@@ -132,6 +132,7 @@ class Browser:
raise
return
vm
def
main
():
"""
Main program
...
...
@@ -141,7 +142,7 @@ def main():
if
args
.
uri
is
not
None
:
vm
=
Struct
()
vm
.
protocol
,
vm
.
user
,
vm
.
password
,
vm
.
host
,
vm
.
port
=
\
args
.
uri
.
split
(
':'
,
4
)
args
.
uri
.
split
(
':'
,
4
)
vm
.
protocol
=
vm
.
protocol
.
upper
()
vm
.
state
=
"RUN"
else
:
...
...
src/python/nxkey.py
View file @
48fc4f71
...
...
@@ -22,7 +22,7 @@ class NXKeyGen:
def
__init__
(
self
,
password
):
"""
Initialize the class
Keyword arguments:
@param password -- Password that will be scrambled
"""
...
...
@@ -31,7 +31,7 @@ class NXKeyGen:
def
getEncrypted
(
self
):
"""
Encrypt (scramble) the given password
Keyword arguments:
@return scrambleString -- Scrambled version of the original
password
...
...
@@ -41,7 +41,7 @@ class NXKeyGen:
def
getvalidCharList
(
self
,
pos
):
"""
Valid character list
Keyword arguments:
@return validcharlist -- List of the valid characters
"""
...
...
@@ -60,7 +60,7 @@ class NXKeyGen:
def
encodePassword
(
self
,
p
):
"""
Password encoder
Keyword arguments:
@return sPass -- Encoded password
"""
...
...
@@ -79,7 +79,7 @@ class NXKeyGen:
def
findCharInList
(
self
,
c
):
"""
Character position finder
Keyword arguments:
@param c -- Character that needs to be matched if valid
@return i -- Place where the character is in the valid list
...
...
@@ -91,11 +91,11 @@ class NXKeyGen:
i
=
j
return
i
return
i
def
getRandomValidCharFromList
(
self
):
"""
Random valid character getter
Keyword arguments:
@return char -- Valid character placed 0-60 in the valid list
"""
...
...
@@ -104,7 +104,7 @@ class NXKeyGen:
def
scrambleString
(
self
,
s
):
"""
Password scrambler
Keyword arguments:
@param s -- Password that needs to be scrambled
@return sRet -- NoMachine NX scrambled password
...
...
@@ -136,7 +136,7 @@ class NXKeyGen:
sRet
=
sRet
+
c2
return
escape
(
sRet
)
def
substr_replace
(
self
,
in_str
,
ch
,
pos
,
qt
):
def
substr_replace
(
self
,
in_str
,
ch
,
pos
,
qt
):
"""
Replace a character at a special position
"""
...
...
src/python/win_install.py
View file @
48fc4f71
...
...
@@ -13,9 +13,10 @@ import shutil
from
win32com.shell
import
shell
,
shellcon
import
windowsclasses
try
:
from
collections
import
*
# noqa
from
collections
import
*
# noqa
except
ImportError
:
from
OrderedDict
import
*
# noqa
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
"""
...
...
@@ -27,10 +28,10 @@ def parse_arguments():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"-d"
,
"--driver"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
default
=
"firefox"
,
help
=
"Select webdriver. Aside from Firefox, you have to install "
+
"first the proper driver."
,
type
=
str
,
default
=
"firefox"
,
required
=
False
,
choices
=
[
'firefox'
,
'chrome'
,
'iexplore'
,
'opera'
])
'iexplore'
,
'opera'
])
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
local_default
=
(
windowsclasses
.
DecideArchitecture
.
GetProgramFiles64
()
+
"
\\
CIRCLE
\\
"
)
...
...
@@ -92,7 +93,7 @@ def main():
try
:
args
=
parse_arguments
()
shortcut
=
pythoncom
.
CoCreateInstance
(
shell
.
CLSID_ShellLink
,
shell
.
CLSID_ShellLink
,
None
,
pythoncom
.
CLSCTX_INPROC_SERVER
,
shell
.
IID_IShellLink
...
...
src/python/windowsclasses.py
View file @
48fc4f71
...
...
@@ -11,11 +11,11 @@ Currently here:
import
os
import
argparse
import
errno
from
_winreg
import
*
# noqa
from
_winreg
import
*
# noqa
try
:
from
collections
import
*
# noqa
from
collections
import
*
# noqa
except
ImporError
:
from
OrderedDict
import
*
# noqa
from
OrderedDict
import
*
# noqa
def
parse_arguments
():
...
...
@@ -36,7 +36,7 @@ def parse_arguments():
action
=
"store_true"
)
parser
.
add_argument
(
"-r"
,
"--registry"
,
help
=
"Which HKEY_* const registry type the program should use"
,
help
=
"Which HKEY_* const registry type the program should use"
,
type
=
str
,
choices
=
[
'HKLM'
,
'HKCR'
,
'HKCU'
,
'HKU'
,
'HKPD'
,
'HKCC'
],
default
=
"HKLM"
)
args
=
parser
.
parse_args
()
...
...
@@ -116,13 +116,13 @@ class RegistryHandler:
self
,
dict_chain
,
both
=
False
,
architect
=
KEY_WOW64_64KEY
,
needed_rights
=
KEY_ALL_ACCESS
):
""""
Create registry key and value multilevel tree by chained
Create registry key and value multilevel tree by chained
dictionaries.
Can raise AttributeError if the provided dict chain isn't
correct
Keyword arguments:
@param key_value_chain -- The dict chain containing all the
@param key_value_chain -- The dict chain containing all the
information
@param both -- Whether create the registry in WOW64
node too
...
...
@@ -138,19 +138,19 @@ class RegistryHandler:
if
not
DecideArchitecture
.
Is64Windows
():
architect
=
0
connected_registy
=
self
.
connect_registry
()
if
(
isinstance
(
dict_chain
,
dict
)
if
(
isinstance
(
dict_chain
,
dict
)
or
isinstance
(
dict_chain
,
OrderedDict
)):
for
key
,
value
in
dict_chain
.
iteritems
():
if
isinstance
(
value
,
dict
)
or
isinstance
(
value
,
OrderedDict
):
temp_dict
=
OrderedDict
()
for
my_key
,
my_value
in
value
.
iteritems
():
temp_dict
[
key
+
"
\\
"
+
my_key
]
=
my_value
temp_dict
[
key
+
"
\\
"
+
my_key
]
=
my_value
self
.
create_registry_from_dict_chain
(
temp_dict
,
False
,
architect
,
needed_rights
)
else
:
if
isinstance
(
value
,
list
):
if
len
(
value
)
%
2
!=
0
:
#print "Not enough member in the list"
if
len
(
value
)
%
2
!=
0
:
#
print "Not enough member in the list"
raise
AttributeError
else
:
new_key
=
CreateKeyEx
(
...
...
@@ -164,7 +164,7 @@ class RegistryHandler:
my_key
=
None
SetValueEx
(
new_key
,
my_key
,
0
,
REG_SZ
,
my_value
)
else
:
else
:
new_key
=
CreateKeyEx
(
connected_registy
,
key
,
0
,
needed_rights
|
architect
)
...
...
@@ -173,7 +173,7 @@ class RegistryHandler:
print
"The provided attribute wasn't a dictionary chain"
raise
AttributeError
def
get_key
(
self
,
key_name
,
needed_rights
=
KEY_ALL_ACCESS
):
def
get_key
(
self
,
key_name
,
needed_rights
=
KEY_ALL_ACCESS
):
"""
Getting a registry value by it's key's name
Can raise KeyError if key is not found in the registry
...
...
@@ -194,8 +194,8 @@ class RegistryHandler:
connected_registy
=
self
.
connect_registry
()
architect
=
0
if
DecideArchitecture
.
Is64Windows
():
architect
=
KEY_WOW64_64KEY
try
:
architect
=
KEY_WOW64_64KEY
try
:
key
=
OpenKey
(
connected_registy
,
key_name
,
0
,
needed_rights
|
architect
)
except
WindowsError
:
...
...
@@ -222,23 +222,23 @@ class RegistryHandler:
Keyword arguments:
@param key_name -- The specific key name of which subkey's
we are interested in
@param subkey_list -- List containing all the subkeys names
@param subkey_list -- List containing all the subkeys names
which values we are interested in
@param subroutine -- Whether suppress exception about not
having enough results or not
(default: False)
@param depth -- How depth the search should go for
[options: key, subkeys, all]
[options: key, subkeys, all]
(default: subkeys)
@return results{} -- Dictionary with the subkey_name - value
combinations as keys and values
"""
if
depth
==
"key"
:
int_depth
=
0
;
int_depth
=
0
elif
depth
==
"subkeys"
:
int_depth
=
1
;
int_depth
=
1
elif
depth
==
"all"
:
int_depth
=
2
;
int_depth
=
2
else
:
raise
AttributeError
try
:
...
...
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