(self)
References for fingerprint:
        DATABASE_VERSION()
        version 2.2.6 added two-arg REPLACE functio REPLACE('a','a') compared to REPLACE('a','a','d')
        version 2.2.5 added SYSTIMESTAMP function
        version 2.2.3 added REGEXPR_SUBSTRING and REGEXPR_SUBSTRING_ARRAY functions
        version 2.2.0 added support for ROWNUM() function
        version 2.1.0 added MEDIAN aggregate function
        version < 2.0.1 added support for datetime ROUND and TRUNC functions
        version 2.0.0 added VALUES support
        version 1.8.0.4 Added org.hsqldbdb.Library function, getDatabaseFullProductVersion to return the
                        full version string, including the 4th digit (e.g 1.8.0.4).
        version 1.7.2 CASE statements added and INFORMATION_SCHEMA
References for fingerprint:
        DATABASE_VERSION()
        version 2.2.6 added two-arg REPLACE functio REPLACE('a','a') compared to REPLACE('a','a','d')
        version 2.2.5 added SYSTIMESTAMP function
        version 2.2.3 added REGEXPR_SUBSTRING and REGEXPR_SUBSTRING_ARRAY functions
        version 2.2.0 added support for ROWNUM() function
        version 2.1.0 added MEDIAN aggregate function
        version < 2.0.1 added support for datetime ROUND and TRUNC functions
        version 2.0.0 added VALUES support
        version 1.8.0.4 Added org.hsqldbdb.Library function, getDatabaseFullProductVersion to return the
                        full version string, including the 4th digit (e.g 1.8.0.4).
        version 1.7.2 CASE statements added and INFORMATION_SCHEMA
References for fingerprint : DATABASE_VERSION () version 2 . 2 . 6 added two - arg REPLACE functio REPLACE ( a a ) compared to REPLACE ( a a d ) version 2 . 2 . 5 added SYSTIMESTAMP function version 2 . 2 . 3 added REGEXPR_SUBSTRING and REGEXPR_SUBSTRING_ARRAY functions version 2 . 2 . 0 added support for ROWNUM () function version 2 . 1 . 0 added MEDIAN aggregate function version < 2 . 0 . 1 added support for datetime ROUND and TRUNC functions version 2 . 0 . 0 added VALUES support version 1 . 8 . 0 . 4 Added org . hsqldbdb . Library function getDatabaseFullProductVersion to return the full version string including the 4th digit ( e . g 1 . 8 . 0 . 4 ) . version 1 . 7 . 2 CASE statements added and INFORMATION_SCHEMA
def checkDbms(self):
        """
        References for fingerprint:
        DATABASE_VERSION()
        version 2.2.6 added two-arg REPLACE functio REPLACE('a','a') compared to REPLACE('a','a','d')
        version 2.2.5 added SYSTIMESTAMP function
        version 2.2.3 added REGEXPR_SUBSTRING and REGEXPR_SUBSTRING_ARRAY functions
        version 2.2.0 added support for ROWNUM() function
        version 2.1.0 added MEDIAN aggregate function
        version < 2.0.1 added support for datetime ROUND and TRUNC functions
        version 2.0.0 added VALUES support
        version 1.8.0.4 Added org.hsqldbdb.Library function, getDatabaseFullProductVersion to return the
                        full version string, including the 4th digit (e.g 1.8.0.4).
        version 1.7.2 CASE statements added and INFORMATION_SCHEMA

        """

        if not conf.extensiveFp and (Backend.isDbmsWithin(HSQLDB_ALIASES) \
           or (conf.dbms or "").lower() in HSQLDB_ALIASES) and Backend.getVersion() and \
           Backend.getVersion() != UNKNOWN_DBMS_VERSION:
            v = Backend.getVersion().replace(">", "")
            v = v.replace("=", "")
            v = v.replace(" ", "")

            Backend.setVersion(v)

            setDbms("%s %s" % (DBMS.HSQLDB, Backend.getVersion()))

            if Backend.isVersionGreaterOrEqualThan("1.7.2"):
                kb.data.has_information_schema = True

            self.getBanner()

            return True

        infoMsg = "testing %s" % DBMS.HSQLDB
        logger.info(infoMsg)

        result = inject.checkBooleanExpression("CASEWHEN(1=1,1,0)=1")

        if result:
            infoMsg = "confirming %s" % DBMS.HSQLDB
            logger.info(infoMsg)

            result = inject.checkBooleanExpression("ROUNDMAGIC(PI())>=3")

            if not result:
                warnMsg = "the back-end DBMS is not %s" % DBMS.HSQLDB
                logger.warn(warnMsg)

                return False
            else:
                kb.data.has_information_schema = True
                Backend.setVersion(">= 1.7.2")
                setDbms("%s 1.7.2" % DBMS.HSQLDB)

                banner = self.getBanner()
                if banner:
                    Backend.setVersion("= %s" % banner)
                else:
                    if inject.checkBooleanExpression("(SELECT [RANDNUM] FROM (VALUES(0)))=[RANDNUM]"):
                        Backend.setVersionList([">= 2.0.0", "< 2.3.0"])
                    else:
                        banner = unArrayizeValue(inject.getValue("\"org.hsqldbdb.Library.getDatabaseFullProductVersion\"()", safeCharEncode=True))
                        if banner:
                            Backend.setVersion("= %s" % banner)
                        else:
                            Backend.setVersionList([">= 1.7.2", "< 1.8.0"])

            return True
        else:
            warnMsg = "the back-end DBMS is not %s or version is < 1.7.2" % DBMS.HSQLDB
            logger.warn(warnMsg)

            return False
