Anti-repeats from generic IP's

By simo on May 11, 2017

this detects repeats in channel and sets kick bans unlike most ircds today wich only have channel lock option to tackle this yet leave the repeaters in the channels wich is not effective this script gets rid of them it sets range bans to prevent them using another range from the ip/host they are using as most likely these kind of floods are done using proxied / vpn alike IPS

credits for myndzi i used his idea and modified it a bit.

Cappuccino.

ON ^*:text:*:#:{ 
  if ($nick(#,$me,@&~%)) {  
    var %h = $hash($lower($strip($left($1-,400))),32)
    if (!$nick($chan,$nick,@&~%)) {
      if (%protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ] < 70) inc -z %protect.r. $+ $chan $+ . $+ %h 10
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ]
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.j. [ $+ [ $chan ] $+ . $+ [ $chan ] ]
    }
    if (%protect.r. [ $+ [ $chan ] $+ . $+ [ $chan ] $+ . $+ [ %h ] ] > 2) { 
    set -u15 %reptxt1 $addtok(%reptxt1,$nick,44)
     if (%modechanRep != $true) {
        .raw mode  $chan +MR
        echo $chan 01,08 ( Mass Text Repeat Flood Detected ) !!!!! Channel Locked !!!!!  
        set -u5 %modechanRep $true
        set -u5 %reptxt2 1
        .timerreptxt 1 30 mode $chan -MR
      }
      while (%reptxt2 <= $numtok(%reptxt1,44)) {
        if ($gettok(%reptxt1,%reptxt2,44) ison $chan) {
            ban35 $gettok(%reptxt1,%reptxt2,44) $chan  
          if (%reptxt2 <=  15) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -1-  }
          if (%reptxt2 >=  16) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -2-  }
        }
        inc %reptxt2
      }
    }
  }
}

ON ^*:action:*:#:{ 
  if ($nick(#,$me,@&~%)) {  
    var %h = $hash($lower($strip($left($1-,400))),32)
    if (!$nick($chan,$nick,@&~%)) {
      if (%protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ] < 70) inc -z %protect.r. $+ $chan $+ . $+ %h 10
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ]
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.j. [ $+ [ $chan ] $+ . $+ [ $chan ] ]
    }
    if (%protect.r. [ $+ [ $chan ] $+ . $+ [ $chan ] $+ . $+ [ %h ] ] > 2) { 
     set -u5 %reptxt1 $addtok(%reptxt1,$nick,44)
     if (%modechanRep != $true) {
        .raw mode  $chan +MR
        echo $chan 01,08 ( Mass Text Repeat Flood Detected ) !!!!! Channel Locked !!!!!  
        set -u5 %modechanRep $true
        set -u5 %reptxt2 1
        .timerreptxt 1 30 mode $chan -MR
      }
      while (%reptxt2 <= $numtok(%reptxt1,44)) {
        if ($gettok(%reptxt1,%reptxt2,44) ison $chan) {
              ban35 $gettok(%reptxt1,%reptxt2,44) $chan  
          if (%reptxt2 <=  15) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -1-  }
          if (%reptxt2 >=  16) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -2-  }
        }
        inc %reptxt2
      }
    }
  }
}

ON ^*:notice:*:#:{ 
  if ($nick(#,$me,@&~%)) {  
    var %h = $hash($lower($strip($left($1-,400))),32)
    if (!$nick($chan,$nick,@&~%)) {
      if (%protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ] < 70) inc -z %protect.r. $+ $chan $+ . $+ %h 10
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.r. [ $+ [ $chan ] $+ . $+ [ %h ] ]
      inc -z %protect.r. $+ $chan $+ . $+ $chan $+ . $+ %h %protect.j. [ $+ [ $chan ] $+ . $+ [ $chan ] ]
    }
    if (%protect.r. [ $+ [ $chan ] $+ . $+ [ $chan ] $+ . $+ [ %h ] ] > 2) { 
    set -u5 %reptxt1 $addtok(%reptxt1,$nick,44)
      if (%modechanRep != $true) {
        .raw mode  $chan +MR
        echo $chan 01,08 ( Mass Repeat Notice Flood Detected ) !!!!! Channel Locked !!!!!  
        set -u5 %modechanRep $true
        set -u5 %reptxt2 1
        .timerreptxt 1 30 mode $chan -MR
      }
      while (%reptxt2 <= $numtok(%reptxt1,44)) {
        if ($gettok(%reptxt1,%reptxt2,44) ison $chan) {
          ban35 $gettok(%reptxt1,%reptxt2,44) $chan  
          if (%reptxt2 <=  15) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -1-  }
          if (%reptxt2 >=  16) { kick $chan $gettok(%reptxt1,%reptxt2,44) Dont repeat please thank you -2-  }
        }
        inc %reptxt2
      }
    }
  }
}

alias ban35 {
 if ($regex($address($1,2),/(irccloud)/i)) {
    mode $2 +b $regsubex($mid($address($1,0),3),/(~?[^@]+)@.*(?=\.[^.]+\..+)/,*!\1@*\2)   
     halt 
 } 
 elseif (!$regex($gettok($address($1,2),-1,64),/[a-zA-Z]/g)) { 
    mode $2 +b $+($gettok($address($1,2),1-3,46),.*)
}    
  else {
    mode $2 +b $+(*!*@*.,$gettok($address($1,2),2-,46))  
} 
}

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.