Simple extraction of content from HTTP request

When writing a script for extraction of data exported to XML from burp, I was forced to make one very dirty hack on extracting body of HTTP request. It seems that there is no easy way of getting just the data, especially if the message transferred is binary file, i.e. image or executable. If it is simply text, it might probably done with some perl regexp wizardry. However it would be nice either way. The hack I mentioned was creating netcat server and piping whole request into it and then downloading it with help of wget. That way it works and takes only two straightforward lines of code, but it is still a hack. You can see it here.

To not be forced to do hacks like that in future I had a plan to make very simple utility program that will just delete HTTP header and print rest of input to stdout. Well, I decided to do this just after finishing the mentioned script, so about half year ago. Now I have found some time to do this and the result is very small utility written in C that does just that and by the way is able to parse the header itself and provides a way to be used easily by the user. The latter is done by spawning child process of default shell with header values set in its environment, so it may not be the nicest way to do this, but for it was the fastest to implement and should be fairly easy to work with. If you know better way that will result in similar behavior I will be graceful if you leave me a comment here.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *

Your email address will never be published.