sqlmapproject/sqlmap · error · SqlmapSyntaxException

tamper script ' ' should have an extension '.py

Error message

tamper script '%s' should have an extension '.py'

What it means

--tamper loading: the referenced script exists as a filesystem path but does not end in '.py', so it cannot be imported as a Python tamper module; SqlmapSyntaxException names the offending script.

Solutions

  1. Rename the file so it ends with '.py'
  2. Ensure you are pointing at the Python source, not a compiled/pyc or doc file
  3. Remove stray trailing characters in the --tamper value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/core/option.py:880 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/b9afa94adc0573f8. Report an issue: GitHub.

Appendix: source

Thrown at lib/core/option.py:880

            found = False

            path = safeFilepathEncode(paths.SQLMAP_TAMPER_PATH)
            script = safeFilepathEncode(script.strip())

            try:
                if not script:
                    continue

                elif os.path.exists(os.path.join(path, script if script.endswith(".py") else "%s.py" % script)):
                    script = os.path.join(path, script if script.endswith(".py") else "%s.py" % script)

                elif not os.path.exists(script):
                    errMsg = "tamper script '%s' does not exist" % script
                    raise SqlmapFilePathException(errMsg)

                elif not script.endswith(".py"):
                    errMsg = "tamper script '%s' should have an extension '.py'" % script
                    raise SqlmapSyntaxException(errMsg)
            except UnicodeDecodeError:
                errMsg = "invalid character provided in option '--tamper'"
                raise SqlmapSyntaxException(errMsg)

            dirname, filename = os.path.split(script)
            dirname = os.path.abspath(dirname)

            infoMsg = "loading tamper module '%s'" % filename[:-3]
            logger.info(infoMsg)

            if not os.path.exists(os.path.join(dirname, "__init__.py")):
                errMsg = "make sure that there is an empty file '__init__.py' "
                errMsg += "inside of tamper scripts directory '%s'" % dirname
                raise SqlmapGenericException(errMsg)

            if dirname not in sys.path:
                sys.path.insert(0, dirname)

View on GitHub (pinned to 0a35b20e39)