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
4a680098
Commit
4a680098
authored
Feb 06, 2017
by
Marcin Bury
Committed by
GitHub
Feb 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #172 from reverse-shell/search-unittests
search command keyword coloring
parents
b3ec1e82
75bbdfde
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
6 deletions
+65
-6
interpreter.py
routersploit/interpreter.py
+13
-5
gxv3611hd_ip_camera_rce.py
...t/modules/exploits/grandstream/gxv3611hd_ip_camera_rce.py
+2
-1
test_interpreter.py
routersploit/test/test_interpreter.py
+50
-0
No files found.
routersploit/interpreter.py
View file @
4a680098
...
...
@@ -457,11 +457,19 @@ class RoutersploitInterpreter(BaseInterpreter):
def
command_exec
(
self
,
*
args
,
**
kwargs
):
os
.
system
(
args
[
0
])
def
command_search
(
self
,
*
args
,
**
kwargs
):
# TODO cover with unit tests
for
arg
in
args
:
matches
=
[
s
for
s
in
self
.
modules
if
arg
in
s
]
for
match
in
matches
:
utils
.
print_info
(
match
.
replace
(
'.'
,
'/'
))
def
command_search
(
self
,
*
args
,
**
kwargs
):
keyword
=
args
[
0
]
if
not
keyword
:
utils
.
print_error
(
"Please specify search keyword. e.g. 'search cisco'"
)
return
for
module
in
self
.
modules
:
if
keyword
in
module
:
module
=
utils
.
humanize_path
(
module
)
utils
.
print_info
(
"{}
\033
[31m{}
\033
[0m{}"
.
format
(
*
module
.
partition
(
keyword
))
)
def
command_exit
(
self
,
*
args
,
**
kwargs
):
raise
EOFError
routersploit/modules/exploits/grandstream/gxv3611hd_ip_camera_rce.py
View file @
4a680098
...
...
@@ -48,7 +48,8 @@ class Exploit(exploits.Exploit):
conn
.
read_until
(
"> "
)
conn
.
write
(
"quit
\r\n
"
)
conn
.
close
()
print_success
(
"SQLI successful, going to telnet into port 20000 with username root and no password to get shell"
)
print_success
(
"SQLI successful, going to telnet into port 20000 "
"with username root and no password to get shell"
)
except
Exception
:
print_error
(
"Exploit failed. Could not log in."
)
...
...
routersploit/test/test_interpreter.py
View file @
4a680098
...
...
@@ -621,6 +621,56 @@ class RoutersploitInterpreterTest(RoutersploitTestCase):
]
)
@mock.patch
(
'routersploit.utils.print_info'
)
def
test_command_search_01
(
self
,
mock_print
):
self
.
interpreter
.
modules
=
[
'exploits.asus.foo'
,
'exploits.asus.bar'
,
'exploits.linksys.baz'
,
'exploits.cisco.foo'
,
]
self
.
interpreter
.
command_search
(
"asus"
)
self
.
assertEqual
(
mock_print
.
mock_calls
,
[
mock
.
call
(
'exploits/
\x1b
[31masus
\x1b
[0m/foo'
),
mock
.
call
(
'exploits/
\x1b
[31masus
\x1b
[0m/bar'
),
]
)
@mock.patch
(
'routersploit.utils.print_info'
)
def
test_command_search_02
(
self
,
mock_print
):
self
.
interpreter
.
modules
=
[
'exploits.asus.foo'
,
'exploits.asus.bar'
,
'exploits.linksys.baz'
,
'exploits.cisco.foo'
,
]
self
.
interpreter
.
command_search
(
"foo"
)
self
.
assertEqual
(
mock_print
.
mock_calls
,
[
mock
.
call
(
'exploits/asus/
\x1b
[31mfoo
\x1b
[0m'
),
mock
.
call
(
'exploits/cisco/
\x1b
[31mfoo
\x1b
[0m'
)
]
)
@mock.patch
(
'routersploit.utils.print_error'
)
def
test_command_search_03
(
self
,
print_error
):
self
.
interpreter
.
modules
=
[
'exploits.asus.foo'
,
'exploits.asus.bar'
,
'exploits.linksys.baz'
,
'exploits.cisco.foo'
,
]
self
.
interpreter
.
command_search
(
""
)
self
.
assertEqual
(
print_error
.
mock_calls
,
[
mock
.
call
(
"Please specify search keyword. e.g. 'search cisco'"
),
]
)
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