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
2ab8d86e
Commit
2ab8d86e
authored
Apr 24, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multi_run() as a decorator.
parent
117843d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
32 deletions
+38
-32
__init__.py
routersploit/__init__.py
+1
-0
http_basic_default.py
routersploit/modules/creds/http_basic_default.py
+5
-32
utils.py
routersploit/utils.py
+32
-0
No files found.
routersploit/__init__.py
View file @
2ab8d86e
...
...
@@ -10,6 +10,7 @@ from routersploit.utils import (
http_request
,
boolify
,
mute
,
multi
,
)
from
routersploit
import
exploits
...
...
routersploit/modules/creds/http_basic_default.py
View file @
2ab8d86e
...
...
@@ -11,7 +11,8 @@ from routersploit import (
print_table
,
sanitize_url
,
boolify
,
http_request
http_request
,
multi
)
...
...
@@ -38,38 +39,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
self
.
credentials
=
[]
self
.
attack
()
if
self
.
target
.
startswith
(
'file://'
):
self
.
multi_run
()
else
:
self
.
single_run
()
def
multi_run
(
self
):
original_target
=
self
.
target
original_port
=
self
.
port
_
,
_
,
feed_path
=
self
.
target
.
partition
(
"file://"
)
try
:
file_handler
=
open
(
feed_path
,
'r'
)
except
IOError
:
print_error
(
"Could not read file: {}"
.
format
(
self
.
target
))
return
for
target
in
file_handler
:
target
=
target
.
strip
()
if
not
target
:
continue
self
.
target
,
_
,
port
=
target
.
partition
(
':'
)
if
port
:
self
.
port
=
port
print_status
(
"Attack against: {}:{}"
.
format
(
self
.
target
,
self
.
port
))
self
.
single_run
()
self
.
target
=
original_target
self
.
port
=
original_port
file_handler
.
close
()
def
single_run
(
self
):
@multi
def
attack
(
self
):
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
response
=
http_request
(
"GET"
,
url
)
...
...
routersploit/utils.py
View file @
2ab8d86e
...
...
@@ -104,6 +104,38 @@ def mute(fn):
return
wrapper
def
multi
(
fn
):
@wraps
(
fn
)
def
wrapper
(
self
,
*
args
,
**
kwargs
):
if
self
.
target
.
startswith
(
'file://'
):
original_target
=
self
.
target
original_port
=
self
.
port
_
,
_
,
feed_path
=
self
.
target
.
partition
(
"file://"
)
try
:
file_handler
=
open
(
feed_path
,
'r'
)
except
IOError
:
print_error
(
"Could not read file: {}"
.
format
(
self
.
target
))
return
for
target
in
file_handler
:
target
=
target
.
strip
()
if
not
target
:
continue
self
.
target
,
_
,
port
=
target
.
partition
(
':'
)
if
port
:
self
.
port
=
port
print_status
(
"Attack against: {}:{}"
.
format
(
self
.
target
,
self
.
port
))
fn
(
self
,
*
args
,
**
kwargs
)
self
.
target
=
original_target
self
.
port
=
original_port
file_handler
.
close
()
return
fn
(
self
,
*
args
,
**
kwargs
)
else
:
return
fn
(
self
,
*
args
,
**
kwargs
)
return
wrapper
def
__cprint
(
*
args
,
**
kwargs
):
""" Color print()
...
...
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