CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Alexander_Conne
F5 Employee
F5 Employee

Problem this snippet solves:

This iRule will force BotDefense to (if it hasn't already) throw up a captcha for a specified URL. This can be helpful when mitigating an attack or for general spam protection purposes.

How to use this snippet:

The iRule can be applied to any virtual server which has a BotDefense profile enabled in blocking mode.

Code :

when RULE_INIT {
  set static::forced_captcha_timeout 30
}

when BOTDEFENSE_ACTION {
  if {[string tolower [HTTP::path -normalized]] contains "my/path/string" && [BOTDEFENSE::cs_possible]} {
    if {[BOTDEFENSE::captcha_age] >= $static::forced_captcha_timeout} {
      BOTDEFENSE::action captcha_challenge
    }
  }
}

Tested this on version:

15.1
Version history
Last update:
‎12-Mar-2021 21:20
Updated by:
Contributors