Bernardo will kill me (added --wizard for total beginners)

This commit is contained in:
Miroslav Stampar 2011-03-29 11:42:55 +00:00
parent 4d78eac938
commit e20d460809
4 changed files with 69 additions and 4 deletions

View File

@ -1265,6 +1265,62 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.userAgents = None kb.userAgents = None
kb.wordlist = None kb.wordlist = None
def __useWizardInterface():
"""
Presents simple wizard interface for beginner users
"""
if not conf.wizard:
return
logger.info("starting wizard interface")
while not conf.url:
message = "[1] Please enter full target URL ('-u'): "
conf.url = readInput(message, default=None)
message = "[2] POST data ('--data') [Enter for None]: "
conf.data = readInput(message, default=None)
message = "[3] Injection difficulty ('--level'/'--risk') [Please choose: 1-Normal(default), 2-Medium, 3-Hard]: "
choice = readInput(message, default=1)
if choice == '2':
conf.risk = conf.level = 3
elif choice == '3':
conf.risk = conf.level = 5
else:
conf.risk = conf.level = 1
message = "[4] Enumeration ('--banner'/'--current-user'/...) [Please choose: 1-Basic(default), 2-Smart, 3-All]: "
choice = readInput(message, default=1)
if choice == '2':
conf.getBanner = True
conf.getCurrentUser = True
conf.getCurrentDb = True
conf.isDba = True
conf.getUsers = True
conf.getDbs = True
conf.getTables = True
conf.excludeSysDbs = True
elif choice == '3':
conf.getBanner = True
conf.getCurrentUser = True
conf.getCurrentDb = True
conf.isDba = True
conf.getUsers = True
conf.getPasswordHashes = True
conf.getPrivileges = True
conf.getRoles = True
conf.dumpAll = True
else:
conf.getBanner = True
conf.getCurrentUser = True
conf.getCurrentDb = True
conf.isDba = True
conf.batch = True
print
def __saveCmdline(): def __saveCmdline():
""" """
Saves the command line options on a sqlmap configuration INI file Saves the command line options on a sqlmap configuration INI file
@ -1433,6 +1489,7 @@ def init(inputOptions=advancedDict(), overrideOptions=False):
__setKnowledgeBaseAttributes() __setKnowledgeBaseAttributes()
__mergeOptions(inputOptions, overrideOptions) __mergeOptions(inputOptions, overrideOptions)
__setVerbosity() __setVerbosity()
__useWizardInterface()
__saveCmdline() __saveCmdline()
__setRequestFromFile() __setRequestFromFile()
__cleanupOptions() __cleanupOptions()

View File

@ -165,6 +165,7 @@ optDict = {
"parseErrors": "boolean", "parseErrors": "boolean",
"replicate": "boolean", "replicate": "boolean",
"tor": "boolean", "tor": "boolean",
"wizard": "boolean",
"verbose": "integer" "verbose": "integer"
}, },
} }

View File

@ -505,6 +505,10 @@ def cmdLineParser():
action="store_true", default=False, action="store_true", default=False,
help="Use default Tor (Vidalia/Privoxy/Polipo) proxy address") help="Use default Tor (Vidalia/Privoxy/Polipo) proxy address")
miscellaneous.add_option("--wizard", dest="wizard",
action="store_true", default=False,
help="Simple wizard interface for beginner users")
# Hidden and/or experimental options # Hidden and/or experimental options
parser.add_option("--profile", dest="profile", action="store_true", parser.add_option("--profile", dest="profile", action="store_true",
default=False, help=SUPPRESS_HELP) default=False, help=SUPPRESS_HELP)
@ -553,10 +557,9 @@ def cmdLineParser():
(args, _) = parser.parse_args(args) (args, _) = parser.parse_args(args)
if not args.direct and not args.url and not args.list and not args.googleDork and not args.configFile \ if not any([args.direct, args.url, args.list, args.googleDork, args.configFile, \
and not args.requestFile and not args.updateAll and not args.smokeTest and not args.liveTest \ args.requestFile, args.updateAll, args.smokeTest, args.liveTest, args.realTest, args.wizard]):
and not args.realTest: errMsg = "missing a mandatory parameter ('-d', '-u', '-l', '-r', '-g', '-c', '--wizard' or '--update'), "
errMsg = "missing a mandatory parameter ('-d', '-u', '-l', '-r', '-g', '-c' or '--update'), "
errMsg += "-h for help" errMsg += "-h for help"
parser.error(errMsg) parser.error(errMsg)

View File

@ -539,6 +539,10 @@ replicate = False
# Valid: True or False # Valid: True or False
tor = False tor = False
# Simple wizard interface for beginner users.
# Valid: True or False
wizard = False
# Verbosity level. # Verbosity level.
# Valid: integer between 0 and 6 # Valid: integer between 0 and 6
# 0: Show only error and critical messages # 0: Show only error and critical messages