Advertisement
westor

Check Bad Common Nick for Debian v2.4

Apr 12th, 2023 (edited)
2,150
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.09 KB | None | 1 0
  1. #bcn_prot on
  2. #bcn_prot end
  3.  
  4. alias -l channel { return #test } ; Place channels (use comma to add more)
  5. alias -l kb_reason { return [Banned]: You are NOT allowed to join here! } ; Ban reason
  6. alias -l kb_bantime { return 3600 } ; Ban seconds
  7. alias -l kb_bantype { return 2 } ; Ban type (/help $mask)
  8.  
  9. ON !*:JOIN:$($channel): {
  10.   if ($group(#bcn_prot).status !== on) { return }
  11.  
  12.   bad_common_nick_check $nick
  13. }
  14.  
  15. ON !*:NICK: {
  16.   if ($group(#bcn_prot).status !== on) { return }
  17.  
  18.   var %t = $comchan($newnick,0)
  19.  
  20.   if (!%t) { return }
  21.  
  22.   var %i = 1
  23.   while (%i <= %t) {
  24.     var %c = $comchan($newnick,%i)
  25.  
  26.     if (%c) && ($istok($channel,%c,44)) { bad_common_nick_check $newnick }
  27.  
  28.     inc %i
  29.   }
  30.  
  31. }
  32.  
  33. alias bcn_prot {
  34.   if (!$1) { echo 4 -at [BCN]: Error, Use an option ON or OFF and try again! | return }
  35.   if (!$istok(on off,$1,32)) { echo 4 -at [BCN]: Error, use ON or OFF options! | return }
  36.  
  37.   var %s = $group(#bcn_prot).status
  38.  
  39.   if ($1 == ON) {
  40.     if (%s == on) { echo 4 -at [BCN]: Error, Already enabled! }
  41.     else { .enable #bcn_prot | echo -at [BCN]: Bad Common Nicknames protection enabled! - Channels: $channel }
  42.   }
  43.  
  44.   if ($1 == OFF) {
  45.     if (%s == off) { echo 4 -at [BCN]: Error, Already disabled! }
  46.     else { .disable #bcn_prot | echo -at [BCN]: Bad Common Nicknames protection disabled! }
  47.   }
  48.  
  49. }
  50.  
  51. alias -l bad_common_nick_check {
  52.   ; /bad_common_nick_check <nick>
  53.  
  54.   if (!$1) { return }
  55.  
  56.   var %h = GOODNICK
  57.   var %t = $hget(%h,0).item
  58.  
  59.   if (!%t) { return }
  60.  
  61.   var %i = 1
  62.   while (%i <= %t) {
  63.     var %e = $hget(%h,%i).item
  64.     var %d = $hget(%h,%e)
  65.  
  66.     if (%e) && (%d) && (%d !== $1) {
  67.       var %n = $bad_common_nick_check_match(%d,$1)
  68.  
  69.       if (%n) { bad_common_nick_kb $1 %d | break }
  70.     }
  71.  
  72.     inc %i
  73.   }
  74.  
  75. }
  76.  
  77. alias -l bad_common_nick_kb {
  78.   ; /bad_common_nick_kb <nick> <match-nick>
  79.  
  80.   if (!$1) && (!$2) { return }
  81.  
  82.   var %t = $comchan($1,0)
  83.  
  84.   if (!%t) { return }
  85.  
  86.   var %i = 1
  87.   while (%i <= %t) {
  88.     var %c = $comchan($1,%i)
  89.  
  90.     if (%c) && ($istok($channel,%c,44)) && ($me isop %c) && ($1 ison %c) && ($1 isreg %c) {
  91.       var %h = $ial($1).host
  92.  
  93.       echo -t %c [BCN]: $1 matches $2 in the list.
  94.  
  95.       if (*.irccloud.com iswm %h) || (*.mibbit.com iswm %h) || (*.kiwiirc.com iswm %h) { ban $+(-u,$kb_bantime) %c *! $+ $ial($1).user $+ @* | kick %c $1 $kb_reason }
  96.       elseif (*.IP iswm %h) { ban $+(-u,$kb_bantime) %c *!*@*. $+ $gettok(%h,3-,46) | kick %c $1 $kb_reason }
  97.       else { ban $+(-ku,$kb_bantime) %c $1 $kb_bantype $kb_reason }
  98.     }
  99.  
  100.     inc %i
  101.   }
  102.  
  103. }
  104.  
  105. alias -l bad_common_nick_check_match {
  106.   ; $bad_common_nick_check_match(main-nick,check-nick)
  107.  
  108.   if (!$1) && (!$2) { return }
  109.  
  110.   var %s = [-_`|{}^\[\]\d]*
  111.   var %p = /^(?! $+ \Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E$) $+ .*? $+ $bad_common_nick_check_match_temp($1,%s) $+ .*$ $+ /iu
  112.   var %r = $regex($2,%p)
  113.  
  114.   return $iif(%r,1,0)
  115. }
  116.  
  117. alias -l bad_common_nick_check_match_temp {
  118.   var %name = $2
  119.  
  120.   return $regsubex($replace($1,o,[0o],e,[e3],i,[i1|],a,[a4]),/(\[[^\]]+\]|.)/g,$iif(\1 !isalnum && $len(\1) == 1,\) $+ \1+ $+ $iif(\n != \0,%name))
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement