rmast on "[Plugin: Stop Spammers Spam Prevention] CIDR format in block list not recognized. For example 114.96.0.0/19"

ساخت وبلاگ

When I use 114.96.0.0/19 in my block list it doesn't block
114.97.200.204 and so many other address-ranges don't get blocked.

I see the same blocked IP-ranges entering in my good-cache over and over again.

Blocking 114.9* does work, but that also shuts out 114.95, which isn't in the range.

https://wordpress.org/plugins/stop-spammer-registrations-plugin/

Thanks for finding this.

I finally had time to look at it. There was a problem in using PHP 5 and another one with using 32 bit vrs 64 bit versions of PHP. I now have a version that works on all my test hosts, so I think it is good to go.

You can download the latest version from my website
http://www.blogseye.com
There is a link to the beta test items at the top of the page.

If you have the Stop Spammer plugin updater installed you can use that to automatically install it.

Please report back if it is working on you installation.

Keith

I did install the newest beta three times, and 114.97.201.8 is still ending up today in my good cache, even when it is already also hardcoded without a mask in my deny-list since yesterday by marking it bad in my good cache and not visible in my good cache today. Quite strange. I'll try the Diagnostics this weekend myself to see whether the isolated routine works.

Diagnostics still only recognizes 114.97.201.8. 114.96.0.0/19 does not show up.

The part of the code that seems to do this match, in stop-spammer-registrations-plugin/classes/be_module.class.php doesn't differ between the productional and the beta version, so probably something is wrong with the beta updater, or we are looking at a different piece of code. I would expect line 89 to do the final match. The code above that line looks like it ought to.

By the way, the productional PHP-build of my provider we talk about is
PHP Version 7.0.3-5+deb.sury.org~trusty+1
Linux web20 3.16.0-59-generic #79~14.04.1-Ubuntu SMP Mon Jan 18 15:41:27 UTC 2016 x86_64

which is freely available on a foreign site.

The manually uploaded plugin does contain a difference. I am going to try the Diagnostics again.

Still the diagnostics of this new version doesn't recognize 114.97.201.8 as 114.96.0.0/19

I now look at this version:

// searching for an cidr in the list
list($subnet, $mask) = explode('/', $search);
$x2=ip2long($needle) & ~((1 << (32 - $mask)) - 1);
$x3=ip2long($subnet)& ~((1 << (32 - $mask)) - 1);
if ($x2 == $x3){
retu "$searchname:$reason";
}

Inspired by your previous version I would change the logic of the mask

& ~((1 << (32 - $mask)) - 1);

with

| ((1 << ($mask)) - 1);

That works on my prompt for this specific IP-check.

However, when I modify this piece of code in the plugin it doesn't work for the same address. On the prompt I tested it with this php-program:

<?php
list($subnet, $mask) = explode('/', '114.96.0.0/19' );
$x2=ip2long('114.97.201.8') | ((1 << ($mask)) - 1);
$x3=ip2long($subnet)| ((1 << ($mask)) - 1);
if ($x2 == $x3){
echo "match";
} else
{ echo "no match";
}
?>

- - , .
.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 277 تاريخ : جمعه 25 تير 1395 ساعت: 22:50