Bro是适合您用例的工具。它自动重组 TCP 流并在顶部运行应用层(例如 HTTP)解析器。Bro 在 Linux 上运行良好,已在网络测量和网络安全社区中得到广泛采用。
在您的情况下,按如下方式运行 Bro:
bro -C -r <trace>
并检查结果http.log
。它应该看起来像这样(在右端修剪):
#separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path http
#fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p trans_depth method host uri referrer user_agent request_body_len response_body_len status_code status_msg
#types time string addr port addr port count string string string string string count count count string count string string table[enum] string string table[string] string string file
1258535653.087137 an7i43AgB5h 192.168.1.104 1191 65.54.95.64 80 1 HEAD download.windowsupdate.com /v9/windowsupdate/redir/muv4wuredir.cab?0911180916 - Windows-Update-Agent 0 0
1258535655.525107 qPXo2uv96I5 192.168.1.104 1192 65.55.184.16 80 1 HEAD www.update.microsoft.com /v9/windowsupdate/selfupdate/wuident.cab?0911180916 - Windows-Update-Agent 0 0
1258535656.495997 9vr3tgviuu6 192.168.1.104 1193 65.54.95.64 80 1 HEAD download.windowsupdate.com /v9/windowsupdate/a/selfupdate/WSUS3/x86/Other/wsus3setup.cab?0911180916 - Windows-Update
随附的工具bro-cut
允许您将输出减少到所需的字段,例如:
bro-cut id.orig_h id.resp_h method host uri < http.log | head
一些示例输出:
192.168.1.104 65.54.95.64 HEAD download.windowsupdate.com /v9/windowsupdate/redir/muv4wuredir.cab?0911180916192.168.1.104 65.55.184.16 HEAD www.update.microsoft.com /v9/windowsupdate/selfupdate/wuident.cab?0911180916
192.168.1.104 65.54.95.64 HEAD download.windowsupdate.com /v9/windowsupdate/a/selfupdate/WSUS3/x86/Other/wsus3setup.cab?0911180916192.168.1.104 65.54.95.64 GET download.windowsupdate.com /v9/windowsupdate/a/selfupdate/WSUS3/x86/Other/wsus3setup.cab?0911180916
192.168.1.104 65.54.95.64 HEAD download.windowsupdate.com /v9/windowsupdate/redir/muv4wuredir.cab?0911180916192.168.1.104 65.54.95.64 HEAD download.windowsupdate.com /v9/windowsupdate/redir/muv4wuredir.cab?0911180916
192.168.1.102 212.227.97.133 POST 212.227.97.133 /rpc.html?e=bl
192.168.1.102 87.106.1.47 POST 87.106.1.47 /rpc.html?e=bl
192.168.1.102 87.106.1.89 POST 87.106.1.89 /rpc.html?e=bl
192.168.1.102 87.106.12.47 POST 87.106.12.47 /rpc.html?e=bl