You are here: Big Brother Bot ForumCommunity DevelopersPlugin DevelopersAdd Ban Into Database Without Kicking Client?
Pages: [1] 2   Go Down
  Print  
Author Topic: Add Ban Into Database Without Kicking Client?  (Read 1229 times) Bookmark and Share
Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« on: September 14, 2011, 06:12:16 PM »

The name pretty much says it all.  I am wondering if there is a way to ban a client without kicking them from the current session (this would be used in a plugin where you ban the client, then they get notified, and then kicked after the notifications; this is to prevent them from leaving before the ban is initiated).  The ban would then act the same as any other if the client tried to rejoin the server.  Is this possible with b3?  Thanks for the help.

Brendan "NinjaNife" West

P.S.
Is there a silent kick function?  One that doesn't put the kick into the "penalties" table?  Kinda doubt it but thought I would ask.
Logged

Beta Testers
*
OS: Windows
Type: Owner dedicated server(s)
Gameservers: MW2 (aIW)
Posts: 187
Offline Offline
WWW
« Reply #1 on: September 14, 2011, 06:20:50 PM »

The name pretty much says it all.  I am wondering if there is a way to ban a client without kicking them from the current session (this would be used in a plugin where you ban the client, then they get notified, and then kicked after the notifications; this is to prevent them from leaving before the ban is initiated).  The ban would then act the same as any other if the client tried to rejoin the server.  Is this possible with b3?  Thanks for the help.

Brendan "NinjaNife" West

P.S.
Is there a silent kick function?  One that doesn't put the kick into the "penalties" table?  Kinda doubt it but thought I would ask.


You can use !lookup <nick> to ban or kick the player offline. Otherwise use echelon.
Logged
Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #2 on: September 14, 2011, 06:32:44 PM »


You can use !lookup <nick> to ban or kick the player offline. Otherwise use echelon.

Sorry, but that isn't what I am trying to do.  I have a plugin that detects someone who should be banned, warns them that they will be banned, and then bans them (which kicks them as well).  What I am wondering is if there is a command (like "client.ban()" or whatever) that will only ban the client, not kick them at the same time (and possibly a kick that doesn't add to the penalties table; that way you wouldn't haev a ban and a kick for the same operation).  This is automated so the "!lookup" doesn't work in this case.  Thanks for the help though.

Brendan "NinjaNife" West
Logged
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 244
Offline Offline
« Reply #3 on: September 15, 2011, 01:30:48 AM »

At UrbanTerror when I give ban to the user from Echelon, he is not kicked instantly. Only on the mapchange he can't rejoin.
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #4 on: September 15, 2011, 04:07:08 AM »

If you code your own plugin you can do such a thing.

Look at how the cmd_permban method of the admin plugin works by first sending messages and then delegating the actual ban to the Client.ban method. The Client.ban method first delegate the server ban (which kicks) to the loaded parser (game dependent), then saves the ban penalty in B3 database.

Also the Client.kick method has a "silent" parameter which is used to tell B3 not to send any message when kicking.
Logged

Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #5 on: September 15, 2011, 07:05:42 AM »

If you code your own plugin you can do such a thing.

Look at how the cmd_permban method of the admin plugin works by first sending messages and then delegating the actual ban to the Client.ban method. The Client.ban method first delegate the server ban (which kicks) to the loaded parser (game dependent), then saves the ban penalty in B3 database.

Also the Client.kick method has a "silent" parameter which is used to tell B3 not to send any message when kicking.
Thanks!  That is exactly what I was looking for.  So all I need to do is copy the kick and ban commands from the client.py and rename them in my plugin?  Or do they need the code from the admin.py as well?  Thanks again!

Brendan "NinjaNife" West
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #6 on: September 15, 2011, 07:14:49 AM »

follow this tutorial : http://wiki.bigbrotherbot.net/customize:plugin_sdk:tutorial1
Logged

Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #7 on: September 16, 2011, 08:26:29 AM »

On a side note Courgette, would you mind taking a look at this post?

http://forum.bigbrotherbot.net/cod6-%28mw2%29/hacker-is-bypassing-bans/

I think you may be the best person to answer the question I had in the last reply.  If you get a few min to take a look that would be great.

Brendan "NinjaNife" West
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #8 on: September 16, 2011, 09:47:09 AM »

sorry I have no experience at all with cod servers and the way they manage the guid/xuid
Logged

Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #9 on: September 16, 2011, 10:17:46 AM »

I am not sure it is a CoD related issue..the PBID hasn't been used in any CoD game I have had b3 on, and it is one of the default columns in the clients table.  Are you saying EVT_CLIENT_AUTH is CoD-specific?  Thanks for the help.

Brendan "NinjaNife" West
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #10 on: September 16, 2011, 10:28:07 AM »

EVT_CLIENT_AUTH is not cod specific. It is a B3 event that is triggered when B3 has found a recently connected player in its database (or create a database entry for a new player)
Logged

Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #11 on: September 16, 2011, 10:46:35 AM »

