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
77598c95
Commit
77598c95
authored
Jun 26, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applying validators to GLOBAL_OPTS when switching between modules.
parent
cdbb42ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
exploits.py
routersploit/exploits.py
+9
-1
interpreter.py
routersploit/interpreter.py
+4
-7
No files found.
routersploit/exploits.py
View file @
77598c95
...
...
@@ -24,7 +24,15 @@ class Option(object):
self
.
data
=
WeakKeyDictionary
()
def
__get__
(
self
,
instance
,
owner
):
return
self
.
data
.
get
(
instance
,
GLOBAL_OPTS
.
get
(
self
.
label
,
self
.
default
))
try
:
return
self
.
data
[
instance
]
except
KeyError
:
pass
try
:
return
self
.
_apply_widgets
(
GLOBAL_OPTS
[
self
.
label
])
except
KeyError
:
return
self
.
default
def
__set__
(
self
,
instance
,
value
):
self
.
data
[
instance
]
=
self
.
_apply_widgets
(
value
)
...
...
routersploit/interpreter.py
View file @
77598c95
...
...
@@ -293,6 +293,8 @@ class RoutersploitInterpreter(BaseInterpreter):
key
,
_
,
value
=
args
[
0
]
.
partition
(
' '
)
if
key
in
self
.
current_module
.
options
:
setattr
(
self
.
current_module
,
key
,
value
)
if
kwargs
.
get
(
"global"
,
False
):
GLOBAL_OPTS
[
key
]
=
value
utils
.
print_success
({
key
:
value
})
else
:
utils
.
print_error
(
"You can't set option '{}'.
\n
"
...
...
@@ -307,13 +309,8 @@ class RoutersploitInterpreter(BaseInterpreter):
@utils.module_required
def
command_setg
(
self
,
*
args
,
**
kwargs
):
key
,
_
,
value
=
args
[
0
]
.
partition
(
' '
)
if
key
in
self
.
current_module
.
options
:
GLOBAL_OPTS
[
key
]
=
value
utils
.
print_success
({
key
:
value
})
else
:
utils
.
print_error
(
"You can't set option '{}'.
\n
"
"Available options: {}"
.
format
(
key
,
self
.
current_module
.
options
))
kwargs
[
'global'
]
=
True
self
.
command_set
(
*
args
,
**
kwargs
)
@utils.stop_after
(
2
)
def
complete_setg
(
self
,
text
,
*
args
,
**
kwargs
):
...
...
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