mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-06-20 13:03:23 +03:00
dealing with variables in SQL procs - issue #33
This commit is contained in:
parent
2527554f8e
commit
f645ac6040
|
@ -1567,11 +1567,20 @@ def getSQLSnippet(dbms, sfile, **variables):
|
||||||
for _ in re.findall(r"%RANDINT\d+%", retVal, re.I):
|
for _ in re.findall(r"%RANDINT\d+%", retVal, re.I):
|
||||||
retVal = retVal.replace(_, randomInt())
|
retVal = retVal.replace(_, randomInt())
|
||||||
|
|
||||||
_ = re.findall(r"%(\w+)%", retVal, re.I)
|
variables = re.findall(r"%(\w+)%", retVal, re.I)
|
||||||
|
|
||||||
if _:
|
if variables:
|
||||||
errMsg = "unresolved variable%s '%s' in SQL file '%s'" % ("s" if len(_) > 1 else "", ", ".join(_), sfile)
|
errMsg = "unresolved variable%s '%s' in SQL file '%s'" % ("s" if len(variables) > 1 else "", ", ".join(variables), sfile)
|
||||||
raise sqlmapGenericException, errMsg
|
logger.error(errMsg)
|
||||||
|
|
||||||
|
msg = "do you want to provide the substitution values? [y/N] "
|
||||||
|
choice = readInput(msg, default="N")
|
||||||
|
|
||||||
|
if choice and choice[0].lower() == "y":
|
||||||
|
for var in variables:
|
||||||
|
msg = "insert value for variable '%s': " % var
|
||||||
|
val = readInput(msg)
|
||||||
|
retVal = retVal.replace(r"%%%s%%" % var, val)
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user