kangarko / ChatControl-Red

Issue tracker and documentation for the next generation ChatControl Red, the most advanced chat management plugin.
43 stars 22 forks source link

"Advanced" swear filter #2723

Closed bobbyrossy123 closed 1 week ago

bobbyrossy123 commented 2 weeks ago

"/version ChatControlRed" - plugin version

10.27.2

Are you using MySQL?

No

Are you using BungeeCord?

No

Error log (if applicable)

No response

"/chc debug" output (strongly recommended)

No response

Information about the issue/bug

Using the "Advanced" Swear and Offensive word filter for ChatControl Red, hardly any of the words are actually filtering any/all bypasses. Basic stuff which should be filtered such as "F!ck or "Hent@i" aren't picked up at all.

TheIntolerant commented 1 week ago

@kangarko could I get access to the source code for the addon? As I could easily add most of these bypasses.

Thanks

kangarko commented 1 week ago

These rules are made to balance performance and effectiveness. For performance reasons, the filters might exclude some edge case bypasses. You can always improve the effectiveness of each filter by adding more letters separated by | and surrounded by ().

Example - the following rule matches "penis" but not "pen!s". To add the ! to the filter, simply edit:

match \b(p+(\W|\d|_)*e+(\W|\d|_)*n+(\W|\d|_)*i+(\W|\d|_)*s+(\W|\d|_)*)

to

match \b(p+(\W|\d|_)*(e|\!)+(\W|\d|_)*n+(\W|\d|_)*i+(\W|\d|_)*s+(\W|\d|_)*)

If you cannot see what we did, note the "e" in the block "e+(\W|\d|_)*" being now (e|!). Note that due to the ! letter being used as a regular expression operator, we had to prefix it with \ to match it literally instead of using it as a function.


To save you time, I have edited the fuck and the hentai filters for you here:

# Blocks 'fuck'
match \b(f+(\W|\d|_)*(u|\!)+(\W|\d|_)*c+(\W|\d|_)*k+(\W|\d|_)*)
group swear

# Blocks 'hentai'
match \b(h+(\W|\d|_)*e+(\W|\d|_)*n+(\W|\d|_)*t+(\W|\d|_)*(a|@)+(\W|\d|_)*i+(\W|\d|_)*)
group swear

@TheIntolerant thank you. If you have time, I have pushed the upsell/ folder to the source code - you can add more letters to the filters. But please keep in mind it has performance impact so try to keep it to the necessary minimum.

TheIntolerant commented 1 week ago

Hey @kangarko thanks! I must of missed that when looking for it lol.

Anyway, I have had a busy few days but I've made most of the changes, just need to test in case of any typos etc.

I personally have used these complex Regular Expressions with little to no impact on performance on smaller server but as it is something that can impact performance as you stated, I thought I would add two files that people could pick once that want to use? (seen the screenshots below)

image

I added a quick note about the two files explaining what makes them different, in the READ ME file. image

Does this seem okay? That way people can pick with they want to use more complex set of rules. Just to give an example for words like "hentai" with the changes I made in the complex file,

It will get matched with any of the following plus more!! h3ntai hent@i henta! h3nt@1 etc.

The work 'Fuck' is similar, with it matching to far more common bypasses f#ck f#ck f**k f@%k f__k etc.

I looked at almost every word in the file and tried my best to see how I can make it harder to bypass, which is why I spilt the files into too, in case it has a performace issue for people!

For example the N word with the "complex" file will also get matched for bypasses like this ^igg4 ^!99@ n!g9a etc.

So it should pretty much be up to 10x harder for people to bypass the filter, if they choose to use this new file!

TheIntolerant commented 1 week ago

Anyway, Let me @kangarko know if you are cool for me spilt them into two files. With the current "advanced" swear filter in one file and a more complex one in another file? and I'll make a pull request with those changes!

kangarko commented 1 week ago

Sure, I love that idea! I will approve the pull request asap :)