TCP port detection/scanning
-
Does anybody know of a good technique to detect if a TCP-port is open on a server, without fully connecting to it? I need to do a half-way TCP-connect, so that the server's
accept()
isn't executed. The server becomes quite "upset" if I just connect and disconnect, not adhering to its protocol. The protocol is proprietary, and I do not have the source code for the server, so I can't add my own tweaks to it. Hence I need to "fool" it on TCP-level. I know there are implementations such as NMap out there, but I figured I'd ask here for the basic techniques first, before taking a plunge into complex multiplatform sources. Note: I'm no dummy, so you don't have to give me tons of source code. Some hints would do just fine. ps. I wouldn't be offended, should you give me code :-D -- An eye for an eye will only make the world blind. -
Does anybody know of a good technique to detect if a TCP-port is open on a server, without fully connecting to it? I need to do a half-way TCP-connect, so that the server's
accept()
isn't executed. The server becomes quite "upset" if I just connect and disconnect, not adhering to its protocol. The protocol is proprietary, and I do not have the source code for the server, so I can't add my own tweaks to it. Hence I need to "fool" it on TCP-level. I know there are implementations such as NMap out there, but I figured I'd ask here for the basic techniques first, before taking a plunge into complex multiplatform sources. Note: I'm no dummy, so you don't have to give me tons of source code. Some hints would do just fine. ps. I wouldn't be offended, should you give me code :-D -- An eye for an eye will only make the world blind.I took print out of your query and went to desks of TCP experts , The answers 1) Call lsof on unix flavoured OSs 2) net stat -p tcp (u can use the rexec(IP , Cmd ) to execute this command at the remote server , but i am not sure of rights issues of RPC ) 3) Ethreal tool can help (but u r searching for code ..almost useless) P.S : not sure of the rexec() function name . Which OS u r talkign abt ?
-
Does anybody know of a good technique to detect if a TCP-port is open on a server, without fully connecting to it? I need to do a half-way TCP-connect, so that the server's
accept()
isn't executed. The server becomes quite "upset" if I just connect and disconnect, not adhering to its protocol. The protocol is proprietary, and I do not have the source code for the server, so I can't add my own tweaks to it. Hence I need to "fool" it on TCP-level. I know there are implementations such as NMap out there, but I figured I'd ask here for the basic techniques first, before taking a plunge into complex multiplatform sources. Note: I'm no dummy, so you don't have to give me tons of source code. Some hints would do just fine. ps. I wouldn't be offended, should you give me code :-D -- An eye for an eye will only make the world blind. -
Does anybody know of a good technique to detect if a TCP-port is open on a server, without fully connecting to it? I need to do a half-way TCP-connect, so that the server's
accept()
isn't executed. The server becomes quite "upset" if I just connect and disconnect, not adhering to its protocol. The protocol is proprietary, and I do not have the source code for the server, so I can't add my own tweaks to it. Hence I need to "fool" it on TCP-level. I know there are implementations such as NMap out there, but I figured I'd ask here for the basic techniques first, before taking a plunge into complex multiplatform sources. Note: I'm no dummy, so you don't have to give me tons of source code. Some hints would do just fine. ps. I wouldn't be offended, should you give me code :-D -- An eye for an eye will only make the world blind. -
I took print out of your query and went to desks of TCP experts , The answers 1) Call lsof on unix flavoured OSs 2) net stat -p tcp (u can use the rexec(IP , Cmd ) to execute this command at the remote server , but i am not sure of rights issues of RPC ) 3) Ethreal tool can help (but u r searching for code ..almost useless) P.S : not sure of the rexec() function name . Which OS u r talkign abt ?
I thought it was obvious that I'm talking about Windows, especially considering the fact that this message board is called "Visual C++". :) Anyway, I need to do it programatically, so I can't just launch a second process, or make it a manual operation for the end user to do.
-
As you know the server IP + port ,you can filter the netstat -p command's results and find if the port is established or not . Right ? redindian
I don't want to establish a connection - it confuses the server, because I don't follow the protocol. I just want to detect the presence of an open port on a particular IP address. I've found the TCP state charts, and it seems that all I need to do is to send a TCP/SYN-message, and wait for a TCP/SYN_ACK message. Then I know there is a process listening on that port. Then my plan is to send a TCP/RST to reset that connection sequence, thus preventing the server from acquiring a socket.
-
I don't want to establish a connection - it confuses the server, because I don't follow the protocol. I just want to detect the presence of an open port on a particular IP address. I've found the TCP state charts, and it seems that all I need to do is to send a TCP/SYN-message, and wait for a TCP/SYN_ACK message. Then I know there is a process listening on that port. Then my plan is to send a TCP/RST to reset that connection sequence, thus preventing the server from acquiring a socket.
-
Hello... Look at: http://www.codeproject.com/internet/NagTPortScanner.asp[^] Not very good explained but a smart introducion about TCP SYN scanning... # Best regards... :)
Thank you for that link! Unfortunately it makes use of win/libpcap, which has a rather fascist license requirement, which states I must reproduce the copyright information. :grumble: It's on my list though, in case I don't find something else. So, once again, thank you!
-
Thank you for that link! Unfortunately it makes use of win/libpcap, which has a rather fascist license requirement, which states I must reproduce the copyright information. :grumble: It's on my list though, in case I don't find something else. So, once again, thank you!