Using TCPDump on Ubuntu System

Using TCPDump on Ubuntu System

I am dealing with some json format data via HTTP server.
So, I will watch the data while I am calling my REST server. I will use TCPDUMP on my Ubuntu.

1. First of all, I will try to install this software on my system.
Download and install TCPdump:
>apt-get install tcpdump

See the TCPdump dependencies:
>apt-cache depends tcpdump

To see the installed TCPdump version:
>apt-cache policy tcpdump

2. I will use the tcpdump to watch my HTTP data on my local server.
>tcpdump -i any -nn host 127.0.0.1 and port 8080 -w network.txt
host 127.0.0.1 is for my local JBOSS server
port 8080 is my JBOSS Http listener port.
-w network.txt is my output file which will contain all the data via HTTP 8080 port.

I need to use my root account to execute this command.

I can see my data in the file network.txt as follow:
Server: Apache-Coyote/1.1^M
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1^M
Content-Type: application/json^M
Transfer-Encoding: chunked^M
Date: Tue, 22 Mar 2011 03:15:10 GMT^M
^M
4c^M
{"name":"[email protected]","id":1,"sex":true,"age":1,"birthday":1299659275000}^M

The json format data is what I post to the server side. It is done.


猜你喜欢

转载自sillycat.iteye.com/blog/970642