生活随笔
收集整理的這篇文章主要介紹了
CentOS下的抓包服务:rpcapd(WinPcap)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
因為需要用Wireshark進行遠程抓包,需要在遠程主機上安裝相應的rpcapd服務。 Windows上只要安裝WinPcap軟件就行了,它已經包含了rpcapd服務,只要啟動就行了。但Linux上需要自己編譯。? 注:Wireshark支持 remote packet capture protocol協議遠程抓包,只要在遠程主機上安裝相應的 rpcapd 服務例程就可以。 安裝命令如下:
yum install glibc-static?flex
wget http://www.winpcap.org/install/bin/WpcapSrc_4_1_2.zip
unzip WpcapSrc_4_1_2.zip
cd winpcap/wpcap/libpcap
chmod +x configure runlex.sh
CFLAGS=-static ./configure
make
cd rpcapd
make
然后
./rpcapd -n
就運行rpcap服務了。
但是,運行./rpcapd -n報如下錯誤
[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -n
Press CTRL + C to stop the server...
socket(): Address family not supported by protocol (code 97)
原因:在linux上,端口有可能沒有開放,這時需要修改iptables服務的配置來開放2002端口。 解決辦法: 1.?CentOS下/etc/sysconfig/下找不到iptables文件 2.?Linux中iptables配置詳細(轉) 參考Linux中iptables配置詳細(轉)修改iptables服務的配置來開放2002端口。
首先要做的是給咱的SSH進行ACCEPT配置,以免直接無法連接的情況發生:
1. 如果SSH端口是22(這里不建議用默認端口最好改掉SSH端口)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
注意要/etc/rc.d/init.d/iptables save,以下每一步都最好執行一遍此語句,以下不再累述。
[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# /etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ ?OK ?]
[root@iZ23gx7o02aZ sysconfig]#
2. 修改iptables開放2002端口?
iptables -A INPUT -p tcp --dport 2002 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT
最后注意需要再執行一下 /etc/init.d/iptables save,這樣這兩條語句就保存到剛才那個/etc/sysconfig/iptables 文件中了。
[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 2002 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT
[root@iZ23gx7o02aZ sysconfig]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ ?OK ?]
[root@iZ23gx7o02aZ sysconfig]#?
3. 查看iptables的內容
[root@iZ23gx7o02aZ sysconfig]# vi iptables1 # Generated by iptables-save v1.4.7 on Wed Dec 10 21:20:39 20142 *filter3 :INPUT ACCEPT [4602:266675]4 :FORWARD ACCEPT [0:0]5 :OUTPUT ACCEPT [5004:417513]6 -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT7 -A INPUT -p tcp -m tcp --dport 2002 -j ACCEPT8 -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT9 -A OUTPUT -p tcp -m tcp --sport 2002 -j ACCEPT10 COMMIT11 # Completed on Wed Dec 10 21:20:39 2014
4. 重啟iptables 重啟指令:
service iptables restart[root@iZ23gx7o02aZ sysconfig]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter ? ? ? ? ?[ ?OK ?]
iptables: Flushing firewall rules: ? ? ? ? ? ? ? ? ? ? ? ? [ ?OK ?]
iptables: Unloading modules: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [ ?OK ?]
iptables: Applying firewall rules: ? ? ? ? ? ? ? ? ? ? ? ? [ ?OK ?]
[root@iZ23gx7o02aZ sysconfig]#?
5. 運行./rpcapd -n
[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -n
Press CTRL + C to stop the server...
socket(): Address family supported by protocol (code 98)
修改成功!
總結
以上是生活随笔 為你收集整理的CentOS下的抓包服务:rpcapd(WinPcap) 的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔 網站內容還不錯,歡迎將生活随笔 推薦給好友。