常用tcpdump命令
生活随笔
收集整理的這篇文章主要介紹了
常用tcpdump命令
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 安裝
yum install -y tcpdump2. tcpdump常用命令
# 檢測系統可用接口 命令:tcpdump -D#抓取所有經過 eth0,目的或源地址是 192.168.29.162 的網絡數據 命令:tcpdump -n -i eth0 host 192.168.29.162# 源地址 命令:tcpdump -i eth1 src host 192.168.29.162# 目的地址 命令:tcpdump -i eth1 dst host 192.168.29.162#抓取當前服務器eth0網卡端口8080的網絡數據 命令:tcpdump -n -i eth0 port 8080#抓取mysql執行的sql語句 命令:tcpdump -i eth1 -s 0 -l -w - dst port 3306 | strings#抓取mysql通訊的網絡包(.cap文件用wireshark打開,或者使用.pcap文件格式) 命令:tcpdump -n -nn -tttt -i eth0 -s 65535 'port 3306' -w 20160505mysql.cap#抓取SMTP數據 命令:tcpdump -i eth1 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack != 0'#抓取HTTP GET數據,"GET "的十六進制是 47455420 命令:tcpdump -i eth1 'tcp[(tcp[12]>>2):4] = 0x47455420'#抓取SSH返回,"SSH-"的十六進制是 0x5353482D 命令:tcpdump -i eth1 'tcp[(tcp[12]>>2):4] = 0x5353482D'#實時抓取端口號8080的GET包,然后寫入GET.log 命令:tcpdump -i eth0 '((port 8080) and (tcp[(tcp[12]>>2):4]=0x47455420))' -nnAl -w /tmp/GET.log#抓取指定SYN個數,-c 參數指定抓多少個包。 命令:time tcpdump -nn -i eth0 'tcp[tcpflags] = tcp-syn' -c 10#抓取源地址段是192.168.91.0/24,且目標端口是8171的tcp報文。 命令:tcpdump -i ens33 src net 192.168.91.0/24 and dst port 8171 and tcp#抓取源地址段是192.168.91.0/24的icmp報文 命令:tcpdump -i ens33 src net 192.168.91.0/24 and icmp#抓取源或者目的地址為192.168.91.0/24地址段的icmp報文,且使用-nn使得ip和端口都不做反向解析。 命令:tcpdump -i ens33 -nn net 192.168.91.0/24 and icmp3. 結合tcpkill命令干掉tcp連接
yum install -y dsnifftcpkill -i any -9 host ip地址 tcpkill -i any -9 port 端口其中過濾規則的使用與tcpdump一樣,請參考tcpdump的過濾規則。
總結
以上是生活随笔為你收集整理的常用tcpdump命令的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机基础教学的建议,关于《计算机应用基
- 下一篇: Azkaban soloserver