mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2004
Posts: 540
A
Armada Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
I have this
Code:
on ^*:SNOTICE:*** Notice -- Client connecting*:{
  if ($7 = port) { 
    /.CCliWin 4[10C4] 9 $+ $7-10
  } 
  else { 
    /.CCliWin 4[10C4] 9 $+ $7 $8-9
  }
  /halt
}
  

Now what Im trying to do is moniter if I get over so many connections in a certain time period Would I use set -u and have a timer checking or what? Just woudl like some ideas

C
captain_comic
captain_comic
C
I am not sure whether I understand you correctly, but once I found a flood-routine which is easy to use. It checks the number of events in a certain time period:

Code:
alias isflood {
  ;Call this identifier each time you want to check if there is a flood, for example
  ;on *:JOIN:*: if ($isflood(joinflood,5,3)) { mode # +i }

  ; $1 - name eg "joinflood"
  ; $2 - times (in how many seconds)
  ; $3 - seconds

  ;If not enough parameters, return
  if (!$3) return

  var %v = $chr(37) $+ isflood. $+ $1

  ;If the var doesnt exist
  if !$(%v,2) {

    ;Set it to 1
    set $(-u $+ $3,2) $(%v,1) 1 
  }

  else {
    ;Else increment the var
    inc $(%v,1)
  }
  ;If the var is more than or equal to what you specified (times)
  if $(%v,2) >= $2 {

    ;Unset the variable so it doesnt continually return true
    unset $(%v,1)

    return $true
  }

  ; If it is not triggered return false
  return $false
}
 


In your case, if I understand you correctly, you can use this routine in the following way:

Code:
on ^*:SNOTICE:*** Notice -- Client connecting*:{
  if ($7 = port) { 
    /.CCliWin 4[10C4] 9 $+ $7-10
  } 
  else { 
    /.CCliWin 4[10C4] 9 $+ $7 $8-9
  }
  if ($isflood(nbr-of-con), 5, 3)) {
  ... your code ...
  }
  /halt
}


In this case $isflood will return $true if it was called with "nbr-of-con" 5 or more times in 3 seconds
You could even set up two variables, one per port:

if ($isflood(nbr-of-con-7), 5, 3)) {
... your code ...
}

and

if ($isflood(nbr-of-con-else), 5, 3)) {
... your code ...
}

Have fun!


Link Copied to Clipboard