ngrep 類似 wireshark、tcpdump 的封包偵測工具

ngrep - http://ngrep.sourceforge.net/

在 Linux 系統上,如果沒有安裝 GUI介面,就無法使用 wireshark,在純文字介面的環境下怎麼看細一點的封包資訊,

比方說存取 80 服務時,這個封包是在抓那個檔案作什麼動作,是 GET 還是 POST,

用 tcpdump 只看的懂來源、目的、服務port,其它沒了。

這時後我們就用 ngrep 吧,且只要你熟 tcpdump 其實參數用法大同小異,你可以把 ngrep 想成 network + grep 它也確實是如此,

指令1: ngrep port 80

attachments/201001/6591489775.jpg

這樣子是不是好看多了


安裝: 有 yum 安裝就用 yum 安裝吧,除非舊的系統,只好 tarball 編譯

編譯時遇到的問題

CentOS release 3.7

ngrep-1.45.tar.bz2

libpcap-1.0.0.tar.gz

Q: ngrep-1.45]# ./configure

creating Makefile
creating doc/Makefile
creating test/Makefile

Configuring Network Grep (ngrep) ...

checking for a broken redhat glibc udphdr declaration... no
checking for a complete set of pcap headers...

more than one set found in:
/usr/local/include
/usr/local/include/pcap

please wipe out all unused pcap installations

A: 這是因為有兩個 pcap.h,一個在 /usr/local/include/pcap/pcap.h,一個在  /usr/local/include/pcap.h
     解決方法有兩個,

把 /usr/local/include/pcap.h 移掉,mv /usr/local/include/pcap.h /usr/local/include/pcap.h_

或者

./configure --with-pcap-include=/usr/local/include/pcap/pcap.h
標籤: 封包 監控 wireshark
評論: 1 | 引用: 0 | 閱讀: 2635 | 列印 | 文件 | 轉發

  • 1 
cross [ 2010-01-18 00:42 | 回覆 | 編輯 刪除 ]
找封包同時為目的ip 1.1.1.1 及目的port 25,注意要兩個單引號 ''
ngrep '' dst host 1.1.1.1 and dst port 25
  • 1 
發表評論
暱 稱: 密 碼:
網 址: E - mail:
驗證碼: 驗證碼圖片 選 項:
頭 像:
內 容:
  • 粗體
  • 斜體
  • 底線
  • 插入圖片
  • 超連結
  • 電子郵件
  • 插入引用
  • 表情符號