From 0a49890120d5e8c4420d9559b910d4f1c1cdba6c Mon Sep 17 00:00:00 2001 From: Warmlight <344053630@qq.com> Date: Mon, 16 Dec 2024 21:25:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E7=BA=B9=E8=AF=86=E5=88=AB=E5=92=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/dbms/maxdb/fingerprint.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/sqlmap-master/plugins/dbms/maxdb/fingerprint.py b/src/sqlmap-master/plugins/dbms/maxdb/fingerprint.py index a60bc65..1c686ab 100644 --- a/src/sqlmap-master/plugins/dbms/maxdb/fingerprint.py +++ b/src/sqlmap-master/plugins/dbms/maxdb/fingerprint.py @@ -21,12 +21,19 @@ from plugins.generic.fingerprint import Fingerprint as GenericFingerprint class Fingerprint(GenericFingerprint): def __init__(self): + """ + 初始化Fingerprint类,指定为SAP MaxDB。 + """ GenericFingerprint.__init__(self, DBMS.MAXDB) def _versionCheck(self): + """ + 执行SAP MaxDB的SYSINFO版本检查。 + """ infoMsg = "executing %s SYSINFO version check" % DBMS.MAXDB logger.info(infoMsg) + # 构建查询语句 query = agent.prefixQuery("/* NoValue */") query = agent.suffixQuery(query) payload = agent.payload(newValue=query) @@ -40,12 +47,14 @@ class Fingerprint(GenericFingerprint): minor, major = None, None + # 检查主要版本号 for version in (6, 7): result = inject.checkBooleanExpression("%d=(SELECT MAJORVERSION FROM SYSINFO.VERSION)" % version) if result: major = version + # 检查次要版本号 for version in xrange(0, 10): result = inject.checkBooleanExpression("%d=(SELECT MINORVERSION FROM SYSINFO.VERSION)" % version) @@ -58,12 +67,17 @@ class Fingerprint(GenericFingerprint): return None def getFingerprint(self): + """ + 获取指纹信息。 + """ value = "" + # 获取Web服务器的操作系统指纹 wsOsFp = Format.getOs("web server", kb.headersFp) if wsOsFp: value += "%s\n" % wsOsFp + # 获取后端数据库的操作系统指纹 if kb.data.banner: dbmsOsFp = Format.getOs("back-end DBMS", kb.bannerFp) @@ -77,6 +91,7 @@ class Fingerprint(GenericFingerprint): value += DBMS.MAXDB return value + # 获取活性指纹 actVer = Format.getDbms() + " (%s)" % self._versionCheck() blank = " " * 15 value += "active fingerprint: %s" % actVer @@ -84,6 +99,7 @@ class Fingerprint(GenericFingerprint): if kb.bannerFp: value += "\n%sbanner parsing fingerprint: -" % blank + # 获取HTML错误消息指纹 htmlErrorFp = Format.getErrorParsedDBMSes() if htmlErrorFp: @@ -92,9 +108,13 @@ class Fingerprint(GenericFingerprint): return value def checkDbms(self): + """ + 检测后端数据库是否为SAP MaxDB。 + """ if not conf.extensiveFp and Backend.isDbmsWithin(MAXDB_ALIASES): setDbms(DBMS.MAXDB) + # 获取Banner信息 self.getBanner() return True @@ -102,12 +122,14 @@ class Fingerprint(GenericFingerprint): infoMsg = "testing %s" % DBMS.MAXDB logger.info(infoMsg) + # 检查ALPHA(NULL)是否为NULL result = inject.checkBooleanExpression("ALPHA(NULL) IS NULL") if result: infoMsg = "confirming %s" % DBMS.MAXDB logger.info(infoMsg) + # 检查MAPCHAR(NULL,1,DEFAULTMAP)是否为NULL result = inject.checkBooleanExpression("MAPCHAR(NULL,1,DEFAULTMAP) IS NULL") if not result: @@ -128,10 +150,13 @@ class Fingerprint(GenericFingerprint): return False def forceDbmsEnum(self): + """ + 强制进行数据库枚举。 + """ if conf.db: conf.db = conf.db.upper() else: conf.db = "USER" if conf.tbl: - conf.tbl = conf.tbl.upper() + conf.tbl = conf.tbl.upper() \ No newline at end of file