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
82d3e58d
Commit
82d3e58d
authored
Jan 21, 2019
by
Steven Aldinger
Committed by
Marcin Bury
Jan 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support noninteractive mode (#556)
* support noninteractive mode * fix linter error in travis build
parent
58a2eda8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
interpreter.py
routersploit/interpreter.py
+34
-0
No files found.
routersploit/interpreter.py
View file @
82d3e58d
...
@@ -4,6 +4,7 @@ import atexit
...
@@ -4,6 +4,7 @@ import atexit
import
itertools
import
itertools
import
os
import
os
import
sys
import
sys
import
getopt
import
traceback
import
traceback
from
collections
import
Counter
from
collections
import
Counter
...
@@ -220,6 +221,8 @@ class RoutersploitInterpreter(BaseInterpreter):
...
@@ -220,6 +221,8 @@ class RoutersploitInterpreter(BaseInterpreter):
self
.
modules_count
.
update
([
module
.
split
(
'.'
)[
0
]
for
module
in
self
.
modules
])
self
.
modules_count
.
update
([
module
.
split
(
'.'
)[
0
]
for
module
in
self
.
modules
])
self
.
main_modules_dirs
=
[
module
for
module
in
os
.
listdir
(
MODULES_DIR
)
if
not
module
.
startswith
(
"__"
)]
self
.
main_modules_dirs
=
[
module
for
module
in
os
.
listdir
(
MODULES_DIR
)
if
not
module
.
startswith
(
"__"
)]
self
.
__handle_if_noninteractive
(
sys
.
argv
[
1
:])
self
.
__parse_prompt
()
self
.
__parse_prompt
()
self
.
banner
=
""" ______ _ _____ _ _ _
self
.
banner
=
""" ______ _ _____ _ _ _
...
@@ -256,6 +259,37 @@ class RoutersploitInterpreter(BaseInterpreter):
...
@@ -256,6 +259,37 @@ class RoutersploitInterpreter(BaseInterpreter):
module_prompt_template
=
os
.
getenv
(
"RSF_MODULE_PROMPT"
,
module_prompt_default_template
)
.
replace
(
'
\\
033'
,
'
\033
'
)
module_prompt_template
=
os
.
getenv
(
"RSF_MODULE_PROMPT"
,
module_prompt_default_template
)
.
replace
(
'
\\
033'
,
'
\033
'
)
self
.
module_prompt_template
=
module_prompt_template
if
all
(
map
(
lambda
x
:
x
in
module_prompt_template
,
[
'{host}'
,
"{module}"
]))
else
module_prompt_default_template
self
.
module_prompt_template
=
module_prompt_template
if
all
(
map
(
lambda
x
:
x
in
module_prompt_template
,
[
'{host}'
,
"{module}"
]))
else
module_prompt_default_template
def
__handle_if_noninteractive
(
self
,
argv
):
noninteractive
=
False
module
=
''
set_opts
=
[]
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"hxm:s:"
,
[
"module="
,
"set="
])
except
getopt
.
GetoptError
:
print
(
'rsf.py -m <module>'
)
sys
.
exit
(
2
)
for
opt
,
arg
in
opts
:
if
opt
==
'-h'
:
print
(
'msf.py -x -m <module> -s "<option> <value"'
)
sys
.
exit
(
0
)
elif
opt
==
'-x'
:
noninteractive
=
True
elif
opt
in
(
"-m"
,
"--module"
):
module
=
arg
elif
opt
in
(
"-s"
,
"--set"
):
set_opts
.
append
(
arg
)
if
noninteractive
:
self
.
command_use
(
module
)
for
opt
in
set_opts
:
self
.
command_set
(
opt
)
self
.
command_exploit
()
sys
.
exit
(
0
)
@property
@property
def
module_metadata
(
self
):
def
module_metadata
(
self
):
return
getattr
(
self
.
current_module
,
"_{}__info__"
.
format
(
self
.
current_module
.
__class__
.
__name__
))
return
getattr
(
self
.
current_module
,
"_{}__info__"
.
format
(
self
.
current_module
.
__class__
.
__name__
))
...
...
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