Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

Reply
 
Thread Tools
Advanced IP Ban Manager Details »»
Advanced IP Ban Manager
Version: 0.3.1, by Carnage Carnage is offline
Developer Last Online: Sep 2014 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 3.7.x Rating:
Released: 07-24-2008 Last Update: 06-11-2009 Installs: 141
DB Changes Uses Plugins
Additional Files Translations Is in Beta Stage  
No support by the author.

Advanced IP ban manager

What is it/What does it do?

This is intended as a replacement for the ip bans under vbulletin options. It allows for timed ip bans, cidr ranges and attatching reasons to bans.

It also features registration only ip bans allowing members who may be effected by an ip ban to continue using the forums, but blocking registrations and ip ban exempts so that you can ban a large range of ips and let through a smaller subset of them.

Features
  • Ip bans
  • Timed ip bans
  • Ip ban exempts
  • Registration only bans
  • Ban by cidr range
Installation
Backup db.
Upload files from zip.
Import product.
Refresh admincp.

Once Version 0.3 is installed; upload the attached php file into your admin cp to replace the one already there. This file fixes a couple of minor issues for some people.

Changelog
  • 0.3.1
    Added a work around for issues of 0.0.0.0 ips being banned on any system where ip2long returned a signed int instead of an unsigned int.
  • 0.3
    Fixed bug where ip bans wouldn't block registrations unless set to registration only.
    Added file with a list of common spambot ips that can be auto banned.
    Changed limit on cidr range from 16 to 4 As i often came across instances where i wanted to ban larger ranges
  • 0.2.1b
    Added a bitfield rebuild to installer to fix issues with menu not showing.
  • 0.2b
    Fixed bug in instal code.
  • 0.2a
    Added admin permissions and exempt bans
  • 0.1a
    Initial release.


Notes

This has been tested on 3.7.2 but should work on 3.6.x, 3.7.x and 3.8.x

This mod has not been tested on vbulletin 4; a separate, improved vbulletin 4 version can be found HERE

Access is now controlled by an admincp permission however no control over ip banning is done.

This variable can be used in the config file to prevent banning any ip/range of ips that contain the ips listed in it: $config['SpecialUsers']['unbannableips'] = "127.0.0.1|127.0.0.2";
Ips should be separated by a | symbol. This will not effect any bans that are already in place.

Bans are limited to a cidr range of 4. (This should be more than enough) If you require a ban that covers more than this, it should be set in the database. If there is demand for it, I may make the cidr limit optional/changable in future versions.

Exempts/bans work by taking the tightest cidr range match. eg if you ban 127.0.0.1/16 and add an exempt for 127.0.0.1/24 the exempt will take precedence, however adding another ban against 127.0.0.1/32 would override the exempt.

When uninstalling, the mod will remove the modifications to the admin table, however it is upto you to drop the ipbans table yourself. This has been done in order to preserve the data in that table incase you still want it for something.

I've added a file which was created by a member of my admin team, it contains a large list of ip addresses from which A lot of malignant traffic seems to come from. If you are having trouble with spam bots this list may help in preventing them from registering. To use the file visit the url : <your forum url>/admincp/ipban.spambots.php It will ask you to log in to your cp then display a blank page; this is to be expected as all its doing is inserting into the database. It will add approximately 140 bans; so they've been coded NOT to show up in the ip ban list. This feature is something i plan to expand on with a full interface for viewing, creating, adding and removing ip blocklists, but for now this mechanism is what i've come up with.

Support

As all of my boards have been upgraded to vbulletin 4, I am no longer actively maintaining any of my vb3.x mods. Free support for all of my 3.x mods is being removed from the 31st of March 2010 after this date, I will only be offering paid support for 3.x mods; downloading and usage of the mods will remain free but unsupported.

Please pm me for support of 3.x mods as I will not be checking their threads very often.

[S]Support is now offered as this is a beta release. I'll be checking vborg from time to time but for critical support issues, you are best contacting me on my own forums.

I'm hoping that this version (0.3) is bug free, so this can be considered a release candidate version.[/S]

I've uploaded a fixed php file for some people who were having problems with short php tags and other parse errors. This needs to be uploaded to the admin cp. The file will be added into the zip once in the next release.

This mod [S]will be [/S] has been upgraded to support vb4 The vbulletin 4 version will be released once the beta goes public.

Extra features in vb4.0 version:
  • whois ip from admin cp
  • cidr calculator (shows the ip range that a cidr bans)
  • test bans (enter an ip to see if its banned or not)

Planned features for future versions:
  • import/export bans
  • integration into 'delete posts as spam' => admins with suitable permissions will be able to select a box to ban the posters ip(s) in addition to banning their account(s)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 01-12-2009, 01:55 PM
tlwwolfseye's Avatar
tlwwolfseye tlwwolfseye is offline
 
Join Date: Dec 2008
Location: Germany
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Definately can?t wait for this to be final. Any ETA on when that will be ?
Thanks for this Mod, I am sure its great once its final.

