Brocade Virtual ADX OpenScript API Guide (Supporting ADX v Manual de usuario Pagina 130

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 132
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 129
118 Brocade Virtual ADX OpenScript API Guide
53-1003243-01
Methods
9
In the following example, the script searches for the ‘correct’ and ‘login’ strings in the response
payload. If it finds the ‘correct’ string, the script replaces the string with the 'Valid' string, and if it
finds the ‘login’ string, it logs onto the log server.
OS_PAYLOAD_INSPECT::matched_idx ()
Returns the index that indicates which input parameters of the
OS_PAYLOAD_INSPECT::match(regexp1, [regexp2 …]) function triggered this matched event.
Context
This function is only callable in the PAYLOAD_INSPECT_MATCHED event.
Usage
The index is one-based. For example, receiving a returned value 1 means the first parameter in the
parameter list has matched.
Return values
The following table contains the return values.
TABLE 135 Return values
Name Type Description
integer Integer that is the matched index.
use OS_HTTP_RESPONSE;
use OS_PAYLOAD_INSPECT;
use OS_SLB;
sub HTTP_RESPONSE {
my $type = OS_HTTP_RESPONSE::content_type;
if (OS_HTTP_RESPONSE::content_type =~ /text/) {
OS_PAYLOAD_INSPECT::match('correct', 'login');
}
}
sub PAYLOAD_INSPECT_MATCHED {
if ( OS_PAYLOAD_INSPECT::matched_str() == "correct") {
OS_PAYLOAD_INSPECT::matched_replace("", 'Valid', 'My', 'Your' );
} else {
OS_SLB::log("Somebody login");
}
}
Vista de pagina 129
1 2 ... 125 126 127 128 129 130 131 132

Comentarios a estos manuales

Sin comentarios