fix for Bug #164 (Proper usage of special characters in paths)

This commit is contained in:
Miroslav Stampar 2010-04-16 15:46:31 +00:00
parent bece99908c
commit 1bdf94f236
4 changed files with 12 additions and 8 deletions

View File

@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import re import re
from StringIO import StringIO
from xml.sax import parse from xml.sax import parse
from xml.sax.handler import ContentHandler from xml.sax.handler import ContentHandler
@ -121,11 +122,11 @@ def bannerParser(banner):
if kb.dbms == "Microsoft SQL Server": if kb.dbms == "Microsoft SQL Server":
handler = MSSQLBannerHandler(banner, kb.bannerFp) handler = MSSQLBannerHandler(banner, kb.bannerFp)
parse(xmlfile, handler) parse(StringIO(open(xmlfile).read()), handler)
handler = FingerprintHandler(banner, kb.bannerFp) handler = FingerprintHandler(banner, kb.bannerFp)
parse(paths.GENERIC_XML, handler) parse(StringIO(open(paths.GENERIC_XML).read()), handler)
else: else:
handler = FingerprintHandler(banner, kb.bannerFp) handler = FingerprintHandler(banner, kb.bannerFp)
parse(xmlfile, handler) parse(StringIO(open(xmlfile).read()), handler)
parse(paths.GENERIC_XML, handler) parse(StringIO(open(paths.GENERIC_XML).read()), handler)

View File

@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os import os
from StringIO import StringIO
from xml.sax import parse from xml.sax import parse
from lib.core.common import checkFile from lib.core.common import checkFile
@ -63,5 +64,5 @@ def headersParser(headers):
handler = FingerprintHandler(value, kb.headersFp) handler = FingerprintHandler(value, kb.headersFp)
parse(xmlfile, handler) parse(StringIO(open(xmlfile).read()), handler)
parse(paths.GENERIC_XML, handler) parse(StringIO(open(paths.GENERIC_XML).read()), handler)

View File

@ -24,6 +24,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import re import re
from StringIO import StringIO
from xml.sax import parse from xml.sax import parse
from xml.sax.handler import ContentHandler from xml.sax.handler import ContentHandler
@ -68,7 +69,7 @@ def htmlParser(page):
checkFile(xmlfile) checkFile(xmlfile)
page = sanitizeStr(page) page = sanitizeStr(page)
handler = htmlHandler(page) handler = htmlHandler(page)
parse(xmlfile, handler) parse(StringIO(open(xmlfile).read()), handler)
if handler.dbms and handler.dbms not in kb.htmlFp: if handler.dbms and handler.dbms not in kb.htmlFp:
kb.htmlFp.append(handler.dbms) kb.htmlFp.append(handler.dbms)

View File

@ -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 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
""" """
from StringIO import StringIO
from xml.sax import parse from xml.sax import parse
from xml.sax.handler import ContentHandler from xml.sax.handler import ContentHandler
@ -234,4 +235,4 @@ def queriesParser():
checkFile(xmlfile) checkFile(xmlfile)
handler = queriesHandler() handler = queriesHandler()
parse(open(xmlfile), handler) parse(StringIO(open(xmlfile).read()), handler)