Implementation for an Issue #128

This commit is contained in:
Miroslav Stampar 2012-10-05 10:24:09 +02:00
parent 098e446ca4
commit ebc7088f94
6 changed files with 30 additions and 11 deletions

View File

@ -218,3 +218,8 @@ class PAYLOAD:
ORIGINAL = 1 ORIGINAL = 1
NEGATIVE = 2 NEGATIVE = 2
REPLACE = 3 REPLACE = 3
class WIZARD:
BASIC = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba")
SMART = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getUsers", "getDbs", "getTables", "getSchema", "excludeSysDbs")
ALL = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getHostname", "getUsers", "getPasswordHashes", "getPrivileges", "getRoles", "dumpAll")

View File

@ -67,6 +67,7 @@ from lib.core.enums import PAYLOAD
from lib.core.enums import PRIORITY from lib.core.enums import PRIORITY
from lib.core.enums import PROXYTYPE from lib.core.enums import PROXYTYPE
from lib.core.enums import REFLECTIVE_COUNTER from lib.core.enums import REFLECTIVE_COUNTER
from lib.core.enums import WIZARD
from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapFilePathException from lib.core.exception import sqlmapFilePathException
from lib.core.exception import sqlmapGenericException from lib.core.exception import sqlmapGenericException
@ -1382,6 +1383,9 @@ def __cleanupOptions():
if conf.string: if conf.string:
conf.string = conf.string.decode("unicode_escape") conf.string = conf.string.decode("unicode_escape")
if conf.getAll:
map(lambda x: conf.__setitem__(x, True), WIZARD.ALL)
threadData = getCurrentThreadData() threadData = getCurrentThreadData()
threadData.reset() threadData.reset()
@ -1613,6 +1617,7 @@ def __useWizardInterface():
conf.risk = 1 conf.risk = 1
conf.level = 1 conf.level = 1
if not conf.getAll:
choice = None choice = None
while choice is None or choice not in ("", "1", "2", "3"): while choice is None or choice not in ("", "1", "2", "3"):
@ -1621,11 +1626,11 @@ def __useWizardInterface():
choice = readInput(message, default='1') choice = readInput(message, default='1')
if choice == '2': if choice == '2':
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getDbs', 'getTables', 'getSchema', 'excludeSysDbs']) map(lambda x: conf.__setitem__(x, True), WIZARD.SMART)
elif choice == '3': elif choice == '3':
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getPasswordHashes', 'getPrivileges', 'getRoles', 'dumpAll']) map(lambda x: conf.__setitem__(x, True), WIZARD.ALL)
else: else:
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba']) map(lambda x: conf.__setitem__(x, True), WIZARD.BASIC)
logger.debug("muting sqlmap.. it will do the magic for you") logger.debug("muting sqlmap.. it will do the magic for you")
conf.verbose = 0 conf.verbose = 0

View File

@ -96,6 +96,7 @@ optDict = {
}, },
"Enumeration": { "Enumeration": {
"getAll": "boolean",
"getBanner": ("boolean", "Banners"), "getBanner": ("boolean", "Banners"),
"getCurrentUser": ("boolean", "Users"), "getCurrentUser": ("boolean", "Users"),
"getCurrentDb": ("boolean", "Databases"), "getCurrentDb": ("boolean", "Databases"),

View File

@ -183,6 +183,7 @@ BASIC_HELP_ITEMS = (
"level", "level",
"risk", "risk",
"tech", "tech",
"getAll",
"getBanner", "getBanner",
"getCurrentUser", "getCurrentUser",
"getCurrentDb", "getCurrentDb",

View File

@ -302,6 +302,9 @@ def cmdLineParser():
"and data contained in the tables. Moreover " "and data contained in the tables. Moreover "
"you can run your own SQL statements") "you can run your own SQL statements")
enumeration.add_option("-a", "--all", dest="getAll",
action="store_true", help="Retrieve everything")
enumeration.add_option("-b", "--banner", dest="getBanner", enumeration.add_option("-b", "--banner", dest="getBanner",
action="store_true", help="Retrieve DBMS banner") action="store_true", help="Retrieve DBMS banner")

View File

@ -324,6 +324,10 @@ extensiveFp = False
# tables. Moreover you can run your own SQL statements. # tables. Moreover you can run your own SQL statements.
[Enumeration] [Enumeration]
# Retrieve everything
# Valid: True or False
getAll = False
# Retrieve back-end database management system banner. # Retrieve back-end database management system banner.
# Valid: True or False # Valid: True or False
getBanner = False getBanner = False