1,依赖 libpcap、libssl 库,需要自己先装;
2,ubuntu 下默认指定的库路径不正确的
./configue 会有报错:configure: error: Couldn't find PCAP library: needed for ssldump。
执行:
./configure --with-pcap-lib=/usr/lib/i386-linux-gnu/ --with-pcap-inc=/usr/include/pcap --with-openssl-lib=/lib/i386-linux-gnu/libssl.so.1.0.0
3,直接 make,报错:
./base/pcap-snoop.c:52:21: fatal error: net/bpf.h: No such file or directory
执行:
cp /usr/include/pcap/bpf.h /usr/include/net/
4,修改 Makefile,添加 -lssl -lcrypto ,-DOPENSSL
70 LIBS += -L/usr/lib/i386-linux-gnu/ -lpcap -lm -lssl -lcrypto
71
72 CFLAGS += -g -O2 -DHAVE_LIBM=1 -DHAVE_SYS_TIME_H=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DSIZEOF_UNSIGNED_SHORT=2 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=4 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DRETSIGTYPE=void -DHAVE_VPRINTF=1 -DHAVE_STRDUP=1 -DOPENSSL
5,make 还有报错:
./ssl/ssldecode.c: In function ‘ssl3_generate_export_iv’:
./ssl/ssldecode.c:672:5: error: unknown type name ‘MD5_CTX’
MD5_CTX md5;
^
./ssl/ssldecode.c: In function ‘ssl3_prf’:
./ssl/ssldecode.c:693:5: error: unknown type name ‘MD5_CTX’
MD5_CTX md5;
^
./ssl/ssldecode.c: In function ‘ssl_generate_keying_material’:
./ssl/ssldecode.c:849:9: error: unknown type name ‘MD5_CTX’
MD5_CTX md5;
^
ssl/targets.mk:245: recipe for target 'ssldecode.o' failed
解决办法:
ssl/ssldecode.c 中需要包含 #include <openssl/md5.h>
6,运行还有错误:
root@ubuntu:/home/zl/ssldump-0.9b3# ./ssldump -i eth0
ERROR: Couldn't create network handler
解决办法:ssl_decode_ctx_create() 中 SSLeay_add_all_algorithms(); 因为不同版本的 openssl ,初始化函数不同,导致的失败,需要替换。