You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.3 KiB
34 lines
1.3 KiB
2 months ago
|
#!/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
|