#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'WebKnight (AQTRONIX)' def is_waf(self): # 定义三个检测模式。 schema1 = [ # 检查响应状态码是否为 999。 self.matchStatus(999), # 检查响应原因是否为'No Hacking'。 self.matchReason('No Hacking') ] schema2 = [ # 检查响应状态码是否为 404。 self.matchStatus(404), # 检查响应原因是否为'Hack Not Found'。 self.matchReason('Hack Not Found') ] schema3 = [ # 检查响应内容中是否包含'WebKnight Application Firewall Alert'。 self.matchContent(r'WebKnight Application Firewall Alert'), # 检查响应内容中是否包含'What is webknight?'。 self.matchContent(r'What is webknight?'), # 检查响应内容中是否包含'AQTRONIX WebKnight is an application firewall'。 self.matchContent(r'AQTRONIX WebKnight is an application firewall'), # 检查响应内容中是否包含'WebKnight will take over and protect'。 self.matchContent(r'WebKnight will take over and protect'), # 检查响应内容中是否包含'aqtronix.com/WebKnight'。 self.matchContent(r'aqtronix\.com/WebKnight'), # 检查响应内容中是否包含'AQTRONIX.(最多十个任意字符)WebKnight'。 self.matchContent(r'AQTRONIX.{0,10}?WebKnight') ] # 如果 schema1 中的所有条件都为真,则认为检测到了 WAF。 if all(i for i in schema1): return True # 如果 schema2 中的所有条件都为真,则认为检测到了 WAF。 if all(i for i in schema2): return True # 如果 schema3 中的任何一个条件为真,则认为检测到了 WAF。 if any(i for i in schema3): return True return False