-
Notifications
You must be signed in to change notification settings - Fork 0
/
RadamsaFuzz.py
30 lines (25 loc) · 962 Bytes
/
RadamsaFuzz.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
#!/usr/bin/env python
import xml.etree.cElementTree as ET
import subprocess
import string
import re
import sys
import random
def radamsa_random():
text = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for i in range(1, (random.randint(1, 200))))
output = subprocess.check_output('echo "' + text + '" | radamsa', shell=True).decode('utf-8','ignore')
return output
def create_files():
if len(sys.argv) < 2 or len(sys.argv) > 2:
print "USAGE: " + sys.argv[0] + " number_of_files_to_make"
sys.exit()
else:
if sys.argv[1] != "":
for i in range(1, int(sys.argv[1])+ 1):
root = ET.Element("root")
doc = ET.SubElement(root, "document")
ET.SubElement(doc, "subsection1", name="subs1").text = radamsa_random()
ET.SubElement(doc, "subsection2", name="subs2").text = radamsa_random()
tree = ET.ElementTree(root)
tree.write("/root/Desktop/RadamsaFiles/file" + str(i) + ".xml")
create_files()