def checkDbms ( self ) : if not conf . extensiveFp and ( Backend . isDbmsWithin ( HSQLDB_ALIASES ) or ( conf . dbms or "" ) . lower ( ) in HSQLDB_ALIASES ) and Backend . getVersion ( ) and Backend . getVersion ( ) != UNKNOWN_DBMS_VERSION : v = Backend . getVersion ( ) . replace ( ">" , "" ) v = v . replace ( "=" , "" ) v = v . replace ( " " , "" ) Backend . setVersion ( v ) setDbms ( "%s %s" % ( DBMS . HSQLDB , Backend . getVersion ( ) ) ) if Backend . isVersionGreaterOrEqualThan ( "1.7.2" ) : kb . data . has_information_schema = True self . getBanner ( ) return True infoMsg = "testing %s" % DBMS . HSQLDB logger . info ( infoMsg ) result = inject . checkBooleanExpression ( "CASEWHEN(1=1,1,0)=1" ) if result : infoMsg = "confirming %s" % DBMS . HSQLDB logger . info ( infoMsg ) result = inject . checkBooleanExpression ( "ROUNDMAGIC(PI())>=3" ) if not result : warnMsg = "the back-end DBMS is not %s" % DBMS . HSQLDB logger . warn ( warnMsg ) return False else : kb . data . has_information_schema = True Backend . setVersion ( ">= 1.7.2" ) setDbms ( "%s 1.7.2" % DBMS . HSQLDB ) banner = self . getBanner ( ) if banner : Backend . setVersion ( "= %s" % banner ) else : if inject . checkBooleanExpression ( "(SELECT [RANDNUM] FROM (VALUES(0)))=[RANDNUM]" ) : Backend . setVersionList ( [ ">= 2.0.0" , "< 2.3.0" ] ) else : banner = unArrayizeValue ( inject . getValue ( "\"org.hsqldbdb.Library.getDatabaseFullProductVersion\"()" , safeCharEncode = True ) ) if banner : Backend . setVersion ( "= %s" % banner ) else : Backend . setVersionList ( [ ">= 1.7.2" , "< 1.8.0" ] ) return True else : warnMsg = "the back-end DBMS is not %s or version is < 1.7.2" % DBMS . HSQLDB logger . warn ( warnMsg ) return False