-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathadder.py
70 lines (63 loc) · 2.4 KB
/
adder.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
from optparse import OptionParser
import json
class Adder:
def __init__(self):
self.dangerous_characters = [ # You can add dangerous characters here
">",
"'",
'"',
"<",
"/",
";"
]
def add_payload(self,payload=None,filename=None):
if filename:
with open(val.filename, 'r') as payloads:
payloads = payloads.readlines()
if val.waf:
val.waf = val.waf.lower()
for payload in payloads:
new_data = {
"Payload": payload,
"Attribute": [],
"count": 0,
"waf": val.waf
}
for char in payload:
if char in self.dangerous_characters:
if char in new_data['Attribute']:
pass
else:
new_data['Attribute'].append(char)
f = open('payloads.json')
data = json.load(f)
data.append(new_data)
with open('payloads.json', "w") as write_data:
json.dump(data, write_data, indent=4)
print("[+] PAYLOAD HAS BEEN ADDED")
else:
if val.waf:
val.waf = val.waf.lower()
new_data = {
"Payload": val.payload,
"Attribute": [],
"count": 0,
"waf": val.waf
}
for char in val.payload:
if char in self.dangerous_characters:
new_data['Attribute'].append(char)
# print(new_data)
f = open('payloads.json')
data = json.load(f)
data.append(new_data)
with open('payloads.json', "w") as write_data:
json.dump(data, write_data, indent=4)
print("[+] PAYLOAD HAS BEEN ADDED")
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-p", dest="payload", help="enter payload")
parser.add_option("-f", dest="filename", help="enter filename containing all the payloads")
parser.add_option("-w", dest="waf", help="enter waf name")
val, args = parser.parse_args()
Adder().add_payload(filename=val.filename,payload=val.payload)