matches_regex
2 TopicsDetect regexp pattern in tcp payload
I was hoping someone could help me out on the proper syntax and approach to using either matches_regex or regexp to match a string pattern in a tcp payload. Basically I am trying to detect if within a payload there is a string comprised of 8-16 characters that can be either upper lower case or numeric, no spaces or returns. I have tried the following but have had no success: when CLIENT_ACCEPTED { TCP::collect } when CLIENT_DATA { set payload [TCP::payload] if { [regexp {[a-zA-Z0-9] {8,16}} $payload] } { log local0. "Got a match!" } } My regex isn't strong so I don't know if that's where I'm messing up or if my syntax/approach to this iRule is wrong. I haven't found the matches_regex or regexp documentation to be all too helpful so hoping the dev community can help out!468Views0likes3CommentsHelp with RegEx
I am having some difficulty forming the correct syntax (or regex) for an irule. I need to block some specific URI's if they come from a specific data group. The logic works, but the regex doesn't. For example. I need to block any URI that has /admin or /admin/ or /user or /user/ BUT (and this is where it's not working) if the URI= /user-experience then it needs to work. I've used REGEX that looks like elseif {([HTTP::uri] matches_regex "^(/admin/|/user/|/?q=admin|/?q=admin|/?q=user|/?q=user) and ([class match [IP::client_addr] equals block_ip])} { And I've used a bunch of different "starts_with" and "equals" but strangely enough whenever I block "user" it blocks user-experience. Even if I use the "equals" URI. Which I don't understand b/c /user-experience doesn't equal /user. I'm sure there is something simple here...any help would be appreciated. Thanks in advanceSolved506Views0likes5Comments