vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Administrative and Maintenance Tools - Advanced IP Ban Manager (https://vborg.vbsupport.ru/showthread.php?t=186342)

Carnage 10-14-2008 04:15 PM

sevo: can you post the 'script language' it comes up with.

angeldevil: can you try with a different cidr; say 31 ?

angeldevil 10-16-2008 08:41 PM

TY Carnage i can ban that IP while change CIDR to 31

mark370 10-18-2008 04:38 PM

So if ive understood this correct if i use the CIDR range /24 to ban IP: 9.10.166.9/24 that will ban the [256 ips] from 9.10.166.0 through to 9.10.166.255.

Btw thats a Example IP :)

Businesss 10-27-2008 06:39 AM

I can't get this to work either. I ban a single ip address using this mod and the same address is used just minutes after.....Hmmmmm.

I'm using (vBulletin 3.7.2 Patch Level 2)

amaarvell 10-28-2008 08:13 AM

Quote:

Originally Posted by Carnage- (Post 1601745)
I've added some code to the installer which should fix the issue you are having.

Incidentally, is anyone else having issues with the menu not showing? (it should appear under the users menu)

I have just installed on 2 forums and nothing shows in the menu of either

ShawneyJ 10-28-2008 08:26 AM

thanks will test this ;)

Carnage 10-29-2008 10:18 AM

i wonder... the banning of a single ip address works perfectly fine on my forums. I'm thinking it may be an issue in the under lying programs - php and mysql.

Can the people having problems with banning single ips (via pm if you wish) tell me what version of php and mysql you are using and if its 64 or 32 bit.

For now, ban using a cidr of 31.

TheInsaneManiac 12-11-2008 10:13 PM

Requests:
  • Add more than one IP at a time (I have a lot of spam bots
  • Some sort of comment system so we can organize our IP bans (Something like have categories like Spam Bot IPs and stuff)

caltek 12-22-2008 03:14 AM

Why when I enter some IP addresses it works, then when I enter certain other ones it comes up as 0.0.0.0 ( I tried CIDR 32 and 31 )?

That is the only glitch I see.....oh would be nice to have multiple fields to enter multiple IP addresses as well as having the script loop back tot he add IP page rather than the main page of admin.

Requests

* Enter more than one IP address
* Ability to update current entries
* Fix error of 0.0.0.0 showing up when IP address entered
* Loop either to entry screen of list of banned IP addresses after submit is hit

habibie_u2 12-30-2008 12:13 AM

just waiting the full version :Peace:

tlwwolfseye 01-12-2009 01:55 PM

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

Fynnon 01-15-2009 08:48 AM

is this working for vB 3.8.0 ?

tlwwolfseye 01-15-2009 11:48 AM

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

kfiasche81 01-16-2009 07:41 AM

Request:

- interfaces it with the IP-to-Country http://ip-to-country.webhosting.info...ountry.csv.zip

jesus likes pie 01-30-2009 07:02 PM

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.

Carnage 03-10-2009 02:57 PM

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?

odln018 03-23-2009 12:21 AM

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

Where would it be?

odln018 03-25-2009 04:38 PM

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();

Carnage 04-09-2009 08:00 PM

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

caltek 04-15-2009 05:39 PM

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 )

nso 04-15-2009 06:08 PM

Quote:

Originally Posted by odln018 (Post 1776789)
Ok, got that resolved, but am now getting the following error:

I got the same error but quickly figuered out the problem.
The author has used the short hand <? instead of <?php in the beginning of the PHP files.

This mode is not supported by many installations, and one should always use <?php when programming in PHP.

So, to fix your problem. Go in to all PHP-files in this modification and change the first line to read
<?php
instead of
<?

It seems like the author has ommited the ?> at the end of the files as well. This is poor practise.

Otherwise, top ace! :)

Carnage 04-16-2009 09:23 AM

Quote:

It seems like the author has ommited the ?> at the end of the files as well. This is poor practise.
This is debatable. There are a good number of reasons for omitting it:
- Prevents excess white space at end of file; this can interfere with sending headers etc and cause xhtml validation errors.
- php.net dosn't use closing delimiters in its code eg http://www.php.net/source.php?url=/include/prepend.inc
- The closing tag is in fact optional.

Anyway, fixed file uploaded for those that dont have short tags enabled.

Carnage 04-16-2009 01:55 PM

@caltek: what versions of php/mysql are you running? 32bit or 64 bit os?

Hornstar 04-17-2009 12:22 AM

thanks for the update. This does indeed enhance the IP banning functionality in vbulletin and could be useful to have as default. I have many banned IPs over the years, now I have no clue why any of them were banned.

Carnage 04-20-2009 03:24 PM

Thats pretty much why i wrote this mod. It also allows me to give all admins ip ban privilages without them having access to the other options.

For anyone who was wondering; this does seem to work fine on vb 3.8.2 as i've just updated my own board to that version.

Mutt 04-29-2009 04:56 PM

installed on 3.82

