Tcpdump usage example

Source: Internet
Author: User
Tags printable characters

There is often a need. I want to see what data is available for my Nic and what data is coming in. In this case, ethereal can be used in the window to capture packets.

Here we will talk about tcpdump, a classic tool in Linux. I used this tool to intercept and print the entire SQL command when I was troubleshooting MySQL.

The command is as follows:

Tcpdump-I eth1-s 0-L-w-DST port 3306 | strings The execution results include the intercepted SQL statements.
-S refers to the number of bytes dropped by a packet header. By default, the system discards the packet header to indicate the 68 bytes of protocols such as IP addresses. -S 0 indicates not to discard any byte of the packet (not to discard and not to discard) -L line buffer standard output (the result is not directly output to standard output ). The data of the packet captured by tcpdump is directly output to the standard output by default. -W-Raw packets to file rather than parsing and printing them out, write the most original data to the file. Here is "-". "-" Refers to the standard output. -W-means writing the original data to the standard output. Strings is used to display printable characters in the file, that is, to print raw data (raw data) from tcpdump)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.