获取目标 ip (>ip) 和“用户代理:”的最有效方法是什么。我想获取这两个值并将它们转储到一个文件中,首先是 ip,然后是用户代理。我想最小化系统资源。这将 24x7 运行,并定期刷新日志。
" 1.1.1.1.58477 > 98.139.239.224.80: Flags [P.], cksum 0x2a6c (correct), seq 1:431, ack 1, win 17520, length 430
E.../y@.~...K...b....m.Px9.Iim/.P.Dp*l..GET /images/40eb913b4b20614fad042dc816d412fe_48.jpeg HTTP/1.1^M
Accept: image/png, image/svg+xml, image/*;q=0.8, */*;q=0.5^M
Referer: http://sports.yahoo.com/news/nascar--scene-at-daytona--was-like-a-war-zone--005423629.html^M
Accept-Language: en-US^M
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)^M
Accept-Encoding: gzip, deflate^M
Host: socialprofiles.zenfs.com^M
DNT: 1^M
Connection: Keep-Alive^M"
为格式良好的原始输出添加 URL。docs.google.com/file/d/0B1umMHxdWKkdNzI3anBaemhuOVE/edit?usp=sharing
T 15.127.111.221:64300 -> 198.252.206.16:80 [AP]
GET /posts/15048809/ivc/29bb?_=1362111021654 HTTP/1.1.
Host: stackoverflow.com.
Connection: keep-alive.
Accept: */*.
X-Requested-With: XMLHttpRequest.
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22.
Referer: http://stackoverflow.com/questions/15048809/tcpdump-header-info-grep-or-awk- or-sed.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3.
Cookie: __qca=P0-1081552782-122603326; sgt=id=9