我有 pcap 跟踪文件,我想从数据包中提取时间和源 IP 地址。我正在使用 tcpdump 和 awk。这是文件的示例
02:00:00.001814 IP 61.31.228.1.80 > 0.106.173.16.19999: Flags [S.], seq 4049606604, ack 4044405336, win 512, length 0
02:00:00.005787 IP 61.31.228.1.80 > 0.4.173.19.13923: Flags [S.], seq 3812128115, ack 3811406374, win 512, length 0
02:00:00.005799 IP 74.54.182.242.80 > 0.176.229.61.43527: Flags [S.], seq 61247722, ack 352633207, win 65535, options [mss 1460,nop,nop,sackOK], length 0
然后我应用 awk 来提取 csv 文件中的时间和源 IP 地址:
02:00:00.001814,0.106.173.16.19999:
02:00:00.005787,0.4.173.19.13923:
02:00:00.005799,0.176.229.61.43527:
我只对最后一点感兴趣,我想摆脱源ip末尾的“:”。我用过
awk '{print $1 "," $5}'
有什么建议么?