Stealth Port Scanner question (recv())...

Jun 19, 2014 at 11:32am
After sending a packet, I get a response...

1
2
3
int size = recv(socketDescriptor, buffer, sizeof(buffer), MSG_DONTWAIT);
cout << "received: " << size << endl;
cout << buffer << endl;


How do I decode the received chars so that I can see which flags are set/unset?
Last edited on Jun 19, 2014 at 11:34am
Jun 19, 2014 at 7:19pm
What flags? Do you mean the flags in the TCP header?
Jun 20, 2014 at 4:04am
Yes, that is correct.

I'd like to know how to get the TCP flags (and IP flags if possible) and data content (if present).
Last edited on Jun 20, 2014 at 4:07am
Jun 20, 2014 at 1:50pm
You can't get them from the sockets library. It's job is to stop you worrying about such things.

You will need to packet capture in a seperate thread. The pcap (captured packets) will have all the commiunication info. You need to find the matching TCP packets and inspect them.

I've done this before. It's not as tricky as it sounds.
Jun 30, 2014 at 3:26am
It seems odd that I need a sniffer thread to capture the packets instead of interpreting from the sockets library...
Jul 3, 2014 at 9:00pm
It's not odd if you understand the networking stack. When using a socket library, you are at the Application layer. TCP header information is in the Transport layer. The point of these layers is to separate out concern to only the relevant parties. As an application developer, you don't care about the transport information - you just care about application data. That is what a socket library will provide for you.
Topic archived. No new replies allowed.