# found error "bad option" while blocking specific user agent

**URL:** <https://community.f5.com/t/found-error-bad-option-while-blocking-specific-user-agent/16848>\
**Category:** Technical Forums\
**Tags:** management, irules, ibm, devops, security, ltm, application-delivery\
**Created:** [June 5, 2015, 1:39am UTC](https://community.f5.com/t/found-error-bad-option-while-blocking-specific-user-agent/16848 "2015-06-05T01:39:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mick39\_201768](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@Mick39\_201768](https://community.f5.com/u/Mick39_201768)\
**Post date:** [June 5, 2015, 1:39am UTC](https://community.f5.com/t/found-error-bad-option-while-blocking-specific-user-agent/16848/1 "2015-06-05T01:39:42Z")

</div>

Hi team,

I got an error like following. Do you have any idea of this?

TCL error: /Common/ua\_block - bad option “--user-agent=mozilla/5.0 (x11; linux x86\_64) applewebkit/537.36 (khtml, like gecko) chrome/32.0.1700.77 safari/537.36”: must be -exact, -glob, -regexp, or -- while executing "switch -glob [string tolower [HTTP::header “User-Agent”]] { “_sqlmap_” - “_havij" - "nmap_” - “_nessus_” - “…”

I think the case is like the case below… [DevCentral](https://devcentral.f5.com/questions/switch-glob-behaviour-when-comparison-string-starts-with-a-hyphen)

The iRule is like following

when HTTP\_REQUEST {

```tcl
log local0. "User-Agent:[HTTP::header "User-Agent"]"

switch -glob [string tolower [HTTP::header "User-Agent"]] {

    "*sqlmap*" -

    "*havij*" -

    "*nmap*" -

    "*nessus*" -

    "*absinthe*" -

    "*nikto*" -

    "*w3af*" -

    "*pangolin*" -

    "*bsqlbf*" -

    "*prog.customcrawler*" -

    "*sql power injector*" -

    "*mysqloit*" -

    "*netsparker*" {

        if { !([IP::addr [IP::client_addr] equals 192.168.XXX.XXX]) } {

            discard

            log local0. "[HTTP::header "User-Agent"] discarding."

        }

   }

}

```

}

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [June 5, 2015, 1:55am UTC](https://community.f5.com/t/found-error-bad-option-while-blocking-specific-user-agent/16848/2 "2015-06-05T01:55:45Z")

</div>

I think the case is like the case below…

> **[DevCentral](https://community.f5.com/)**
>
> DevCentral is an online technical community where engineers and practitioners collaborate, share knowledge, and solve problems related to F5 technologies and industry trends.

agree
