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

Skip to content

Commit adfbfef

Browse files
committed
minor refactoring
1 parent 12f3024 commit adfbfef

2 files changed

Lines changed: 9 additions & 21 deletions

File tree

lib/core/option.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,9 @@ def __cleanupOptions():
11391139
if conf.data:
11401140
conf.data = urldecode(conf.data)
11411141

1142+
if conf.template:
1143+
map(lambda x: conf.__setitem__(x, True), ['tor', 'flushSession', 'batch', 'getBanner', 'getCurrentUser', 'getCurrentDb', 'getDbs', 'randomAgent'])
1144+
11421145
def __setConfAttributes():
11431146
"""
11441147
This function set some needed attributes into the configuration
@@ -1297,29 +1300,11 @@ def __useWizardInterface():
12971300
message = "[4] Enumeration ('--banner'/'--current-user'/...) [Please choose: 1-Basic(default), 2-Smart, 3-All]: "
12981301
choice = readInput(message, default='1')
12991302
if choice == '2':
1300-
conf.getBanner = True
1301-
conf.getCurrentUser = True
1302-
conf.getCurrentDb = True
1303-
conf.isDba = True
1304-
conf.getUsers = True
1305-
conf.getDbs = True
1306-
conf.getTables = True
1307-
conf.excludeSysDbs = True
1303+
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getDbs', 'getTables', 'excludeSysDbs'])
13081304
elif choice == '3':
1309-
conf.getBanner = True
1310-
conf.getCurrentUser = True
1311-
conf.getCurrentDb = True
1312-
conf.isDba = True
1313-
conf.getUsers = True
1314-
conf.getPasswordHashes = True
1315-
conf.getPrivileges = True
1316-
conf.getRoles = True
1317-
conf.dumpAll = True
1305+
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba', 'getUsers', 'getPasswordHashes', 'getPrivileges', 'getRoles', 'dumpAll'])
13181306
else:
1319-
conf.getBanner = True
1320-
conf.getCurrentUser = True
1321-
conf.getCurrentDb = True
1322-
conf.isDba = True
1307+
map(lambda x: conf.__setitem__(x, True), ['getBanner', 'getCurrentUser', 'getCurrentDb', 'isDba'])
13231308

13241309
conf.batch = True
13251310
print

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ def cmdLineParser():
534534
parser.add_option("--group-concat", dest="groupConcat", action="store_true",
535535
default=False, help=SUPPRESS_HELP)
536536

537+
parser.add_option("--template", dest="template", action="store_true",
538+
default=False, help=SUPPRESS_HELP)
539+
537540
parser.add_option_group(target)
538541
parser.add_option_group(request)
539542
parser.add_option_group(optimization)

0 commit comments

Comments
 (0)