JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.04k stars 615 forks source link

Executing actions based on userinfo #775

Open Caelish opened 8 years ago

Caelish commented 8 years ago

One feature I'd really really like to see in the OpenJK server-side is the ability to run predefined actions on players who have a specific text string in their userinfo. For example, I'm currently hosting someone using a number of hacky and horrible scripts to automatically log the IPs of players with specific names.

Some of the things I might want to do depending on a completely arbitrary text match in a player's userinfo include:

Ideally, support for wildcards in userinfo and several actions would be nice, along the lines of...

Check userinfo -> if match for ✱\name\bob\✱\rate\4000\✱ -> log the player's userinfo & IP and then ban them.

This would save me huge, huge amounts of headaches. It could be used for several things, such as identifying or banning unwanted players using VPNs, providing debug info when someone messes up their userinfo with relation to userinfo validation, or just giving them a message relevant to them like the rate one.

As a simpler alternative in the meantime though, even being able to extend the existing userinfo validation with custom illegal text string matches of my own would be hugely useful.

ensiform commented 8 years ago

I see this more as a mod feature.

Razish commented 8 years ago

Yep, I agree. Should we do it in OpenJK modcode?

Caelish commented 8 years ago

That makes sense, but could we at least add a cvar for custom text strings that fail userinfo validation as non-mod thing? I suppose I'm just in a weird position (seeing as I host a bazillion of servers each using different mods), but at the very least having that as a non-mod feature would make my life considerably easier.

Something like...

set sv_userinfofail "\rate\25000;\name\bob;\name\s*nta;etc;etc;e*t*c;etc;etc"

...or simply a plain text file containing custom userinfo validation matches.

ensiform commented 8 years ago

Alternatively the filtering could be moved to engine entirely.

Razish commented 8 years ago

Mods may definitely wish to have their own userinfo validation, especially if there's a possibility of incompatibility

ensiform commented 8 years ago

So move the core non mod specific portions to engine and the rest can be up to mods.

Razish commented 8 years ago

So modcode should match patterns specific to the modcode, engine should have size + format checking and then user-specified filter strings. Should investigate ways to allow admins to create rules, combining operators and algorithms. Or just a polymorphic structure stored in a list like "i am a less-than rule" operating on "numCharactersInValue" and "64". Could look into how Wireshark applies its filters

mrwonko commented 8 years ago

Just make Icarus powerful enough to be able to express filtering rules in it. :stuck_out_tongue:

Joking aside, the most general way would be an actual scripting language, though maybe not icarus.