Skip to content

Commit 46495f7

Browse files
committed
Adding char escaper to ClickHouse support (#5229)
1 parent 30ba167 commit 46495f7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.7.2.3"
23+
VERSION = "1.7.2.4"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/clickhouse/syntax.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
#!/usr/bin/env python
22

33
"""
4-
Copyright (c) 2006-2023 sqlmap developers (http://sqlmap.org/)
4+
Copyright (c) 2006-2023 sqlmap developers (https://sqlmap.org/)
55
See the file 'LICENSE' for copying permission
66
"""
77

8+
from lib.core.convert import getOrds
89
from plugins.generic.syntax import Syntax as GenericSyntax
910

1011
class Syntax(GenericSyntax):
1112
@staticmethod
1213
def escape(expression, quote=True):
1314
"""
14-
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar") == u"SELECT 'abcdefgh' FROM foobar"
15+
>>> 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"
1516
True
1617
"""
1718

18-
return expression
19+
def escaper(value):
20+
return "||".join("char(%d)" % _ for _ in getOrds(value))
21+
22+
return Syntax._escape(expression, quote, escaper)

0 commit comments

Comments
 (0)