The packet capture tool tcpdump in linux. The packet capture tool has two advantages: one is snort and the other is tcpdump. this time, we don't mention snort. Although the tool is powerful, it is complicated, and tcpdump is relatively simple. Tcpdumpwindows and tcpdump
This article describes the packet capture tool in linux.
The packet capture tool has two advantages: one is snort and the other is tcpdump. this time, we don't mention snort. Although the tool is powerful, it is complicated, and tcpdump is relatively simple. Tcpdump for windows and linux. You can download the linux version from www.tcpdump.org.
After tcpdump is installed, run tcpdump:
1. tcpdump-D: get the network adapter list. The following is the result obtained on windows:
2. tcpdump-I <需要监控的网络适配器编号> For example, if you want to monitor lo (127.0.0.1), that is, 1. \ Device \ PssdkLoopback: (exclusive to windows, not applicable to linux)
Tcpdump-I 1
If you do not use-I to define the monitoring adapter, the first one in the list is used by default;
3. the monitoring host is the tcp protocol of port 8000 on port 192.9.200.59:
Tcpdump host 192.9.200.59 and tcp port 8000
4. if you want to display the data packet content, you need to use the-X parameter. for example, I want to display the captured http packet http header content:
The result shows that only part of the http header is displayed, but not all is displayed, because tcpdump truncates the displayed data length by default. you can add the data length after-s, to set the data display length:
Tcpdump-X-s 0 host 192.9.200.59 and tcp port 8000
In the preceding example,-s 0 indicates that the length is automatically set to show all data.
5. if too much data is captured and the screen is constantly refreshed, you may need to record the data content to the file. you need to use the-w parameter:
Tcpdump-X-s 0-w aaa host 192.9.200.59 and tcp port 8000
Then, the content displayed on the screen is written to the aaa file under the Directory of the tcpdump executable file.
To view the file, use the-r parameter:
Tcpdump-X-s 0-r aaa host 192.9.200.59 and tcp port 8000
Write the following statement:
Tcpdump-r aaa
You can only see the simplest data transmission interaction process, but not the data packet content. you also need to use the corresponding parameters when viewing the data packet.
6. Summary
To sum up, the parameters of tcpdump are divided into two parts: Options and expressions ):
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.