URL Spam Protection

By DarthReven on May 02, 2005

This is alittle snippet for ops in the rooms that like to protect against spamming urls. You have the option of adding urls you wish to alow into a text file via a menu in the channel

#url off
on @*:text:*:#: {
  if ($nick isreg $chan) {
    if ($wildtok($strip($1-),*www.*.*,0,32)) {
      var %a $wildtok($strip($1-),*www.*.*,0,32), %b $strip($1-)
      while (%a) {
        if (!$read(urls.txt,w,$+(*,$wildtok(%b,*www.*.*,%a,32),*))) {
          hinc -u20 webspam $address($nick,5)
          if ($hget(webspam,$address($nick,5)) == 5) { msg $chan $+($chr(2),$chr(3),4,[,$chr(2),$chr(3),15,$nick,$chr(2),$chr(3),4,],$chr(2),$chr(3),9,$chr(32),Please refrain from spamming unauthorized urls. Further infactions will result in a break from the room.) | halt }
          elseif ($hget(webspam,$address($nick,5)) == 9) { hadd webspam $address($nick,5) 9 | kick $chan $nick Spamming Unauthorized Urls. | halt }
          elseif ($hget(webspam,$address($nick,5)) == 12) { hdel webspam $address($nick,5) | ban -ku18000 $chan $nick 3 Banned: Spamming Unauthorized Urls. | halt }
        }
        else { dec %a }
      }
    }
  }
}
#url end
on *:start: { hmake webspam 100 }
on *:exit: { hfree webspam }
menu channel {
  -
  Url Spam Protection
  .$iif($group(#url) == on,Protection [On],Protection [Off]) { if ($group(#url) == on) { .disable #url | echo 12 -ae Url Protection :Off: } | else { .enable #url | echo 12 -ae Url Protection :On: } }
  .-
  .Add Allowed Url { var %x $$?="enter url:" | if (!$read(urls.txt,w,$+(*,%x,*))) { write urls.txt %x | echo 12 -ae Added %x to allowed URL list. } | else { echo 4 -ae Error - %x already exists in URL file } }
  .Delete Allowed Url { var %x $$?="enter url:" | if ($read(urls.txt,w,$+(*,%x,*))) { write urls.txt -dl $+ $readn | echo 12 -ae Deleted %x from allowed URL list } | else { echo 4 -ae Error - %x does not exist in the URL file } }
  -
}

Comments

Sign in to comment.
Jethro   -  Jul 29, 2009

By entering www.blah.com for example, it will kick for http://www.blah.com or www.blah.com

You may need to add another one for url starting with http://url

 Respond  
Cheiron   -  Jul 29, 2009

oh... the issue link was a http://url here .. there was no www. in the link

other wise yeah it works

 Respond  
Jethro   -  Jul 29, 2009

I don't know what you have done, but by using mirc's highlight feature, along with the $highlight identifier in the on text event as shown above, it works perfectly for me:> I invite you to visit www.hawkee.com

  • You were kicked by Jethro_ (:No spamming!) Once you have the 'Add Highlight' dialog open, all you need to do is enter www.blah.com (any URL) under 'Highlight lines that contain these words' and ok to finish. It's simple as that.
 Respond  
Cheiron   -  Jul 29, 2009

i followed the instructions .. put it on the bot ... didnt work

 Respond  
Jethro   -  Jul 29, 2009

Indeed. Unless of course you opt for a kick to set upon you whenever your chat nick is mentioned. lol

 Respond  
Cheiron   -  Jul 29, 2009

many thanks .. i take it that it would be wise to remove my $me from the highlighter then lol

 Respond  
Jethro   -  Jul 29, 2009

Actually for urls, just place it as www.domainnamehere.com will do just fine. No need for asterisks. It shall match anywhere in a text with added links in the highlight dialog.

 Respond  
Cheiron   -  Jul 29, 2009

so if it was a url .. i would put say www.hawkee.com in highlight ?

 Respond  
Jethro   -  Jul 29, 2009

Cheiron, you can advantage of mirc's highlight feature to match text or urls typed in channel.
1) go to address book (alt+B)
2) click on the Highlight tab
3) click on the Add button
4) Once the Add Highlight dialog pops up, fill in the word you want to match in the box. (if the matching words you fill in are of wildcard, put it as: TextorLinkHere (with * on both sides)
Let's say you fill in a word go. The highlight will match a sentence containing go, but not going. With wildcard, it will match.
Then you add another one via the add button, resuming the same process.
5) To Match on, drop it down to Message. (It should already be message)
6) don't choose any color.
7) Ok to finish.

  • Now place this code in your bot's remote:
    Code:
on @*:TEXT:*:#: {
  if ($highlight($1-)) {
    kick $chan $nick No spamming!
  }
}
 Respond  
Cheiron   -  Jul 29, 2009

is there a simple edit to turn this so instead of adding allowed urls to it..
the urls added to it will kick a user if said?

 Respond  
DarthReven   -  Jan 29, 2007

well checking for a channel is much easier you can use this simple alias to find an channel name in a line of text: alias chancheck { if ($regex(channel,$1-,/(#[a-z0-9]{1,100})/ig)) { if ($v1 > 1) { var %chan# $v1, %chanout | while (%chan#) { %chan_out = $addtok(%chanout,$regml(channel,%chan#,44) | dec %chan_# } | return %chan_out } | else { return $regml(channel,1) } } }

 Respond  
dj_boT   -  Jan 20, 2007

If you can man,plz change the url to # .I mean not for url spamming,for channel spamming...Well i think i can do it,but in order not to make a mistake...

 Respond  
RusselB   -  May 03, 2005

Looks good DarthReven

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.