#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'Instart DX (Instart Logic)' def is_waf(self): # 定义两个不同的检测模式。 schema1 = [ # 检查响应头中是否存在'X-Instart-Request-ID'字段且其值不为空。 self.matchHeader(('X-Instart-Request-ID', '.+')), # 检查响应头中是否存在'X-Instart-Cache'字段且其值不为空。 self.matchHeader(('X-Instart-Cache', '.+')), # 检查响应头中是否存在'X-Instart-WL'字段且其值不为空。 self.matchHeader(('X-Instart-WL', '.+')) ] schema2 = [ # 检查响应内容中是否包含'the requested url was rejected'。 self.matchContent(r'the requested url was rejected'), # 检查响应内容中是否包含'please consult with your administrator'。 self.matchContent(r'please consult with your administrator'), # 检查响应内容中是否包含'your support id is'。 self.matchContent(r'your support id is') ] # 如果 schema1 中的任何一个条件为真,则认为检测到了 WAF。 if any(i for i in schema1): return True # 如果 schema2 中的所有条件都为真,则认为检测到了 WAF。 if all(i for i in schema2): return True return False