when I add an ip, it says added successfully, & the row is saved to the DB

BUT when I list banned ips, the list is blank.

not sure what is wrong

Carnage 05-05-2009 11:06 AM

You checked the db and the ip is in there?

did you install the list of ip bans provided with the mod?

Mutt 05-06-2009 10:01 PM

Quote:

Originally Posted by Carnage- (Post 1804961)
You checked the db and the ip is in there?

did you install the list of ip bans provided with the mod?

This is all I did

-------
Installation
Backup db.
Upload files from zip.
Import product.
Refresh admincp.
-------

yes, the ips are in the DB. I have 3 rows in the ipban table. I've attached an example. image 1 shows the row int he DB. image 2 is what I get when I click List "IP Bans"

s8glive 05-11-2009 01:00 PM

Does this work on 3.8.2

kapii 05-15-2009 01:05 AM

When I ban a IP with an CIDR, it shows as 0.0.0.0 and /8 for example, instead of what I entered... In the case shown in the attached zip file, I was banning 194.8.0.0/8 which is spammer trying to spam my site... However, it all shows as 0.0.0.0 as you will see in the attachment...

What can I do about it, or is there a reason it wouldn't show the IP info?

Thanks,
kapii

lighthazard 05-17-2009 04:31 AM

I uploaded to my FTP and everything. But how do i access it?

kapii 05-17-2009 04:42 AM

Quote:

Originally Posted by lighthazard (Post 1812235)
I uploaded to my FTP and everything. But how do i access it?

It's in the left side of your ACP probably between the users and users groups...

Carnage 05-22-2009 03:21 PM

re: ip ban against 194.8.0.0/8

I testeed this on my own board and it went through ok. (displaying a ban against 194.0.0.0 which is correct for /8)

can you tell me what versions of php/mysql you are running and if you are using 64 bit or 32 bit versions. I'm having issues tracking down the apparent random occurance of 0.0.0.0 bans...

LordNinja 05-25-2009 12:17 AM

Not Working
Mod Inutil

Andrewsha 06-01-2009 12:44 PM

The same problem with 0.0.0.0

Please try
array('ip'=>'194.158.64.0','cidr'=>'19','descripti on'=>'Country'),
array('ip'=>'217.147.112.0','cidr'=>'20','descript ion'=>'Country'),

You will see 0 in 'ip' column in "ipban"-table

'ip'-column has attribute 'UNSIGNED'
I've changed attribute. Set it empty. Now in db:
194.158.64.0 -> -1029816320
217.147.112.0 -> -644648960

But in admin panel "List IP Bans" this ip-addresses are not shown.

mrspring 06-02-2009 09:54 AM

Same problem here.. mad numbers for the duration, and new bans appear as 0.0.0.0 in the list.. this is new behaviour, there are bans in the list made on the .2a revision that are coherent..

this is ver 3.7.2, on a (shared) linux server..

edit: i should mention, this problem started BEFORE i upgraded from ver .2a, i imagined the upgrade would fix it, but it did not.

CILGINKRAL_ 06-02-2009 11:31 AM

hmm. I will definitely hurt. thanks

kapii 06-02-2009 11:48 AM

Quote:

Originally Posted by Carnage- (Post 1815260)
re: ip ban against 194.8.0.0/8

I testeed this on my own board and it went through ok. (displaying a ban against 194.0.0.0 which is correct for /8)

can you tell me what versions of php/mysql you are running and if you are using 64 bit or 32 bit versions. I'm having issues tracking down the apparent random occurance of 0.0.0.0 bans...

Mine is not random... It happens every time I try to ban anything from 190 and up on the prefix number...

I'm using :
MySQL Version 5.0.77-community
PHP 5.2.5
Web Server Apache v1.3.41 (cgi)

I hope there is a way to fix this as the spammers and hackers are driving me nuts...

Thanks,
kapii
:eek:

Andrewsha 06-02-2009 11:52 AM

Hello!
I just remove UNSIGNED attribute in table and now everything is OK

Carnage 06-09-2009 11:03 PM

Quote:

Originally Posted by Andrewsha (Post 1821282)
The same problem with 0.0.0.0

Please try
array('ip'=>'194.158.64.0','cidr'=>'19','descripti on'=>'Country'),
array('ip'=>'217.147.112.0','cidr'=>'20','descript ion'=>'Country'),

You will see 0 in 'ip' column in "ipban"-table

'ip'-column has attribute 'UNSIGNED'
I've changed attribute. Set it empty. Now in db:
194.158.64.0 -> -1029816320
217.147.112.0 -> -644648960

But in admin panel "List IP Bans" this ip-addresses are not shown.

Thanks for this information, its very useful.

An ip address should be an unsigned int, however it would seem that some versions of php return a signed int instead hence the problem. I'll see if theres a better fix for this tommorow, however if not, changing the mysql field to signed will probably solve it.


All times are GMT. The time now is 12:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01292 seconds
  • Memory Usage 1,840KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete