in aardvark.py [0:0]
def scan_dict(self, post_dict: multidict.MultiDictProxy):
"""Scans form data dicts for spam"""
bad_items = []
for k, v in post_dict.items():
if v and isinstance(v, str) and len(v) >= MINIMUM_SCAN_LENGTH:
b = bytes(v, encoding="utf-8")
bad_items.extend(self.scan_simple(f"formdata::{k}", b))
# Use the naïve scanner as well?
if self.enable_naive:
res = self.spamfilter.scan_text(v)
if res >= self.naive_threshold:
bad_items.append(
f"Form element {k} has spam score of {res}, crosses threshold of {self.naive_threshold}!")
return bad_items