Jump to content

TCP State

- - - - -

  • Please log in to reply
2 replies to this topic

#1
julmuri

julmuri

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts
Heya!

So, Iam using pcap to to capture specific tcp packets.
I would like to be able to track tcp state of connections,
especially connect (SYN->SYN/ACK->ACK) and close (FIN->ACK || FIN/ACK->ACK).

Ths would give me the ability to read and write over existing connection
by tracking the sequence number and keeping client and server in sync.

So Iam looking for code that deduces tcp state by parsing the tcp flags.
Im sure I could figure this out eventually, but figured it would be alot faster
if there was some code and/or documentation covering it.
Already tried quickly parsing connection handshake but countered some shenanigans.

Any help would be appreciated.
std::string s("oberq zhpu?");std::for_each(s.begin(),s.end(),[&](char&c){c=~c;c=~c-0x01/(~(c|0x20)/0x0D*0x02-0x0B)*0x0D;});std::cout<<s;

#2
Lance

Lance

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 276 posts
Transmission Control Protocol - Wikipedia, the free encyclopedia

Last resort, check linux kernal source, TCP/IP part, you should be able to figure everything you need.

#3
julmuri

julmuri

    Programmer

  • Members
  • PipPipPipPip
  • 139 posts

Lance said:

Last resort, check linux kernal source, TCP/IP part, you should be able to figure everything you need.
Ofcourse, why didnt I think of that.
Little wider read than I hoped, but guess it will have to do. (:
std::string s("oberq zhpu?");std::for_each(s.begin(),s.end(),[&](char&c){c=~c;c=~c-0x01/(~(c|0x20)/0x0D*0x02-0x0B)*0x0D;});std::cout<<s;




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users