Forum Discussion
semperfiguy_759
Nimbostratus
Feb 19, 2016Parse UDP::payload
How do I parse out a string from UDP::payload? I am trying to parse out the file name from a TFTP get.
UDP::payload looks like this ??filename??netascii??
string range works fine, but the file name in 'n' length, so I would like to use string map. Not having luck.
when CLIENT_ACCEPTED {
set fileName [string map {"??" "" "??netascii??" ""} [UDP::payload]]
log local0.debug "Client IP: [IP::client_addr] "
log local0.debug "TFTP File Name : $fileName "
}
1 Reply
Hi Semperfiguy,
you may try this syntax...
when CLIENT_ACCEPTED { log local0.debug "Payload: [UDP::payload]" binary scan [UDP::payload] xxa* payload log local0.debug "Payload_a: $payload" log local0.debug "TFTP File Name : [lindex [split $payload \000] 0]" }Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
