When testing it is sometimes difficult to define suitable delimiters which allow you to correlate information for use later in a script. For example I once tested an application where code similar to this was returned. In the attached example I captured a large amount of returned data.
In this example a large hexadecimal number identified the account. Due to the large number of quotation marks prior to the string that I was interested in and the fact that multiple strings were returned by the web page, it was difficult to capture the string directly. Instead I decided to capture the whole of the above text and then extract the HEX6A31013657A217B4A2254993C29633893A920BAE3C9400DB string from the captured text.
Using the C function strtok it is possible to extract data from a string based on delimiters. In this case I needed the fifth value in the string that is separated from the rest of the returned data by the [“] delimiter. I used a loop function to repeatedly search through the returned data until it reaches the fifth quotation mark.
Then the captured “token” can be written to a string.