From 8abcdae1b5af61b13ffa6b811ac42dbff9a76f64 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 30 Sep 2010 19:45:23 +0000 Subject: [PATCH] some update --- lib/controller/controller.py | 4 ++++ lib/core/exception.py | 4 ++++ plugins/generic/enumeration.py | 14 +++++++++++++- sqlmap.py | 7 +++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/controller/controller.py b/lib/controller/controller.py index f0c7ee92d..9d0c0849b 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -39,6 +39,7 @@ from lib.core.data import kb from lib.core.data import logger from lib.core.exception import exceptionsTuple from lib.core.exception import sqlmapNotVulnerableException +from lib.core.exception import sqlmapUserQuitException from lib.core.session import setInjection from lib.core.target import initTargetEnv from lib.core.target import setupTargetEnv @@ -279,6 +280,9 @@ def start(): checkForParenthesis() action() + except sqlmapUserQuitException: + raise + except exceptionsTuple, e: e = getUnicode(e) diff --git a/lib/core/exception.py b/lib/core/exception.py index 557e23185..76c864e2e 100644 --- a/lib/core/exception.py +++ b/lib/core/exception.py @@ -55,6 +55,9 @@ class sqlmapNoneDataException(Exception): class sqlmapNotVulnerableException(Exception): pass +class sqlmapUserQuitException(Exception): + pass + class sqlmapRegExprException(Exception): pass @@ -93,6 +96,7 @@ exceptionsTuple = ( sqlmapMissingDependence, sqlmapMissingMandatoryOptionException, sqlmapNoneDataException, + sqlmapUserQuitException, sqlmapRegExprException, sqlmapSyntaxException, sqlmapUndefinedMethod, diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index e64fed64a..256373ccc 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -42,11 +42,13 @@ from lib.core.convert import utf8decode 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 queries from lib.core.data import temp from lib.core.exception import sqlmapMissingMandatoryOptionException from lib.core.exception import sqlmapNoneDataException from lib.core.exception import sqlmapUnsupportedFeatureException +from lib.core.exception import sqlmapUserQuitException from lib.core.session import setOs from lib.core.settings import SQL_STATEMENTS from lib.core.shell import autoCompletion @@ -695,7 +697,17 @@ class Enumeration: if kb.dbms == "MySQL" and not kb.data.has_information_schema: errMsg = "information_schema not available, " errMsg += "back-end DBMS is MySQL < 5.0" - raise sqlmapUnsupportedFeatureException, errMsg + logger.error(errMsg) + + message = "do you want to use common table existance check? [Y/n/q]" + test = readInput(message, default="Y") + + if test[0] in ("n", "N"): + return + elif test[0] in ("q", "Q"): + raise sqlmapUserQuitException + else: + return self.tableExists(paths.COMMON_TABLES) self.forceDbmsEnum() diff --git a/sqlmap.py b/sqlmap.py index 31399d776..5342bd245 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -51,6 +51,7 @@ from lib.core.data import conf from lib.core.data import logger from lib.core.data import paths from lib.core.exception import exceptionsTuple +from lib.core.exception import sqlmapUserQuitException from lib.core.exception import unhandledException from lib.core.option import init from lib.core.profiling import profile @@ -93,6 +94,12 @@ def main(): liveTest() else: start() + + except sqlmapUserQuitException: + errMsg = "user quit" + logger.error(errMsg) + closeDumper(False, errMsg) + except exceptionsTuple, e: e = getUnicode(e) logger.critical(e)