mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-03 15:23:44 +03:00
minor update
This commit is contained in:
parent
9059d30312
commit
122db6e164
|
@ -1809,13 +1809,21 @@ def parseXmlFile(xmlFile, handler):
|
||||||
|
|
||||||
def getSPLSnippet(name, **variables):
|
def getSPLSnippet(name, **variables):
|
||||||
"""
|
"""
|
||||||
Returns content of snippet stored in program's "procs" directory
|
Returns content of SPL snippet located inside "procs" directory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
filename = os.path.join(paths.SQLMAP_PROCS_PATH, "%s.txt" % name)
|
filename = os.path.join(paths.SQLMAP_PROCS_PATH, "%s.txt" % name)
|
||||||
checkFile(filename)
|
checkFile(filename)
|
||||||
retVal = readCachedFileContent(filename)
|
retVal = readCachedFileContent(filename)
|
||||||
|
|
||||||
for _ in variables.keys():
|
for _ in variables.keys():
|
||||||
retVal = re.sub(r"%%%s%%" % _, variables[_], retVal, flags=re.I)
|
retVal = re.sub(r"%%%s%%" % _, variables[_], retVal, flags=re.I)
|
||||||
|
|
||||||
|
_ = re.search(r"%([^%]+)%", retVal, re.I)
|
||||||
|
if _:
|
||||||
|
errMsg = "unresolved variable '%s' in SPL snippet '%s'" % (_.group(1), name)
|
||||||
|
raise sqlmapGenericException, errMsg
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
def readCachedFileContent(filename, mode='rb'):
|
def readCachedFileContent(filename, mode='rb'):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user