클라이언트 (OpenWrt 10.04 라우터에서)의 DNS 요청을 tcpdump하려면
root@ROUTER:/etc# tcpdump -n -i br-lan dst port 53 2>&1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br-lan, link-type EN10MB (Ethernet), capture size 96 bytes
22:29:38.989412 IP 192.168.1.200.55919 > 192.168.1.1.53: 5697+ A? foo.org. (25)
22:29:39.538981 IP 192.168.1.200.60071 > 192.168.1.1.53: 17481+ PTR? 150.33.87.208.in-addr.arpa. (44)
^C
2 packets captured
3 packets received by filter
0 packets dropped by kernel
괜찮습니다. 그러나. tcpdumps 출력을 실시간으로 파이프 할 수없는 이유는 무엇입니까?
root@ROUTER:/etc# tcpdump -n -i br-lan dst port 53 2>&1 | awk '/\?/ {print $3}'
^C
root@ROUTER:/etc#
tcpdump 이후에 내가 awk 등을하면 어떤 출력도 얻지 못합니다. 왜 그런 겁니까? 파이프 라이닝으로 tcpdump의 출력을 실시간으로 처리 할 수없는 이유는 무엇입니까? (예 : 예제에서 세 번째 열만 출력 함)
이에 대한 해결책이 있습니까?
똑바로 man tcpdump
-l Make stdout line buffered. Useful if you want to see the data while
capturing it. E.g.,
tcpdump -l | tee dat
or
tcpdump -l > dat & tail -f dat
Note that on Windows,``line buffered'' means ``unbuffered'', so that
WinDump will write each character individually if -l is specified.
-U is similar to -l in its behavior, but it will cause output to be
``packet-buffered'', so that the output is written to stdout at the
end of each packet rather than at the end of each line; this is
buffered on all platforms, including Windows.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다