Adding --openapi-tags

This commit is contained in:
Miroslav Štampar 2026-07-09 14:13:21 +02:00
parent fc1ae6950e
commit 622cfa76c6
6 changed files with 37 additions and 4 deletions

View file

@ -521,8 +521,13 @@ def _setOpenApiTargets():
logger.info(infoMsg)
content = openFile(conf.openApiFile).read()
tags = [_.strip() for _ in re.split(PARAMETER_SPLITTING_REGEX, conf.openApiTags) if _.strip()] if conf.openApiTags else None
if tags:
infoMsg = "restricting extraction to OpenAPI/Swagger operations tagged: %s" % ", ".join(tags)
logger.info(infoMsg)
try:
targets = openApiTargets(content, origin)
targets = openApiTargets(content, origin, tags)
except ValueError as ex:
errMsg = "unable to parse the OpenAPI/Swagger specification ('%s')" % getSafeExString(ex)
raise SqlmapSyntaxException(errMsg)

View file

@ -21,6 +21,7 @@ optDict = {
"configFile": "string",
"openApiFile": "string",
"openApiBase": "string",
"openApiTags": "string",
},
"Request": {

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.57"
VERSION = "1.10.7.58"
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)