Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20700fd

Browse files
committed
Adding support for CockroachDB (Postgres fork)
1 parent 4be7c7d commit 20700fd

5 files changed

Lines changed: 28 additions & 9 deletions

File tree

lib/core/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class DBMS_DIRECTORY_NAME(object):
7070
class FORK(object):
7171
MARIADB = "MariaDB"
7272
MEMSQL = "MemSQL"
73+
COCKROACHDB = "CockroachDB"
7374

7475
class CUSTOM_LOGGING(object):
7576
PAYLOAD = 9

lib/core/settings.py

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

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

plugins/dbms/mysql/fingerprint.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ def _commentCheck(self):
9696
return None
9797

9898
def getFingerprint(self):
99+
fork = hashDBRetrieve(HASHDB_KEYS.DBMS_FORK)
100+
101+
if fork is None:
102+
fork = inject.checkBooleanExpression("VERSION() LIKE '%MariaDB%'") and FORK.MARIADB or ""
103+
hashDBWrite(HASHDB_KEYS.DBMS_FORK, fork)
104+
99105
value = ""
100106
wsOsFp = Format.getOs("web server", kb.headersFp)
101107

@@ -111,12 +117,10 @@ def getFingerprint(self):
111117
value += "back-end DBMS: "
112118
actVer = Format.getDbms()
113119

114-
_ = hashDBRetrieve(HASHDB_KEYS.DBMS_FORK)
115-
if _:
116-
actVer += " (%s fork)" % _
117-
118120
if not conf.extensiveFp:
119121
value += actVer
122+
if fork:
123+
value += " (%s fork)" % fork
120124
return value
121125

122126
comVer = self._commentCheck()
@@ -142,6 +146,9 @@ def getFingerprint(self):
142146
if htmlErrorFp:
143147
value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp)
144148

149+
if fork:
150+
value += "\n%sfork fingerprint: %s" % (blank, fork)
151+
145152
return value
146153

147154
def checkDbms(self):
@@ -189,9 +196,6 @@ def checkDbms(self):
189196

190197
return False
191198

192-
if hashDBRetrieve(HASHDB_KEYS.DBMS_FORK) is None:
193-
hashDBWrite(HASHDB_KEYS.DBMS_FORK, inject.checkBooleanExpression("VERSION() LIKE '%MariaDB%'") and FORK.MARIADB or "")
194-
195199
# reading information_schema on some platforms is causing annoying timeout exits
196200
# Reference: http://bugs.mysql.com/bug.php?id=15855
197201

plugins/dbms/postgresql/fingerprint.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77

88
from lib.core.common import Backend
99
from lib.core.common import Format
10+
from lib.core.common import hashDBRetrieve
11+
from lib.core.common import hashDBWrite
1012
from lib.core.data import conf
1113
from lib.core.data import kb
1214
from lib.core.data import logger
1315
from lib.core.enums import DBMS
16+
from lib.core.enums import FORK
17+
from lib.core.enums import HASHDB_KEYS
1418
from lib.core.enums import OS
1519
from lib.core.session import setDbms
1620
from lib.core.settings import PGSQL_ALIASES
@@ -22,6 +26,12 @@ def __init__(self):
2226
GenericFingerprint.__init__(self, DBMS.PGSQL)
2327

2428
def getFingerprint(self):
29+
fork = hashDBRetrieve(HASHDB_KEYS.DBMS_FORK)
30+
31+
if fork is None:
32+
fork = inject.checkBooleanExpression("VERSION() LIKE '%CockroachDB%'") and FORK.COCKROACHDB or ""
33+
hashDBWrite(HASHDB_KEYS.DBMS_FORK, fork)
34+
2535
value = ""
2636
wsOsFp = Format.getOs("web server", kb.headersFp)
2737

@@ -38,6 +48,8 @@ def getFingerprint(self):
3848

3949
if not conf.extensiveFp:
4050
value += DBMS.PGSQL
51+
if fork:
52+
value += " (%s fork)" % fork
4153
return value
4254

4355
actVer = Format.getDbms()
@@ -56,6 +68,9 @@ def getFingerprint(self):
5668
if htmlErrorFp:
5769
value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp)
5870

71+
if fork:
72+
value += "\n%sfork fingerprint: %s" % (blank, fork)
73+
5974
return value
6075

6176
def checkDbms(self):

plugins/dbms/vertica/fingerprint.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from lib.core.data import kb
1212
from lib.core.data import logger
1313
from lib.core.enums import DBMS
14-
from lib.core.enums import OS
1514
from lib.core.session import setDbms
1615
from lib.core.settings import VERTICA_ALIASES
1716
from lib.request import inject

0 commit comments

Comments
 (0)