sqlmap/waf/sucuri.py

30 lines
978 B
Python
Raw Normal View History

#!/usr/bin/env python
"""
2019-01-05 23:38:52 +03:00
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
2017-10-11 15:50:46 +03:00
See the file 'LICENSE' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
2016-07-07 00:43:21 +03:00
__product__ = "CloudProxy WebSite Firewall (Sucuri)"
def detect(get_page):
2016-05-27 03:24:59 +03:00
retval = False
for vector in WAF_ATTACK_VECTORS:
2016-07-07 00:43:21 +03:00
page, headers, code = get_page(get=vector)
2016-05-27 03:24:59 +03:00
retval = code == 403 and re.search(r"Sucuri/Cloudproxy", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
retval |= "Access Denied - Sucuri Website Firewall" in (page or "")
2016-07-07 00:43:21 +03:00
retval |= "Sucuri WebSite Firewall - CloudProxy - Access Denied" in (page or "")
retval |= re.search(r"Questions\?.+cloudproxy@sucuri\.net", (page or "")) is not None
2018-08-05 15:19:27 +03:00
retval |= headers.get("X-Sucuri-ID") is not None
retval |= headers.get("X-Sucuri-Cache") is not None
2016-05-27 03:24:59 +03:00
if retval:
break
2016-05-27 03:24:59 +03:00
return retval