2017-11-14 22:07:26 +00:00
|
|
|
import re
|
|
|
|
|
|
2017-11-27 19:09:53 +00:00
|
|
|
from lib.core.common import HTTP_HEADER
|
|
|
|
|
|
2017-11-14 22:07:26 +00:00
|
|
|
|
|
|
|
|
__item__ = "Amazon Web Services Web Application Firewall (Amazon)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def detect(content, **kwargs):
|
|
|
|
|
headers = kwargs.get("headers", None)
|
|
|
|
|
content = str(content)
|
|
|
|
|
detection_schema = (
|
|
|
|
|
re.compile(r"<RequestId>[0-9a-zA-Z]{16,25}<.RequestId>", re.I),
|
2017-11-21 02:00:45 +00:00
|
|
|
re.compile(r"<Error><Code>AccessDenied<.Code>", re.I),
|
|
|
|
|
re.compile(r"\bAWS", re.I),
|
|
|
|
|
re.compile(r"x.amz.id.\d+", re.I),
|
2017-11-27 19:09:53 +00:00
|
|
|
re.compile(r"x.amz.request.id", re.I),
|
|
|
|
|
re.compile(r"amazon.\d+", re.I)
|
2017-11-14 22:07:26 +00:00
|
|
|
)
|
2017-11-24 13:02:28 +00:00
|
|
|
for detection in detection_schema:
|
|
|
|
|
if detection.search(content) is not None:
|
|
|
|
|
return True
|
2017-11-27 19:09:53 +00:00
|
|
|
if detection.search(headers.get(HTTP_HEADER.SERVER, "")) is not None:
|
|
|
|
|
return True
|
|
|
|
|
if detection.search(headers.get(HTTP_HEADER.X_POWERED_BY, "")) is not None:
|
2017-11-24 13:02:28 +00:00
|
|
|
return True
|