EVT_CLIENT_AUTH is not cod specific. It is a B3 event that is triggered when B3 has found a recently connected player in its database (or create a database entry for a new player)
Ah.  What variables does EVT_CLIENT_AUTH return?  The plugin that I was using is run by EVT_CLIENT_AUTH, and apparently it crashes when a new client (never seen by b3) joins the server and the plugin has a PBID that is not recognized..I guess it either doesn't get one or can't find one in the database (since the entry must be created).  I was just wondering if that is an EVT_CLIENT_AUTH problem or if it gets that info from the database and it just isn't there...

Brendan "NinjaNife" West

*EDIT*
Another thought; is there any way to have a plugin delay it's actions?  Like if the plugin is triggered by EVT_CLIENT_AUTH, could I tell the plugin to wait 5sec (for example) before performing the checks?  That may give the database time to create a new client and end up solving the problem (if it is caused by a database error and not because EVT_CLIENT_AUTH returns an unknown value for PBID).
« Last Edit: September 16, 2011, 10:52:38 AM by NinjaNife » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #12 on: September 16, 2011, 11:04:15 AM »

What variables does EVT_CLIENT_AUTH return?
a Client object for authenticated player.

Quote from: NinjaNife
The plugin that I was using is run by EVT_CLIENT_AUTH, and apparently it crashes when a new client (never seen by b3) joins the server and the plugin has a PBID that is not recognized..I guess it either doesn't get one or can't find one in the database (since the entry must be created).  I was just wondering if that is an EVT_CLIENT_AUTH problem or if it gets that info from the database and it just isn't there...
well the data B3 uses to authenticate a player (understand uniquely identify a player in B3 database) depend on the game. I'm not sure how the CoD* B3 parsers handle this in detail. And I think it might also depend on if you activated the punkbuster option in b3.xml.
It may be that when the pb option is on B3 uses the pbid to auth the player while when off it uses the game guid (or xuid whatever this is in cod)


Quote from: NinjaNife
is there any way to have a plugin delay it's actions?  Like if the plugin is triggered by EVT_CLIENT_AUTH, could I tell the plugin to wait 5sec (for example) before performing the checks?
you can but make sure not to use the sleep() function as it would block the whole B3. If you want to delay either use python tread/threading modules to setup a timer or use the OneTimeCronTab class

Quote from: NinjaNife
That may give the database time to create a new client and end up solving the problem (if it is caused by a database error and not because EVT_CLIENT_AUTH returns an unknown value for PBID).
I'm pretty sure the EVT_CLIENT_AUTH event is triggered once data is saved to database. See here's the only place where the EVT_CLIENT_AUTH event is triggered and a few lines before you got the save() call which write any info held in the Client object to the database.
Logged

Full Member
***
OS: Windows
Type: Owner dedicated server(s)
Gameservers: CoD4, CoD6, CoD7
Posts: 80
Offline Offline
Currently hosting 40+ b3 Bots!!!
WWW
« Reply #13 on: September 16, 2011, 11:16:23 AM »

Ah, I guess that means my idea won't work then lol.  I tried enabling PB in b3, but it still gives the same error

Code:
110916 15:12:13 ERROR "handler WidebanxtremePlugin could not handle event Client Authenticated: TypeError: object of type 'NoneType' has no len() [('b3\\\\parser.pyo', 973, 'handleEvents', None), ('b3\\\\plugin.pyo', 158, 'parseEvent', None), ('G:\\\\UserFiles\\\\NinjaNife\\\\GameServers\\\\TC30418520720240387106885\\\\b3\\\\extplugins\\\\widebanxtreme.py', 68, 'onEvent', None)]"

Now, there is no PB on the server itself, so I guess that could still be the problem..  Not sure; I will try to check later.  If b3 doesn't find a PBID when a player connects, what does it send in the EVT_CLIENT_AUTH event?  Just 'None' or something else?

As for the "sleep()" thing, I actually have found that in several of the plugins I use, and if it causes all of b3 to sleep then I should try to fix that.  Is there a guide available that explains how to exchange "sleep(5)" for something that won't harm b3's core functions (only sleep the plugin/section of code)?  Thanks for all the help!

Brendan "NinjaNife" West

P.S.
Here is the code that handles the pbid after it is received:

Code:
if len(event.client.pbid) > 0 and event.client.pbid is not None and event.client.pbid != 'None':

It sorts through 'None' and blank pbid's, which to me means b3 must be submitting another variable..even though it shows up as 'None' in the database.  It works perfectly fine as long as the client connections > 1, just fails if client connections = 0 or 1.
« Last Edit: September 16, 2011, 11:25:30 AM by NinjaNife » Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #14 on: September 16, 2011, 12:52:24 PM »

Why not fix a bigger problem here and have someone recode the cod6 parser to pull the pbid from the xuid. Then it won't be none?


Forget it if it way off base....
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Tags: plugin event thread 
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal