thankyou
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: banlist plugin  (Read 87399 times)

Offline grosbedo

  • Former Dev. (senate)
  • Sr. Member
  • *****
  • Posts: 258
Re: banlist plugin v2.1.2
« Reply #45 on: September 05, 2010, 04:23:45 PM »
Thank you very much ryry46d9 for these ideas !

But just to confirm : how do you generate those banlists files that you share ? With Echelon only, or did you find another way ?

Offline ryry46d9

  • B3 Contrib/Support
  • Sr. Member
  • *
  • Posts: 337
    • Pb| clan
Re: banlist plugin v2.1.2
« Reply #46 on: September 06, 2010, 05:36:22 AM »
Master bot:
Code: [Select]
<ip_banlist>
<name>target</name>
<file>/var/www/banlists/pbtarget.txt</file>
<force_ip_range>no</force_ip_range>
<message>^4$name^7 is ^1BAN^7 on the ^5Target Practice Server</message>
<url>ftp://user:[email protected]/path/to/the/banlist.txt</url>
</ip_banlist>

<ip_banlist> 
<name>UAA</name> 
<file>/var/www/banlists/uaa.txt</file> 
<force_ip_range>no</force_ip_range> 
<message>^4$name^7 is a member of the ^5UAA BAN LIST</message>
<url>http://www.urtadmins.com/e107_files/public/banlist.txt</url>
</ip_banlist>

<ip_banlist>
<name>echelon</name>
<file>/var/www/banlists/pbechelon.txt</file>
<force_ip_range>no</force_ip_range>
<message>^4$name^7 was ^1BAN^7 via ^5Echelon for being a jackass</message>
<url>http://72.51.33.80/poorbastard/echelon/banlist.php</url>
</ip_banlist>   
slave bot:
Code: [Select]
<ip_banlist>
<name>target</name>
<file>/var/www/banlists/pbtarget.txt</file>
<force_ip_range>no</force_ip_range>
<message>^4$name^7 is ^1BAN^7 on the ^5Target Practice Server</message>
<!-- <url>ftp://user:[email protected]/path/to/the/banlist.txt</url> -->
</ip_banlist>

<ip_banlist> 
<name>UAA</name> 
<file>/var/www/banlists/uaa.txt</file> 
<force_ip_range>no</force_ip_range> 
<message>^4$name^7 is a member of the ^5UAA BAN LIST</message>
<!-- <url>http://www.urtadmins.com/e107_files/public/banlist.txt</url> -->
</ip_banlist>   

<ip_banlist>
<name>echelon</name>
<file>/var/www/banlists/pbechelon.txt</file>
<force_ip_range>no</force_ip_range>
<message>^4$name^7 was ^1BAN^7 via ^5Echelon for being a jackass</message>
<!-- <url>http://72.51.33.80/poorbastard/echelon/banlist.php</url> -->
</ip_banlist>


I leave the last line so @ any given time that bot could take over as master if the master dies


Offline MsKiller

  • Jr. Member
  • **
  • Posts: 20
Re: banlist plugin v2.1.2
« Reply #47 on: September 13, 2010, 07:29:13 PM »
Hi Courgette,

in the config file there are settings to direct the plugin on which directory should save and or read the balists from.

Code: [Select]
...
<file>/home/urt/banlist2.txt</file>....

I tried to use some unix standard directions, like "~" for home and ".." for upper dir. It works on the status plugin and I supposed it was something managed by python itself, so I tried to put that sort of things but it does not works, it seems to accept only full path.

I've tried to read the code, but I know almost nothing about python ...
Anyway in the status plugin I supposed that the line

Code: [Select]
self._outputFile = os.path.expanduser(self.config.get('settings', 'output_file'))
makes the trick ...

Tried to understand where to use the same function, "os.path.expanduser" , but all I got is a headache :D

Maybe it could be implemented in the next version ... :D

Cheers !

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: banlist plugin
« Reply #48 on: September 13, 2010, 08:24:09 PM »
I've added your suggestion. Can you test and report back ?

