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
bd731f2d
Commit
bd731f2d
authored
May 13, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renaming widgets to validators
parent
f427143c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
28 deletions
+28
-28
__init__.py
routersploit/__init__.py
+1
-1
exploits.py
routersploit/exploits.py
+6
-6
gateway_auth_bypass.py
routersploit/modules/exploits/2wire/gateway_auth_bypass.py
+2
-2
ar_804_gu_rce.py
routersploit/modules/exploits/asmax/ar_804_gu_rce.py
+2
-2
test_exploits.py
routersploit/test/test_exploits.py
+12
-12
test_validators.py
routersploit/test/test_validators.py
+5
-5
validators.py
routersploit/validators.py
+0
-0
No files found.
routersploit/__init__.py
View file @
bd731f2d
...
...
@@ -16,5 +16,5 @@ from routersploit.utils import (
from
routersploit
import
exploits
from
routersploit
import
wordlists
from
routersploit
import
widget
s
from
routersploit
import
validator
s
routersploit/exploits.py
View file @
bd731f2d
...
...
@@ -9,11 +9,11 @@ from routersploit.utils import print_status, NonStringIterable
class
Option
(
object
):
""" Exploit attribute that is set by the end user. """
def
__init__
(
self
,
default
,
description
=
""
,
widget
s
=
()):
if
isinstance
(
widget
s
,
NonStringIterable
):
self
.
widgets
=
widget
s
def
__init__
(
self
,
default
,
description
=
""
,
validator
s
=
()):
if
isinstance
(
validator
s
,
NonStringIterable
):
self
.
validators
=
validator
s
else
:
self
.
widgets
=
(
widget
s
,)
self
.
validators
=
(
validator
s
,)
self
.
default
=
self
.
_apply_widgets
(
default
)
self
.
description
=
description
...
...
@@ -26,8 +26,8 @@ class Option(object):
self
.
data
[
instance
]
=
self
.
_apply_widgets
(
value
)
def
_apply_widgets
(
self
,
value
):
for
widget
in
self
.
widget
s
:
value
=
widget
(
value
)
for
validator
in
self
.
validator
s
:
value
=
validator
(
value
)
return
value
...
...
routersploit/modules/exploits/2wire/gateway_auth_bypass.py
View file @
bd731f2d
...
...
@@ -5,7 +5,7 @@ from routersploit import (
print_info
,
http_request
,
mute
,
widget
s
,
validator
s
,
)
...
...
@@ -32,7 +32,7 @@ class Exploit(exploits.Exploit):
],
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
,
widgets
=
widget
s
.
url
)
# target address
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
,
validators
=
validator
s
.
url
)
# target address
port
=
exploits
.
Option
(
80
,
'Target port'
)
# default port
def
run
(
self
):
...
...
routersploit/modules/exploits/asmax/ar_804_gu_rce.py
View file @
bd731f2d
...
...
@@ -8,7 +8,7 @@ from routersploit import (
http_request
,
random_text
,
mute
,
widget
s
,
validator
s
,
)
...
...
@@ -34,7 +34,7 @@ class Exploit(exploits.Exploit):
],
}
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
,
widgets
=
widget
s
.
url
)
target
=
exploits
.
Option
(
''
,
'Target address e.g. http://192.168.1.1'
,
validators
=
validator
s
.
url
)
port
=
exploits
.
Option
(
80
,
'Target Port'
)
def
run
(
self
):
...
...
routersploit/test/test_exploits.py
View file @
bd731f2d
...
...
@@ -27,16 +27,16 @@ class TestExploitBar(Exploit):
paa
=
Option
(
default
=
4
,
description
=
"description_four"
)
class
TestExploitWith
Widget
s
(
Exploit
):
doo
=
Option
(
default
=
"default_value"
,
description
=
"description_three"
,
widget
s
=
suffix
)
paa
=
Option
(
default
=
"default_value"
,
description
=
"description_three"
,
widget
s
=
(
suffix
,
SUFFIX
))
class
TestExploitWith
Validator
s
(
Exploit
):
doo
=
Option
(
default
=
"default_value"
,
description
=
"description_three"
,
validator
s
=
suffix
)
paa
=
Option
(
default
=
"default_value"
,
description
=
"description_three"
,
validator
s
=
(
suffix
,
SUFFIX
))
class
OptionTest
(
RoutersploitTestCase
):
def
setUp
(
self
):
self
.
exploit_foo
=
TestExploitFoo
()
self
.
exploit_bar
=
TestExploitBar
()
self
.
exploit_with_
widgets
=
TestExploitWithWidget
s
()
self
.
exploit_with_
validators
=
TestExploitWithValidator
s
()
def
test_default_value
(
self
):
""" Test if default value is properly set. """
...
...
@@ -55,16 +55,16 @@ class OptionTest(RoutersploitTestCase):
self
.
assertEqual
(
self
.
exploit_bar
.
doo
,
3
)
self
.
assertEqual
(
self
.
exploit_bar
.
paa
,
4
)
def
test_if_
widget
_is_applied_on_default_value
(
self
):
self
.
assertEqual
(
self
.
exploit_with_
widget
s
.
doo
,
"default_value_suffix"
)
def
test_if_
validator
_is_applied_on_default_value
(
self
):
self
.
assertEqual
(
self
.
exploit_with_
validator
s
.
doo
,
"default_value_suffix"
)
def
test_if_
widget
_is_applied_after_setting_value
(
self
):
self
.
exploit_with_
widget
s
.
doo
=
"new_value"
self
.
assertEqual
(
self
.
exploit_with_
widget
s
.
doo
,
"new_value_suffix"
)
def
test_if_
validator
_is_applied_after_setting_value
(
self
):
self
.
exploit_with_
validator
s
.
doo
=
"new_value"
self
.
assertEqual
(
self
.
exploit_with_
validator
s
.
doo
,
"new_value_suffix"
)
def
test_if_
widget
_is_applied_in_specific_order
(
self
):
self
.
exploit_with_
widget
s
.
paa
=
"new_value"
self
.
assertEqual
(
self
.
exploit_with_
widget
s
.
paa
,
"new_value_suffix_SUFFIX"
)
def
test_if_
validator
_is_applied_in_specific_order
(
self
):
self
.
exploit_with_
validator
s
.
paa
=
"new_value"
self
.
assertEqual
(
self
.
exploit_with_
validator
s
.
paa
,
"new_value_suffix_SUFFIX"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
...
...
routersploit/test/test_
widget
s.py
→
routersploit/test/test_
validator
s.py
View file @
bd731f2d
...
...
@@ -6,18 +6,18 @@ except ImportError:
import
mock
from
routersploit.test
import
RoutersploitTestCase
from
routersploit
import
widget
s
from
routersploit
import
validator
s
class
Widget
sTest
(
RoutersploitTestCase
):
class
Validator
sTest
(
RoutersploitTestCase
):
def
test_url_adding_http_prefix
(
self
):
self
.
assertEqual
(
widget
s
.
url
(
"127.0.0.1"
),
"http://127.0.0.1"
)
self
.
assertEqual
(
validator
s
.
url
(
"127.0.0.1"
),
"http://127.0.0.1"
)
def
test_url_already_with_http_prefix
(
self
):
self
.
assertEqual
(
widget
s
.
url
(
"http://127.0.0.1"
),
"http://127.0.0.1"
)
self
.
assertEqual
(
validator
s
.
url
(
"http://127.0.0.1"
),
"http://127.0.0.1"
)
def
test_url_already_with_https_prefix
(
self
):
self
.
assertEqual
(
widget
s
.
url
(
"https://127.0.0.1"
),
"https://127.0.0.1"
)
self
.
assertEqual
(
validator
s
.
url
(
"https://127.0.0.1"
),
"https://127.0.0.1"
)
if
__name__
==
'__main__'
:
...
...
routersploit/
widget
s.py
→
routersploit/
validator
s.py
View file @
bd731f2d
File moved
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