mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-24 23:19:45 +03:00
Fixes #5381 and similar problems.
This commit is contained in:
parent
4dd362cb2c
commit
61f67342ae
|
@ -815,7 +815,11 @@ def _setTamperingFunctions():
|
|||
priority = PRIORITY.NORMAL if not hasattr(module, "__priority__") else module.__priority__
|
||||
|
||||
for name, function in inspect.getmembers(module, inspect.isfunction):
|
||||
if name == "tamper" and (hasattr(inspect, "signature") and all(_ in inspect.signature(function).parameters for _ in ("payload", "kwargs")) or inspect.getargspec(function).args and inspect.getargspec(function).keywords == "kwargs"):
|
||||
try:
|
||||
argspec = inspect.getargspec(function)
|
||||
except AttributeError: # `inspect.getargspec` was removed in Python 3.11
|
||||
argspec = inspect.getfullargspec(function)
|
||||
if name == "tamper" and (hasattr(inspect, "signature") and all(_ in inspect.signature(function).parameters for _ in ("payload", "kwargs")) or argspec.args and argspec.keywords == "kwargs"):
|
||||
found = True
|
||||
kb.tamperFunctions.append(function)
|
||||
function.__name__ = module.__name__
|
||||
|
@ -912,7 +916,11 @@ def _setPreprocessFunctions():
|
|||
|
||||
for name, function in inspect.getmembers(module, inspect.isfunction):
|
||||
try:
|
||||
if name == "preprocess" and inspect.getargspec(function).args and all(_ in inspect.getargspec(function).args for _ in ("req",)):
|
||||
try:
|
||||
argspec = inspect.getargspec(function)
|
||||
except AttributeError: # `inspct.getargspec` was removed in Python 3.11
|
||||
argspec = inspect.getfullargspec(function)
|
||||
if name == "preprocess" and argspec.args and all(_ in argspec.args for _ in ("req",)):
|
||||
found = True
|
||||
|
||||
kb.preprocessFunctions.append(function)
|
||||
|
@ -994,7 +1002,11 @@ def _setPostprocessFunctions():
|
|||
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")):
|
||||
try:
|
||||
argspec = inspect.getargspec(function)
|
||||
except AttributeError: # `inspect.getargspec` was removed in Python 3.11
|
||||
argspec = inspect.getfullargspec(function)
|
||||
if name == "postprocess" and argspec.args and all(_ in argspec.args for _ in ("page", "headers", "code")):
|
||||
found = True
|
||||
|
||||
kb.postprocessFunctions.append(function)
|
||||
|
|
Loading…
Reference in New Issue
Block a user