MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / checkDbms

Method checkDbms

plugins/dbms/presto/fingerprint.py:60–137  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

58 return value
59
60 def checkDbms(self):
61 if not conf.extensiveFp and Backend.isDbmsWithin(PRESTO_ALIASES):
62 setDbms(DBMS.PRESTO)
63
64 self.getBanner()
65
66 return True
67
68 infoMsg = "testing %s" % DBMS.PRESTO
69 logger.info(infoMsg)
70
71 result = inject.checkBooleanExpression("TO_BASE64URL(NULL) IS NULL")
72
73 if result:
74 infoMsg = "confirming %s" % DBMS.PRESTO
75 logger.info(infoMsg)
76
77 result = inject.checkBooleanExpression("TO_HEX(FROM_HEX(NULL)) IS NULL")
78
79 if not result:
80 warnMsg = "the back-end DBMS is not %s" % DBMS.PRESTO
81 logger.warning(warnMsg)
82
83 return False
84
85 setDbms(DBMS.PRESTO)
86
87 if not conf.extensiveFp:
88 return True
89
90 infoMsg = "actively fingerprinting %s" % DBMS.PRESTO
91 logger.info(infoMsg)
92
93 # Reference: https://prestodb.io/docs/current/release/release-0.200.html
94 if inject.checkBooleanExpression("FROM_IEEE754_32(NULL) IS NULL"):
95 Backend.setVersion(">= 0.200")
96 # Reference: https://prestodb.io/docs/current/release/release-0.193.html
97 elif inject.checkBooleanExpression("NORMAL_CDF(NULL,NULL,NULL) IS NULL"):
98 Backend.setVersion(">= 0.193")
99 # Reference: https://prestodb.io/docs/current/release/release-0.183.html
100 elif inject.checkBooleanExpression("MAP_ENTRIES(NULL) IS NULL"):
101 Backend.setVersion(">= 0.183")
102 # Reference: https://prestodb.io/docs/current/release/release-0.171.html
103 elif inject.checkBooleanExpression("CODEPOINT(NULL) IS NULL"):
104 Backend.setVersion(">= 0.171")
105 # Reference: https://prestodb.io/docs/current/release/release-0.162.html
106 elif inject.checkBooleanExpression("XXHASH64(NULL) IS NULL"):
107 Backend.setVersion(">= 0.162")
108 # Reference: https://prestodb.io/docs/current/release/release-0.151.html
109 elif inject.checkBooleanExpression("COSINE_SIMILARITY(NULL,NULL) IS NULL"):
110 Backend.setVersion(">= 0.151")
111 # Reference: https://prestodb.io/docs/current/release/release-0.143.html
112 elif inject.checkBooleanExpression("TRUNCATE(NULL) IS NULL"):
113 Backend.setVersion(">= 0.143")
114 # Reference: https://prestodb.io/docs/current/release/release-0.137.html
115 elif inject.checkBooleanExpression("BIT_COUNT(NULL,NULL) IS NULL"):
116 Backend.setVersion(">= 0.137")
117 # Reference: https://prestodb.io/docs/current/release/release-0.130.html

Callers

nothing calls this directly

Calls 5

setDbmsFunction · 0.90
isDbmsWithinMethod · 0.80
infoMethod · 0.80
setVersionMethod · 0.80
getBannerMethod · 0.45

Tested by

no test coverage detected