Skip to content

Commit 9eb970e

Browse files
committed
More fixes related to ClickHouse support (#5229)
1 parent 46495f7 commit 9eb970e

File tree

8 files changed

+36
-15
lines changed

8 files changed

+36
-15
lines changed

lib/core/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ def limitQuery(self, num, query, field=None, uniqueField=None):
10271027
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (num + 1, 1)
10281028
limitedQuery += " %s" % limitStr
10291029

1030-
elif Backend.getIdentifiedDbms() in (DBMS.DERBY, DBMS.CRATEDB):
1030+
elif Backend.getIdentifiedDbms() in (DBMS.DERBY, DBMS.CRATEDB, DBMS.CLICKHOUSE):
10311031
limitStr = queries[Backend.getIdentifiedDbms()].limit.query % (1, num)
10321032
limitedQuery += " %s" % limitStr
10331033

lib/core/settings.py

Lines changed: 3 additions & 2 deletions
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.4"
23+
VERSION = "1.7.2.5"
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)
@@ -283,7 +283,7 @@
283283
ALTIBASE_SYSTEM_DBS = ("SYSTEM_",)
284284
MIMERSQL_SYSTEM_DBS = ("information_schema", "SYSTEM",)
285285
CRATEDB_SYSTEM_DBS = ("information_schema", "pg_catalog", "sys")
286-
CLICKHOUSE_SYSTEM_DBS = ("information_schema", "system")
286+
CLICKHOUSE_SYSTEM_DBS = ("information_schema", "INFORMATION_SCHEMA", "system")
287287
CUBRID_SYSTEM_DBS = ("DBA",)
288288
CACHE_SYSTEM_DBS = ("%Dictionary", "INFORMATION_SCHEMA", "%SYS")
289289
EXTREMEDB_SYSTEM_DBS = ("",)
@@ -415,6 +415,7 @@
415415
r"(?P<result>[^\n>]{0,100}SQL Syntax[^\n<]+)",
416416
r"(?s)<li>Error Type:<br>(?P<result>.+?)</li>",
417417
r"CDbCommand (?P<result>[^<>\n]*SQL[^<>\n]+)",
418+
r"Code: \d+. DB::Exception: (?P<result>[^<>\n]*)",
418419
r"error '[0-9a-f]{8}'((<[^>]+>)|\s)+(?P<result>[^<>]+)",
419420
r"\[[^\n\]]{1,100}(ODBC|JDBC)[^\n\]]+\](\[[^\]]+\])?(?P<result>[^\n]+(in query expression|\(SQL| at /[^ ]+pdo)[^\n<]+)",
420421
r"(?P<result>query error: SELECT[^<>]+)"

plugins/dbms/clickhouse/connector.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
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.common import getSafeExString
9-
from lib.core.data import logger
10-
from lib.core.exception import SqlmapConnectionException
118
from plugins.generic.connector import Connector as GenericConnector
129

1310
class Connector(GenericConnector):

plugins/dbms/clickhouse/enumeration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
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.data import logger
98
from plugins.generic.enumeration import Enumeration as GenericEnumeration
109

1110
class Enumeration(GenericEnumeration):

plugins/dbms/clickhouse/filesystem.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
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.exception import SqlmapUnsupportedFeatureException
89
from plugins.generic.filesystem import Filesystem as GenericFilesystem
910

1011
class Filesystem(GenericFilesystem):
11-
pass
12+
def readFile(self, remoteFile):
13+
errMsg = "on ClickHouse it is not possible to read files"
14+
raise SqlmapUnsupportedFeatureException(errMsg)
15+
16+
def writeFile(self, localFile, remoteFile, fileType=None, forceCheck=False):
17+
errMsg = "on ClickHouse it is not possible to write files"
18+
raise SqlmapUnsupportedFeatureException(errMsg)

plugins/dbms/clickhouse/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

plugins/dbms/clickhouse/takeover.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
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.exception import SqlmapUnsupportedFeatureException
89
from plugins.generic.takeover import Takeover as GenericTakeover
910

1011
class Takeover(GenericTakeover):
11-
pass
12+
def osCmd(self):
13+
errMsg = "on ClickHouse it is not possible to execute commands"
14+
raise SqlmapUnsupportedFeatureException(errMsg)
15+
16+
def osShell(self):
17+
errMsg = "on ClickHouse it is not possible to execute commands"
18+
raise SqlmapUnsupportedFeatureException(errMsg)
19+
20+
def osPwn(self):
21+
errMsg = "on ClickHouse it is not possible to establish an "
22+
errMsg += "out-of-band connection"
23+
raise SqlmapUnsupportedFeatureException(errMsg)
24+
25+
def osSmb(self):
26+
errMsg = "on ClickHouse it is not possible to establish an "
27+
errMsg += "out-of-band connection"
28+
raise SqlmapUnsupportedFeatureException(errMsg)

plugins/generic/entries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def dumpTable(self, foundData=None):
239239
entries = BigArray(_zip(*[entries[colName] for colName in colList]))
240240
else:
241241
query = rootQuery.inband.query % (colString, conf.db, tbl)
242-
elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.HSQLDB, DBMS.H2, DBMS.VERTICA, DBMS.PRESTO, DBMS.CRATEDB, DBMS.CACHE, DBMS.VIRTUOSO):
242+
elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.HSQLDB, DBMS.H2, DBMS.VERTICA, DBMS.PRESTO, DBMS.CRATEDB, DBMS.CACHE, DBMS.VIRTUOSO, DBMS.CLICKHOUSE):
243243
query = rootQuery.inband.query % (colString, conf.db, tbl, prioritySortColumns(colList)[0])
244244
else:
245245
query = rootQuery.inband.query % (colString, conf.db, tbl)

0 commit comments

Comments
 (0)