dowload latest at http://github.com/courgette/b3-plugin-banlist/zipball/master

Offline MsKiller

  • Jr. Member
  • **
  • Posts: 20
Re: banlist plugin
« Reply #49 on: September 14, 2010, 03:52:23 PM »
... beers to Courgette !!!!

it works "smoothly like on oil" (roughly translated from italian "liscio come l'olio")  ;D ;D :D

This are the settings ...

Code: [Select]
        <ip_banlist>
                <name>banlist 1</name>
                <file>~/banlists/local_banlist.txt</file>
                <force_ip_range>no</force_ip_range>
                <message>^4$name^7 is ^1BANNED^7 (LOCAL BANLIST)</message>
        </ip_banlist>

        <ip_banlist>
                <name>banlist 2</name>
                <file>@conf/../banlists/uaa_banlist.txt</file>
                <force_ip_range>yes</force_ip_range>
                <message>^4$name^7 is ^1BANNED^7 (FROM UAA BANLIST)</message>
                <url><![CDATA[http://www.urtadmins.com/e107_files/public/banlist.txt]]></url>
        </ip_banlist>

and this is the log

Code: [Select]
100914 15:39:07 INFO    BanlistPlugin: immunity level : 100
100914 15:39:07 INFO    BanlistPlugin: auto update : True
100914 15:39:07 INFO    BanlistPlugin: loading IpBanlist [banlist 1], file:[/home/lbs/banl
ists/local_banlist.txt], url:[None], message:[^4$name^7 is ^1BANNED^7 (LOCAL BANLIST)]
100914 15:39:07 DEBUG   BanlistPlugin: IpBanlist [banlist 1] force IP range : False
100914 15:39:07 INFO    BanlistPlugin: IpBanlist [banlist 1] loaded
100914 15:39:07 DEBUG   BanlistPlugin: /home/lbs/banlists/uaa_banlist.txt age is 442.62868
5951
100914 15:39:07 DEBUG   BanlistPlugin: [banlist 2] will be autoupdated at 11 min of every
hour
100914 15:39:07 VERBOSE Added crontab <bound method IpBanlist.autoUpdateFromUrl of <banlis
t.IpBanlist object at 0x9ada84c>> (162375788) - 0s 11m -1h -1d -1M -1DOW
100914 15:39:07 INFO    BanlistPlugin: loading IpBanlist [banlist 2], file:[/home/lbs/banl
ists/uaa_banlist.txt], url:[http://www.urtadmins.com/e107_files/public/banlist.txt], messa
ge:[^4$name^7 is ^1BANNED^7 (FROM UAA BANLIST)]
100914 15:39:07 DEBUG   BanlistPlugin: IpBanlist [banlist 2] force IP range : True
100914 15:39:07 INFO    BanlistPlugin: IpBanlist [banlist 2] loaded
100914 15:39:07 DEBUG   BanlistPlugin: 2 banlist loaded
100914 15:39:07 DEBUG   BanlistPlugin: 0 whitelists loaded
100914 15:39:07 INFO    BanlistPlugin: checking all connected players
100914 15:39:07 DEBUG   Register Event: Stop Process: BanlistPlugin
100914 15:39:07 DEBUG   Register Event: Program Exit: BanlistPlugin
100914 15:39:07 BOT     Plugin banlist (2.2 - Courgette) loaded

Thanks !!!

Offline zax33333

  • Newbie
  • *
  • Posts: 9
Re: banlist plugin
« Reply #50 on: October 01, 2010, 04:46:16 AM »
I found a way to use the echelon banlist to ban IPs, I have made a couple bash scripts which download the banlist and then that reads the banlist and checks whether or not it has changed then adds it to a banfile which another script reads and applies the bans through IPTABLES

I have changed the folder names used to user rather than my real username.
also wherever the script says website will need to be changed to the IP or website of the server where the banlist is.

This script runs all the time.
I run this through screen, although it should be runnable by using nohup <command> &

Code: [Select]
#!/bin/bash
#! /bin/sh
a=1
while [ $a = 1 ] ; do
sleep 4
/home/user/b3banner
sleep 4
/home/user/banning
done


This is the "banning" script
Code: [Select]
#!/bin/bash
#!/bin/sh
wget http://www.website.com/echelon/banlist.php -O /home/user/b3bans.new
cat b3bans.new | awk ' {print $1}' > b3ips
if diff /home/user/b3ips /home/user/banlists/b3bans > /dev/null ; then

echo Same

else

echo Different
cp /home/user/b3ips /home/user/banlists/b3bans
/home/user/banner

fi


banner script

Change "SERVERIP" to your servers IP address
change "user" to your username

Code: [Select]
#!/bin/bash

/sbin/iptables -F

/sbin/iptables -A INPUT -s SERVERIP -j ACCEPT

for ip in `cat /home/user/banlists/bans | awk '{print $1}'`; do
/sbin/iptables -A INPUT -s $ip -p udp --dport 28960 -j DROP
done

for ip in `cat /home/user/banlists/b3bans | awk -F: '{print $1}'`; do
/sbin/iptables -A INPUT -s $ip/24 -p udp --dport 28960 -j DROP
done


These scripts will mess up any firewall you have set up because it flushes the iptables list so if you have any other firewall rules set up you'll have to modify this.

Also I'm sure this isn't the best way to do this as I'm not great at using bash, so any changes that you think would make it better would be useful.

one thing I am wondering is how to add regular b3 bans and tempbans to the echelon banlist.txt so I can use this script for those also, if anyone knows how to do this please let me know.

Hopefully this helps someone having the problem that I was.

--EDIT--
This is for cod4 you'll have to modify the port number if you want to use it for other games.
« Last Edit: October 02, 2010, 01:00:31 AM by zax33333 »

Offline Destroyer

  • Jr. Member
  • **
  • Posts: 35
    • QuietConqueror
Re: banlist plugin
« Reply #51 on: October 03, 2010, 04:03:55 PM »
Courgette

can i use your config? and i have do nothing else?

B3 can now check players in banlist, i have test it :)
Hi <QC> Urban terror

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: banlist plugin
« Reply #52 on: December 26, 2010, 03:25:29 AM »
I am curious as to how i can make banlist.php also can show guids?

I'm running MW2 servers on aiw.net, and, i'd like the bans to be global so i don't have to mess around with the databases and such.

The banlist.php is being generated, but, i don't really see how to make the guids appear in it so i can have my second server read the 200 bans i have on the first server.

Since the game does not allow for perm-bans, as there is no such function/command, i am using a 999d tb for now.
Is it possible to add tempbans to this? Or, even if i did go and permban all of them using the echelon, how would i make the guids appear along with their IP and such?

Great plugin btw, very nice touch :)

http://www.banditcompany.com/echelon/banlist.php

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: banlist plugin
« Reply #53 on: January 03, 2011, 01:18:23 AM »
I've been waiting for quite a few days now for a possible response to my question.
But i figured since it's been xmas and all that, that i would give it until the new year and such so people could get a chance to actually reply to the question.

Does anyone have this banlist plugin figured out along with echelons banlist.txt so it does show guid's as well as IP's ?
(i do understand that this is echelon related and not directly linked to the banlist plugin as it is echelon that generates the banlist.txt/banlist.php)
« Last Edit: January 03, 2011, 01:20:27 AM by Nocturnal1982 »

Offline ryry46d9

  • B3 Contrib/Support
  • Sr. Member
  • *
  • Posts: 337
    • Pb| clan
Re: banlist plugin
« Reply #54 on: January 03, 2011, 02:49:38 AM »
I'm unsure  but, I feel you might have to do this all by hand in the guid.txt file.

with a entry like this in you banlist.xml:

Code: [Select]
<guid_banlist>
        <name>guid banlist</name>
        <file>/var/www/banlists/guid.txt</file>
        <message>^4$guid^7 is ^1BANNED^7 GUID</message>
</guid_banlist>

I only run Q3 Based games and our GUID system = fail
but for the few know hacked clients, The entries I have in the guid.txt file, The bot does ban them.

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: banlist plugin
« Reply #55 on: January 04, 2011, 12:14:15 AM »
I'm unsure  but, I feel you might have to do this all by hand in the guid.txt file.

with a entry like this in you banlist.xml:

Code: [Select]
<guid_banlist>
        <name>guid banlist</name>
        <file>/var/www/banlists/guid.txt</file>
        <message>^4$guid^7 is ^1BANNED^7 GUID</message>
</guid_banlist>

I only run Q3 Based games and our GUID system = fail
but for the few know hacked clients, The entries I have in the guid.txt file, The bot does ban them.

Well, my problem is that there is no guid.txt file generated by echelon.
And i would very much like to figure out a way to generate these guids.

I do understand that the guid ban idea on quake3 based games is not a good one, which you mention.
But, since i don't really want to ban by IP's running COD servers, i'd want to make the php file generate guids for these people that have been banned.

I understand that this is not really related to banlist plugin as the banlist plugin does have all the required fields to do this.

Offline oddball118

  • Beta Testers
  • Full Member
  • *
  • Posts: 60
    • 4thID Clan
Re: banlist plugin
« Reply #56 on: January 11, 2011, 03:29:02 AM »
I accomplished this with a quick and dirty solution.  I didn't not see any reason to re-invent the wheel.  I took the banlist.php and modified the mysql statement and the output.

So I customized the mysql query and added my tempban time frame to it.  I changed:



Code: sql [Select]
$query_rs_activebans = sprintf("SELECT penalties.id, penalties.type, penalties.time_add, penalties.time_expire, penalties.reason, penalties.inactive, penalties.duration, penalties.admin_id, target.id as target_id, target.name as target_name, target.ip as target_ip FROM penalties, clients as target WHERE penalties.type = 'Ban' AND inactive = 0 AND penalties.client_id = target.id AND ( penalties.time_expire = -1) ORDER BY penalties.id DESC");


to

Code: sql [Select]
$query_rs_activebans = sprintf("SELECT penalties.id, penalties.type, penalties.time_add, penalties.time_expire, penalties.reason, penalties.inactive, penalties.duration, penalties.admin_id, target.id AS target_id, target.name AS target_name, target.ip AS target_ip, target.guid FROM penalties INNER JOIN clients target ON penalties.client_id = target.id WHERE penalties.type = 'TempBan' AND penalties.inactive = 0 AND penalties.time_expire >= UNIX_TIMESTAMP(NOW()) + 432000 ORDER BY  penalties.id DESC");



And I changed the output from:

Code: php [Select]
  public function writeBans() {
    echo "\n";  
    echo "//  permanent bans from " . $this->serverConfig['name'] . " \n";
    foreach ($this->Aban as $ban) {
      $text = preg_replace('/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.\d{1,3}/','  public function writeBans() {
    echo "\n";  
    echo "//  permanent bans from " . $this->serverConfig['name'] . " \n";
    foreach ($this->Aban as $ban) {
      $text = preg_replace('/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.\d{1,3}/','$1.$2.$3.0',$ban['target_ip']) . ':-1   // ';
      $text .= $ban['target_name'];
      $text .= '    banned on  ' . date('m/d/Y (H:i)',$ban['time_add']);
      $text .= ', reason : ' . $ban['reason'];
      echo $text . "\n";
    }.php.$3.0',$ban['target_ip']) . ':-1   // ';
      $text .= $ban['target_name'];
      $text .= '    banned on  ' . date('m/d/Y (H:i)',$ban['time_add']);
      $text .= ', reason : ' . $ban['reason'];
      echo $text . "\n";
    }



to

Code: php [Select]
  public function writeBans() {
    echo "\n";  
    echo "//  permanent bans from " . $this->serverConfig['name'] . " \n";
    foreach ($this->Aban as $ban) {
 $text = $ban['guid'] . '    // ';
 $text .= $ban['target_ip'] . '  ';
      $text .= $ban['target_name'];
      $text .= '    banned on  ' . date('m/d/Y (H:i)',$ban['time_add']);
      $text .= ', reason : ' . $ban['reason'];
      echo $text . "\n";
    }



Change the file name to whatever you like.  I used banlist-GUID.php.  Now just navigate from echelon to banlist-GUID.php.
« Last Edit: January 12, 2011, 10:50:39 PM by oddball118 »

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: banlist plugin
« Reply #57 on: January 12, 2011, 10:36:43 PM »
Thank you man :)
Exactly what i was looking for, but, for some reason my banlist.xml is not working as it should.

Code: [Select]
	<guid_banlist>
<name>guid banlist</name>
<file>http://www.banditcompany.com/echelon/guid_banlist.php</file>
<message>^4$guid^7 is ^1BANNED^7 (GUID 1)</message>
</guid_banlist>

When i do the blinfo so it will show which banlists is loaded, it comes up blank, and i did a test by banning a mate of mine, i forced the banlist to update, banned him with a tempban and it did not respond to him.

Offline oddball118

  • Beta Testers
  • Full Member
  • *
  • Posts: 60
    • 4thID Clan
Re: banlist plugin
« Reply #58 on: January 12, 2011, 10:45:31 PM »
I have mine set up this way:


Code: xml [Select]


<guid_banlist>
<name>GUID Banlist</name>
<file>C:\banlist\MW2-GUID-banlist.txt</file>
<message>^4$name^7 is ^1BANNED^7 (GUID-BANLIST)</message>
<url><![CDATA[http://yoursite.com/mw2/banlist-GUID.php]]></url>
</guid_banlist>



Just have a directory on your game server to write the ban list too.


« Last Edit: January 12, 2011, 10:48:56 PM by oddball118 »

Offline oddball118

  • Beta Testers
  • Full Member
  • *
  • Posts: 60
    • 4thID Clan
Re: banlist plugin
« Reply #59 on: January 12, 2011, 10:58:45 PM »
Also here it is for IP. 

Change banlist.php to:


Code: sql [Select]
 $query_rs_activebans = sprintf("SELECT penalties.id, penalties.type, penalties.time_add, penalties.time_expire, penalties.reason, penalties.inactive, penalties.duration, penalties.admin_id, target.id AS target_id, target.name AS target_name, target.ip AS target_ip, target.guid FROM penalties INNER JOIN clients target ON penalties.client_id = target.id WHERE penalties.type = 'TempBan' AND penalties.inactive = 0 AND penalties.time_expire >= UNIX_TIMESTAMP(NOW()) + 432000 ORDER BY  penalties.id DESC");



And my output:
Code: php [Select]
  public function writeBans() {
    echo "\n"; 
    echo "//  permanent bans from " . $this->serverConfig['name'] . " \n";
    foreach ($this->Aban as $ban) {
      $text = preg_replace('/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.\d{1,3}/','  public function writeBans() {
    echo "\n"; 
    echo "//  permanent bans from " . $this->serverConfig['name'] . " \n";
    foreach ($this->Aban as $ban) {
      $text = preg_replace('/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.\d{1,3}/','$1.$2.$3.0',$ban['target_ip']) . ':-1   // ';
      $text .= $ban['target_name'];
      $text .= '    banned on  ' . date('m/d/Y (H:i)',$ban['time_add']);
      $text .= ', reason : ' . $ban['reason'];
      echo $text . "\n";
    }.php.$3.0',$ban['target_ip']) . ':-1   // ';
      $text .= $ban['target_name'];
      $text .= '    banned on  ' . date('m/d/Y (H:i)',$ban['time_add']);
      $text .= ', reason : ' . $ban['reason'];
      echo $text . "\n";
    }



 


Rate this page +1 at Google Search