httpry 專為 HTTP 協定設計的封包嗅探工具,直接在協定層解析並以人類可讀格式輸出,比 tcpdump 更直觀,不需完整存取 Web 伺服器日誌即可即時分析流量。
sudo apt-get install gcc make git libpcap0.8-dev
git clone https://github.com/jbittel/httpry.git
cd httpry
make
sudo make install
# 啟用 EPEL 後
sudo yum install httpry
# 或原始碼編譯
sudo yum install gcc make git libpcap-devel
git clone https://github.com/jbittel/httpry.git
cd httpry
make
sudo make install
sudo httpry -i eth0
輸出範例:
2024-01-15 10:30:45 192.168.1.100 192.168.1.200 > GET /api/users HTTP/1.1
2024-01-15 10:30:45 192.168.1.200 192.168.1.100 < HTTP/1.1 200 OK
# 二進制原始封包(可回放)
sudo httpry -i eth0 -b traffic.dump
# 回放
httpry -r traffic.dump
# 文字格式(人類可讀)
sudo httpry -i eth0 -o traffic.txt
sudo httpry -i eth0 -m get,post,head
原始碼目錄 scripts/plugins/ 提供:
hostnames — 統計唯一主機名find_proxies — 偵測代理伺服器search_terms — 搜尋關鍵字統計content_analysis — URL 關鍵字過濾xml_output — 轉換為 XMLlog_summary — 產生日誌摘要db_dump — 匯入 MySQL# 先擷取文字日誌
sudo httpry -i eth0 -o traffic.txt -m get,post
# 執行所有腳本
cd httpry/scripts
perl parse_log.pl -d ./plugins traffic.txt
# 查看摘要
cat log_summary.txt