【问题标题】:TcpDump: showing the absolute timestamp (date + time) of pcap fileTcpDump:显示pcap文件的绝对时间戳(日期+时间)
【发布时间】:2018-06-28 21:40:46
【问题描述】:

我想使用 tcpdump 查看 pcap 文件中数据包的绝对时间戳。当我使用命令tcpdump -r mypcapfiile 时,它只显示时间,

03:21:14.804778 IP static.vnpt.vn.51193 > 192.168.0.146.smtp

如何读取日期?

【问题讨论】:

    标签: timestamp pcap tcpdump


    【解决方案1】:

    下面的例子将给出时间戳的输出

    tcpdump -i any -lnv port 53 -tttt | egrep -i "something" -B1

    示例: 2021-01-29 00:17:28.143766 IP (tos 0x0, ttl 254, id 60132, offset 0, flags [DF], proto UDP (17), length 68) 10.10.15.4.9193 > 10.10.27.251.53: 42463+ A? something.com. (40)

    【讨论】:

      【解决方案2】:

      您可以使用-tttt 选项:

      $ tcpdump -tttt -nr tmp.pcap 
      reading from file tmp.pcap, link-type EN10MB (Ethernet)
      2018-01-19 17:50:43.275918 IP 172.24.0.97.45386 > 93.153.221.29.80: Flags [.], ack 3335572340, win 251, options [nop,nop,TS val 98777655 ecr 230462279], length 0
      2018-01-19 17:50:43.287273 IP 93.153.221.29.80 > 172.24.0.97.45386: Flags [.], ack 1, win 285, options [nop,nop,TS val 230464839 ecr 98706059], length 0
      2018-01-19 17:50:44.138480 ARP, Request who-has 172.24.0.73 tell 172.24.0.78, length 46
      2018-01-19 17:50:45.162482 ARP, Request who-has 172.24.0.73 tell 172.24.0.78, length 46
      

      【讨论】:

      • 执行此操作时,请务必正确设置 TZ 环境变量。
      猜你喜欢
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-16
      相关资源
      最近更新 更多