Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebc7088

Browse files
committed
Implementation for an Issue #128
1 parent 098e446 commit ebc7088

6 files changed

Lines changed: 30 additions & 11 deletions

File tree

lib/core/enums.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,8 @@ class WHERE:
218218
ORIGINAL = 1
219219
NEGATIVE = 2
220220
REPLACE = 3
221+
222+
class WIZARD:
223+
BASIC = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba")
224+
SMART = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getUsers", "getDbs", "getTables", "getSchema", "excludeSysDbs")
225+
ALL = ("getBanner", "getCurrentUser", "getCurrentDb", "isDba", "getHostname", "getUsers", "getPasswordHashes", "getPrivileges", "getRoles", "dumpAll")

lib/core/option.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from lib.core.enums import PRIORITY
6868
from lib.core.enums import PROXYTYPE
6969
from lib.core.enums import REFLECTIVE_COUNTER
70+
from lib.core.enums import WIZARD
7071
from lib.core.exception import sqlmapConnectionException
7172
from lib.core.exception import sqlmapFilePathException
7273
from lib.core.exception import sqlmapGenericException
@@ -1382,6 +1383,9 @@ class _(unicode): pass
13821383
if conf.string:
13831384
conf.string = conf.string.decode("unicode_escape")
13841385

1386+
if conf.getAll:
1387+
map(lambda x: conf.__setitem__(x, True), WIZARD.ALL)
1388+
13851389
threadData = getCurrentThreadData()
13861390
threadData.reset()
13871391

@@ -1613,19 +1617,20 @@ def __useWizardInterface():
16131617
conf.risk = 1
16141618
conf.level = 1
16151619

1616-
choice = None
1620+
if not conf.getAll:
1621+
choice = None
16171622

1618-
while choice is None or choice not in ("", "1", "2", "3"):
1619-
message = "Enumeration (--banner/--current-user/etc). Please choose:\n"
1620-
message += "[1] Basic (default)\n[2] Smart\n[3] All"
1621-
choice = readInput(message, default='1')
1623+
while choice is None or choice not in ("", "1", "2", "3"):
1624+
message = "Enumeration (--banner/--current-user/etc). Please choose:\n"
1625+
message += "[1] Basic (default)\n[2] Smart\n[3] All"
1626+
choice = readInput(message, default='1')
16221627

1623-
if choice == '2':
1624-
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getDbs', 'getTables', 'getSchema', 'excludeSysDbs'])
1625-
elif choice == '3':
1626-
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getPasswordHashes', 'getPrivileges', 'getRoles', 'dumpAll'])
1627-
else:
1628-
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba'])
1628+
if choice == '2':
1629+
map(lambda x: conf.__setitem__(x, True), WIZARD.SMART)
1630+
elif choice == '3':
1631+
map(lambda x: conf.__setitem__(x, True), WIZARD.ALL)
1632+
else:
1633+
map(lambda x: conf.__setitem__(x, True), WIZARD.BASIC)
16291634

16301635
logger.debug("muting sqlmap.. it will do the magic for you")
16311636
conf.verbose = 0

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
},
9797

9898
"Enumeration": {
99+
"getAll": "boolean",
99100
"getBanner": ("boolean", "Banners"),
100101
"getCurrentUser": ("boolean", "Users"),
101102
"getCurrentDb": ("boolean", "Databases"),

lib/core/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"level",
184184
"risk",
185185
"tech",
186+
"getAll",
186187
"getBanner",
187188
"getCurrentUser",
188189
"getCurrentDb",

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ def cmdLineParser():
302302
"and data contained in the tables. Moreover "
303303
"you can run your own SQL statements")
304304

305+
enumeration.add_option("-a", "--all", dest="getAll",
306+
action="store_true", help="Retrieve everything")
307+
305308
enumeration.add_option("-b", "--banner", dest="getBanner",
306309
action="store_true", help="Retrieve DBMS banner")
307310

sqlmap.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ extensiveFp = False
324324
# tables. Moreover you can run your own SQL statements.
325325
[Enumeration]
326326

327+
# Retrieve everything
328+
# Valid: True or False
329+
getAll = False
330+
327331
# Retrieve back-end database management system banner.
328332
# Valid: True or False
329333
getBanner = False

0 commit comments

Comments
 (0)