For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

ims_243721's avatar
ims_243721
Icon for Nimbostratus rankNimbostratus
Jun 04, 2016

Extract session ID

Am trying to extract the sessionid value from XML request and response and log it, Anyone have experience on this

this is the request


1.0.0
123456789
0

1 Reply

  • Hi,

    Here is an example for the request side :

    when HTTP_REQUEST {
    
      if {[HTTP::method] eq "POST"}{
         Trigger collection for up to 1MB of data
        if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{
          set content_length [HTTP::header "Content-Length"]
        } else {
            set content_length 1048576
        }
         Check if $content_length is not set to 0
        if { $content_length > 0} {
          HTTP::collect $content_length
        }
      }
    }
    
    when HTTP_REQUEST_DATA {
      set payload [HTTP::payload]
      regexp {(.*)(.*)} $payload -> sessionid garbage
      log local0. "virtual=[virtual], sessionid=$payload"
    }
    
    when HTTP_RESPONSE {
         Trigger collection for up to 1MB of data
        if {[HTTP::header "Content-Length"] ne "" and [HTTP::header "Content-Length"] <= 1048576 and [HTTP::header Content-Type] contains "xml" }{
          set content_length [HTTP::header "Content-Length"]
        } else {
            set content_length 1048576
        }
         Check if $content_length is not set to 0
        if { $content_length > 0} {
          HTTP::collect $content_length
        }
    }
    when HTTP_RESPONSE_DATA {
      set payload [HTTP::payload]
      regexp {(.*)(.*)} $payload -> sessionid garbage
      log local0. "virtual=[virtual], sessionid=$payload"
    }