Forum Discussion
kullwahad_19151
Jun 10, 2015Nimbostratus
for information : i have a clue with the split option, but i have to put for each xxx.xxx.xxx.xxx that can exist...
(here in the ex for maximum 4 field in HTTP::host :
when HTTP_REQUEST {
if { [class match [IP::remote_addr] equals HTTP_url_exception_based_on_source_ip_address] }{
set i 0
set host [string tolower [HTTP::host]]
if { $host matches_regex {^\w+\.\w+$} } {
log local0. "dans le regex double champs : $host"
}
if { $host matches_regex {^\w+\.\w+\.\w+$} } {
set fields [split $host "."]
set m1 [lindex $fields 0]
set m2 [lindex $fields 1]
set m3 [lindex $fields 2]
set endofhost "$m2.$m3"
log local0. "dans le regex fields 3 champs, champs1 : $m1, champs2 : $m2, champs3: $m3; endofhost : $endofhost "
set i 1
}
if { $host matches_regex {^\w+\.\w+\.\w+\.\w+$} } {
set fields [split $host "."]
set m3 [lindex $fields 2]
set m4 [lindex $fields 3]
set endofhost "$m3.$m4"
log local0. "dans le regex fields 4 champs,champs3 : $m3, champs4: $m4; endofhost : $endofhost "
set i 1
}
if { $i == "0" } {
log local0. "i=$i"
if { ! ( [class match $host equals HTTP_exception_url_for_source_ip]) }{
log local0. "dans le match host : $host "
snat automap
forward
}
}
if { $i == "1" } {
log local0. "i=$i"
if { ! ( [class match $endofhost equals HTTP_exception_url_for_source_ip]) }{
log local0. "dans le match endofhost : $endofhost "
snat automap
forward
}
}
}
}