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/litespeed.py

30 lines
1.0 KiB

#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'LiteSpeed (LiteSpeed Technologies)'
def is_waf(self):
# 定义两个不同的检测模式。
schema1 = [
# 检查响应头中的'Server'字段是否为'LiteSpeed'。
self.matchHeader(('Server', 'LiteSpeed')),
# 检查响应状态码是否为 403。
self.matchStatus(403)
]
schema2 = [
# 检查响应内容中是否包含'Proudly powered by litespeed web server'。
self.matchContent(r'Proudly powered by litespeed web server'),
# 检查响应内容中是否包含'www.litespeedtech.com/error-page'。
self.matchContent(r'www\.litespeedtech\.com/error\-page')
]
# 如果 schema1 中的所有条件都为真,则认为检测到了 WAF。
if all(i for i in schema1):
return True
# 如果 schema2 中的任何一个条件为真,则认为检测到了 WAF。
if any(i for i in schema2):
return True
return False