Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
routersploit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
czos-dpend
routersploit
Commits
4e556a3f
Commit
4e556a3f
authored
Jul 18, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing flake8 violations within core
parent
34297343
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
28 additions
and
44 deletions
+28
-44
__init__.py
routersploit/__init__.py
+1
-1
exceptions.py
routersploit/exceptions.py
+1
-2
interpreter.py
routersploit/interpreter.py
+3
-3
shell.py
routersploit/shell.py
+0
-0
__init__.py
routersploit/test/__init__.py
+1
-2
test_case.py
routersploit/test/test_case.py
+2
-3
test_exploits.py
routersploit/test/test_exploits.py
+0
-6
test_interpreter.py
routersploit/test/test_interpreter.py
+5
-5
test_utils.py
routersploit/test/test_utils.py
+1
-2
test_validators.py
routersploit/test/test_validators.py
+0
-1
utils.py
routersploit/utils.py
+13
-18
__init__.py
routersploit/wordlists/__init__.py
+1
-1
No files found.
routersploit/__init__.py
View file @
4e556a3f
...
@@ -19,4 +19,4 @@ from routersploit.utils import (
...
@@ -19,4 +19,4 @@ from routersploit.utils import (
from
routersploit
import
exploits
from
routersploit
import
exploits
from
routersploit
import
wordlists
from
routersploit
import
wordlists
from
routersploit
import
validators
from
routersploit
import
validators
from
routersploit.shell
import
shell
from
routersploit.shell
import
shell
routersploit/exceptions.py
View file @
4e556a3f
...
@@ -3,4 +3,4 @@ class RoutersploitException(Exception):
...
@@ -3,4 +3,4 @@ class RoutersploitException(Exception):
class
OptionValidationError
(
RoutersploitException
):
class
OptionValidationError
(
RoutersploitException
):
pass
pass
\ No newline at end of file
routersploit/interpreter.py
View file @
4e556a3f
...
@@ -356,9 +356,9 @@ class RoutersploitInterpreter(BaseInterpreter):
...
@@ -356,9 +356,9 @@ class RoutersploitInterpreter(BaseInterpreter):
@utils.module_required
@utils.module_required
def
_show_info
(
self
,
*
args
,
**
kwargs
):
def
_show_info
(
self
,
*
args
,
**
kwargs
):
utils
.
pprint_dict_in_order
(
utils
.
pprint_dict_in_order
(
self
.
module_metadata
,
self
.
module_metadata
,
(
"name"
,
"description"
,
"devices"
,
"authors"
,
"references"
),
(
"name"
,
"description"
,
"devices"
,
"authors"
,
"references"
),
)
)
utils
.
print_info
()
utils
.
print_info
()
@utils.module_required
@utils.module_required
...
...
routersploit/shell.py
View file @
4e556a3f
This diff is collapsed.
Click to expand it.
routersploit/test/__init__.py
View file @
4e556a3f
from
routersploit.test.test_case
import
RoutersploitTestCase
from
routersploit.test.test_case
import
RoutersploitTestCase
\ No newline at end of file
routersploit/test/test_case.py
View file @
4e556a3f
...
@@ -14,11 +14,11 @@ class RoutersploitTestCase(unittest.TestCase):
...
@@ -14,11 +14,11 @@ class RoutersploitTestCase(unittest.TestCase):
decorator_name
,
decorator_name
,
decorator_list
,
decorator_list
,
msg
=
"'{}' method should be decorated with 'module_required'"
.
format
(
function
.
__name__
)
msg
=
"'{}' method should be decorated with 'module_required'"
.
format
(
function
.
__name__
)
)
)
def
assertIsSequence
(
self
,
arg
):
def
assertIsSequence
(
self
,
arg
):
self
.
assertEqual
(
self
.
assertEqual
(
True
,
True
,
isinstance
(
arg
,
NonStringIterable
),
isinstance
(
arg
,
NonStringIterable
),
"'{}' is not a sequence"
.
format
(
arg
)
"'{}' is not a sequence"
.
format
(
arg
)
)
)
\ No newline at end of file
routersploit/test/test_exploits.py
View file @
4e556a3f
import
unittest
import
unittest
try
:
import
unittest.mock
as
mock
except
ImportError
:
import
mock
from
routersploit.test
import
RoutersploitTestCase
from
routersploit.test
import
RoutersploitTestCase
from
routersploit.exploits
import
Exploit
,
Option
,
GLOBAL_OPTS
from
routersploit.exploits
import
Exploit
,
Option
,
GLOBAL_OPTS
...
@@ -86,4 +81,3 @@ class OptionTest(RoutersploitTestCase):
...
@@ -86,4 +81,3 @@ class OptionTest(RoutersploitTestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
routersploit/test/test_interpreter.py
View file @
4e556a3f
...
@@ -382,8 +382,9 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
...
@@ -382,8 +382,9 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
mock
.
call
(
'authors_desc'
),
mock
.
call
(
'authors_desc'
),
mock
.
call
(
'
\n
References:'
),
mock
.
call
(
'
\n
References:'
),
mock
.
call
(
'references_desc'
),
mock
.
call
(
'references_desc'
),
mock
.
call
()]
mock
.
call
()
)
]
)
@mock.patch
(
'__builtin__.print'
)
@mock.patch
(
'__builtin__.print'
)
def
test_command_show_info_module_with_no_metadata
(
self
,
mock_print
):
def
test_command_show_info_module_with_no_metadata
(
self
,
mock_print
):
...
@@ -395,9 +396,8 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
...
@@ -395,9 +396,8 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
self
.
interpreter
.
_show_info
()
self
.
interpreter
.
_show_info
()
self
.
assertEqual
(
self
.
assertEqual
(
mock_print
.
mock_calls
,
mock_print
.
mock_calls
,
[
[
mock
.
call
()]
mock
.
call
()]
)
)
@mock.patch
(
'__builtin__.print'
)
@mock.patch
(
'__builtin__.print'
)
def
test_show_options
(
self
,
mock_print
):
def
test_show_options
(
self
,
mock_print
):
...
...
routersploit/test/test_utils.py
View file @
4e556a3f
...
@@ -53,4 +53,4 @@ class UtilsTest(RoutersploitTestCase):
...
@@ -53,4 +53,4 @@ class UtilsTest(RoutersploitTestCase):
)
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
\ No newline at end of file
routersploit/test/test_validators.py
View file @
4e556a3f
import
unittest
import
unittest
import
socket
try
:
try
:
import
unittest.mock
as
mock
import
unittest.mock
as
mock
...
...
routersploit/utils.py
View file @
4e556a3f
...
@@ -25,10 +25,10 @@ MODULES_DIR = rsf_modules.__path__[0]
...
@@ -25,10 +25,10 @@ MODULES_DIR = rsf_modules.__path__[0]
print_lock
=
threading
.
Lock
()
print_lock
=
threading
.
Lock
()
colors
=
{
colors
=
{
'grey'
:
30
,
'red'
:
31
,
'grey'
:
30
,
'red'
:
31
,
'green'
:
32
,
'yellow'
:
33
,
'green'
:
32
,
'yellow'
:
33
,
'blue'
:
34
,
'magenta'
:
35
,
'blue'
:
34
,
'magenta'
:
35
,
'cyan'
:
36
,
'white'
:
37
,
'cyan'
:
36
,
'white'
:
37
,
}
}
# Disable certificate verification warnings
# Disable certificate verification warnings
...
@@ -148,7 +148,8 @@ def stop_after(space_number):
...
@@ -148,7 +148,8 @@ def stop_after(space_number):
class
DummyFile
(
object
):
class
DummyFile
(
object
):
""" Mocking file object. Optimalization for the "mute" decorator. """
""" Mocking file object. Optimalization for the "mute" decorator. """
def
write
(
self
,
x
):
pass
def
write
(
self
,
x
):
pass
def
mute
(
fn
):
def
mute
(
fn
):
...
@@ -390,9 +391,9 @@ def pprint_dict_in_order(dictionary, order=None):
...
@@ -390,9 +391,9 @@ def pprint_dict_in_order(dictionary, order=None):
prettyprint
(
rest_keys
,
dictionary
[
rest_keys
])
prettyprint
(
rest_keys
,
dictionary
[
rest_keys
])
def
random_text
(
length
,
alph
=
string
.
ascii_letters
+
string
.
digits
):
def
random_text
(
length
,
alph
=
string
.
ascii_letters
+
string
.
digits
):
""" Random text generator. NOT crypto safe.
""" Random text generator. NOT crypto safe.
Generates random text with specified length and alphabet.
Generates random text with specified length and alphabet.
"""
"""
return
''
.
join
(
random
.
choice
(
alph
)
for
_
in
range
(
length
))
return
''
.
join
(
random
.
choice
(
alph
)
for
_
in
range
(
length
))
...
@@ -460,29 +461,24 @@ def posix_shell(chan):
...
@@ -460,29 +461,24 @@ def posix_shell(chan):
while
(
True
):
while
(
True
):
r
,
w
,
e
=
select
.
select
([
chan
,
sys
.
stdin
],
[],
[])
r
,
w
,
e
=
select
.
select
([
chan
,
sys
.
stdin
],
[],
[])
if
(
chan
in
r
)
:
if
chan
in
r
:
try
:
try
:
x
=
unicode
(
chan
.
recv
(
1024
))
x
=
unicode
(
chan
.
recv
(
1024
))
if
len
(
x
)
==
0
:
if
(
len
(
x
)
==
0
):
break
break
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
write
(
x
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
except
socket
.
timeout
:
except
socket
.
timeout
:
pass
pass
if
(
sys
.
stdin
in
r
)
:
if
sys
.
stdin
in
r
:
x
=
sys
.
stdin
.
read
(
1
)
x
=
sys
.
stdin
.
read
(
1
)
if
len
(
x
)
==
0
:
if
(
len
(
x
)
==
0
):
break
break
chan
.
send
(
x
)
chan
.
send
(
x
)
finally
:
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
oldtty
)
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
oldtty
)
return
return
def
windows_shell
(
chan
):
def
windows_shell
(
chan
):
...
@@ -532,4 +528,3 @@ def tokenize(token_specification, text):
...
@@ -532,4 +528,3 @@ def tokenize(token_specification, text):
else
:
else
:
column
=
mo
.
start
()
-
line_start
column
=
mo
.
start
()
-
line_start
yield
Token
(
kind
,
value
,
line_num
,
column
,
mo
)
yield
Token
(
kind
,
value
,
line_num
,
column
,
mo
)
routersploit/wordlists/__init__.py
View file @
4e556a3f
...
@@ -4,4 +4,4 @@ import pkg_resources
...
@@ -4,4 +4,4 @@ import pkg_resources
defaults
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'defaults.txt'
)
defaults
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'defaults.txt'
)
passwords
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'passwords.txt'
)
passwords
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'passwords.txt'
)
usernames
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'usernames.txt'
)
usernames
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'usernames.txt'
)
snmp
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'snmp.txt'
)
snmp
=
'file://'
+
pkg_resources
.
resource_filename
(
__name__
,
'snmp.txt'
)
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