Current time: 07-23-2014, 07:52 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 3 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ban IPs by range
10-25-2007, 06:16 AM (This post was last modified: 10-25-2007 06:20 AM by sscs.)
Post: #1
Ban IPs by range
Need to be able to ban IPs by range in a proper format, for example:
72.1.0.0 - 72.63.255.255

The current method of banning whole blocks of IPs is cumbersome and produces unwanted side-effects - see:
http://community.mybboard.net/showthread.php?tid=25022
Find all posts by this user
Quote this message in a reply
10-27-2007, 07:24 AM
Post: #2
RE: Ban IPs by range
An alternative would be to specify an IP and a submask. The range you specified actually covers multiple subnets, the first two being:

Northern Telephone and Data Corp
72.1.0.0/19 = 72.1.0.0-72.1.31.255

TierraNet Inc
72.1.32.0/20 = 72.1.32.0-72.1.47.255
Find all posts by this user
Quote this message in a reply
10-28-2007, 04:33 AM
Post: #3
RE: Ban IPs by range
Thanks - a couple of questions:

1) Can myBB banning actually handle IPs entered in the format 72.1.0.0/19 ?

2) Assuming I'm certain I want to ban the whole range 72.1.0.0 - 72.63.255.255 wouldn't that method require far too many entries to be made? I'm just requesting the ability to enter a start and end IP where everything in between would be banned.
Find all posts by this user
Quote this message in a reply
10-28-2007, 05:41 AM
Post: #4
RE: Ban IPs by range
This user has been denied support. This user has been denied support.
I don't believe mybb will ban in the manner that laie suggests.

Code:
function get_banned_ips()
{
    global $mybb;
    $banned_ips = explode(",", $mybb->settings['bannedips']);
    $banned_ips = array_map("trim", $banned_ips);
    return $banned_ips;
}

/**
* Checks if a specific IP address has been banned.
*
* @param string The IP address.
* @return boolean True if banned, false if not banned.
*/
function is_banned_ip($ip_address)
{
    $banned_ips = get_banned_ips();
    foreach($banned_ips as $banned_ip)
    {
        if($banned_ip != "" && strpos($ip_address, $banned_ip) !== false)
        {
            return true;
        }
    }
    return false;    
}

As you can see it does a strpos() which of course won't match a range in the manner suggested.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2007, 07:21 PM
Post: #5
RE: Ban IPs by range
As I said before this is fixed in MyBB 1.4

Dennis Tsang
http://dennistt.net
Find all posts by this user
Quote this message in a reply
10-30-2007, 06:22 PM
Post: #6
RE: Ban IPs by range
Which syntax is used in MyBB 1.4 -- subnets or hyphenated range?
Find all posts by this user
Quote this message in a reply
10-30-2007, 10:41 PM
Post: #7
RE: Ban IPs by range
subnets as follows:

127.0.0.*

or

127.*.0.1

or

127.*

etc...
Visit this user's website Find all posts by this user
Quote this message in a reply
10-31-2007, 04:33 AM
Post: #8
RE: Ban IPs by range
wow, that will be great!

Official Arabic Translator.
Find all posts by this user
Quote this message in a reply
11-20-2007, 02:11 AM (This post was last modified: 11-20-2007 02:13 AM by Pow-Mia.)
Post: #9
RE: Ban IPs by range
cool! we need that! any hlep to put a stop to those spam trolls !
and competitve sites

Even Lies Can't keep a good man down. Heart
Find all posts by this user
Quote this message in a reply
02-22-2008, 03:47 AM
Post: #10
RE: Ban IPs by range
Tikitiki Wrote:subnets as follows:

127.0.0.*

or

127.*.0.1

or

127.*

etc...

Does this work in the latest version?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication