Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/lib/core/unescaper.py
2989 views
1
#!/usr/bin/env python
2
3
"""
4
Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
5
See the file 'LICENSE' for copying permission
6
"""
7
8
from lib.core.common import Backend
9
from lib.core.datatype import AttribDict
10
from lib.core.settings import EXCLUDE_UNESCAPE
11
12
class Unescaper(AttribDict):
13
def escape(self, expression, quote=True, dbms=None):
14
if expression is None:
15
return expression
16
17
for exclude in EXCLUDE_UNESCAPE:
18
if exclude in expression:
19
return expression
20
21
identifiedDbms = Backend.getIdentifiedDbms()
22
23
if dbms is not None:
24
retVal = self[dbms](expression, quote=quote)
25
elif identifiedDbms is not None and identifiedDbms in self:
26
retVal = self[identifiedDbms](expression, quote=quote)
27
else:
28
retVal = expression
29
30
# e.g. inference comparison for '
31
retVal = retVal.replace("'''", "''''")
32
33
return retVal
34
35
unescaper = Unescaper()
36
37