Forum Discussion
gerhackett
Nimbostratus
Oct 13, 2020iRule to examine response HTML for image URLs
Hi, I'd like to write an iRule to scan a HTML response body for image tags and store all of the source URLs in a table. I understand that once I've fired a HTTP::collect in a HTTP_REQUEST event...
Dario_Garrido
Noctilucent
Oct 19, 2020Hello Gerhackett.
After collecting the HTTP payload, you can do something like this.
when HTTP_RESPONSE_DATA {
set find "https?://.*.jpg"
set indices [regexp -all -indices -inline $find [HTTP::payload]]
foreach idx $indices {
set start [ expr { [lindex $idx 0] } ]
set end [expr { [lindex $idx 1] } ]
log local0. "[substr [HTTP::payload] $start $end]"
}
}Modify the regex properly to match your goal. You can test your regex here:
Regards,
Dario.
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
