[CDB] Stop Forum Spam

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
FredQ
Registered User
Posts: 138
Joined: Sat Nov 01, 2014 10:48 am
Location: Northeast Scotland
Name: Fred Q

Re: [RC] Stop Forum Spam

Post by FredQ »

Hi,

First of all, thanks for the great job!

I'm a little bit surprised, on the screenshots I can see a field to input your "API key", but I can't see it on mine :?

Is the API key not needed any more? or is it in another page?
My board (converted from vBulletin)
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Stop Forum Spam

Post by RMcGirr83 »

Not needed anymore.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
FredQ
Registered User
Posts: 138
Joined: Sat Nov 01, 2014 10:48 am
Location: Northeast Scotland
Name: Fred Q

Re: [RC] Stop Forum Spam

Post by FredQ »

RMcGirr83 wrote:Not needed anymore.
Cool! Thank you. Well I'd be happy to send information back to the stop spam website, I believe that's what the API key is for.

Anyway, I do use this extension in production. With the help of reCaptcha v2, now I don't have to delete hundreds of spambot registrations a day!

Thanks
My board (converted from vBulletin)
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium

Re: [RC] Stop Forum Spam

Post by GoBieN »

According to StopForumSpam it's not supposed to be used like this. You should only report/submit if they actually make a spam post.
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium

Re: [RC] Stop Forum Spam

Post by GoBieN »

I just changed this part:

Code: Select all

			// Let's not ban a registrant/poster with a common IP address, who is otherwise clean
			// not sure of keeping this or not...we'll see
			/*if ($ck_username + $ck_email == 0)
			{
				$ck_ip = 0;
			}*/

Code: Select all

			// Let's not ban a registrant/poster with a common IP address, who is otherwise clean
			// not sure of keeping this or not...we'll see
			if (($ck_username + $ck_email == 0) && $ck_ip < 2)
			{
				$ck_ip = 0;
			}
I had a flood of inactive new users all from the same IP known on SFS:
https://www.stopforumspam.com/ipcheck/46.151.52.38
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Stop Forum Spam

Post by RMcGirr83 »

I will probably just remove the code. Though IP addresses change all the time which may disallow actual users from registering.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
nero
Registered User
Posts: 321
Joined: Fri Mar 13, 2015 8:18 am

Re: [RC] Stop Forum Spam

Post by nero »

Thanks :) +1
Lady_G
Registered User
Posts: 276
Joined: Fri Jun 08, 2012 12:38 pm
Location: US

Re: [RC] Stop Forum Spam

Post by Lady_G »

^^^ Also, thanks.
GoBieN wrote:Might I suggest admin options to choose for check on IP, email, username or all of them?

I disabled username checking in the code, I don't think it's useful but does potentially deny user registration.
I had a user that just chose the username "Sydney" for registration and got blocked.
That's a good idea, as I never check username. I agree that legitimate users will be denied registration.

I'm waiting for the mod to complete the phpBB validation process before deploying it on my production server.
User avatar
thecaretaker1
Registered User
Posts: 135
Joined: Tue Dec 30, 2014 8:38 pm

Re: [RC] Stop Forum Spam

Post by thecaretaker1 »

GoBieN wrote:
I disabled username checking in the code, I don't think it's useful but does potentially deny user registration.
I had a user that just chose the username "Sydney" for registration and got blocked.
I'm getting this problem a lot. may I ask what you altered in the code to stop it checking against username?
User avatar
GoBieN
Registered User
Posts: 546
Joined: Fri Mar 05, 2004 5:22 pm
Location: Belgium

Re: [RC] Stop Forum Spam

Post by GoBieN »

If IP and E-mail do not return any hits, clear the score for Username
OPEN
ext/rmcgirr83/stopforumspam/event/main_listener.php
FIND

Code: Select all

			// Return the total score
			$spam_score = ($ck_username + $ck_email + $ck_ip);
ADD BEFORE

Code: Select all

			// Let's not score the username if ip and email are clear
			if ($ck_ip + $ck_email == 0)
			{
				$ck_username = 0;
			}
			

The next part is what I discussed some messages ago

If Username & E-mail do not return any hits, clear the score for IP, except when IP is listed more than 1 times
OPEN
ext/rmcgirr83/stopforumspam/event/main_listener.php
FIND

Code: Select all

			// Let's not ban a registrant/poster with a common IP address, who is otherwise clean
			// not sure of keeping this or not...we'll see
			if ($ck_username + $ck_email == 0)
			{
				$ck_ip = 0;
			}
REPLACE WITH

Code: Select all

			// Let's not ban a registrant/poster with a common IP address, who is otherwise clean
			// not sure of keeping this or not...we'll see
			if (($ck_username + $ck_email == 0) && $ck_ip < 2)
			{
				$ck_ip = 0;
			}
			
Lady_G
Registered User
Posts: 276
Joined: Fri Jun 08, 2012 12:38 pm
Location: US

Re: [RC] Stop Forum Spam

Post by Lady_G »

