Am1rr3zA
Am1rr3zA

Reputation: 7421

How can I create my own TCP connection (just send TCP request and get the result)?

I want to connect to some server and find if the special port is open or not, so I want to send TCP packet with SYN flag set and get the result packet from server and check the result flag to find out if the port is open, closed or filtered? now my question is how can I create this TCP connection (I just need 2 way connection not 3-way handshake) please show me how can I create this special connection and how can I check special flag and how can I create my TCP connection with my desired flag.

Upvotes: 2

Views: 865

Answers (3)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136238

Use Nmap to scan for open ports.

Upvotes: 0

sarnold
sarnold

Reputation: 104050

I suggest starting with file scan_engine.cc from nmap source code; follow the isRawScan() function.

My quick scan through the source seems to indicate that you need to create SOCK_RAW sockets and install a pcap packet capture filter to read the response packets. (Perhaps the pcap filter is just for convenience/speed sake, but if the nmap team decided to go this route, they probably had good reasons.)

Upvotes: 1

Will Dean
Will Dean

Reputation: 39500

You don't say what platform you're on, but the term you need to search for is 'raw sockets'.

Upvotes: 1

Related Questions