um simples gato no arquivo pcap parece terrível:
$cat tcp_dump.pcap
?ò????YVJ?
JJ
?@@.?E<??@@
?CA??qe?U????иh?
.Ceh?YVJ??
JJ
?@@.?E<??@@
CA??qe?U????еz?
.ChV?YVJ$?JJ
?@@.?E<-/@@A?CAͼ?9????F???A&?
.Ck??YVJgeJJ@@.?Ӣ#3E<@3{nͼ?9CA??P?ɝ?F???<K?
?ԛ`.Ck??YVJgeBB
?@@.?E4-0@@AFCAͼ?9????F?P?ʀ???
.Ck??ԛ`?YVJ?""@@.?Ӣ#3E?L@3?Iͼ?9CA??P?ʝ?F?????
?ԛ?.Ck?220-rly-da03.mx
etc.
Tentei torná-lo mais bonito com:
sudo tcpdump -ttttnnr tcp_dump.pcap
reading from file tcp_dump.pcap, link-type EN10MB (Ethernet)
2009-07-09 20:57:40.819734 IP 67.23.28.65.49237 > 216.239.113.101.25: S 2535121895:2535121895(0) win 5840 <mss 1460,sackOK,timestamp 776168808 0,nop,wscale 5>
2009-07-09 20:57:43.819905 IP 67.23.28.65.49237 > 216.239.113.101.25: S 2535121895:2535121895(0) win 5840 <mss 1460,sackOK,timestamp 776169558 0,nop,wscale 5>
2009-07-09 20:57:47.248100 IP 67.23.28.65.42385 > 205.188.159.57.25: S 2644526720:2644526720(0) win 5840 <mss 1460,sackOK,timestamp 776170415 0,nop,wscale 5>
2009-07-09 20:57:47.288103 IP 205.188.159.57.25 > 67.23.28.65.42385: S 1358829769:1358829769(0) ack 2644526721 win 5792 <mss 1460,sackOK,timestamp 4292123488 776170415,nop,wscale 2>
2009-07-09 20:57:47.288103 IP 67.23.28.65.42385 > 205.188.159.57.25: . ack 1 win 183 <nop,nop,timestamp 776170425 4292123488>
2009-07-09 20:57:47.368107 IP 205.188.159.57.25 > 67.23.28.65.42385: P 1:481(480) ack 1 win 1448 <nop,nop,timestamp 4292123568 776170425>
2009-07-09 20:57:47.368107 IP 67.23.28.65.42385 > 205.188.159.57.25: . ack 481 win 216 <nop,nop,timestamp 776170445 4292123568>
2009-07-09 20:57:47.368107 IP 67.23.28.65.42385 > 205.188.159.57.25: P 1:18(17) ack 481 win 216 <nop,nop,timestamp 776170445 4292123568>
2009-07-09 20:57:47.404109 IP 205.188.159.57.25 > 67.23.28.65.42385: . ack 18 win 1448 <nop,nop,timestamp 4292123606 776170445>
2009-07-09 20:57:47.404109 IP 205.188.159.57.25 > 67.23.28.65.42385: P 481:536(55) ack 18 win 1448 <nop,nop,timestamp 4292123606 776170445>
2009-07-09 20:57:47.404109 IP 67.23.28.65.42385 > 205.188.159.57.25: P 18:44(26) ack 536 win 216 <nop,nop,timestamp 776170454 4292123606>
2009-07-09 20:57:47.444112 IP 205.188.159.57.25 > 67.23.28.65.42385: P 536:581(45) ack 44 win 1448 <nop,nop,timestamp 4292123644 776170454>
2009-07-09 20:57:47.484114 IP 67.23.28.65.42385 > 205.188.159.57.25: . ack 581 win 216 <nop,nop,timestamp 776170474 4292123644>
2009-07-09 20:57:47.616121 IP 67.23.28.65.42385 > 205.188.159.57.25: P 44:50(6) ack 581 win 216 <nop,nop,timestamp 776170507 4292123644>
2009-07-09 20:57:47.652123 IP 205.188.159.57.25 > 67.23.28.65.42385: P 581:589(8) ack 50 win 1448 <nop,nop,timestamp 4292123855 776170507>
2009-07-09 20:57:47.652123 IP 67.23.28.65.42385 > 205.188.159.57.25: . ack 589 win 216 <nop,nop,timestamp 776170516 4292123855>
2009-07-09 20:57:47.652123 IP 67.23.28.65.42385 > 205.188.159.57.25: P 50:56(6) ack 589 win 216 <nop,nop,timestamp 776170516 4292123855>
2009-07-09 20:57:47.652123 IP 67.23.28.65.42385 > 205.188.159.57.25: F 56:56(0) ack 589 win 216 <nop,nop,timestamp 776170516 4292123855>
2009-07-09 20:57:47.668124 IP 67.23.28.65.49239 > 216.239.113.101.25: S 2642380481:2642380481(0) win 5840 <mss 1460,sackOK,timestamp 776170520 0,nop,wscale 5>
2009-07-09 20:57:47.692126 IP 205.188.159.57.25 > 67.23.28.65.42385: P 589:618(29) ack 57 win 1448 <nop,nop,timestamp 4292123893 776170516>
2009-07-09 20:57:47.692126 IP 67.23.28.65.42385 > 205.188.159.57.25: R 2644526777:2644526777(0) win 0
2009-07-09 20:57:47.692126 IP 205.188.159.57.25 > 67.23.28.65.42385: F 618:618(0) ack 57 win 1448 <nop,nop,timestamp 4292123893 776170516>
2009-07-09 20:57:47.692126 IP 67.23.28.65.42385 > 205.188.159.57.25: R 2644526777:2644526777(0) win 0
Bem ... isso é muito mais bonito, mas não mostra as mensagens reais. Na verdade, posso extrair mais informações apenas visualizando o arquivo RAW. Qual é a melhor (e de preferência mais fácil) maneira de exibir apenas todo o conteúdo do arquivo pcap?
ATUALIZAR
Graças às respostas abaixo, fiz alguns progressos. Aqui está o que parece agora:
tcpdump -qns 0 -A -r blah.pcap
20:57:47.368107 IP 205.188.159.57.25 > 67.23.28.65.42385: tcp 480
0x0000: 4500 0214 834c 4000 3306 f649 cdbc 9f39 E....L@.3..I...9
0x0010: 4317 1c41 0019 a591 50fe 18ca 9da0 4681 C..A....P.....F.
0x0020: 8018 05a8 848f 0000 0101 080a ffd4 9bb0 ................
0x0030: 2e43 6bb9 3232 302d 726c 792d 6461 3033 .Ck.220-rly-da03
0x0040: 2e6d 782e 616f 6c2e 636f 6d20 4553 4d54 .mx.aol.com.ESMT
0x0050: 5020 6d61 696c 5f72 656c 6179 5f69 6e2d P.mail_relay_in-
0x0060: 6461 3033 2e34 3b20 5468 752c 2030 3920 da03.4;.Thu,.09.
0x0070: 4a75 6c20 3230 3039 2031 363a 3537 3a34 Jul.2009.16:57:4
0x0080: 3720 2d30 3430 300d 0a32 3230 2d41 6d65 7.-0400..220-Ame
0x0090: 7269 6361 204f 6e6c 696e 6520 2841 4f4c rica.Online.(AOL
0x00a0: 2920 616e 6420 6974 7320 6166 6669 6c69 ).and.its.affili
0x00b0: 6174 6564 2063 6f6d 7061 6e69 6573 2064 ated.companies.d
etc.
Parece bom, mas ainda dificulta a leitura da mensagem à direita. Existe uma maneira de ver essas mensagens de uma maneira mais amigável?
ATUALIZAR
Isso tornou bonito:
tcpick -C -yP -r tcp_dump.pcap
Obrigado!