beautypg.com

Os_payload_inspect::matched_str (), Context, Return values – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 129: Example

background image

Brocade Virtual ADX OpenScript API Guide

117

53-1003243-01

Methods

9

OS_PAYLOAD_INSPECT::matched_str ()

Returns the substring that was matched in scanning payload data during a

OS_PAYLOAD_INSPECT::match(regexp1, [regexp2 …])

call.

Context

This function is only callable in the PAYLOAD_INSPECT_MATCHED event.

Return values

The following table contains the return values.

Example

In the following example, the script scans the payload to read the member information, and logs
the information on the log server.

TABLE 134

Return values

Name

Type

Description

string

String that is the matched substring.

use OS_HTTP_REQUEST;

use OS_PAYLOAD_INSPECT;

use OS_SLB;

sub HTTP_REQUEST {

if (OS_HTTP_REQUEST::url =~ /login/) {

OS_PAYLOAD_INSPECT::match(

‘gold_member’,

‘basic_member’,

‘visitor’

);

}

}

sub PAYLOAD_INSPECT_MATCHED {

my $member = OS_PAYLOAD_INSPECT::matched_str();

OS_SLB::log("$member login");

}