in reply to Win32 TCP SYN messages
It looks to me like you are looking at the wrong bits. NetPacket::TCP has the following constants defined:
Just to test my theory I wrote the following snippet.use constant FIN => 0x01; use constant SYN => 0x02; use constant RST => 0x04; use constant PSH => 0x08; use constant ACK => 0x10; use constant URG => 0x20; use constant ECE => 0x40; use constant CWR => 0x80;
I hope this helps.#!/usr/bin/perl use strict; use warnings; use constant FIN => 0x01; use constant SYN => 0x02; use constant RST => 0x04; use constant PSH => 0x08; use constant ACK => 0x10; use constant URG => 0x20; use constant ECE => 0x40; use constant CWR => 0x80; my $helpDec = sprintf("%d", 19); # an arbitrary number that will have +the SYN bit set my $helpBin = unpack("B*", pack('C',$helpDec)); print "TCPFLAG: $helpBin\n"; print "Or: $helpDec\n"; print "TCPACK: " . substr( $helpBin, 6, 1 ) . "\n"; #TCP flag ACK print "TCPPSH: " . substr( $helpBin, 5, 1 ) . "\n"; #TCP flag PUSH (PS +H) print "TCPRST: " . substr( $helpBin, 4, 1 ) . "\n"; #TCP flag RESET (R +ST) print "TCPSYN: " . substr( $helpBin, 3, 1 ) . "\n"; #TCP flag SYN print "TCPFIN: " . substr( $helpBin, 2, 1 ) . "\n"; #TCP flag FIN print "\n"; print "TCPACK: " . ( $helpDec & ACK ? 1 : 0 ) . "\n"; #TCP flag ACK print "TCPPSH: " . ( $helpDec & PSH ? 1 : 0 ) . "\n"; #TCP flag PUSH ( +PSH) print "TCPRST: " . ( $helpDec & RST ? 1 : 0 ) . "\n"; #TCP flag RESET +(RST) print "TCPSYN: " . ( $helpDec & SYN ? 1 : 0 ) . "\n"; #TCP flag SYN print "TCPFIN: " . ( $helpDec & FIN ? 1 : 0 ) . "\n"; #TCP flag FIN __END__ TCPFLAG: 00010011 Or: 19 TCPACK: 1 TCPPSH: 0 TCPRST: 0 TCPSYN: 1 TCPFIN: 0 TCPACK: 1 TCPPSH: 0 TCPRST: 0 TCPSYN: 1 TCPFIN: 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32 TCP SYN messages
by ikegami (Patriarch) on Jun 21, 2006 at 12:58 UTC | |
by Mr. Muskrat (Canon) on Jun 21, 2006 at 13:50 UTC | |
by ikegami (Patriarch) on Jun 21, 2006 at 15:09 UTC | |
|
Re^2: Win32 TCP SYN messages
by jschollen (Beadle) on Jun 21, 2006 at 07:29 UTC |