#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'ASP.NET Generic (Microsoft)' def is_waf(self): # 定义用于检测是否存在特定 Web 应用防火墙(WAF)的方案列表。 schemes = [ # 检查响应内容中是否包含特定的 IIS 错误信息格式。 self.matchContent(r'iis (\d+.)+?detailed error'), # 检查响应内容中是否包含特定的关于潜在危险请求查询字符串的提示。 self.matchContent(r'potentially dangerous request querystring'), # 检查响应内容中是否包含特定的关于应用程序因安全原因不能被远程查看的错误信息。 self.matchContent(r'application error from being viewed remotely (for security reasons)?'), # 检查响应内容中是否包含特定的关于服务器上发生应用程序错误的信息。 self.matchContent(r'An application error occurred on the server') ] # 如果方案列表中的任何一个方案为真,则认为检测到了 WAF。 if any(i for i in schemes): return True else: return False