How to i sniff/dump HTTP protocol as ASCII for a port with tcpdump or altenative

httpmonitoringpacket-sniffertcpdump

I need to view how an application is sending and is receiving traffic through a http protocol that it comunicates on localhost (it has an embeded port coded with .gz)
I'm sure it's some XML that it sends and receives but i want to sniff it , and then analize it

Is this possible somehow with Tcpdump? there i can see only that it connects but not the actual send receive

Best Answer

ngrep is very useful for this. Something as simple as

ngrep -W byline port 80

would work, but you can filter on the content of the requests too (hence the grep part of the name), and it prints out the packet payload:

ngrep -W byline some_string port 80