in aardvark.py [0:0]
def scan_simple(self, request_url: str, post_data: bytes = None):
"""Scans post data for spam"""
bad_items = []
# Check for honey pot URLs
for su in self.spamurls:
if su.match(request_url):
bad_items.append(f"Request URL '{request_url}' matches honey pot URL '{su.pattern}'")
# Standard POST data simple matches
for pm in self.postmatches:
if pm.search(post_data):
bad_items.append("Found offending match in POST data: " + str(pm.pattern, encoding="utf-8"))
# Multimatch check where one _required_ match is needed, PLUS one or more _auxiliary_ matches.
# Thus, "phone support" does not match, but "for phone support, call 1-234-453-2383" will.
for req in self.multispam_required:
if req.search(post_data):
for aux in self.multispam_auxiliary:
if aux.search(post_data):
bad_items.append(
f"Found multi-match in POST data: '%s' + '%s'"
% (str(req.pattern, encoding="utf-8"), str(aux.pattern, encoding="utf-8"))
)
return bad_items