Some more Python 3.9 patching

This commit is contained in:
Miroslav Stampar 2020-02-28 14:24:50 +01:00
parent 44b7cc7d17
commit 2a1e812288

View File

@ -44,7 +44,7 @@ def parseXmlNode(node):
for element in node.findall("boundary"):
boundary = AttribDict()
for child in element.getchildren():
for child in element:
if child.text:
values = cleanupVals(child.text, child.tag)
boundary[child.tag] = values
@ -56,18 +56,18 @@ def parseXmlNode(node):
for element in node.findall("test"):
test = AttribDict()
for child in element.getchildren():
for child in element:
if child.text and child.text.strip():
values = cleanupVals(child.text, child.tag)
test[child.tag] = values
else:
if len(child.getchildren()) == 0:
if len(child.findall("*")) == 0:
test[child.tag] = None
continue
else:
test[child.tag] = AttribDict()
for gchild in child.getchildren():
for gchild in child:
if gchild.tag in test[child.tag]:
prevtext = test[child.tag][gchild.tag]
test[child.tag][gchild.tag] = [prevtext, gchild.text]
@ -77,6 +77,15 @@ def parseXmlNode(node):
conf.tests.append(test)
def loadBoundaries():
"""
Loads boundaries from XML
>>> conf.boundaries = []
>>> loadBoundaries()
>>> len(conf.boundaries) > 0
True
"""
try:
doc = et.parse(paths.BOUNDARIES_XML)
except Exception as ex:
@ -89,6 +98,15 @@ def loadBoundaries():
parseXmlNode(root)
def loadPayloads():
"""
Loads payloads/tests from XML
>>> conf.tests = []
>>> loadPayloads()
>>> len(conf.tests) > 0
True
"""
for payloadFile in PAYLOAD_XML_FILES:
payloadFilePath = os.path.join(paths.SQLMAP_XML_PAYLOADS_PATH, payloadFile)