mIRC Home    About    Download    Register    News    Help

Print Thread
filter script not showing correct details #269054 30/05/21 10:02 PM
Joined: Oct 2014
Posts: 48
O
Orobas Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Oct 2014
Posts: 48
Hi Guys

Running a catch and announce-to-channel script from an snotice for spamfilter catchments and noticed on one particular filter it does not display correctly

Bot is mirc 7.55

message from snotice is
Quote
matches filter '(?-i)[A-Z ]{30}':

filter window @spam shows correct every time

bot message is
Quote
[22:05] <Titan_Bot> AndroUser2 tripped spamfilter at 22:05:51 on 30/05/2021 .. the spamfilter is '(?-i)[A-Z and they said #testchannel: 'THIS IS A TEST etc etc etc

For some reason $5 is breaking due to the required space between the Z and the ] and it doesnt show the rest as seen above.. I can live with it but this is the first time it has occurred and i would like to fix if possible

code section is
Code
if (matches filter isin $1-) {
    window -nek @spam
    aline -hp  @spam 4 $+ $1-  at $time on $date on $network
    /msg #filters $gettok($2,1,33) tripped spamfilter at $time on $date .. the spamfilter is $5 and they said $gettok($8-,1,93)
     haltdef
  }

Is there an easy fix here and what is it please smile

Re: filter script not showing correct details [Re: Orobas] #269060 31/05/21 11:04 AM
Joined: Jan 2004
Posts: 1,585
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,585
Because of the space in your filter, the space-tokenizing of $1- is affected, and I would've expected $8- to also be messed up.

One way to fix is to check for the presence of an expected word at a specific place. For example, if $8 is supposed to be a channel name and it's not, then you could parse the region from $9- forward until you find the 1st word matching #* so you know how many extra words to include as $5-whatever and to replace $8- with $9- $10- etc.

Another way is to ensure your filter never contains a space. If not possible to have the snotice contain $encode(the-filter,m) and then display it as $decode($5,m), you can replace the space in your filter with \s or \x20. Note that \s would also match other characters including the TAB.

edit: helps if you give the *ACTUAL* snotice. There's also a way to make a regex that finds the filter by showing the character following the 1st singlequote until the character preceding the 2nd one. But again, that would also glitch if the filter contains a singlequote. Having the ACTUAL format of the ACTUAL snotice would help greatly.

edit: your message also fails if your pattern contains enough spaces to push a $chr(93) within your filter into the $8-. If your filter can contain any character-pattern and so can the offending message being quoted, there will always be a possibility for a filter message to not be handled correctly.

Last edited by maroon; 31/05/21 11:38 AM.
Re: filter script not showing correct details [Re: maroon] #269061 31/05/21 11:38 AM
Joined: Oct 2014
Posts: 48
O
Orobas Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Oct 2014
Posts: 48
Hiya maroon

ironically... $8- displays correctly.. and the full message on all hits on any filter that gets tripped so that is unaffected

the space in the filter is deliberate and was specified as such in person by Syzop as an unrealircd filter on the spamfilter.conf section but i set it on mirc using

Code
/spamfilter add -regex c soft-block - caps_or_netspammer (?-i)[A-Z ]{30}


i tested it on regex101 to confirm the regex works and it does.. i tested it on the server with a regged and unregged nick and it worked fine.

re the full snotice.. sorry .. here it is
Quote
[Spamfilter] AndroUser2!~androirc@ip.address.here.threembb.co.uk matches filter '(?-i)[A-Z ]{30}': [PRIVMSG #testchannel: 'THIS IS A TEST TRIP OF THE SPAMMERSFILTER I SET ON THE NETWORK FROM SLEEPINGDRAGOONY'] [caps or netspammer] at 22:05:51 on 30/05/2021 on network.here


the spamfilter announcement from snotice as i showed clearly shows the tripped filter in full.. its purely the script that looks at the snotice.. $5 is the spamfilter read which as you correctly pointed out .. has a space in it instead of a solid block. is it just a case of using $5- ?

Re: filter script not showing correct details [Re: Orobas] #269063 31/05/21 05:10 PM
Joined: Jan 2004
Posts: 1,585
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,585
The $8- is being handled differently also, because the space in the regex filter shifts the normal #channelname at $7 into being the $8 word.

[Spamfilter] AndroUser2!~androirc@ip.address.here.threembb.co.uk matches filter '(?-i)[A-Z ]{30}': [PRIVMSG #testchannel: 'THIS IS A TEST TRIP OF THE SPAMMERSFILTER I SET ON THE NETWORK FROM SLEEPINGDRAGOONY'] [caps or netspammer] at 22:05:51 on 30/05/2021 on network.here

$2 = AndroUser2!~androirc@ip.address.here.threembb.co.uk
$3-4 = matches filter
$5 'filter':
$6 = [PRIVMSG
$7 #testchannel:
$8- = 'THIS IS A TEST TRIP OF THE SPAMMERSFILTER I SET ON THE NETWORK FROM SLEEPINGDRAGOONY'] [caps or netspammer] at 22:05:51 on 30/05/2021 on network.here

Without the space in the filter, the $8- begins with the singlequote followed by what they said. With the space, the $8- contains the "#testchannel:" string.

Also, the way you're tokenizing by 93, your output is terminated prior to the "[caps" string, so it includes the ending ] brace preceding that. However, it also means that if their message contains the ] character, the message will truncate at that instead.

^'([^']+)': \[\S+ \S+: '(.+)'\] \[

With a regex like the above against $5- it should create $regml(1) containing the filter assuming it does not contain any singlequotes followed by $noqt(: [) and creates $regml(2) containing their sentence assuming the sentence doesn't contain: $noqt('] [)

Re: filter script not showing correct details [Re: maroon] #269066 31/05/21 08:00 PM
Joined: Oct 2014
Posts: 48
O
Orobas Offline OP
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Oct 2014
Posts: 48
Hi Maroon

many thanks for the reply and apologies for the time delay in this message.. real life had me priority.

Much appreciated for the feedback. I know my scripting is exceptionally rough and crude and should be using much better code but that is all i know i am afraid when it comes to msl scripting lol.

I'll sit down and have a play and see if i can improve my script from your suggestions!