做成脚本了,保存成文件,sudo ./xxx.sh即可。
#!/bin/bash
# 如果没有加sudo,提示错误并退出
if [ "x$(id -u)" != x0 ]; then
echo "Error: please run this script with 'sudo'."
exit 1
fi
#安装依赖的源码和工具
sudo apt-get -yf install libssl-dev libpcap-dev git-core autoconf automake libtool bison flex gnome-core-devel libgnutls-dev
#下载和解压wireshark源码
wget http://www.wireshark.org/download/src/all-versions/wireshark-1.7.1.tar.bz2
tar jxvf wireshark-1.7.1.tar.bz2
#下载spdyshark扩展包代码
git clone https://code.google.com/p/spdyshark/
cp -r spdyshark/spdyshark wireshark-1.7.1/plugins/
#patch
cd wireshark-1.7.1
patch -p1 < ../spdyshark/spdyshark_build.patch
./autogen.sh
#配置
./configure --with-ssl
#解决编译时treat warning as error的问题
sed -i /'AM_CFLAGS = -Werror'/d wsutil/Makefile
sed -i /'AM_CFLAGS = -Werror'/d epan/ftypes/Makefile
#解决链接时找不到g_module_name函数的问题。这是wireshark源码的bug,官方是如下的解决方案
sed -i '370a @GLIB_LIBS@ \\' Makefile.am
#编译
make
#安装。如想打包成deb,此处应为sudo checkinstall
sudo make install
为了把编译出来的程序打包成deb,方便安装到其它机器,可以先安装checkinstall
sudo apt-get install checkinstall
然后上述脚本不要运行最后一行的sudo make install,而是这样:
sudo checkinstall
根据提示输入一些包信息,这样就会生成deb安装包了。
最后,要运行wireshark,可能需要先导出一个路径:
export LD_LIBRARY_PATH=/usr/local/lib
或者先
sudo ldconfig
要得到root权限才能截包:
sudo wireshark
带有spdy支持的wireshark,在Preferences的Protocols下会有SPDY选项。
注:本文的方法在Ubuntu13、Linux Mint 15下测试通过。使用方法见下一篇文章。《使用支持SPDY协议的Wireshark截包(含spdyshark插件)》
参考:
http://blog.csdn.net/hursing/article/details/20543837
http://www.wireshark.org/download/src/
http://www.linuxdiyf.com/viewarticle.php?id=108414
http://wiki.ubuntu.org.cn/SCP%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6
http://www.linuxidc.com/Linux/2008-08/14626.htm
http://www.linuxidc.com/Linux/2009-09/21648.htm
http://www.wireshark.org/lists/wireshark-users/200612/msg00002.html
https://www.wireshark.org/lists/wireshark-bugs/201207/msg00001.html
http://ask.wireshark.org/questions/6568/starting-wireshark-error-libwiretapso1
以上方法能在32bit和64bit系统都适用。64bit的deb包下载:http://download.csdn.net/detail/hursing/7000107
转载请注明出处:http://blog.csdn.net/hursing