Wolfseye
Reply With Quote
  #53  
Old 01-15-2009, 08:48 AM
Fynnon Fynnon is offline
 
Join Date: Jul 2008
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is this working for vB 3.8.0 ?
Reply With Quote
  #54  
Old 01-15-2009, 11:48 AM
tlwwolfseye's Avatar
tlwwolfseye tlwwolfseye is offline
 
Join Date: Dec 2008
Location: Germany
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could I please have an example on how to use this ? I know how to ban IP Ranges in PLESK etc. so there its simple. For an example below I would like to know what to enter. I hope you can help me with that so I understand it correctly.

That is the IP range that I would like to Ban.
Code:
IP: 94.0.0.0 - 94.15.255.255
Now the CIDR would be:
Code:
CIDR:       94.0.0.0/12
So what would I would have to enter exactly in the IP Ban options of this Mod ? Thank you in advance.

Wolfseye
Reply With Quote
  #55  
Old 01-16-2009, 07:41 AM
kfiasche81 kfiasche81 is offline
 
Join Date: Sep 2004
Location: iTALY
Posts: 84
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Request:

- interfaces it with the IP-to-Country http://ip-to-country.webhosting.info...ountry.csv.zip
Reply With Quote
  #56  
Old 01-30-2009, 07:02 PM
jesus likes pie jesus likes pie is offline
 
Join Date: Apr 2005
Posts: 342
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hm, the registration thing doesnt seem to be working. No matter what I put under that field it bans the IP for everything, not just registration.
Reply With Quote
  #57  
Old 03-10-2009, 02:57 PM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

jesus: what vb version are you using?

kfiasche81: what integration would you like? All that is is a list of what ips come from what country...

tlwwolfseye: ban for 94.0.0.0 cidr set to 12 however the code (for safety reasons) is set to block ip bans over too large a range; so you will need to edit ipbans.php and change the 16 on lines 85 and 87 to 12.

caltek: what ips caused errors, which ones worked?
Reply With Quote
  #58  
Old 03-23-2009, 12:21 AM
odln018's Avatar
odln018 odln018 is offline
 
Join Date: Mar 2006
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't seem to be able to find the option on where to access the mod.

Where would it be?
Reply With Quote
  #59  
Old 03-25-2009, 04:38 PM
odln018's Avatar
odln018 odln018 is offline
 
Join Date: Mar 2006
Posts: 210
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, got that resolved, but am now getting the following error:

