Minor patching

This commit is contained in:
Miroslav Štampar 2026-06-19 00:55:11 +02:00
parent 8de9c5899d
commit a2d44a7a16
8 changed files with 74 additions and 21 deletions

View file

@ -68,7 +68,7 @@ class Fingerprint(GenericFingerprint):
infoMsg = "testing %s" % DBMS.MONETDB
logger.info(infoMsg)
result = inject.checkBooleanExpression("isaurl(NULL)=false")
result = inject.checkBooleanExpression("isaurl(NULL) IS NULL")
if result:
infoMsg = "confirming %s" % DBMS.MONETDB

View file

@ -9,15 +9,8 @@ from lib.core.data import logger
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration):
def getBanner(self):
warnMsg = "on Presto it is not possible to get the banner"
logger.warning(warnMsg)
return None
def getCurrentDb(self):
warnMsg = "on Presto it is not possible to get name of the current database (schema)"
logger.warning(warnMsg)
# NOTE: getBanner()/getCurrentDb() are intentionally NOT overridden - modern Presto/Trino expose
# version() and current_schema (wired in queries.xml), so the generic implementations work.
def isDba(self, user=None):
warnMsg = "on Presto it is not possible to test if current user is DBA"

View file

@ -7,10 +7,14 @@ See the file 'LICENSE' for copying permission
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.common import hashDBRetrieve
from lib.core.common import hashDBWrite
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.enums import DBMS
from lib.core.enums import FORK
from lib.core.enums import HASHDB_KEYS
from lib.core.session import setDbms
from lib.core.settings import PRESTO_ALIASES
from lib.request import inject
@ -21,6 +25,18 @@ class Fingerprint(GenericFingerprint):
GenericFingerprint.__init__(self, DBMS.PRESTO)
def getFingerprint(self):
fork = hashDBRetrieve(HASHDB_KEYS.DBMS_FORK)
if fork is None:
# Trino (the PrestoSQL fork) exposes functions PrestoDB never added (e.g. SOUNDEX),
# so a NULL-based probe on one of them distinguishes the fork from the original.
if inject.checkBooleanExpression("SOUNDEX(NULL) IS NULL"):
fork = FORK.TRINO
else:
fork = ""
hashDBWrite(HASHDB_KEYS.DBMS_FORK, fork)
value = ""
wsOsFp = Format.getOs("web server", kb.headersFp)
@ -37,6 +53,8 @@ class Fingerprint(GenericFingerprint):
if not conf.extensiveFp:
value += DBMS.PRESTO
if fork:
value += " (%s fork)" % fork
return value
actVer = Format.getDbms()
@ -55,6 +73,9 @@ class Fingerprint(GenericFingerprint):
if htmlErrorFp:
value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp)
if fork:
value += "\n%sfork fingerprint: %s" % (blank, fork)
return value
def checkDbms(self):