From 10b0639a964603332337013c4f4c3e76671c87f2 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 4 Jun 2012 09:24:46 +0000 Subject: [PATCH] making a "--exact" switch on demand (choosing exact identifier names by default instead of LIKE) --- lib/core/optiondict.py | 1 + lib/parse/cmdline.py | 4 ++++ plugins/generic/misc.py | 8 ++++---- sqlmap.conf | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 2442a959d..c08c565eb 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -188,6 +188,7 @@ optDict = { "checkPayload": "boolean", "cleanup": "boolean", "dependencies": "boolean", + "exact": "boolean", "googlePage": "integer", "mobile": "boolean", "pageRank": "boolean", diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 7b3331ceb..4cece08d5 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -596,6 +596,10 @@ def cmdLineParser(): action="store_true", help="Check for missing sqlmap dependencies") + miscellaneous.add_option("--exact", dest="exact", + action="store_true", + help="Prefer usage of exact names for provided identificators") + miscellaneous.add_option("--gpage", dest="googlePage", type="int", help="Use Google dork results from specified page number") diff --git a/plugins/generic/misc.py b/plugins/generic/misc.py index a4ae73f6b..82c0a68db 100644 --- a/plugins/generic/misc.py +++ b/plugins/generic/misc.py @@ -171,12 +171,12 @@ class Miscellaneous: message += "[1] as LIKE %s names (default)\n" % what message += "[2] as exact %s names" % what - choice = readInput(message, default="1") + choice = readInput(message, default='1') if not conf.exact else '2' - if not choice or choice == "1": - choice = "1" + if not choice or choice == '1': + choice = '1' condParam = " LIKE '%%%s%%'" - elif choice == "2": + elif choice == '2': condParam = "='%s'" else: errMsg = "invalid value" diff --git a/sqlmap.conf b/sqlmap.conf index b79284422..7706c790a 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -635,6 +635,10 @@ cleanup = False # Valid: True or False dependencies = False +# Prefer usage of exact names for provided identificators. +# Valid: True or False +exact = False + # Use Google dork results from specified page number. # Valid: integer # Default: 1