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
67357be3
Commit
67357be3
authored
Apr 18, 2016
by
fwkz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding 'verbose' kwarg to print_*() functions.
parent
095f2a10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
18 deletions
+15
-18
ssh_bruteforce.py
routersploit/modules/creds/ssh_bruteforce.py
+6
-12
utils.py
routersploit/utils.py
+9
-6
No files found.
routersploit/modules/creds/ssh_bruteforce.py
View file @
67357be3
...
...
@@ -30,10 +30,9 @@ class Exploit(exploits.Exploit):
threads
=
exploits
.
Option
(
8
,
'Number of threads'
)
usernames
=
exploits
.
Option
(
'admin'
,
'Username or file with usernames (file://)'
)
passwords
=
exploits
.
Option
(
wordlists
.
passwords
,
'Password or file with passwords (file://)'
)
verbosity
=
exploits
.
Option
(
'yes'
,
'Display authentication attempts'
)
verbosity
=
exploits
.
Option
(
True
,
'Display authentication attempts'
)
credentials
=
[]
verb
=
None
def
run
(
self
):
self
.
credentials
=
[]
...
...
@@ -60,7 +59,6 @@ class Exploit(exploits.Exploit):
else
:
passwords
=
[
self
.
passwords
]
self
.
verb
=
self
.
verbosity
.
lower
()
collection
=
LockedIterator
(
itertools
.
product
(
usernames
,
passwords
))
self
.
run_threads
(
self
.
threads
,
self
.
target_function
,
collection
)
...
...
@@ -72,12 +70,12 @@ class Exploit(exploits.Exploit):
print_error
(
"Credentials not found"
)
def
target_function
(
self
,
running
,
data
):
module_verbosity
=
bool
(
self
.
verbosity
)
name
=
threading
.
current_thread
()
.
name
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
if
self
.
verb
==
'yes'
:
print_status
(
name
,
'thread is starting...'
)
print_status
(
name
,
'thread is starting...'
,
verbose
=
module_verbosity
)
while
running
.
is_set
():
try
:
...
...
@@ -89,16 +87,12 @@ class Exploit(exploits.Exploit):
break
except
paramiko
.
ssh_exception
.
SSHException
as
err
:
ssh
.
close
()
if
self
.
verb
==
'yes'
:
print_error
(
name
,
err
,
user
,
password
)
print_error
(
name
,
err
,
user
,
password
,
verbose
=
module_verbosity
)
else
:
running
.
clear
()
if
self
.
verb
==
'yes'
:
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
)
print_success
(
"{}: Authentication succeed!"
.
format
(
name
),
user
,
password
,
verbose
=
module_verbosity
)
self
.
credentials
.
append
((
user
,
password
))
if
self
.
verb
==
'yes'
:
print_status
(
name
,
'thread is terminated.'
)
print_status
(
name
,
'thread is terminated.'
,
verbose
=
module_verbosity
)
routersploit/utils.py
View file @
67357be3
...
...
@@ -92,6 +92,9 @@ def __cprint(*args, **kwargs):
Signature like Python 3 print() function
print([object, ...][, sep=' '][, end='
\n
'][, file=sys.stdout])
"""
if
not
kwargs
.
get
(
"verbose"
,
True
):
return
with
print_lock
:
color
=
kwargs
.
get
(
'color'
,
None
)
if
color
:
...
...
@@ -105,16 +108,16 @@ def __cprint(*args, **kwargs):
print
(
*
args
,
**
kwargs
)
def
print_error
(
*
args
):
__cprint
(
'
\033
[91m[-]
\033
[0m'
,
*
args
)
def
print_error
(
*
args
,
**
kwargs
):
__cprint
(
'
\033
[91m[-]
\033
[0m'
,
*
args
,
**
kwargs
)
def
print_status
(
*
args
):
__cprint
(
'
\033
[94m[*]
\033
[0m'
,
*
args
)
def
print_status
(
*
args
,
**
kwargs
):
__cprint
(
'
\033
[94m[*]
\033
[0m'
,
*
args
,
**
kwargs
)
def
print_success
(
*
args
):
__cprint
(
'
\033
[92m[+]
\033
[0m'
,
*
args
)
def
print_success
(
*
args
,
**
kwargs
):
__cprint
(
'
\033
[92m[+]
\033
[0m'
,
*
args
,
**
kwargs
)
def
print_info
(
*
args
,
**
kwargs
):
...
...
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