|
40 | 40 | from subprocess import Popen as execute |
41 | 41 | from xml.dom import minidom |
42 | 42 | from xml.sax import parse |
| 43 | +from xml.sax import SAXParseException |
43 | 44 |
|
44 | 45 | from extra.cloak.cloak import decloak |
45 | 46 | from extra.safe2bin.safe2bin import safecharencode |
|
77 | 78 | from lib.core.exception import SqlmapDataException |
78 | 79 | from lib.core.exception import SqlmapGenericException |
79 | 80 | from lib.core.exception import SqlmapNoneDataException |
| 81 | +from lib.core.exception import SqlmapInstallationException |
80 | 82 | from lib.core.exception import SqlmapMissingDependence |
81 | 83 | from lib.core.exception import SqlmapSilentQuitException |
82 | 84 | from lib.core.exception import SqlmapSyntaxException |
@@ -1758,8 +1760,14 @@ def parseXmlFile(xmlFile, handler): |
1758 | 1760 | Parses XML file by a given handler |
1759 | 1761 | """ |
1760 | 1762 |
|
1761 | | - with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream: |
1762 | | - parse(stream, handler) |
| 1763 | + try: |
| 1764 | + with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream: |
| 1765 | + parse(stream, handler) |
| 1766 | + except (SAXParseException, UnicodeError), ex: |
| 1767 | + errMsg = "something seems to be wrong with " |
| 1768 | + errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, ex) |
| 1769 | + errMsg += "sure that you haven't made any changes to it" |
| 1770 | + raise SqlmapInstallationException, errMsg |
1763 | 1771 |
|
1764 | 1772 | def getSQLSnippet(dbms, sfile, **variables): |
1765 | 1773 | """ |
|
0 commit comments