mIRC Homepage

Need a little help

Posted By: saragani

Need a little help - 15/08/04 04:27 PM

I'm building a spam blocker for my mIRC, and so far i managed to collect more like 60 spam messages to be recignized by my spma blocker.

I use an On Text event for private messages and all the messages that I compare to are located inside a hash table and they are in regex.

For example:

1 = (?i)Speed up your mIRC DCC Transfer by up to
2 = (?i)It seems that you have been infected with .* please download a cleaner for this virus

etc...
1 and 2 .... are the item name and the "(?i)Speed up your mIRC DCC Transfer by up to" is the data.

For some of the messages I get I would like to get some information from the message, for example:

3 = Free iPod/iPod Mini! US Residents ONLY! (.*) Sign up and complete an offer.

The (.*) which is $regml(1) will give me the website that the spam was reffering to. I would like to get that information so I could later inform thier hoster about it, or do other things.



I'm using:

if ($hfind(spam,$1-,1,R).data > 0) {
echo -a $v1
}

$v1 (or $ifmatch) returns the item name which I got using the $hfind. I gave the spam messgaes items numbers in some areas to define between thems and define the actions that should be taken.

For example if $ifmatch is between 1-30 then the query window is just being closed.
If the $ifmatch is between 31 and 60 the user is being ignored.

If the $ifmatch is between 61 and 90, I also log some information, for example the website that the spam message was reffering to. The problem is that $regml(1) doesn't return the information (altough I have expected it to return it). It only returned the website information for about 2 of the 30 spam messages that have link inside (I have no idea why it happens. For some reason it is recognizing the $regml for some messages, and for the othres it doesn't recognize).

I'm sure that the regex expression that I wrote is OK, for few reasons:
1) I have tested it with an external software (regex coatch)
2) It is recognzing the message and enters the if (and also tell me which item in the list it found, for example $ifmatch = 8)
3) I also texted the script before using elseif statements, but the problem that it makes the script too long, and it takes more cpu to chkeck like 90 elseif statements (I'm takjng the worst case scenario that the spam message that was sent is the last in the elseif statements), not to mention that my database it contantly growing (I just got 3 new messages today).
It is also easier to update the database from the net other than updating the script itself.

My question is: How can I make it recognize the $regml for all the messages that it catches?? confused confused

(I'm sorry for the long story)

Using this method of hash tables seems to be the fastest is the most efficient. This is why I'm using it. Thanks for your help and for reading this long long story. wink
Posted By: saragani

Re: Need a little help - 15/08/04 07:23 PM

It seems that I was wrong a little.
It doesn't work for 2 of the 30 items that I checked but onlt for one of them.

I made an expirament. I have created a hash table which has only 2 items and then I checked it by sending notices to myself:

on *:NOTICE:*:?: {
if ($hfind(spam,$1-,1,R).data > 0) {
echo 4 -a $v1 $regml(1)
}
}

1 = (?i)It seems that you have been infected with (.*) please download a cleaner for this virus

2 = (?i)HI! My name is (.*) I need boyfriend

When I sent a notice to myself I managed to catch the $regml(1) of only one of the messages that I sent to myself.
This made me realize that I can retrieve the $regml(1) only if the regex data on the hash table which matches the text is the last one inside the hash table. (I would assumed that it should return to the script as soon as it finds the first match).

Does anyone knows how to solve this problem, or get around it by any way??

Thanks :tongue: :tongue:
Posted By: Kelder

Re: Need a little help - 15/08/04 10:11 PM

Same topic as bugreport :
http://forums.mirc.com/showflat.php?Cat=...amp;amp;fpart=1

Already answered: if (($hfind(spam,$1-,1,R).data) && ($regex($1-,$hget(spam,$v1)))) { ... }
It would be best you don't have an item called 0, $null or $false with a matching regex smile
Posted By: saragani

Re: Need a little help - 16/08/04 07:16 AM

I saw your respones. smile

I don't have any item called 0 $null or $false wink


I hope that this new method will prevent the hight cpu peeks when ever I get a provate message (My computer is kinda old, and dealing with 90 elseif statements is not the easiest thing for it).

© 2021 mIRC Discussion Forums