networking - How to command “hping3” display time and date of hping3 - Ask Ubuntu
when hping3 have output:
hping3 -s -p 80 google.com hping google.com (eth0 89.25.120.57): s set, 40 headers + 0 data bytes len=46 ip=89.25.120.57 ttl=62 id=40422 sport=80 flags=sa seq=0 win=29200 rtt=3.9 ms len=46 ip=89.25.120.57 ttl=62 id=41026 sport=80 flags=sa seq=1 win=29200 rtt=7.8 ms len=46 ip=89.25.120.57 ttl=62 id=41341 sport=80 flags=sa seq=2 win=29200 rtt=3.7 ms ^c --- google.com hping statistic --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 3.7/5.1/7.8 ms
i have date in front of each line: how command "ping" display time , date of ping
can ?
i've made work.
hping3 buffering output. in order fix installed expect
(sudo apt-get install expect
) on ubuntu 16.04 , ran following command:
$ unbuffer hping3 -s -p 80 google.com | while read pong; echo "$(date): $pong"; done wed nov 2 12:48:29 utc 2016: hping google.com (ens160 172.217.23.14): s set, 40 headers + 0 data bytes wed nov 2 12:48:29 utc 2016: len=46 ip=172.217.23.14 ttl=58 id=35798 sport=80 flags=sa seq=0 win=42900 rtt=7.9 ms wed nov 2 12:48:30 utc 2016: len=46 ip=172.217.23.14 ttl=58 id=44519 sport=80 flags=sa seq=1 win=42900 rtt=7.9 ms wed nov 2 12:48:31 utc 2016: len=46 ip=172.217.23.14 ttl=58 id=43418 sport=80 flags=sa seq=2 win=42900 rtt=3.8 ms wed nov 2 12:48:32 utc 2016: len=46 ip=172.217.23.14 ttl=58 id=9116 sport=80 flags=sa seq=3 win=42900 rtt=7.7 ms
Comments
Post a Comment