References for fingerprint: * https://www.postgresql.org/docs/current/static/release.html
(self)
| 92 | return value |
| 93 | |
| 94 | def checkDbms(self): |
| 95 | """ |
| 96 | References for fingerprint: |
| 97 | |
| 98 | * https://www.postgresql.org/docs/current/static/release.html |
| 99 | """ |
| 100 | |
| 101 | if not conf.extensiveFp and Backend.isDbmsWithin(PGSQL_ALIASES): |
| 102 | setDbms(DBMS.PGSQL) |
| 103 | |
| 104 | self.getBanner() |
| 105 | |
| 106 | return True |
| 107 | |
| 108 | infoMsg = "testing %s" % DBMS.PGSQL |
| 109 | logger.info(infoMsg) |
| 110 | |
| 111 | # NOTE: Vertica works too without the CONVERT_TO() |
| 112 | result = inject.checkBooleanExpression("CONVERT_TO('[RANDSTR]', QUOTE_IDENT(NULL)) IS NULL") |
| 113 | |
| 114 | if result: |
| 115 | infoMsg = "confirming %s" % DBMS.PGSQL |
| 116 | logger.info(infoMsg) |
| 117 | |
| 118 | result = inject.checkBooleanExpression("COALESCE([RANDNUM], NULL)=[RANDNUM]") |
| 119 | |
| 120 | if not result: |
| 121 | warnMsg = "the back-end DBMS is not %s" % DBMS.PGSQL |
| 122 | logger.warning(warnMsg) |
| 123 | |
| 124 | return False |
| 125 | |
| 126 | setDbms(DBMS.PGSQL) |
| 127 | |
| 128 | self.getBanner() |
| 129 | |
| 130 | if not conf.extensiveFp: |
| 131 | return True |
| 132 | |
| 133 | infoMsg = "actively fingerprinting %s" % DBMS.PGSQL |
| 134 | logger.info(infoMsg) |
| 135 | |
| 136 | if inject.checkBooleanExpression("JSON_QUERY(NULL::jsonb, '$') IS NULL"): |
| 137 | Backend.setVersion(">= 17.0") |
| 138 | elif inject.checkBooleanExpression("RANDOM_NORMAL(0.0, 1.0) IS NOT NULL"): |
| 139 | Backend.setVersion(">= 16.0") |
| 140 | elif inject.checkBooleanExpression("REGEXP_COUNT(NULL,NULL) IS NULL"): |
| 141 | Backend.setVersion(">= 15.0") |
| 142 | elif inject.checkBooleanExpression("BIT_COUNT(NULL) IS NULL"): |
| 143 | Backend.setVersion(">= 14.0") |
| 144 | elif inject.checkBooleanExpression("NULL::anycompatible IS NULL"): |
| 145 | Backend.setVersion(">= 13.0") |
| 146 | elif inject.checkBooleanExpression("SINH(0)=0"): |
| 147 | Backend.setVersion(">= 12.0") |
| 148 | elif inject.checkBooleanExpression("SHA256(NULL) IS NULL"): |
| 149 | Backend.setVersion(">= 11.0") |
| 150 | elif inject.checkBooleanExpression("XMLTABLE(NULL) IS NULL"): |
| 151 | Backend.setVersionList([">= 10.0", "< 11.0"]) |
nothing calls this directly
no test coverage detected