HI Peter
We use it in our software project but I extract the key points for you and wrote a little script. Here we go:
You could do it like this:
1) Config a rewrite for the form submit endpoint
In nginx you would do it like this:
location = /form/submit {
try_files $uri /submit.php$is_args$args;
}
In apache it would be something with rewrite in the htaccess.
2) Configure a cron job which downloads the known tor exit nodes
( Please be carefull and do not download the list to frequently. They will block you quit quickly. )
I store the list in the /var/cache dir in the mautic document root. Feel free to use every other location
0 */6 * * * curl -o /var/www/beispiel.com/public_html/var/cache/torbulkexitlist https://check.torproject.org/torbulkexitlist >/dev/null 2>&1
3) Custom submit.php
You could use this little script to do your checks. For the script I assume that you got a âlogsâ dir in the document root.
We log all requests (spam and non spam) for later analytics.
I just check for any cookies and if the user ip is associated with a tor exit node.
Please note: I just hacked this script together for you. Feel free to improve it. Maybe I will do a better script later. I got some more advanced integrations running, but donât have the time at the moment to publish them.
But this little script is working fine.
Some further ideas:
Of course you could insert more advanced checks here. For example look for a specific cookie, look for honey pot fields in the post array ⊠and so on.
You could also change the script that it will just change form fields if you think the user is a spam bot (for example fill a form field with the value bot or something and check that later)
You could also do some simple checks and look for the message length in form fields. Most spam bots try to insert very short spam because of the heuristic spam detection systems.
4) Review logs and clean dir
From time to time you should take a look into the logs dir and look for false positives.
You should also setup some sort of cronjobs which cleans the directory from time to time (older files) and access protect the directory maybe.
Greetings
Sebastian