> - tcpdump 'tcp[13] & 3 != 0 and not src and dst net localnet'
>
> What I don't understand is how to traslate tcp[13] and 3 (or tcp[3]).
It looks like you've got it mostly figured out. As you say, tcp[13]
accesses the byte located at offset 13 in the TCP header (the first
byte in the header being at offset 0). That particular byte contains
the TCP control flags. Among these, the least significant bit (bit 0)
is FIN, bit 1 is SYN, and bit 4 is ACK. The "& 3" of your tcpdump
command is applying a bit mask (logical 'and') to the control flags,
clearing all bits except the bottom 2 (SYN & FIN). The "!= 0" part
of the command tests the result and matches if either the SYN or FIN
bit is 1.
> .... The TCP
> section is at off: 34 (x22) and 13 bytes after that is 47 (x2F), that puts
> me at the TCP flags summary.
I'm not exactly sure where you are coming up with the TCP section starting
at offset 34, at least in terms of the data in your dumps, which say the
TCP header is at offset 20 from the beginning of the IP header. Maybe
you're counting some link level headers which are not shown?
> windump: listening on\Device\Packet_{CC3ED418-E76E-4062-B5C5-4BCDC13A4AFA}
> 17:55:24.969794 host1.1429 > host2.139: S 4267803795:4267803795(0) win 16384
> (DF)
> 4500 0030 1d65 4000 7c06 d87b ab4e 0345
> 8021 da32 0595 008b fe61 8493 0000 0000
> 7002 4000 b122 0000 0204 05b4 0101 0402
The first byte of the IP header (0x45) says the TCP header begins at an
offset of 5 words (32 bit ea.), or 20 bytes. So the TCP control flags
are at an offset of 20 + 13 = 33. In this case, the flag byte contains
0x02 = SYN.
> 17:55:24.970018 host2.139 > host1.1429: S 3666998063:3666998063(0) ack
> 4267803796 win 17520 (DF)
> 4500 0030 4385 4000 8006 ae5b 8021 da32
> ab4e 0345 008b 0595 da91 f32f fe61 8494
> 7012 4470 dedf 0000 0204 05b4 0101 0402
Here the TCP flag byte contains 0x12 = ACK, SYN
> 17:55:25.008545 host2.genuity.com.1429 > host1.139: F 1:1(0) ack 1 win 17520
> (DF)
> 4500 0028 1d67 4000 7c06 d881 ab4e 0345
> 8021 da32 0595 008b fe61 8494 da91 f330
> 5011 4470 0ba3 0000 e712 8418 4130
Here the TCP flag byte contains 0x11 = ACK, FIN
-Joe
--
To unsubscribe: mail ">majordomo@ale.org with "unsubscribe ale" in message body.