From 8d343fc2a6c2be190ae7b7e5bf8ef3d45f30bde2 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 31 Jan 2020 11:39:16 +0100 Subject: [PATCH] Adding support for Amazon Redshift (pgsql fork) --- lib/core/enums.py | 1 + lib/core/settings.py | 2 +- plugins/dbms/postgresql/fingerprint.py | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/core/enums.py b/lib/core/enums.py index 1aa1e28c5..c9b190f56 100644 --- a/lib/core/enums.py +++ b/lib/core/enums.py @@ -81,6 +81,7 @@ class FORK(object): PERCONA = "Percona" COCKROACHDB = "CockroachDB" TIDB = "TiDB" + REDSHIFT = "Amazon Redshift" class CUSTOM_LOGGING(object): PAYLOAD = 9 diff --git a/lib/core/settings.py b/lib/core/settings.py index c35c4f602..cda820f2e 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.1.62" +VERSION = "1.4.1.63" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" 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) diff --git a/plugins/dbms/postgresql/fingerprint.py b/plugins/dbms/postgresql/fingerprint.py index 1c31dcd4c..a6e1a46d8 100644 --- a/plugins/dbms/postgresql/fingerprint.py +++ b/plugins/dbms/postgresql/fingerprint.py @@ -29,7 +29,13 @@ class Fingerprint(GenericFingerprint): fork = hashDBRetrieve(HASHDB_KEYS.DBMS_FORK) if fork is None: - fork = inject.checkBooleanExpression("VERSION() LIKE '%CockroachDB%'") and FORK.COCKROACHDB or "" + if inject.checkBooleanExpression("VERSION() LIKE '%CockroachDB%'"): + fork = FORK.COCKROACHDB + elif inject.checkBooleanExpression("VERSION() LIKE '%Redshift%'"): # Reference: https://dataedo.com/kb/query/amazon-redshift/check-server-version + fork = FORK.REDSHIFT + else: + fork = "" + hashDBWrite(HASHDB_KEYS.DBMS_FORK, fork) value = ""