Commit 095f2a10 by Marcin Bury

SSH verbosity option

parent 13fafdab
...@@ -30,8 +30,10 @@ class Exploit(exploits.Exploit): ...@@ -30,8 +30,10 @@ 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 = []
verb = None
def run(self): def run(self):
self.credentials = [] self.credentials = []
...@@ -58,6 +60,7 @@ class Exploit(exploits.Exploit): ...@@ -58,6 +60,7 @@ class Exploit(exploits.Exploit):
else: else:
passwords = [self.passwords] passwords = [self.passwords]
self.verb = self.verbosity.lower()
collection = LockedIterator(itertools.product(usernames, passwords)) collection = LockedIterator(itertools.product(usernames, passwords))
self.run_threads(self.threads, self.target_function, collection) self.run_threads(self.threads, self.target_function, collection)
...@@ -73,6 +76,7 @@ class Exploit(exploits.Exploit): ...@@ -73,6 +76,7 @@ class Exploit(exploits.Exploit):
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, 'thread is starting...') print_status(name, 'thread is starting...')
while running.is_set(): while running.is_set():
...@@ -85,10 +89,16 @@ class Exploit(exploits.Exploit): ...@@ -85,10 +89,16 @@ class Exploit(exploits.Exploit):
break break
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, user, password) print_error(name, err, user, password)
else: else:
running.clear() running.clear()
if self.verb == 'yes':
print_success("{}: Authentication succeed!".format(name), user, password) 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, 'thread is terminated.') print_status(name, 'thread is terminated.')
...@@ -29,8 +29,10 @@ class Exploit(exploits.Exploit): ...@@ -29,8 +29,10 @@ class Exploit(exploits.Exploit):
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://)')
verbosity = exploits.Option('yes', 'Display authentication attempts')
credentials = [] credentials = []
verb = None
def run(self): def run(self):
self.credentials = [] self.credentials = []
...@@ -52,6 +54,7 @@ class Exploit(exploits.Exploit): ...@@ -52,6 +54,7 @@ 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)
...@@ -67,6 +70,7 @@ class Exploit(exploits.Exploit): ...@@ -67,6 +70,7 @@ class Exploit(exploits.Exploit):
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...') print_status(name, 'process is starting...')
while running.is_set(): while running.is_set():
...@@ -79,10 +83,16 @@ class Exploit(exploits.Exploit): ...@@ -79,10 +83,16 @@ class Exploit(exploits.Exploit):
break break
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)) 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) 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.') print_status(name, 'process is terminated.')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment