Loads queries from 'xml/queries.xml' file.
()
| 178 | WindowsError = None |
| 179 | |
| 180 | def _loadQueries(): |
| 181 | """ |
| 182 | Loads queries from 'xml/queries.xml' file. |
| 183 | """ |
| 184 | |
| 185 | def iterate(node, retVal=None): |
| 186 | class DictObject(object): |
| 187 | def __init__(self): |
| 188 | self.__dict__ = {} |
| 189 | |
| 190 | def __contains__(self, name): |
| 191 | return name in self.__dict__ |
| 192 | |
| 193 | if retVal is None: |
| 194 | retVal = DictObject() |
| 195 | |
| 196 | for child in node.findall("*"): |
| 197 | instance = DictObject() |
| 198 | retVal.__dict__[child.tag] = instance |
| 199 | if child.attrib: |
| 200 | instance.__dict__.update(child.attrib) |
| 201 | else: |
| 202 | iterate(child, instance) |
| 203 | |
| 204 | return retVal |
| 205 | |
| 206 | tree = ElementTree() |
| 207 | try: |
| 208 | tree.parse(paths.QUERIES_XML) |
| 209 | except Exception as ex: |
| 210 | errMsg = "something appears to be wrong with " |
| 211 | errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex)) |
| 212 | errMsg += "sure that you haven't made any changes to it" |
| 213 | raise SqlmapInstallationException(errMsg) |
| 214 | |
| 215 | for node in tree.findall("*"): |
| 216 | queries[node.attrib['value']] = iterate(node) |
| 217 | |
| 218 | def _setMultipleTargets(): |
| 219 | """ |
no test coverage detected
searching dependent graphs…