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
66be5de2
Commit
66be5de2
authored
Jul 03, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'show' command available globally
parent
ac339a95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
interpreter.py
routersploit/interpreter.py
+4
-2
test_completer.py
routersploit/test/test_completer.py
+1
-1
test_interpreter.py
routersploit/test/test_interpreter.py
+15
-3
No files found.
routersploit/interpreter.py
View file @
66be5de2
...
...
@@ -255,7 +255,7 @@ class RoutersploitInterpreter(BaseInterpreter):
return
itertools
.
chain
(
module_commands
,
(
'unsetg '
,))
return
module_commands
else
:
return
[
'use '
,
'exec'
,
'help'
,
'exit'
]
return
[
'use '
,
'exec'
,
'help'
,
'exit'
,
'show '
]
def
command_back
(
self
,
*
args
,
**
kwargs
):
self
.
current_module
=
None
...
...
@@ -352,6 +352,7 @@ class RoutersploitInterpreter(BaseInterpreter):
else
:
yield
opt_key
,
opt_value
,
opt_description
@utils.module_required
def
_show_info
(
self
,
*
args
,
**
kwargs
):
utils
.
pprint_dict_in_order
(
self
.
module_metadata
,
...
...
@@ -359,6 +360,7 @@ class RoutersploitInterpreter(BaseInterpreter):
)
utils
.
print_info
()
@utils.module_required
def
_show_options
(
self
,
*
args
,
**
kwargs
):
target_opts
=
{
'port'
,
'target'
}
module_opts
=
set
(
self
.
current_module
.
options
)
-
target_opts
...
...
@@ -373,6 +375,7 @@ class RoutersploitInterpreter(BaseInterpreter):
utils
.
print_info
()
@utils.module_required
def
_show_devices
(
self
,
*
args
,
**
kwargs
):
# TODO: cover with tests
try
:
devices
=
self
.
current_module
.
_Exploit__info__
[
'devices'
]
...
...
@@ -389,7 +392,6 @@ class RoutersploitInterpreter(BaseInterpreter):
except
KeyError
:
print
(
"
\n
Target devices are not defined"
)
@utils.module_required
def
command_show
(
self
,
*
args
,
**
kwargs
):
sub_commands
=
(
'info'
,
'options'
,
'devices'
)
sub_command
=
args
[
0
]
...
...
routersploit/test/test_completer.py
View file @
66be5de2
...
...
@@ -32,7 +32,7 @@ class RoutersploitCompleterTest(RoutersploitTestCase):
def
test_raw_commands_no_module
(
self
):
self
.
rsf
.
send
(
"
\t\t
"
)
self
.
assertPrompt
(
'exec
exit help use
\r\n
'
,
self
.
raw_prompt
)
self
.
assertPrompt
(
'exec
exit help show use
\r\n
'
,
self
.
raw_prompt
)
def
test_complete_use_raw
(
self
):
self
.
rsf
.
send
(
"u
\t\t
"
)
...
...
routersploit/test/test_interpreter.py
View file @
66be5de2
...
...
@@ -266,7 +266,7 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
self
.
interpreter
.
current_module
=
None
self
.
assertEqual
(
self
.
interpreter
.
suggested_commands
(),
# Extra space at the end because of following param
[
'use '
,
'exec'
,
'help'
,
'exit'
]
[
'use '
,
'exec'
,
'help'
,
'exit'
,
'show '
]
)
@mock.patch
(
'importlib.import_module'
)
...
...
@@ -491,9 +491,21 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
"module_required"
)
def
test_if_command_show_has_module_required_decorator
(
self
):
def
test_if_command_show_
info_
has_module_required_decorator
(
self
):
self
.
assertIsDecorated
(
self
.
interpreter
.
command_show
,
self
.
interpreter
.
_show_info
,
"module_required"
)
def
test_if_command_show_options_has_module_required_decorator
(
self
):
self
.
assertIsDecorated
(
self
.
interpreter
.
_show_options
,
"module_required"
)
def
test_if_command_show_devices_has_module_required_decorator
(
self
):
self
.
assertIsDecorated
(
self
.
interpreter
.
_show_devices
,
"module_required"
)
...
...
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