$is_nickspam() - Nickname Highlight Spam Detection

By raccoon on Mar 01, 2017

This script detects "Nickname Highlight Spam" in IRC. Works in both mIRC and AdiIRC.

; $is_nickspam() - Nickname Highlight Spam Detector by Raccoon 2017.
; Parameters: $is_nickspam(<channel>,<text>,[M=6],[N=8])  eg: $is_nickspam($chan,$1-,6,8)  or just  $is_nickspam($chan,$1-)
;   Where M (>=2) is minimum nickname length to regard, and N (>=1) is number of matches considered as spammy.  Defaults: M = 6, N = 8.
; Returns: Number of positive nickname matches in the string, if it exceeds [N].  Returns 0 if less than [N]. 
; Note: This script looks at nickname parts that contain Letters, Numbers and Underscores, to detect variously decorated spam.
; Example Usage:  (Un-comment the next 5 lines to activate, and enjoy.)
; On @*:TEXT:????????????????????????????????????????????????????????????*:#: {
;   if ($nick !isop $chan) && (!$($+(%,_spamban.,$cid,$chan,$nick),2)) && ($is_nickspam($chan,$1-)) {
;     ban -k $chan $nick 2 Lame Highlight Spam Detected.
;     inc -z $+(%,_spamban.,$cid,$chan,$nick) 5
; } }
ALIAS is_nickspam { 
  var %chan = $$1, %text = $$2, %nicklen = $$iif($calc($3 -1) > 0,$v1,5), %nickspam = $$iif($calc($4) > 0,$v1,8)
  var %text = $mid($regsubex(is_nickspam,! %text !,/(*UTF8)(?:\W++|(?<!\w)(?:\w{1, $+ %nicklen $+ }|(\w++)(?=.*?\W\1(?:\W|$)))(?!\w))+/g,|),2,-1)
  if (%chan ischan) && ($numtok(%text,124) >= %nickspam) && ($fline(%chan,/(?<=^|\W)(?: $+ %text $+ )(?=\W|$)/i,0,3) >= %nickspam) { return $v1 }
  return 0
} ; by Raccoon 2017 Feb 28 - http://www.mpaste.com/p/Tu7NJh - http://hawkee.com/snippet/18055/

Comments

Sign in to comment.
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.