Quote:
input->clean_array_gpc('r', array( 'userid' => TYPE_INT )); log_admin_action(); print_cp_header("IP ban manager"); if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'list'; } if($_REQUEST['do'] == 'list') { //list print_table_start(); print_table_header("IP Bans", 8); print_cells_row(array("IP","Cidr","Banned by","Registration","exempt","Expires","Reason","De lete")); $q = $db->query("SELECT " . TABLE_PREFIX . "ipban.*," . TABLE_PREFIX . "user.username FROM " . TABLE_PREFIX . "ipban, " . TABLE_PREFIX . "user WHERE " . TABLE_PREFIX . "ipban.setby = " . TABLE_PREFIX . "user.userid AND (expires > unix_timestamp() OR expires = 0)"); while ($row = mysql_fetch_array($q)) { $data = array(); $data[] = long2ip($row['ip']); $data[] = "/" . $row['cidr']; $data[] = $row['username']; $data[] = ($row['registration']) ? 'Yes':'No'; $data[] = ($row['exempt']) ? 'Yes':'No'; $data[] = date("U",$row['expires']); $data[] = $row['reason']; $data[] = "[Delete]"; print_cells_row($data); //echo long2ip($row['ip']) . " \n"; } print_table_footer(); } if($_REQUEST['do'] == 'doadd') { //add $vbulletin->input->clean_array_gpc('p', array( 'ip' => TYPE_STR, 'period' => TYPE_STR, 'reason' => TYPE_NOHTML, 'cidr' => TYPE_INT, 'exempt' => TYPE_BOOL, 'registration' => TYPE_BOOL )); // check that the number of days is valid if ($vbulletin->GPC['period'] != 'PERMANENT' AND !preg_match('#^(D|M|Y)_[1-9][0-9]?$#', $vbulletin->GPC['period'])) { print_stop_message('invalid_ban_period_specified') ; } // if we've got this far all the incoming data is good if ($vbulletin->GPC['period'] == 'PERMANENT') { // make this ban permanent $liftdate = 0; } else { // get the unixtime for when this ban will be lifted $liftdate = convert_date_to_timestamp($vbulletin->GPC['period']); } //dont let an admin ban too large a range of ips at once if($vbulletin->GPC['cidr'] < 16) { $vbulletin->GPC['cidr'] = 16; } if(strlen($vbulletin->GPC['reason'])<1) { $vbulletin->GPC['reason'] = "No Reason"; } $ip = ip2long($vbulletin->GPC['ip']); $cidrmask = ((pow(2,$vbulletin->GPC['cidr']) -1) << (32 - $vbulletin->GPC['cidr'])); //nb only works with ipv4. for ipv6 changes need to be made. $ip = $ip & $cidrmask; if(isset($vbulletin->config['SpecialUsers']['unbannableips'])) { $unbannable = explode("|",$vbulletin->config['SpecialUsers']['unbannableips']); if(is_array($unbannable)) { foreach($unbannable as $unbannableip) { $unbannableip = ip2long($unbannableip); $unbannableip = $unbannableip & $cidrmask; if($unbannableip == $ip) { print_stop_message('unbannable_ip'); } } } } $db->query("INSERT INTO " . TABLE_PREFIX . "ipban (ip,cidr,registration,exempt,setby,reason,expires) VALUES ($ip,{$vbulletin->GPC['cidr']},{$vbulletin->GPC['registration']},{$vbulletin->GPC['exempt']}, {$vbulletin->userinfo['userid']},'{$vbulletin->GPC['reason']}',$liftdate)"); print_cp_message("Ip Ban added sucessfully","?",3); } if($_REQUEST['do'] == 'add') { $temporary_phrase = $vbphrase['temporary_ban_options']; $permanent_phrase = $vbphrase['permanent_ban_options']; // make a list of banning period options $periodoptions = array( $temporary_phrase => array( 'D_1' => "1 $vbphrase[day]", 'D_2' => "2 $vbphrase[days]", 'D_3' => "3 $vbphrase[days]", 'D_4' => "4 $vbphrase[days]", 'D_5' => "5 $vbphrase[days]", 'D_6' => "6 $vbphrase[days]", 'D_7' => "7 $vbphrase[days]", 'D_10' => "10 $vbphrase[days]", 'D_14' => "2 $vbphrase[weeks]", 'D_21' => "3 $vbphrase[weeks]", 'M_1' => "1 $vbphrase[month]", 'M_2' => "2 $vbphrase[months]", 'M_3' => "3 $vbphrase[months]", 'M_4' => "4 $vbphrase[months]", 'M_5' => "5 $vbphrase[months]", 'M_6' => "6 $vbphrase[months]", 'Y_1' => "1 $vbphrase[year]", 'Y_2' => "2 $vbphrase[years]", ), $permanent_phrase => array( 'PERMANENT' => "$vbphrase[permanent] - $vbphrase[never_lift_ban]" ) ); foreach ($periodoptions["$temporary_phrase"] AS $thisperiod => $text) { if ($liftdate = convert_date_to_timestamp($thisperiod)) { $periodoptions["$temporary_phrase"]["$thisperiod"] .= ' (' . vbdate($vbulletin->options['dateformat'] . ' ' . $vbulletin->options['timeformat'], $liftdate) . ')'; } } //add form print_form_header("ipbans","doadd"); print_table_header("Add ip ban"); print_input_row("IP Address","ip",""); print_input_row("CIDR Range (if you are unsure what this does, leave it as 32)","cidr",32); print_yes_no_row("Registrations only?","registrations",1); print_yes_no_row("Exempt IP? (not yet implemented)","exempt",0); print_select_row($vbphrase['lift_ban_after'], 'period', $periodoptions, $vbulletin->GPC['period']); print_input_row("Reason to ban ip", 'reason', '', true, 50, 250); print_submit_row(); } if($_REQUEST['do'] == 'delete') { $vbulletin->input->clean_array_gpc('g', array('ipbanid' => TYPE_INT)); //print confirm form print_delete_confirmation("ipban", $vbulletin->GPC['ipbanid'], "ipbans", "dodelete", 'ipban', 0,'','ip'); } if($_REQUEST['do'] == 'dodelete') { //do the delete $vbulletin->input->clean_array_gpc('p', array('ipbanid' => TYPE_INT)); $db->query("DELETE FROM " . TABLE_PREFIX . "ipban WHERE ipbanid = '{$vbulletin->GPC['ipbanid']}'"); print_cp_message("Ip Ban deleted sucessfully","?",3); } print_cp_footer();
Reply With Quote
  #60  
Old 04-09-2009, 08:00 PM
Carnage Carnage is offline
 
Join Date: Jan 2005
Location: uk
Posts: 760
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That seems like a print out of the code... well; some of it anyway - my suggestion is to upload a fresh copy of ipbans.php to your admincp dir.

If you wait an hour or so before doing that - i'm putting the finishing touches to V 0.3

Edit:

V0.3 is out now, i suggest you upgrade to that and see if that solves the problem
Reply With Quote
  #61  
Old 04-15-2009, 05:39 PM
caltek caltek is offline
 
Join Date: Nov 2008
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed v 0.3 and get this error when I try to add an IP:

Parse error: syntax error, unexpected '(', expecting '}' in ipbans.php on line 121


Also note that when I try to add an IP that starts with '1' I get 0.0.0.0 showing up. ( i.e. 192.1.243.1 shows up as 0.0.0.0 )
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05158 seconds
  • Memory Usage 2,320KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete