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.
MiaCTFer/client-1/webinfo/wafw00f/plugins/fortiweb.py

38 lines
1.3 KiB

2 months ago
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'FortiWeb (Fortinet)'
def is_waf(self):
# 定义两个不同的检测模式。
schema1 = [
# 检查是否存在以'FORTIWAFSID='开头的 Cookie。
self.matchCookie(r'^FORTIWAFSID='),
# 检查响应内容中是否包含'.fgd_icon'。
self.matchContent('.fgd_icon')
]
schema2 = [
# 检查响应内容中是否包含'fgd_icon'。
self.matchContent('fgd_icon'),
# 检查响应内容中是否包含'web.page.blocked'。
self.matchContent('web.page.blocked'),
# 检查响应内容中是否包含'url'。
self.matchContent('url'),
# 检查响应内容中是否包含'attack.id'。
self.matchContent('attack.id'),
# 检查响应内容中是否包含'message.id'。
self.matchContent('message.id'),
# 检查响应内容中是否包含'client.ip'。
self.matchContent('client.ip')
]
# 如果 schema1 中的任何一个条件为真,则认为检测到了 WAF。
if any(i for i in schema1):
return True
# 如果 schema2 中的所有条件都为真,则认为检测到了 WAF。
if all(i for i in schema2):
return True
return False