{"id":126,"date":"2009-03-15T19:55:00","date_gmt":"2009-03-15T19:55:00","guid":{"rendered":"http:\/\/antynet.pl\/index.php\/2009\/03\/15\/linux-tcpdump\/"},"modified":"2009-03-15T19:55:00","modified_gmt":"2009-03-15T19:55:00","slug":"linux-tcpdump","status":"publish","type":"post","link":"https:\/\/www.antynet.pl\/index.php\/2009\/03\/15\/linux-tcpdump\/","title":{"rendered":"LINUX TCPDUMP"},"content":{"rendered":"<div class=\"console\">tcpdump -XXnve -i eth1 'arp [7]==2&#8242; -s0<\/div>\n<p>#read data with header in ASCI and HEX &#8211; use option -XX, which 8-th byte in ARP header will be 2(DEC) &#8211; count from 0 to 7, means answer on ARP broadcast<\/p>\n<div class=\"console\">tcpdump -XXnve -i eth1 'tcp [13]==18&#8242; -s 0<\/div>\n<p>#read data as above, which 14th byte in TCP header:<\/p>\n<pre>18(DEC) = 12 (HEX) = 00010010(BIN) means set flags SYN and ACK, C|E|U|A|P|R|S|F where letters mean flags in bits code<br \/>0 0 0 1 0 1 1 0 means set flag ACK,RST,SYN - 22(DEC) and 16(HEX)<\/pre>\n<hr \/>\n<p>describe TCPDUMP output<\/p>\n<hr \/>\n<p>ARP answer on&nbsp; broadcast:<\/p>\n<pre>tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes<br \/>12:55:53.464953 00:c0:a8:fe:6f:f2 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: arp who-has 192.168.1.212 tell 192.168.1.24<br \/>0x0000:  ffff ffff ffff 00c0 a8fe 6ff2 0806 0001  ..........o.....<br \/>0x0010:  0800 0604 0001 00c0 a8fe 6ff2 c0a8 0118  ..........o.....<br \/>0x0020:  0000 0000 0000 c0a8 01d4 0000 0000 0000  ................<br \/>0x0030:  0000 0000 0000 0000 0000 0000            ............<\/pre>\n<p>Description in order:<br \/>1w\/8k\/1-4 means 1 row\/8 column\/position form 1 to 4: <\/p>\n<pre class=\"code\">1w\/1k\/1-...1w\/3k\/-4 destination MAC<br \/>1w\/4k\/1-...1w\/6k\/-4 source MAC<br \/>1w\/7k\/1-4  typ ramki: 0806 - ARP; 0800 - IP; 8035 - reverse ARP; 8137 - IPX<br \/>------------------------START IP protocol----------------------------------------------<br \/>1w\/8k\/1-4  device address type: 0001 - Ethernet<br \/>2w\/1k\/1-4  protocol address type: 0800 - IP<br \/>2w\/2k\/1-2  length device address in Btes<br \/>2e\/2k\/3-4  length proctocol address in Bytes<br \/>2w\/3k\/1-4  operation: 0001 - question; 0002 - answer<br \/>2w\/4k\/1-...2w\/6k\/-4 sender MAC<br \/>2w\/7k\/1-...2w\/8k\/-4 sender IP<br \/>3w\/1k\/1-...3w\/3k\/-4 recipient MAC<br \/>3w\/4k\/1-...3w\/5k\/-4 recipient IP<\/pre>\n<hr \/>\n<p>send 1 tcp packet with flags SYN,ACK,RST and data &#8222;ABC&#8221; which means 3 Bytes from file &#8222;wy&#8221; by hping3:<\/p>\n<div class=\"cr\">hping3 192.168.1.253 -S -A -R -E wy -d 3 -c 1<\/div>\n<p>we receive:<\/p>\n<pre class=\"code\">ROUTER:\/# tcpdump -XXnve -i eth1 'tcp [13]==22' -s0 and host 192.168.1.4<br \/>tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes<br \/>13:30:10.508842 00:0c:76:e7:f1:d3 > 00:30:4f:23:b8:4e, ethertype IPv4 (0x0800), length 60: IP (tos 0x0, ttl  64, <br \/>id 57585, offset 0, flags [none], length: 43) 192.168.1.4.2029 > 192.168.1.253.0: SR [tcp sum ok] 1842019365:1842019368(3) <br \/>ack 2138831316 win 512 [RST ABC]<br \/>0x0000:  0030 4f23 b84e 000c 76e7 f1d3 0800 4500  .0O#.N..v.....E.<br \/>0x0010:  002b e0f1 0000 4006 158a c0a8 0104 c0a8  .+....@.........<br \/>0x0020:  01fd 07ed 0000 6dca fc25 7f7b f9d4 5016  ......m..%.{..P.<br \/>0x0030:  0200 ba09 0000 4142 4300 0000            ......ABC...<br \/>----------------------------------------------------------------------------------------<br \/>1w\/1k\/1-...1w\/3k\/-4 destination MAC<br \/>1w\/4k\/1-...1w\/6k\/-4 source MAC<br \/>1w\/7k\/1-4  typ ramki: 0806 - ARP; 0800 - IP; 8035 - reverse ARP; 8137 - IPX<br \/>------------------------START IP protocol----------------------------------------------<br \/>1w\/8k\/1   wersja protoko\u0142u<br \/>1w\/8k\/2   header length in Bytes<br \/>1w\/8k\/3-4  TOS type<br \/>2w\/1k\/1-4  whole length hader plus data<br \/>2w\/2k\/1-4  datagram ID<br \/>2w\/3k\/1   fragmentation sign<br \/>2w\/3k\/2-4  shift<br \/>2w\/4k\/1-2  TTL field<br \/>2w\/4k\/3-4  protocol type: 06 - TCP; 17 - UDP; 01 - ICMP;<br \/>2w\/5k\/1-4  control sum header<br \/>2w\/6k\/1-...2w\/7k\/-4 sender IP<br \/>2w\/8k\/1-...3w\/1k\/-4 recipient IP<br \/>------------------------START TCP protocol---------------------------------------------<br \/>3w\/2k\/1-4  source port<br \/>3w\/3k\/1-4  destination port<br \/>3w\/4k\/1-...3w\/5k\/-4 output data order nr<br \/>3w\/6k\/1-...3w\/7k\/-4 input data order nr<br \/>3w\/8k\/1-2  header length<br \/>3w\/8k\/3-4  cody bits: 02 - SYN; 12 - SYN,ACK; 16 - SYN,ACK,RST<br \/>4w\/1k\/1-4  input data window<br \/>4w\/2k\/1-4  header control sum<br \/>4w\/3k\/1-4  pointer data<br \/>------------------------START data----------------------------------------------------<br \/>4w\/4k\/1-  dane 41,42,43 in ASCI means ABC<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>tcpdump -XXnve -i eth1 'arp [7]==2&#8242; -s0 #read data with header in ASCI and HEX &#8211; use option -XX, which 8-th byte in ARP header will be 2(DEC) &#8211; count from 0 to 7, means answer on ARP broadcast tcpdump -XXnve -i eth1 'tcp [13]==18&#8242; -s 0 #read data as above, which 14th byte in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1],"tags":[44],"class_list":["post-126","post","type-post","status-publish","format-standard","hentry","category-bez-kategorii","tag-linux-tcpdump"],"_links":{"self":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":0,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.antynet.pl\/index.php\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}