Your approach will still allow a registration / post if there is one result for IP address. I prefer a total removal of the username and to use a $spam_score depending only on ($ck_email + $ck_ip).

OPEN
ext/rmcgirr83/stopforumspam/event/main_listener.php
FIND

Code: Select all

			// Let's not ban a registrant/poster with a common IP address, who is otherwise clean
			// not sure of keeping this or not...we'll see
			if ($ck_username + $ck_email == 0)
			{
				$ck_ip = 0;
			}
Replace with

Code: Select all

			$ck_username = 0;     // Prevent username from influencing ban decision
The following line is then influenced only by ($ck_email + $ck_ip).

Code: Select all

			// Return the total score
			$spam_score = ($ck_username + $ck_email + $ck_ip);
I also do not want spammers to be notified of the ban.
FIND

Code: Select all

		// ban the nub for one hour
		user_ban('ip', $ip, 60, 0, false, $this->user->lang['SFS_BANNED'], $this->user->lang['SFS_BANNED']);
Replace with

Code: Select all

		// ban the nub for one hour
		user_ban('ip', $ip, 60, 0, false, $this->user->lang['SFS_BANNED'], '');
User avatar
FredQ
Registered User
Posts: 138
Joined: Sat Nov 01, 2014 10:48 am
Location: Northeast Scotland
Name: Fred Q

Re: [RC] Stop Forum Spam

Post by FredQ »

As we all have different views on how to deal with the username issue, I suggest it could be configurable inside the extension :roll:
My board (converted from vBulletin)
User avatar
RMcGirr83
Former Team Member
Posts: 22072
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Stop Forum Spam

Post by RMcGirr83 »

There is a new version out

https://github.com/RMcGirr83/phpBB-3.1- ... ree/Dev102

needs testing though. Allows checking, or not, on either username, email or IP. Also allows admin to choose to have banned reason displayed to the banned user.

Settings will now be found under the extensions tab instead of the user registration settings.

I have posted the above for testing purposes, it should not be installed on a live forum....yet. :)
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
Lady_G
Registered User
Posts: 276
Joined: Fri Jun 08, 2012 12:38 pm
Location: US

Re: [RC] Stop Forum Spam

Post by Lady_G »

As noted, this git download is from development branch Dev102.

The Clone installation instructions don't show the development branch, use this instead:

Code: Select all

git clone --branch Dev102 https://github.com/RMcGirr83/phpBB-3.1-stopforumspam.git ext/rmcgirr83/stopforumspam/
(Testing in process.)
Lady_G
Registered User
Posts: 276
Joined: Fri Jun 08, 2012 12:38 pm
Location: US

Re: [RC] Stop Forum Spam

Post by Lady_G »

My test results so far -

Configuration: localhost, phpBB 3.1.5
Environment: PostgreSQL 9.4.4 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 5.1.1 20150618 (Red Hat 5.1.1-4), 64-bit.

I recommend clarifying the admin control panel instructions from:
Stop Forum Spam threshold:
The extension will check against a threshold (e.g., the number of times a user name, email or IP address is found within the stop forum database). You can input any number between 1 and 99. The lower the number the greater the possibility of a false positive.
To:
Stop Forum Spam threshold:
Sets the threshold to trigger a ban (the combined total number of times a user name, email or IP address is found within the stop forum database). Input any number between 1 and 99. The lower the number the greater the possibility of a false positive.
I enabled guest posting (Re: Enable Guest Posting?), then inserted a test IP.

OPEN
ext/rmcgirr83/stopforumspam/event/main_listener.php
FIND

Code: Select all

	public function user_sfs_validate_posting($event)
	{
Add your test IP After, to result in (for example):

Code: Select all

	public function user_sfs_validate_posting($event)
	{
$this->user->ip = '192.168.42.43';  // test IP
		$array = $event['error'];
Everything worked as expected.

I don't have any email services running on localhost, so I tested "Display reason if banned:" with pgAdmin III and verified that the banlist table, ban_give_reason column updated correctly.

Could the log info provide a more detailed reason? It's not possible to tell the source of the ban.

Moderator and admin logs from:

Code: Select all

Banned IP for reason “Found in the Stop Forum Spam database”
» 192.168.42.43
To:

Code: Select all

Banned IP for reason “When registering: Found in the Stop Forum Spam database”
» 192.168.42.43

Code: Select all

Banned IP for reason “When posting: Found in the Stop Forum Spam database”
» 192.168.42.43
User logs from:

Code: Select all

Stop Forum Spam triggered:
Username: test%40example.com
IP: 192.168.42.43
Email: [email protected]
To:

Code: Select all

Stop Forum Spam triggered when registering:
Username: test%40example.com
IP: 192.168.42.43
Email: [email protected]

Code: Select all

Stop Forum Spam triggered when posting:
Username: test%40example.com
IP: 192.168.42.43
Email: [email protected]
Last edited by Lady_G on Sat Aug 08, 2015 12:34 am, edited 2 times in total.

Return to “Extensions in Development”