2727from lib .controller .checks import checkConnection
2828from lib .core .common import Backend
2929from lib .core .common import dataToStdout
30+ from lib .core .common import getPublicTypeMembers
3031from lib .core .common import extractRegexResult
3132from lib .core .common import filterStringValue
3233from lib .core .common import getConsoleWidth
@@ -605,8 +606,22 @@ def __setOS():
605606 raise sqlmapUnsupportedDBMSException , errMsg
606607
607608def __setTechnique ():
608- if not conf .tech or not isinstance (conf .tech , int ):
609- conf .tech = []
609+ validTechniques = getPublicTypeMembers (PAYLOAD .TECHNIQUE )
610+ selTechniques = []
611+
612+ if conf .tech and isinstance (conf .tech , basestring ):
613+ for t in conf .tech :
614+ if t .upper () not in ("B" , "E" , "U" , "S" , "T" ):
615+ errMsg = "value for --technique must be a string composed "
616+ errMsg += "by the letters B, E, U, S and T. Refer to the "
617+ errMsg += "user's manual for details"
618+ raise sqlmapSyntaxException , errMsg
619+
620+ for validTech , validInt in validTechniques :
621+ if t .upper () == validTech [0 ]:
622+ selTechniques .append (validInt )
623+ break
624+ conf .tech = selTechniques
610625 else :
611626 conf .tech = filter (lambda x : x in PAYLOAD .SQLINJECTION , [int (c ) for c in str (conf .tech )])
612627
@@ -617,7 +632,7 @@ def __setTechnique():
617632 'osCmd' , 'osShell' , 'osPwn' , 'osSmb' , 'osBof' , 'regRead' , \
618633 'regAdd' , 'regDel' ])) and PAYLOAD .TECHNIQUE .STACKED not in conf .tech :
619634 errMsg = "value for --technique must include stacked queries "
620- errMsg += "technique (4 ) when you want to access the file "
635+ errMsg += "technique (S ) when you want to access the file "
621636 errMsg += "system, takeover the operating system or access "
622637 errMsg += "Windows registry hives"
623638 raise sqlmapSyntaxException , errMsg
0 commit comments