How can I have tcpdump write to file and standard output the appropriate data?

前端 未结 3 1833
说谎
说谎 2021-01-30 00:37

I want to have tcpdump write raw packet data into a file and display packet analysis in standard output as the packets are captured (by analysis I mean the lines it displays nor

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 01:17

    Here's a neat way to do what you want:

    tcpdump -w - | tee somefile | tcpdump -r -
    

    What it does:

    • -w - tells tcpdump to write binary data to stdout
    • tee writes that binary data to a file AND to its own stdout
    • -r - tells the second tcpdump to get its data from its stdin

提交回复
热议问题