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
a248808a
Commit
a248808a
authored
Apr 22, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command "exit"
parent
8c8662ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
interpreter.py
routersploit/interpreter.py
+6
-4
test_completer.py
routersploit/test/test_completer.py
+3
-3
test_interpreter.py
routersploit/test/test_interpreter.py
+6
-2
No files found.
routersploit/interpreter.py
View file @
a248808a
...
...
@@ -87,8 +87,7 @@ class BaseInterpreter(object):
except
RoutersploitException
as
err
:
utils
.
print_error
(
err
)
except
KeyboardInterrupt
:
print
()
utils
.
print_status
(
"routersploit stopped"
)
utils
.
print_status
(
"
\n
routersploit stopped"
)
break
def
complete
(
self
,
text
,
state
):
...
...
@@ -259,9 +258,9 @@ class RoutersploitInterpreter(BaseInterpreter):
:return: list of most accurate command suggestions
"""
if
self
.
current_module
:
return
[
'run'
,
'back'
,
'set '
,
'show '
,
'check'
,
'debug'
]
return
[
'run'
,
'back'
,
'set '
,
'show '
,
'check'
,
'debug'
,
'exit'
]
else
:
return
[
'use '
,
'debug'
]
return
[
'use '
,
'debug'
,
'exit'
]
def
command_back
(
self
,
*
args
,
**
kwargs
):
self
.
current_module
=
None
...
...
@@ -382,3 +381,5 @@ class RoutersploitInterpreter(BaseInterpreter):
utils
.
print_info
(
key
)
utils
.
print_error
(
value
,
'
\n
'
)
def
command_exit
(
self
,
*
args
,
**
kwargs
):
raise
KeyboardInterrupt
\ No newline at end of file
routersploit/test/test_completer.py
View file @
a248808a
...
...
@@ -22,7 +22,7 @@ class RoutersploitCompleterTest(unittest.TestCase):
def
assertPrompt
(
self
,
*
args
):
value
=
''
.
join
(
args
)
self
.
rsf
.
expect_exact
(
value
,
timeout
=
0.5
)
self
.
rsf
.
expect_exact
(
value
,
timeout
=
1
)
def
set_module
(
self
):
self
.
rsf
.
send
(
"use creds/ftp_bruteforce
\r\n
"
)
...
...
@@ -30,7 +30,7 @@ class RoutersploitCompleterTest(unittest.TestCase):
def
test_raw_commands_no_module
(
self
):
self
.
rsf
.
send
(
"
\t\t
"
)
self
.
assertPrompt
(
'debug use
\r\n
'
,
self
.
raw_prompt
)
self
.
assertPrompt
(
'debug
exit
use
\r\n
'
,
self
.
raw_prompt
)
def
test_complete_use_raw
(
self
):
self
.
rsf
.
send
(
"u
\t\t
"
)
...
...
@@ -87,7 +87,7 @@ class RoutersploitCompleterTest(unittest.TestCase):
self
.
set_module
()
self
.
rsf
.
send
(
"
\t\t
"
)
self
.
assertPrompt
(
'back check debug run set show
\r\n
'
,
'back check debug
exit
run set show
\r\n
'
,
self
.
module_prompt
(
'FTP Bruteforce'
)
)
...
...
routersploit/test/test_interpreter.py
View file @
a248808a
...
...
@@ -197,14 +197,14 @@ class RoutersploitInterpreterTest(unittest.TestCase):
def
test_suggested_commands_with_loaded_module
(
self
):
self
.
assertEqual
(
self
.
interpreter
.
suggested_commands
(),
[
'run'
,
'back'
,
'set '
,
'show '
,
'check'
,
'debug'
]
# Extra space at the end because of following param
[
'run'
,
'back'
,
'set '
,
'show '
,
'check'
,
'debug'
,
'exit'
]
# Extra space at the end because of following param
)
def
test_suggested_commands_without_loaded_module
(
self
):
self
.
interpreter
.
current_module
=
None
self
.
assertEqual
(
self
.
interpreter
.
suggested_commands
(),
# Extra space at the end because of following param
[
'use '
,
'debug'
]
[
'use '
,
'debug'
,
'exit'
]
)
@mock.patch
(
'importlib.import_module'
)
...
...
@@ -567,5 +567,9 @@ class RoutersploitInterpreterTest(unittest.TestCase):
]
)
def
test_command_exit
(
self
):
with
self
.
assertRaises
(
KeyboardInterrupt
):
self
.
interpreter
.
command_exit
()
if
__name__
==
'__main__'
:
unittest
.
main
()
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