@@ -44,7 +44,7 @@ def parseXmlNode(node):
4444 for element in node .findall ("boundary" ):
4545 boundary = AttribDict ()
4646
47- for child in element . getchildren () :
47+ for child in element :
4848 if child .text :
4949 values = cleanupVals (child .text , child .tag )
5050 boundary [child .tag ] = values
@@ -56,18 +56,18 @@ def parseXmlNode(node):
5656 for element in node .findall ("test" ):
5757 test = AttribDict ()
5858
59- for child in element . getchildren () :
59+ for child in element :
6060 if child .text and child .text .strip ():
6161 values = cleanupVals (child .text , child .tag )
6262 test [child .tag ] = values
6363 else :
64- if len (child .getchildren ( )) == 0 :
64+ if len (child .findall ( "*" )) == 0 :
6565 test [child .tag ] = None
6666 continue
6767 else :
6868 test [child .tag ] = AttribDict ()
6969
70- for gchild in child . getchildren () :
70+ for gchild in child :
7171 if gchild .tag in test [child .tag ]:
7272 prevtext = test [child .tag ][gchild .tag ]
7373 test [child .tag ][gchild .tag ] = [prevtext , gchild .text ]
@@ -77,6 +77,15 @@ def parseXmlNode(node):
7777 conf .tests .append (test )
7878
7979def loadBoundaries ():
80+ """
81+ Loads boundaries from XML
82+
83+ >>> conf.boundaries = []
84+ >>> loadBoundaries()
85+ >>> len(conf.boundaries) > 0
86+ True
87+ """
88+
8089 try :
8190 doc = et .parse (paths .BOUNDARIES_XML )
8291 except Exception as ex :
@@ -89,6 +98,15 @@ def loadBoundaries():
8998 parseXmlNode (root )
9099
91100def loadPayloads ():
101+ """
102+ Loads payloads/tests from XML
103+
104+ >>> conf.tests = []
105+ >>> loadPayloads()
106+ >>> len(conf.tests) > 0
107+ True
108+ """
109+
92110 for payloadFile in PAYLOAD_XML_FILES :
93111 payloadFilePath = os .path .join (paths .SQLMAP_XML_PAYLOADS_PATH , payloadFile )
94112
0 commit comments