Adding check for repackaging prick

This commit is contained in:
Miroslav Štampar 2026-07-16 18:12:29 +02:00
parent da07c8756d
commit c496cf99e6
2 changed files with 17 additions and 1 deletions

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.105"
VERSION = "1.10.7.106"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View file

@ -134,6 +134,22 @@ def checkEnvironment():
logger.critical(errMsg)
raise SystemExit
# Check for being run from inside a third-party repackage bundling sqlmap for resale
_ = modulePath()
repackaged = "sqlbox" in _.lower()
while not repackaged and os.path.dirname(_) != _:
if os.path.basename(_) == "XDATA" and all(os.path.isdir(os.path.join(_, __)) for __ in ("_tools", "_DB")):
repackaged = True
_ = os.path.dirname(_)
if repackaged:
errMsg = "this sqlmap instance appears to be running from inside a third-party "
errMsg += "repackage. sqlmap is free and open source under the GPL (https://sqlmap.org). "
errMsg += "embedding it into proprietary or paid software requires a separate commercial "
errMsg += "license (sales@sqlmap.org)"
logger.critical(errMsg)
raise SystemExit
# Patch for pip (import) environment
if "sqlmap.sqlmap" in sys.modules:
for _ in ("cmdLineOptions", "conf", "kb"):