為arm linux交叉編譯tcpdump

來源:互聯網
上載者:User

標籤:c   blog   tar   http   a   com   

1.從官網www.tcpdump.org下載並解壓源檔案,這裡是

tcpdump-4.5.1.tar.gz

libpcap-1.5.3.tar.gz

2.編譯libpcap,安裝目錄為/home/armroot,交叉編譯不能確定pcap類型,手工指定為linux

./configure --host=arm-linux --with-pcap=linux --prefix=/home/armroot

make

make install

3.編譯tcpdump。交叉編譯不能確定核心版本,手工指定為嵌入式系統的核心版本

ac_cv_linux_vers=3.2.35 ./configure --host=arm-linux --prefix=/home/armroot

make

make install

4.最終檔案為/home/armroot/sbin/tcpdump,拷貝到裝置上即可使用

 

tcpdump簡單命令

ttcpdump -i eth0 tcp port 3333 and dst host 192.168.1.129 -s 0 -vv -w /tmp/aa.cap -c 100 -x

監聽eth0網卡上發送到192.168.1.129,連接埠為3333的tcp資料,採集完整資料包(-s 0,預設68byte),詳細輸出(-vv),抓取的資料寫入/tmp/aa.cap,只抓取100個包(-c 100),16進位顯示抓取的包(TCP含資料頭)。

如果是監聽雙向連結去掉dst。

tcpdump抓取的資料可用wireshark解析,因為它們都使用libpcap。

src net 192.168.1.0/24  抓取源地址為192.168.1.*的包

 

tcpdump詳細命令可參考

www.tcpdump.org/manpages/tcpdump.1.html

www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.