[PERL] StopForumSpam 12-12-2013, 07:05 AM
#1
Okay, well, this is just a quick little perl hack/script i worked up for a specific need... was attempting to register on a forum that had implemented StopForumSpam (using a proxy). After 10-15 registration attempts with different IP's i was getting fed up of being denied
Basically, this reads a file called iplist.txt which is populated with IP's (1 per line) to check against the SFS site. Any IP's that return 0 results get printed to a file called clean.txt - These are not found in the SFS database!
Must have Perl and Curl - Tested only on my Linux system
They do have an API - i didnt want to fiddle around with obtaining one and what not. This probably breaks their terms of service and its probably a bit slower than having used the API due to curl needing to download a webpage for each IP... wouldnt recommend doing hundreds of requests... might get yourself banned, but as far as a quick check on a handful or two of IP's it works well enough imo.
*disclaimer, I did use a regex generator to generate the regex code. Not my strong point.
Basically, this reads a file called iplist.txt which is populated with IP's (1 per line) to check against the SFS site. Any IP's that return 0 results get printed to a file called clean.txt - These are not found in the SFS database!
Must have Perl and Curl - Tested only on my Linux system
They do have an API - i didnt want to fiddle around with obtaining one and what not. This probably breaks their terms of service and its probably a bit slower than having used the API due to curl needing to download a webpage for each IP... wouldnt recommend doing hundreds of requests... might get yourself banned, but as far as a quick check on a handful or two of IP's it works well enough imo.
Code:
#!/usr/bin/perl
open (CLEAN, '>>clean.txt');
open (IP, 'iplist.txt');
while (<IP>) {
chomp;
$sfs = `curl http://www.stopforumspam.com/ipcheck/$_`;
$re1='(database)';
$re2='(\\s+)';
$re3='(\\d+)';
$re4='(\\s+)';
$re5='((?:[a-z][a-z]+))';
$re=$re1.$re2.$re3.$re4.$re5;
if ($sfs =~ m/$re/is) {
$int1=$3;
if($int1 <= 0) {
print CLEAN "$_\n";
}
}
}
close (IP);
close (CLEAN);*disclaimer, I did use a regex generator to generate the regex code. Not my strong point.



![[+]](https://sinister.li/images/modern/collapse_collapsed.png)