mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
minor refactoring
This commit is contained in:
parent
1880f18367
commit
845533e92f
|
@ -125,7 +125,6 @@ class PAYLOAD:
|
||||||
UNION = "union"
|
UNION = "union"
|
||||||
|
|
||||||
class TECHNIQUE:
|
class TECHNIQUE:
|
||||||
HEURISTIC = 0
|
|
||||||
BOOLEAN = 1
|
BOOLEAN = 1
|
||||||
ERROR = 2
|
ERROR = 2
|
||||||
UNION = 3
|
UNION = 3
|
||||||
|
|
|
@ -606,26 +606,31 @@ def __setOS():
|
||||||
raise sqlmapUnsupportedDBMSException, errMsg
|
raise sqlmapUnsupportedDBMSException, errMsg
|
||||||
|
|
||||||
def __setTechnique():
|
def __setTechnique():
|
||||||
validTechniques = getPublicTypeMembers(PAYLOAD.TECHNIQUE)
|
validTechniques = sorted(getPublicTypeMembers(PAYLOAD.TECHNIQUE), key=lambda x: x[1])
|
||||||
|
validLetters = map(lambda x: x[0][0].upper(), validTechniques)
|
||||||
|
|
||||||
if conf.tech and isinstance(conf.tech, basestring):
|
if conf.tech and isinstance(conf.tech, basestring):
|
||||||
selTechniques = []
|
selTechniques = []
|
||||||
|
|
||||||
for t in conf.tech:
|
# e.g.: BEUST
|
||||||
if t.upper() not in ("B", "E", "U", "S", "T"):
|
if not conf.tech.isdigit():
|
||||||
|
for letter in conf.tech:
|
||||||
|
if letter.upper() not in validLetters:
|
||||||
errMsg = "value for --technique must be a string composed "
|
errMsg = "value for --technique must be a string composed "
|
||||||
errMsg += "by the letters B, E, U, S and T. Refer to the "
|
errMsg += "by the letters %s. Refer to the " % ",".join(validLetters)
|
||||||
errMsg += "user's manual for details"
|
errMsg += "user's manual for details"
|
||||||
raise sqlmapSyntaxException, errMsg
|
raise sqlmapSyntaxException, errMsg
|
||||||
|
|
||||||
for validTech, validInt in validTechniques:
|
for validTech, validInt in validTechniques:
|
||||||
if t.upper() == validTech[0]:
|
if letter.upper() == validTech[0]:
|
||||||
selTechniques.append(validInt)
|
selTechniques.append(validInt)
|
||||||
break
|
break
|
||||||
|
|
||||||
conf.tech = selTechniques
|
# e.g.: 12345
|
||||||
else:
|
else:
|
||||||
conf.tech = filter(lambda x: x in PAYLOAD.SQLINJECTION, [int(c) for c in str(conf.tech)])
|
selTechniques = filter(lambda x: x in PAYLOAD.SQLINJECTION, [int(c) for c in str(conf.tech)])
|
||||||
|
|
||||||
|
conf.tech = selTechniques
|
||||||
|
|
||||||
if len(conf.tech) > 0:
|
if len(conf.tech) > 0:
|
||||||
# TODO: consider MySQL/PHP/ASP/web backdoor case where stacked
|
# TODO: consider MySQL/PHP/ASP/web backdoor case where stacked
|
||||||
|
|
Loading…
Reference in New Issue
Block a user