Skip to content

Commit eeb16d1

Browse files
committed
Adding missing Spanner directory (#6025)
1 parent 3c16bfd commit eeb16d1

File tree

9 files changed

+254
-2
lines changed

9 files changed

+254
-2
lines changed

data/txt/sha256sums.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ d9b37177efcaba035c7fabe7d015a3b63d9cfe502bb4998ff71e47f825eeaaca lib/core/patch
188188
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
189189
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
190190
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
191-
d524f3ebcb647f7d7018922d86d35103379e921a9b5d05cf762b7d5c6ad82c47 lib/core/settings.py
191+
76185a4a072f97b95162bb4e141b354436daa0f7a64e8740e833cfe5fa836e62 lib/core/settings.py
192192
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
193193
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
194194
70ea3768f1b3062b22d20644df41c86238157ec80dd43da40545c620714273c6 lib/core/target.py
@@ -439,6 +439,13 @@ b76606fe4dee18467bc0d19af1e6ab38c0b5593c6c0f2068a8d4c664d4bd71d8 plugins/dbms/r
439439
1de7c93b445deb0766c314066cb122535e9982408614b0ff952a97cbae9b813a plugins/dbms/snowflake/__init__.py
440440
859cc5b9be496fe35f2782743f8e573ff9d823de7e99b0d32dbc250c361c653e plugins/dbms/snowflake/syntax.py
441441
da43fed8bfa4a94aaceb63e760c69e9927c1640e45e457b8f03189be6604693f plugins/dbms/snowflake/takeover.py
442+
0163ce14bfa49b7485ab430be1fa33366c9f516573a89d89120f812ffdbc0c83 plugins/dbms/spanner/connector.py
443+
6392bd210e740df6c21befc1c4f74cc88ab8ee8d774fd41c0389d132c11c745a plugins/dbms/spanner/enumeration.py
444+
672dc9b3d291aa4f5d6c4cbe364e92b92e19ee6de86f6d9b9a4dda7d5611b409 plugins/dbms/spanner/filesystem.py
445+
30f4caea09eb300a8b16ff2609960d165d8a7fa0f3034c345fea24002fea2670 plugins/dbms/spanner/fingerprint.py
446+
7c46a84ece581b5284ffd604b54bacb38acc87ea7fbac31aae38e20eb4ead31a plugins/dbms/spanner/__init__.py
447+
54a184528a74d7e1ff3131cbca2efa86bbf63c2b2623fb9a395bdb5d2db6cf5a plugins/dbms/spanner/syntax.py
448+
949add058f3774fbed41a6a724985ac902abe03b0617ec99698e3a29292efa43 plugins/dbms/spanner/takeover.py
442449
cae01d387617e3986b9cfb23519b7c6a444e2d116f2dc774163abec0217f6ed6 plugins/dbms/sqlite/connector.py
443450
fbcff0468fcccd9f86277d205b33f14578b7550b33d31716fd10003f16122752 plugins/dbms/sqlite/enumeration.py
444451
013f6cf4d04edce3ee0ede73b6415a2774e58452a5365ab5f7a49c77650ba355 plugins/dbms/sqlite/filesystem.py

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 import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.3.6"
23+
VERSION = "1.10.3.7"
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/spanner/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from lib.core.enums import DBMS
9+
from lib.core.settings import SPANNER_SYSTEM_DBS
10+
from lib.core.unescaper import unescaper
11+
12+
from plugins.dbms.spanner.enumeration import Enumeration
13+
from plugins.dbms.spanner.filesystem import Filesystem
14+
from plugins.dbms.spanner.fingerprint import Fingerprint
15+
from plugins.dbms.spanner.syntax import Syntax
16+
from plugins.dbms.spanner.takeover import Takeover
17+
from plugins.generic.misc import Miscellaneous
18+
19+
class SpannerMap(Syntax, Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
20+
"""
21+
This class defines Spanner methods
22+
"""
23+
24+
def __init__(self):
25+
self.excludeDbsList = SPANNER_SYSTEM_DBS
26+
27+
for cls in self.__class__.__bases__:
28+
cls.__init__(self)
29+
30+
unescaper[DBMS.SPANNER] = Syntax.escape

plugins/dbms/spanner/connector.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from plugins.generic.connector import Connector as GenericConnector
9+
10+
class Connector(GenericConnector):
11+
pass
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from lib.core.data import logger
9+
from lib.core.settings import SPANNER_DEFAULT_SCHEMA
10+
from plugins.generic.enumeration import Enumeration as GenericEnumeration
11+
12+
class Enumeration(GenericEnumeration):
13+
def getCurrentDb(self):
14+
return SPANNER_DEFAULT_SCHEMA
15+
16+
def getCurrentUser(self):
17+
warnMsg = "on Spanner it is not possible to enumerate the current user"
18+
logger.warning(warnMsg)
19+
20+
def isDba(self, user=None):
21+
warnMsg = "on Spanner it is not possible to test if current user is DBA"
22+
logger.warning(warnMsg)
23+
24+
def getUsers(self):
25+
warnMsg = "on Spanner it is not possible to enumerate the users"
26+
logger.warning(warnMsg)
27+
28+
return []
29+
30+
def getPasswordHashes(self):
31+
warnMsg = "on Spanner it is not possible to enumerate the user password hashes"
32+
logger.warning(warnMsg)
33+
34+
return {}
35+
36+
def getRoles(self, *args, **kwargs):
37+
warnMsg = "on Spanner it is not possible to enumerate the user roles"
38+
logger.warning(warnMsg)
39+
40+
return {}
41+
42+
def getPrivileges(self, *args, **kwargs):
43+
warnMsg = "on Spanner it is not possible to enumerate the user privileges"
44+
logger.warning(warnMsg)
45+
46+
return {}

plugins/dbms/spanner/filesystem.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from plugins.generic.filesystem import Filesystem as GenericFilesystem
9+
10+
class Filesystem(GenericFilesystem):
11+
pass
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 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.common import Format
10+
from lib.core.data import conf
11+
from lib.core.data import kb
12+
from lib.core.data import logger
13+
from lib.core.enums import DBMS
14+
from lib.core.session import setDbms
15+
from lib.core.settings import SPANNER_ALIASES
16+
from lib.request import inject
17+
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
18+
19+
class Fingerprint(GenericFingerprint):
20+
def __init__(self):
21+
GenericFingerprint.__init__(self, DBMS.SPANNER)
22+
23+
def getFingerprint(self):
24+
value = ""
25+
wsOsFp = Format.getOs("web server", kb.headersFp)
26+
27+
if wsOsFp:
28+
value += "%s\n" % wsOsFp
29+
30+
if kb.data.banner:
31+
dbmsOsFp = Format.getOs("back-end DBMS", kb.bannerFp)
32+
33+
if dbmsOsFp:
34+
value += "%s\n" % dbmsOsFp
35+
36+
value += "back-end DBMS: "
37+
38+
if not conf.extensiveFp:
39+
value += DBMS.SPANNER
40+
return value
41+
42+
actVer = Format.getDbms()
43+
blank = " " * 15
44+
value += "active fingerprint: %s" % actVer
45+
46+
if kb.bannerFp:
47+
banVer = kb.bannerFp.get("dbmsVersion")
48+
49+
if banVer:
50+
banVer = Format.getDbms([banVer])
51+
value += "\n%sbanner parsing fingerprint: %s" % (blank, banVer)
52+
53+
htmlErrorFp = Format.getErrorParsedDBMSes()
54+
55+
if htmlErrorFp:
56+
value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp)
57+
58+
return value
59+
60+
def checkDbms(self):
61+
if not conf.extensiveFp and Backend.isDbmsWithin(SPANNER_ALIASES):
62+
setDbms(DBMS.SPANNER)
63+
64+
self.getBanner()
65+
66+
return True
67+
68+
infoMsg = "testing %s" % DBMS.SPANNER
69+
logger.info(infoMsg)
70+
71+
result = inject.checkBooleanExpression("FARM_FINGERPRINT('sqlmap') IS NOT NULL")
72+
73+
if result:
74+
infoMsg = "confirming %s" % DBMS.SPANNER
75+
logger.info(infoMsg)
76+
77+
result = inject.checkBooleanExpression("SAFE_CAST(1 AS INT64)=1")
78+
if not result:
79+
warnMsg = "the back-end DBMS is not %s" % DBMS.SPANNER
80+
logger.warning(warnMsg)
81+
82+
return False
83+
84+
setDbms(DBMS.SPANNER)
85+
86+
self.getBanner()
87+
88+
return True
89+
else:
90+
warnMsg = "the back-end DBMS is not %s" % DBMS.SPANNER
91+
logger.warning(warnMsg)
92+
93+
return False

plugins/dbms/spanner/syntax.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from lib.core.convert import getOrds
9+
from plugins.generic.syntax import Syntax as GenericSyntax
10+
11+
class Syntax(GenericSyntax):
12+
@staticmethod
13+
def escape(expression, quote=True):
14+
"""
15+
Note: Google Standard SQL (Spanner) natively supports converting integer arrays
16+
to strings via CODE_POINTS_TO_STRING(). This is much cleaner and shorter
17+
than chaining multiple CHR() functions with the || operator.
18+
19+
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar") == "SELECT CODE_POINTS_TO_STRING([97, 98, 99, 100, 101, 102, 103, 104]) FROM foobar"
20+
True
21+
"""
22+
23+
def escaper(value):
24+
return "CODE_POINTS_TO_STRING([%s])" % ", ".join(str(_) for _ in getOrds(value))
25+
26+
return Syntax._escape(expression, quote, escaper)

plugins/dbms/spanner/takeover.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from lib.core.exception import SqlmapUnsupportedFeatureException
9+
from plugins.generic.takeover import Takeover as GenericTakeover
10+
11+
class Takeover(GenericTakeover):
12+
def osCmd(self):
13+
errMsg = "on Spanner it is not possible to execute commands"
14+
raise SqlmapUnsupportedFeatureException(errMsg)
15+
16+
def osShell(self):
17+
errMsg = "on Spanner it is not possible to execute commands"
18+
raise SqlmapUnsupportedFeatureException(errMsg)
19+
20+
def osPwn(self):
21+
errMsg = "on Spanner 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 Spanner it is not possible to establish an "
27+
errMsg += "out-of-band connection"
28+
raise SqlmapUnsupportedFeatureException(errMsg)

0 commit comments

Comments
 (0)