mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-26 00:30:38 +03:00
Better yet for #4633
This commit is contained in:
parent
732b9670d2
commit
387020ece8
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.5.4.5"
|
VERSION = "1.5.4.6"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -5,35 +5,18 @@ Copyright (c) 2006-2021 sqlmap developers (http://sqlmap.org/)
|
||||||
See the file 'LICENSE' for copying permission
|
See the file 'LICENSE' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import binascii
|
from lib.core.convert import getOrds
|
||||||
|
|
||||||
from lib.core.common import isDBMSVersionAtLeast
|
|
||||||
from lib.core.convert import getBytes
|
|
||||||
from lib.core.convert import getUnicode
|
|
||||||
from plugins.generic.syntax import Syntax as GenericSyntax
|
from plugins.generic.syntax import Syntax as GenericSyntax
|
||||||
|
|
||||||
class Syntax(GenericSyntax):
|
class Syntax(GenericSyntax):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def escape(expression, quote=True):
|
def escape(expression, quote=True):
|
||||||
"""
|
"""
|
||||||
>>> from lib.core.common import Backend
|
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar") == "SELECT CHAR(97,98,99,100,101,102,103,104) FROM foobar"
|
||||||
>>> Backend.setVersion('2')
|
|
||||||
['2']
|
|
||||||
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar") == "SELECT 'abcdefgh' FROM foobar"
|
|
||||||
True
|
|
||||||
>>> Backend.setVersion('3')
|
|
||||||
['3']
|
|
||||||
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar") == "SELECT CAST(X'6162636465666768' AS TEXT) FROM foobar"
|
|
||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def escaper(value):
|
def escaper(value):
|
||||||
# Reference: http://stackoverflow.com/questions/3444335/how-do-i-quote-a-utf-8-string-literal-in-sqlite3
|
return "CHAR(%s)" % ','.join("%d" % _ for _ in getOrds(value))
|
||||||
return "CAST(X'%s' AS TEXT)" % getUnicode(binascii.hexlify(getBytes(value)))
|
|
||||||
|
|
||||||
retVal = expression
|
return Syntax._escape(expression, quote, escaper)
|
||||||
|
|
||||||
if isDBMSVersionAtLeast('3'):
|
|
||||||
retVal = Syntax._escape(expression, quote, escaper)
|
|
||||||
|
|
||||||
return retVal
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user