mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 06:50:14 +00:00
Fixing CI/CD errors
This commit is contained in:
parent
0c6f57d9ec
commit
9db49d5e34
2 changed files with 13 additions and 5 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.109"
|
||||
VERSION = "1.10.7.110"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -449,20 +449,28 @@ class TestEsperanto(unittest.TestCase):
|
|||
self.assertTrue(any("stopped early" in n for n in esp.dialect.notes))
|
||||
|
||||
def test_left_right_rung(self):
|
||||
# SUBSTR/SUBSTRING/MID blocked but LEFT+RIGHT present -> RIGHT(LEFT(x,p),1)
|
||||
# SUBSTR/SUBSTRING/MID blocked but LEFT+RIGHT present -> RIGHT(LEFT(x,p),1).
|
||||
# LEFT/RIGHT are reserved JOIN keywords in SQLite; some builds reject LEFT(/RIGHT(
|
||||
# as function calls (syntax error, keyword) rather than invoking a same-named UDF,
|
||||
# so register the shims under non-keyword names and translate the engine's LEFT(/
|
||||
# RIGHT( onto them (the same rewrite the disguised-dialect oracles use). Keeps the
|
||||
# test portable across SQLite builds while still exercising the real left_right rung.
|
||||
con = sqlite3.connect(":memory:")
|
||||
con.execute("CREATE TABLE t7 (v TEXT)")
|
||||
con.execute("INSERT INTO t7 VALUES ('Zagreb-42')")
|
||||
con.commit()
|
||||
con.create_function("LEFT", 2, lambda s, n: (s or "")[:max(n, 0)])
|
||||
con.create_function("RIGHT", 2, lambda s, n: (s or "")[len(s or "") - n:] if n > 0 else "")
|
||||
con.create_function("esp_left", 2, lambda s, n: (s or "")[:max(n, 0)])
|
||||
con.create_function("esp_right", 2, lambda s, n: (s or "")[len(s or "") - n:] if n > 0 else "")
|
||||
blk = re.compile(r"(?i)\b(SUBSTR|SUBSTRING|SUBSTRC|MID)\s*\(")
|
||||
rwLeft = re.compile(r"(?i)\bLEFT\s*\(")
|
||||
rwRight = re.compile(r"(?i)\bRIGHT\s*\(")
|
||||
|
||||
def ask(cond):
|
||||
if blk.search(cond):
|
||||
return False
|
||||
sql = rwRight.sub("esp_right(", rwLeft.sub("esp_left(", cond))
|
||||
try:
|
||||
return con.execute("SELECT CASE WHEN (%s) THEN 1 ELSE 0 END" % cond).fetchone()[0] == 1
|
||||
return con.execute("SELECT CASE WHEN (%s) THEN 1 ELSE 0 END" % sql).fetchone()[0] == 1
|
||||
except sqlite3.DatabaseError:
|
||||
return False
|
||||
esp = Esperanto(ask)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue