Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/plugins/dbms/frontbase/fingerprint.py
2992 views
1
#!/usr/bin/env python
2
3
"""
4
Copyright (c) 2006-2025 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 FRONTBASE_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.FRONTBASE)
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.FRONTBASE
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(FRONTBASE_ALIASES):
62
setDbms(DBMS.FRONTBASE)
63
return True
64
65
infoMsg = "testing %s" % DBMS.FRONTBASE
66
logger.info(infoMsg)
67
68
result = inject.checkBooleanExpression("(SELECT degradedTransactions FROM INFORMATION_SCHEMA.IO_STATISTICS)>=0")
69
70
if result:
71
infoMsg = "confirming %s" % DBMS.FRONTBASE
72
logger.info(infoMsg)
73
74
result = inject.checkBooleanExpression("(SELECT TOP (0,1) file_version FROM INFORMATION_SCHEMA.FRAGMENTATION)>=0")
75
76
if not result:
77
warnMsg = "the back-end DBMS is not %s" % DBMS.FRONTBASE
78
logger.warning(warnMsg)
79
80
return False
81
82
setDbms(DBMS.FRONTBASE)
83
84
return True
85
else:
86
warnMsg = "the back-end DBMS is not %s" % DBMS.FRONTBASE
87
logger.warning(warnMsg)
88
89
return False
90
91