@@ -2631,11 +2631,13 @@ def __init__(self):
26312631 for option in group .option_list :
26322632 for opt in option ._long_opts + option ._short_opts :
26332633 pointer = head
2634+
26342635 for char in opt :
26352636 if char == "-" :
26362637 continue
26372638 elif char not in pointer .next :
26382639 pointer .next [char ] = MnemonicNode ()
2640+
26392641 pointer = pointer .next [char ]
26402642 pointer .current .append (option )
26412643
@@ -2644,6 +2646,7 @@ def __init__(self):
26442646 name = mnemonic .split ('=' )[0 ].replace ("-" , "" ).strip ()
26452647 value = mnemonic .split ('=' )[1 ] if len (mnemonic .split ('=' )) > 1 else None
26462648 pointer = head
2649+
26472650 for char in name :
26482651 if char in pointer .next :
26492652 pointer = pointer .next [char ]
@@ -2654,20 +2657,26 @@ def __init__(self):
26542657 if pointer in (None , head ):
26552658 errMsg = "mnemonic '%s' can't be resolved to any parameter name" % name
26562659 raise sqlmapSyntaxException , errMsg
2660+
26572661 elif len (pointer .current ) > 1 :
26582662 options = {}
2663+
26592664 for option in pointer .current :
26602665 for opt in option ._long_opts + option ._short_opts :
2661- options [opt .strip ('-' )] = option
2666+ opt = opt .strip ('-' )
2667+ if opt .startswith (name ):
2668+ options [opt ] = option
2669+
26622670 if name in options :
26632671 found = name
26642672 debugMsg = "mnemonic '%s' resolved to %s). " % (name , found )
26652673 logger .debug (debugMsg )
26662674 else :
26672675 found = sorted (options .keys (), key = lambda x : len (x ))[0 ]
2668- warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to %s). " % (name , ", " .join (options .keys ()))
2669- warnMsg += "resolved to shortest parameter name (%s )" % found
2676+ warnMsg = "detected ambiguity (mnemonic '%s' can be resolved to %s). " % (name , ", " .join ("'%s'" % key for key in options .keys ()))
2677+ warnMsg += "resolved to shortest of those available ('%s' )" % found
26702678 logger .warn (warnMsg )
2679+
26712680 found = options [found ]
26722681 else :
26732682 found = pointer .current [0 ]
@@ -2676,6 +2685,7 @@ def __init__(self):
26762685
26772686 if found :
26782687 value = found .convert_value (found , value )
2688+
26792689 if value is not None :
26802690 setattr (args , found .dest , value )
26812691 elif not found .type : # boolean
0 commit comments