mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Minor bug fix for --openapi
This commit is contained in:
parent
84f0ef8232
commit
f992e44fb5
3 changed files with 14 additions and 2 deletions
|
|
@ -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.219"
|
||||
VERSION = "1.10.7.220"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -193,7 +193,11 @@ def _baseUrl(spec, origin=None, servers=None):
|
|||
variables = servers[0].get("variables")
|
||||
if isinstance(variables, dict):
|
||||
for name, meta in variables.items():
|
||||
default = meta.get("default", "1") if isinstance(meta, dict) else "1"
|
||||
meta = meta if isinstance(meta, dict) else {}
|
||||
default = meta.get("default")
|
||||
if default is None: # 'default' is spec-required; when omitted, a declared enum value beats a placeholder host ('1')
|
||||
enum = meta.get("enum")
|
||||
default = enum[0] if isinstance(enum, list) and enum else "1"
|
||||
url = url.replace("{%s}" % name, str(default))
|
||||
if re.match(r"(?i)[a-z][a-z0-9+.-]*://", url): # absolute server URL -> used as declared (the host is NOT rewritten to the spec's own origin)
|
||||
return url.rstrip('/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue