Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Echelon v2 is not yet officially released! If you cannot get this dev-version installed, revert to version 1 as available in our download section.

Author Topic: Cross server ban plugin possible?  (Read 9792 times)

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Cross server ban plugin possible?
« on: May 29, 2013, 01:52:40 PM »
Hi,

This has probably been discussed over and over somewhere, but is it possible to have a plugin for B3 and Echelon which works as so;

You ban a player from server 1
You check Echelon to make sure the ban is in place, but you also want to ban the player on server #2, #3 etc even though he has not played on them.

Granted his GUID and PBGUID will NOT be registered on server #2,#3 making it a no go to enforce a ban - of course,  BUT! is it not possible for Echelon to check the database from #1, grab the GUID or even copy/paste it and initiate a ban for the player on server's 2+3?

It would be a massive change to create this as multi server bans for B3 and Echelon are an issue if the player has never played there before...

Many thanks
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline MordyT

  • Support Hero
  • Hero Member
  • *
  • Posts: 3644
  • Over $300 Donated to B3!
    • MordyT
Re: Cross server ban plugin possible?
« Reply #1 on: May 29, 2013, 02:54:48 PM »
Hi,
Could have sworn this was discussed with you before, but the banlist plugin will do what you want (in some ways). You can add a GUID to a list file and B3 will read that file in real time (configurable) and if a player in the list connects, it bans them.
http://forum.bigbrotherbot.net/plugins-by-courgette/banlist-plugin/
Help will be given to those with a b3.log

If drop off the map it is due to RL becoming busy :)

System: Python 2.7.3 - Deb 7 - B3 Source Code - 128MB RAM box (rented at $5 a year) - remote MySQL - Remote Web Services

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #2 on: May 29, 2013, 03:08:59 PM »
It was,
we never could get the plugin to work correctly as it was banning innocent players for no reason from other servers.
I tried IP range and GUID.. I have a thread open here somewhere about it and it ground to a halt as it was simply banning and kicking innocent players.

As that didn't work, I am trying to find a better solution.
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #3 on: June 06, 2013, 06:49:31 PM »
Hi guys,

This is becoming an increasingly frustrating issue for me.
I have more communities and clans who have more than one server.

They would like to issue a ban for someone cheating on server #1 and have that ban implemented on server # 2, #3 and in some cases #4+5.

I have tried an insane amount of times to get the banlist to work. If I use ip's it bans everyman and his dog
If I use GUID bans it seems to go bananas and simply ban regular lads.

I've used a hack attempt to run the queries, it goes so far then stops.
There HAS to be a way to do this, and honestly? It's a serious factor that's missing from B3 + or Echelon.

Nowadays - in today's gaming society and scene, most clans and communities have more than one - more than two - server(s) and having an admin tool that is incapable of server-wide bans is a massive flaw.

Now please don't take this as offensive as none is intended, and you guys know how I personally feel about the B3 project, but consider it as constructive criticism if you will..

We game in a scene where having two or more servers in say, BF3 for example, is the norm. Having an admin tool that is hugely customisable and extremely efficient but cannot ban across ALL servers is almost unbelievable.

I have tried myself to no end to get this to work, but it just becomes 'ban happy'
There MUST be a way to implement this INTO B3 and Echelon!?

I am more than happy to let any coder into one of my servers, and we will test what I have done and you will see it just bans left right and centre.
If anyone is willing to have a crack at it  I can help with servers, B3 servers and everything you need.
I'll keep going with a few things I've done but it's not working and I don't know if I can get it working alone..

This, in my honest opinion, really needs to be a core functionality in B3 for this day and age where clans/communities and guilds have more than one server and need multi server bans.

I will help as much as possible with anyone who thinks they can get the banlist working correctly using GUID's

Failing that, does anyone have a good idea or guide on how to get this working?
« Last Edit: June 06, 2013, 06:52:17 PM by Glock »
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline 82ndAB.Bravo17

  • Dev. Team
  • Hero Member
  • *
  • Posts: 2628
Re: Cross server ban plugin possible?
« Reply #4 on: June 06, 2013, 08:23:13 PM »
Why not use a common db for all servers?

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #5 on: June 06, 2013, 09:11:18 PM »
hi mate
In one of the other threads, in fact it's on the plugin thread itself, I want to avoid using single databases for several servers.

4-5 servers running off one database wouldn't be cricket;
Stats, chatlogs and so on.. it's not ideal, and of course the performance of it all.

I'd rather avoid this if possible.
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #6 on: June 06, 2013, 09:41:28 PM »
Also,
I've managed to do a hell of a lot so far, it's pulling the GUID banlist and actually working but going ott with it all.

So I'm almost there with it, but gave up as I couldn't see what more needed to be done to refine it all.
If there was a way to add a query or plugin or anything to add cross server bans it would seriously complete the package for multi server clans.

I'm almost there with it but have hit a brick wall and don't know how to continue with it further.. so frustrating really.  :-\
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #7 on: June 14, 2013, 09:02:28 PM »
I guess not.!!

Sigh.............    ::)
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline tanka

  • Jr. Member
  • **
  • Posts: 46
Re: Cross server ban plugin possible?
« Reply #8 on: June 15, 2013, 11:01:55 AM »
Best option is to use a single database for all servers. This way you have every connected client in the same table and the bans are enforced on all servers connecting to that database. You have to make custom XLR tables and status tables but works nicely. That is what I have done when I run COD4 at a GSP here: http://cod4.wage.co.za

The penalties, clients and stats are from multiple servers.

Offline Spoon

  • Sr. Member
  • ****
  • Posts: 255
    • EHD Gaming
Re: Cross server ban plugin possible?
« Reply #9 on: June 18, 2013, 01:20:48 AM »
Code: [Select]
Make a new database with a table called globalban make sure the engine is MyISAM.
In the globalban table make the following columns Name, GUID, Reason, Inactive

Make a file called globalban.py
[code__version__ = '1.0'
__author__  = 'Spoon'

from b3.querybuilder import QueryBuilder
import b3, re, threading, MySQLdb
import b3, thread, time, string, datetime
import b3.events
import b3, re

class GlobalbanPlugin(b3.plugin.Plugin):
    _adminPlugin = None

    def onStartup(self):
      self.registerEvent(b3.events.EVT_CLIENT_AUTH)
      """\
      Initialize plugin settings
      """

      self._adminPlugin = self.console.getPlugin('admin')
      if not self._adminPlugin:
        self.error('Could not find admin plugin')
        return False
   
      if 'commands' in self.config.sections():
        for cmd in self.config.options('commands'):
          level = self.config.get('commands', cmd)
          sp = cmd.split('-')
          alias = None
          if len(sp) == 2:
            cmd, alias = sp

          func = self.getCmd(cmd)
          if func:
            self._adminPlugin.registerCommand(self, cmd, level, func, alias)

      self.debug('Started')

    def getCmd(self, cmd):
      cmd = 'cmd_%s' % cmd
      if hasattr(self, cmd):
        func = getattr(self, cmd)
        return func

      return None

    def dbconnect(self):
        self._db = MySQLdb.connect(self.config.get('db','host'),self.config.get('db','username'),self.config.get('db','password'),self.config.get('db','db'))

    def _query(self, query):
        c = self._db.cursor()
        c.execute(query)
        return c

    def query(self, query):
        if self._db or self.dbconnect():
            try:
                return self._query(query)
            except Exception, e:

                if e[0] == 2013 or e[0] == 2006:
                    self.console.error('Query failed, trying to reconnect - %s: %s' % (type(e), e))

                    if self.dbconnect():
                        try:
                            return self._query(query)
                        except Exception, e:
                            pass

                self.console.error('Query failed - %s: %s' % (type(e), e))

    def onEvent(self, event):
        if not event.client:
            return
        if event.type == b3.events.EVT_CLIENT_AUTH:
            self.ban_check(event.client)

    def checkBan(self, client):
        self.dbconnect()
       
        cursor = self.query("""SELECT reason FROM globalbans WHERE guid = '%s' AND inactive = '0' """ % (client.pbid))
        if cursor.rowcount > 0:
            r = cursor.fetchone()
            client.ban('%s ^7(Enforced Global ^1Ban^7)' % r[0])
        else:
        return False
           
       
    def cmd_globalban(self, data, client=None, cmd=None):
        """\
        <name> [<reason>] - Adds a player to the global ban list.
        """
        m = self._adminPlugin.parseUserCmd(data)
        if not m:
            client.message('^7Invalid parameters')
            return False

        cid, keyword = m
        reason = self._adminPlugin.getReason(keyword)

        if not reason and client.maxLevel < self._noreason_level:
            client.message('^1ERROR: ^7You must supply a reason')
            return False

        sclient = self._adminPlugin.findClientPrompt(cid, client)
        if sclient:
            if sclient.cid == client.cid:
                self.console.say(self._adminPlugin.getMessage('ban_self', client.exactName))
                return True
            elif sclient.maxLevel >= client.maxLevel:
                if sclient.maskGroup:
                    client.message('^7%s ^7is a masked higher level player, can\'t ban' % sclient.exactName)
                else:
                    self.console.say(self._adminPlugin.getMessage('ban_denied', client.exactName, sclient.exactName))
                return True
            else:
                cursor = self.query("INSERT INTO globalban ( name, guid, reason, inactive ) VALUES ('%s', '%s', '%s' '0')") % (sclient.exactName, sclient.pbid, reason)
                self.checkBan(sclient)
                return True

Make a file called plugin_globalban.xml
Code: [Select]
<configuration plugin="globalban">
  <settings name="commands">
    <set name="globalban-gban">80</set>
  </settings>
  <settings name="db">
    <set name="host">localhost</set>
    <set name="username">username</set>
    <set name="password">password</set>
    <set name="db">globalban</set>
  </settings>
</configuration>

Use !globalban <name> to add someone to the global ban list and when they join any of your servers running this plugin it will ban them from there too.

I have not tested this pugin so i don't know if it works :)
« Last Edit: June 20, 2013, 02:57:20 PM by Spoon »

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #10 on: June 20, 2013, 02:21:28 PM »
Oh my

Spoon, just got the message.
Thank you SO much mate! Really, this will solve SO many issues for me, I will test this at the next opportunity

Thank you very very much bro
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #11 on: June 20, 2013, 02:41:50 PM »
Hi Spoon,

There is a syntax error on line 116,
I'm adjusting it with notepad++ but not getting it right,



it DID however, pull the table from the database

! Edit ! I've got it, well it fired up on a local test, now to test it in game :)
thank you
« Last Edit: June 20, 2013, 02:47:42 PM by Glock »
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Spoon

  • Sr. Member
  • ****
  • Posts: 255
    • EHD Gaming
Re: Cross server ban plugin possible?
« Reply #12 on: June 20, 2013, 02:57:56 PM »
line 116 there is 2 ) at the end there should only be 1 my bad :)

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #13 on: June 20, 2013, 03:18:31 PM »
Hi Spoon,

One more when I check it with IDLE;

    def query(self, query):
        if self._db or self.dbconnect():
            try:
                return self._query(query)
            except Exception, e:

Invalid syntax only on that line ^   :-\  
« Last Edit: June 20, 2013, 03:20:10 PM by Glock »
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

Offline Glock

  • Sr. Member
  • ****
  • Posts: 172
  • Running B3 on 4 busy BF3 servers myself! B3 FTW!
Re: Cross server ban plugin possible?
« Reply #14 on: June 20, 2013, 03:21:41 PM »
it's the lines 54-58 (sorry) but thanks very much, i really appreciate this
Need B3 Bot Hosting for your gameservers in the UK & Europe?
Take a look at Rcon-Admin.com
Cheap + reliable B3 Bot hosting in the UK and Europe

 


Rate this page +1 at Google Search

anything