Forum Discussion
den_39838
Nimbostratus
May 16, 2010Binary (HEX) payload replace in HTTP
Trying to write simple iRule to replace 2 bytes in HTTP response data.
===============================================
when HTTP_RESPONSE {
set v_1_0 "\x8d\x90"
set v_1_2 "\x8d\x92"
regsub $v_1_2 [HTTP::payload] $v_1_0 replaced
HTTP::payload replace 0 [HTTP::payload length] $replaced
HTTP::release
}
===============================================
Looks like "regsub" or "HTTP::payload replace" does not do the job right.
After replacement the Wireshark could not reassemble the packet.
This iRule just ruin all paiload data and replace not only 2 bytes as you can see in attached Wireshark screen captures, the payload before replacemnt was starting as HEX:
8c 81 98 ...
and after replacement:
c2 8c c2 81 c2 98 ...
Any idea what i doing wrong?
regards,
Denis
- hoolio
Cirrostratus
Hi Den, - den_39838
Nimbostratus
Hi Aaron,when HTTP_RESPONSE { set v_1_0 "\x8d\x90" set v_1_1 "\x8d\x91" set v_1_2 "\x8d\x92" log local0. "START response parsing" if { [regexp {\x8d\x92} [HTTP::payload]] } { log local0. "Found 8d92 = v1.2:" } if { [regexp {\x8d\x91} [HTTP::payload]] } { log local0. "Found 8d91 = v1.1:" } if { [regexp {\x8d\x90} [HTTP::payload]] } { log local0. "Found 8d90 = v1.0:" } regsub $v_1_2 [HTTP::payload] $v_1_0 replaced regsub $v_1_1 $replaced $v_1_0 replaced HTTP::payload replace 0 [HTTP::payload length] [binary format a* $replaced] log local0. "STOP response processing" HTTP::release }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects