2023-02-04 01:10:12 +03:00
#!/usr/bin/env python
"""
2024-01-04 01:11:52 +03:00
Copyright ( c ) 2006 - 2024 sqlmap developers ( https : / / sqlmap . org / )
2023-02-04 01:10:12 +03:00
See the file ' LICENSE ' for copying permission
"""
2023-02-04 02:00:21 +03:00
from lib . core . convert import getOrds
2023-02-04 01:10:12 +03:00
from plugins . generic . syntax import Syntax as GenericSyntax
class Syntax ( GenericSyntax ) :
@staticmethod
def escape ( expression , quote = True ) :
"""
2023-02-04 02:00:21 +03:00
>> > Syntax . escape ( " SELECT ' abcdefgh ' FROM foobar " ) == " SELECT char(97)||char(98)||char(99)||char(100)||char(101)||char(102)||char(103)||char(104) FROM foobar "
2023-02-04 01:10:12 +03:00
True
"""
2023-02-04 02:00:21 +03:00
def escaper ( value ) :
return " || " . join ( " char( %d ) " % _ for _ in getOrds ( value ) )
return Syntax . _escape ( expression , quote , escaper )