ElkArte Community

General => Chit Chat => Topic started by: kode54 on April 26, 2016, 03:50:19 pm

Title: Meet the Banhammer
Post by: kode54 on April 26, 2016, 03:50:19 pm
Back when the Hydrogen Audio forum was powered by IPB 2.x, this lovely script was crafted by the foobar2000 author, Peter Pawlowski, to help our group combat the massive influx of spammers. When I migrated the forum to ElkArte, I gave it a reworking for the new database structure, replaced mysqli with PDO, and import the configuration from the forum's own settings file.

https://gitlab.kode54.net/kode54/elkarte-banhammer

This script is meant to be limited access only, as it can ban (new) members, sanitize their profiles, hide their posts, etc.

I am looking for a two way road with this script, though. I would like a little help with fixing certain bugs I have with it, namely how I hide topics created by spammers when the Sanitize button is clicked. I am also looking to help bring some of these spammer smashing features to the official forum script in some way, maybe to help administrators out there to smash any spam problems they may have as well.

Things the default index can do:

- Display recently registered users who have added links to their profiles
- Find potential PM spammers by whether they're recently registered and are sending links via PM
- Attempt to detect ban evasion

Things other parts can do:

- Ban (recently registered and low post count only) members and report them to Stop Forum Spam at the click of the Spammer button

It needs some work with banning, though, since it currently uses a hard coded group ID number that is associated with an old imported IPB "Banned" member group.
Title: Re: Meet the Banhammer
Post by: emanuele on April 27, 2016, 06:38:07 pm
Interesting!
Anything that helps fighting spam is a good thing. nods

I'll try to install and try it, but if in the meantime you have specific questions feel free to ask, I'm sure someone will be able to give you hints or code! ;D
Title: Re: Meet the Banhammer
Post by: kode54 on May 01, 2016, 08:45:39 pm
It's not currently an add-on, and it performs no authentication on access.

So, perhaps what really needs to be done is finding a way to either integrate or make an add-on out of some of the spammer tracking features, and migrate the cleanup methods to actual internal script actions, so that they can be done correctly, instead of the half-booty methods I used when porting it.
Title: Re: Meet the Banhammer
Post by: Frenzie on May 02, 2016, 05:27:03 am
I see there's at least some overlap with the SMF Stop Spammer (http://custom.simplemachines.org/mods/index.php?mod=1547) addon,[1] which I probably intend to port over to Elk sometime (with permission). It's probably the most relevant ready-made overview of Elk/SMF hooks pertaining to the kinds of things you're doing.

Here's a (possibly working, didn't test) quick conversion of the DB creation script, but otherwise I haven't had a real look at it yet. The main effort in porting Stop Spammer would be in converting the source mods into more Elk hooks as much as possible.
Code: [Select]
<?php
// Stop Spammer
// This file will create all the necessary columns in your database, if they do not exist already.

$db = database();
$db_table = db_table();

$db_table->db_add_column(
'{db_prefix}members',
array (
'name' => 'is_spammer',
'type' => 'TINYINT',
'size' => '3',
'null' => '', // NOT NULL
'default' => '0',
'auto' => ''
),
'',
''
);

$db->insert('ignore',
'{db_prefix}settings',
array('variable' => 'string','value' => 'string'),
array(
array ('stopspammer_count' ,'0'),
array ('stopspammer_enable','0'),
array ('stopspammer_show01','1'),
array ('stopspammer_faildb','2'),
array ('stopspammer_api_key',''),
array ('stopspammer_check_name','0'),
array ('stopspammer_check_mail','1'),
array ('stopspammer_check_ip','1')
),
array()
);
Its main purpose is flagging suspicious members based on SFS and of course also to submit back.
Title: Re: Meet the Banhammer
Post by: kode54 on February 15, 2017, 09:00:02 pm
I have updated this script, fixing the issue with hiding spammers' topics. Apparently, topic.approved doesn't hide the topic from normal users, it hides its entire post listing from everyone, including administrators. The correct way to hide a topic is to mark first_post.approved = 0.
Title: Re: Meet the Banhammer
Post by: Frenzie on February 16, 2017, 12:14:05 pm
Coincidentally, it apparently took me about 10 months since posting the message above, but last week when I had some spare time I actually ported over the bulk of Stop Spammer: http://www.elkarte.net/community/index.php?topic=4277.0

Its integrated SFS check on registration as well as on demand might be of some minor interest to you, plus it seems to be about the only thing your excellent script doesn't do. ;)