From 7d7170fc97f5409c4f17b28661ecaa52ece5ff97 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Mon, 17 Nov 2008 00:13:49 +0000 Subject: [PATCH] Minor code adjustments --- lib/parse/headers.py | 12 +++++------- lib/parse/html.py | 6 ++---- lib/techniques/inband/union/use.py | 3 +-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/parse/headers.py b/lib/parse/headers.py index 2a768eb0b..00fa2dae8 100644 --- a/lib/parse/headers.py +++ b/lib/parse/headers.py @@ -26,23 +26,20 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import re -from xml.sax import parse -from xml.sax.handler import ContentHandler - from lib.core.common import checkFile -from lib.core.common import sanitizeStr from lib.core.data import kb from lib.core.data import paths from lib.parse.banner import BannerHandler + def headersParser(headers): """ This function calls a class that parses the input HTTP headers to fingerprint the back-end database management system operating system - and web application technology + and the web application technology """ - topHeaders = { + topHeaders = ( "cookie", "microsoftsharepointteamservices", "server", @@ -50,8 +47,9 @@ def headersParser(headers): "www-authenticate", "x-aspnet-version", "x-powered-by", - } + ) for header in headers: if header in topHeaders: + # TODO: fill me pass diff --git a/lib/parse/html.py b/lib/parse/html.py index 237f6596f..80cd9d601 100644 --- a/lib/parse/html.py +++ b/lib/parse/html.py @@ -63,15 +63,13 @@ class htmlHandler(ContentHandler): self.__match = None -def htmlParser(page, xmlfile=None): +def htmlParser(page): """ This function calls a class that parses the input HTML page to fingerprint the back-end database management system """ - if not xmlfile: - xmlfile = paths.ERRORS_XML - + xmlfile = paths.ERRORS_XML checkFile(xmlfile) page = sanitizeStr(page) handler = htmlHandler(page) diff --git a/lib/techniques/inband/union/use.py b/lib/techniques/inband/union/use.py index b700846b5..b6241603f 100644 --- a/lib/techniques/inband/union/use.py +++ b/lib/techniques/inband/union/use.py @@ -31,7 +31,6 @@ from lib.core.common import randomStr from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger -from lib.core.data import paths from lib.core.data import temp from lib.core.exception import sqlmapUnsupportedDBMSException from lib.core.session import setUnion @@ -74,7 +73,7 @@ def __unionPosition(count, expression): # HTML code of the result page because, for instance, it is there # when the query is wrong and the back-end DBMS is Microsoft SQL # server - htmlParsed = htmlParser(resultPage, paths.ERRORS_XML) + htmlParsed = htmlParser(resultPage) if randQuery in resultPage and not htmlParsed: setUnion(position=exprPosition)