Chaosreader是一个Snoop数据输出的分析工具,完全Perl写成,因此可以运行在所有支持Perl的操作系统上。Chaosreader能够支持对TCP/UDP/HTTP/FTP...等等一系列协议的跟踪和Session解析,甚至能够解析出ftp和http传输的文件,跟踪X-window的动作,对Telnet的数据进行回放等等。有了Chaosreader,就相当于在Snoop之上加了一双明亮的眼睛,非常方便。
Chaosreader支持有Tcpdump、snoop和Ethereal输出的数据包记录文件,自动解析之后会生成一系列文件,包含HTML格式的数据输出文件,协议传输中的图形附件,以及一些用于进行协议回放的perl脚本。
要使用Chaosreader,有下面几种快捷方法:
tcpdump -w outfile
snoop -o outfile
ethereal (或tethereal)保存cap数据
之后,适用chaosreader.pl outfile对文件进行分析处理,完成后即可在当前目录下生成一系列输出文件,可以使用任何一个Web浏览器打开index.html进行查看。
如果直接执行 chaosreader -s 5; netscape index.html ,那么chaosreader将自动运行当前系统中可用的sniffer类程序(自动搜索snoop或tcpdump),然后生成分析文件。
-s参数指定一定时间的抓取时间,以分钟为单位。
在每次分析中,Chaosreader可能会生成如下文件:
index.html Html index (本次抓包统计信息)
index.text Text index
index.file File index for standalone redo mode
image.html HTML report of images
getpost.html HTML report of HTTP GET/POST requests
session_0001.info TCP session #1的相关信息(如果有抓包过程中包含多个TCP Session,则每个Session都会生成一系列的Session文件)
session_0001.telnet.html 按时间顺序存放的html格式telnet数据
session_0001.telnet.raw 按时间顺序存档的telnet session数据
session_0001.telnet.raw1 server->client的telnet数据
session_0001.telnet.raw2 client->server的telnet数据
session_0002.web.html 按请求顺序存放的HTTP Session数据
session_0002.part_01.html HTTP portion of the above, a HTML file
session_0003.web.html HTML coloured 2-way
session_0003.part_01.jpeg HTTP portion of the above, a JPEG file
session_0004.web.html HTML coloured 2-way
session_0004.part_01.gif HTTP portion of the above, a GIF file
session_0005.part_01.ftp-data.gz 如果是ftp session,则传输数据存放在此文件中
...
总结所有的文件类型如下:
session_* TCP Sessions
stream_* UDP Streams
icmp_* ICMP 数据包
index.html HTML Index 文件
index.text Text Index 文件
index.file File Index for standalone redo mode only
image.html HTML report of images
getpost.html HTTP GET/POST 请求记录
*.info Session/Stream的描述信息
*.raw 按时间顺序排列的C<->S二路原始数据
*.raw1 server->client的原始数据
*.raw2 client->server的原始数据
*.replay Session回放程序,perl脚本,执行将在终端上模拟任务发生时的状况
*.partial.* Partial capture (tcpdump/snoop were aware of drops)
*.hex.html 2-way Hex dump, rendered in coloured HTML
*.hex.text 2-way Hex dump in plain text
*.X11.replay X-Window回放脚本,必须运行在X-Window下
*.textX11.replay X11通讯的文本模拟回放程序
*.textX11.html 2-way text report, rendered in red/blue HTML
*.keydata SSH通讯中的密钥中继传输数据
先在控制台上开启一个snoop,只记录IP数据:
===============================
[Tracy@Katty]# snoop -d pcn0 -o out ip
Using device /dev/pcn0 (promiscuous mode)
358 ^C
===============================
之后,我们通过网络分别执行了以下操作:
1. telnet
用户 elly 由192.168.0.2 telnet登录到Katty:23,并执行w,uname -a,exit ;
2. ssh
root 由 192.168.0.2 ssh登录到Katty:22,并执行w,pwd ;
3. http
root在dtconsole(控制台X窗口)上打开Mozilla访问http://www.google.com;
4. ftp
用户elly 由192.168.0.2通过ftp下载文件/etc/passwd;
5. X-Window
用户elly 由192.168.0.2执行xeye -display Katty:0,运行了一个xeye到远程的X桌面。
完成所有操作后,运行Chaosreader分析刚才snoop所记录的网络数据:
=============================
[Tracy@Katty]# chaosreader out
Chaosreader ver 0.94
Opening, out
Reading file contents,
100% (58408/58408)
Reassembling packets,
100% (358/358)
Creating files...
Num Session (host:port <=> host:port) Service
0012 192.168.0.31:32925,64.233.189.104:80 web
0005 192.168.0.2:1591,192.168.0.31:21 ftp
0004 192.168.0.31:6000,192.168.0.2:1590 X11
0009 192.168.0.2:1593,192.168.0.31:23 telnet
0001 192.168.0.2:1589,192.168.0.31:22 ssh
0008 192.168.0.2:1592,192.168.0.31:20 ftp-data
0013 10.0.0.1:138,10.255.255.255:138 netbios-dgm
0007 192.168.0.31:33242,202.96.209.6:53 domain
0003 192.168.0.31:33240,202.96.209.6:53 domain
0002 192.168.0.31:33239,202.96.209.6:53 domain
0010 192.168.0.31:33243,202.96.209.6:53 domain
0006 192.168.0.31:33241,202.96.209.6:53 domain
0011 192.168.0.31:33244,202.96.209.6:53 domain
index.html created.
=============================
Chaosreader分析snoop的输出文件out,识别出刚才进行过的所有网络连接,包含web、ftp、X11、telnet、ssh,以及dns和netbios-dgm。其中前五种分别是我们进行的网络操作,而netbios是windows网络中定期广播产生的干扰数据,domain则是在访问google时web请求前产生的dns解析请求。
经过分析产生了统计报告index.html和以下文件:
getpost.html Web访问时的get/post请求
httplog.text 文本格式的http访问日志
image.html 空
index.html 索引页面
index.text 文本索引页面
session_0001.textSSH.html ssh连接日志
session_0001.textSSH.keydata ssh key
session_0001.textSSH.replay ssh连接回放脚本
session_0004.X11.replay X-Window Session回放脚本
session_0004.textX11.html
session_0004.textX11.replay
session_0005.ftp.html ftp连接日志
session_0008.part_01.ftp-data.data ftp传输的文件
session_0009.telnet.html telnet连接日志
session_0009.telnet.replay telnet连接回放脚本
session_0012.part_01.html
session_0012.web.html web连接详细日志
stream_0002.domain.html DNS请求
stream_0003.domain.html
stream_0006.domain.html
stream_0007.domain.html
stream_0010.domain.html
stream_0011.domain.html
看一下记录下的详细日志:
ftp: session_0005.ftp.html
===============================
ftp: 192.168.0.2:1591 -> 192.168.0.31:21
File out, Session 5
220 Katty FTP server ready.
USER elly
331 Password required for elly.
PASS elly
230 User elly logged in.
CWD /etc
250 CWD command successful.
PORT 192,168,0,2,6,56
200 PORT command successful.
RETR passwd
150 Opening ASCII mode data connection for passwd (628 bytes).
226 Transfer complete.
QUIT
221-You have transferred 644 bytes in 1 files.
221-Total traffic for this session was 985 bytes in 1 transfers.
221-Thank you for using the FTP service on Katty.
221 Goodbye.
==============================
另外,在session_0008.part_01.ftp-data.data文件中记录下了本次连接传输的文件副本。
telnet: session_0009.telnet.html
==============================
telnet: 192.168.0.2:1593 -> 192.168.0.31:23
File out, Session 9
..%..%..%..%...........%.......&..&..&..&........#..''..$.............P.
....#..''..$..#..''..$........#..''..$....ANSI..........................
login: ...eellllyy
Password: elly
Last login: Tue Feb 15 21:32:09 from 192.168.0.2
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
-bash-3.00$ ww
.... 9..32.. .... 4:18, 3 ...., ..........0.08, 0.18, 0.13
...... ...... ........ .... JCPU PCPU ........
root console .... 9..24.. 8 1 /usr/dt/bin/sdt_shell -c ?
root pts/2 .... 9..31.. 1 -sh
root pts/5 .... 9..25.. 1 snoop -o out ip
elly pts/6 .... 9..32.. w
-bash-3.00$ uunnaammee --aa
SunOS Katty 5.10 Generic i86pc i386 i86pc
-bash-3.00$ eexxiitt
logout
=============================
注意,由于telnet的回显协议,所以每个字符都会重复显示一遍,如果要避免这种情况可以在snoop设置中指定dst参数。
web:
session_0012.part_01.html 记录下了访问的页面镜像;
httplog.text 记录下了访问页面的连接过程;
session_0012.web.html 记录下了访问页面的详细信息;
ssh:
由于ssh连接加密算法协商阶段完成之后,通讯就完全加密了,所以只有部分数据可见。
X-Window:
本身没有记录太多信息,但是生成了一个session_0004.X11.replay脚本,来模拟回放当时的操作。
另外,telnet连接也生成了一个相应的回放脚本session_0009.telnet.replay。回放只是模拟当时的操作,并按对应的时间顺序显示出来,并不进行真实的操作,因此可以放心测试。但是X-Window回放需要注意,因为X的回放是完全真实的操作,有可能会影响到系统哦。另外,如果X回放无法运行,可以先在当前X桌面上执行xhost +,然后再运行回放脚本。
总结...Chaosreader的连接重组,协议解析,数据析取,模拟回放功能都是极为强大的,给原本鸡肋的snoop注入了极大的生命力,另外还提供了对tcpdump、dsniff和ethereal的支持,的确是网络分析中的一个好工具。
一点Tips:
记住,几乎任何网络抓包工具的数据报都是可以相互转换的(虽然在软件自身可能不兼容)。Ethereal当前就已经可以支持大多数抓包工具所生成的数据记录文件,而以前我推荐过的更加强大的Wildpackets ProCovert更是可以转换当前几乎所有抓包软件生成的数据记录。因此我们可以用一种工具抓包,转换过之后很灵活方便的使用最适合分析它的软件来进行细化的分析,例如在Windows上用Sniffer Pro,Linux上用TCPDumpSunOS上用Snoop,之后可以任意把它转换成对方的数据类型进行分析,就方便多了吧。