diff --git a/lib/parse/banner.py b/lib/parse/banner.py index 1779e7d02..127fa6d44 100644 --- a/lib/parse/banner.py +++ b/lib/parse/banner.py @@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import re +from StringIO import StringIO from xml.sax import parse from xml.sax.handler import ContentHandler @@ -121,11 +122,11 @@ def bannerParser(banner): if kb.dbms == "Microsoft SQL Server": handler = MSSQLBannerHandler(banner, kb.bannerFp) - parse(xmlfile, handler) + parse(StringIO(open(xmlfile).read()), handler) handler = FingerprintHandler(banner, kb.bannerFp) - parse(paths.GENERIC_XML, handler) + parse(StringIO(open(paths.GENERIC_XML).read()), handler) else: handler = FingerprintHandler(banner, kb.bannerFp) - parse(xmlfile, handler) - parse(paths.GENERIC_XML, handler) + parse(StringIO(open(xmlfile).read()), handler) + parse(StringIO(open(paths.GENERIC_XML).read()), handler) diff --git a/lib/parse/headers.py b/lib/parse/headers.py index 3c4459e65..6fa0af714 100644 --- a/lib/parse/headers.py +++ b/lib/parse/headers.py @@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import os +from StringIO import StringIO from xml.sax import parse from lib.core.common import checkFile @@ -63,5 +64,5 @@ def headersParser(headers): handler = FingerprintHandler(value, kb.headersFp) - parse(xmlfile, handler) - parse(paths.GENERIC_XML, handler) + parse(StringIO(open(xmlfile).read()), handler) + parse(StringIO(open(paths.GENERIC_XML).read()), handler) diff --git a/lib/parse/html.py b/lib/parse/html.py index 234377829..9ce1d946a 100644 --- a/lib/parse/html.py +++ b/lib/parse/html.py @@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import re +from StringIO import StringIO from xml.sax import parse from xml.sax.handler import ContentHandler @@ -68,7 +69,7 @@ def htmlParser(page): checkFile(xmlfile) page = sanitizeStr(page) handler = htmlHandler(page) - parse(xmlfile, handler) + parse(StringIO(open(xmlfile).read()), handler) if handler.dbms and handler.dbms not in kb.htmlFp: kb.htmlFp.append(handler.dbms) diff --git a/lib/parse/queriesfile.py b/lib/parse/queriesfile.py index 619c97890..97badf7ff 100644 --- a/lib/parse/queriesfile.py +++ b/lib/parse/queriesfile.py @@ -22,6 +22,7 @@ with sqlmap; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ +from StringIO import StringIO from xml.sax import parse from xml.sax.handler import ContentHandler @@ -234,4 +235,4 @@ def queriesParser(): checkFile(xmlfile) handler = queriesHandler() - parse(open(xmlfile), handler) + parse(StringIO(open(xmlfile).read()), handler)