sqlmapproject/sqlmap · error · SqlmapGenericException
missing function 'postprocess(page, headers=None…
Error message
missing function 'postprocess(page, headers=None, code=None)' in postprocess script '%s'
What it means
After importing the postprocess module, sqlmap scans its functions for one named 'postprocess' accepting the signature postprocess(page, headers=None, code=None) that will be applied to each HTTP response. If inspect finds no such function, this SqlmapGenericException is raised — a contract check that the script exports the required response-processing hook.
Solutions
- Define a top-level `def postprocess(page, headers=None, code=None):` in the script with the exact name and signature.
- Ensure the function is module-level (not nested, not a method) so inspect.getmembers can discover it.
- Use the default-argument form shown in the message; extra required parameters will fail the signature match.
- Start from sqlmap's bundled template postprocess script and adapt it.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/core/option.py:1113 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26).
Data as JSON: /api/errors/7d3da0c15f6b6e95.
Report an issue: GitHub.
Appendix: source
Thrown at lib/core/option.py:1113
try:
getattr(importlib, "invalidate_caches", lambda: None)() # Note: py3.3+ only; a script just written into an already-scanned dir is invisible to a cached FileFinder (Windows coarse mtime)
module = __import__(safeFilepathEncode(filename[:-3]))
except Exception as ex:
raise SqlmapSyntaxException("cannot import postprocess module '%s' (%s)" % (getUnicode(filename[:-3]), getSafeExString(ex)))
for name, function in inspect.getmembers(module, inspect.isfunction):
if name == "postprocess" and inspect.getargspec(function).args and all(_ in inspect.getargspec(function).args for _ in ("page", "headers", "code")):
found = True
kb.postprocessFunctions.append(function)
function.__name__ = module.__name__
break
if not found:
errMsg = "missing function 'postprocess(page, headers=None, code=None)' "
errMsg += "in postprocess script '%s'" % script
raise SqlmapGenericException(errMsg)
else:
try:
_, _, _ = function("", {}, None)
except:
handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.PREPROCESS, suffix=".py")
os.close(handle)
openFile(filename, "w+").write("#!/usr/bin/env\n\ndef postprocess(page, headers=None, code=None):\n return page, headers, code\n")
openFile(os.path.join(os.path.dirname(filename), "__init__.py"), "w+").write("pass")
errMsg = "function 'postprocess(page, headers=None, code=None)' "
errMsg += "in postprocess script '%s' " % script
errMsg += "should return a tuple '(page, headers, code)' "
errMsg += "(Note: find template script at '%s')" % filename
raise SqlmapGenericException(errMsg)
def _setThreads():
if not isinstance(conf.threads, int) or conf.threads <= 0:View on GitHub (pinned to 0a35b20e39)