RE: problem with nc 1.107-4
The manual saying: NC(1) BSD General Commands ManualNC(1) NAME nc — arbitrary TCP and UDP connections and listens SYNOPSIS nc [-46CDdhklnrStUuvz] [-I length] [-i interval] [-O length] [-P proxy_username] [-p source_port] [-s source] [-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port] DESCRIPTION The nc (or netcat) utility is used for just about anything under the sun involving TCP, UDP, or UNIX-domain sockets. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scan‐ ning, and deal with both IPv4 and IPv6. Unlike telnet(1), nc scripts nicely, and separates error messages onto standard error instead of sending them to standard output, as telnet(1) does with some. -u Use UDP instead of the default option of TCP. For UNIX-domain sockets, use a datagram socket instead of a stream socket. If a UNIX-domain socket is used, a temporary receiving socket is cre‐ ated in /tmp unless the -s flag is given. PORT SCANNING It may be useful to know which ports are open and running services on a target machine. The -z flag can be used to tell nc to report open ports, rather than initiate a connection. For example: EXAMPLES Open a UDP connection to port 53 of host.example.com: $ nc -u host.example.com 53 -Original Message- From: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] On Behalf Of David Bala?ic Sent: Thursday, March 30, 2017 10:58 PM To: cygwin@cygwin.com Subject: Re: problem with nc 1.107-4 On 30 March 2017 at 04:24, 高锋 wrote: > I just installed the latest nc 1.107-4 on windows 7 platform.When > lauched the command like: > nc -vuz 10.31.28.188 6110 > ,each time it reported connecting successed,even if the target ip > 10.31.28.188 does not really exists. What exactly does it say? Because with UDP there are no connections, so there can not be any successful connection. Regards, David -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: reply: problem with nc 1.107-4
On 2017-03-30 10:44, Michael Enright wrote: > On Wed, Mar 29, 2017 at 11:28 PM, 高锋 wrote: >> Two days ago, I wanted to determine whether a udp port of another >> machine is open or not, which is deployed on different subnet. But >> Windows platform does not provide utility that can do this. So I >> downloaded a setup.exe from cygwin, of which version is 2.877 (64 >> bit), and I had never used this utility before. > > I tried this command on Debian 8.7. My conclusion is that this didn't > tell me that the UDP port is listened to by another machine. I used > your exact command, which had similarly uninformative results as > yours. There is no 10.31.x.x machine that I can reach, yet 'nc -u' > allowed me to send text to that address and port. Strace of 'nc -uz' > showed that the special -z option (zero i/o port scan) code "sent > successfully" a single byte to the destination, even though it > doesn't exist. > > I conclude that "nc -uz" can't be used to determine unambiguously if > a UDP host is available, because it will succeed even if the host is > not present. And that carries to all systems that use the same 'nc' > utility as Debian or Cygwin. man nc CAVEATS says -uz always reports success and suggests how it could be used. nc is used, instead of a network daemon, as a patient network pipe that can be used to move arbitrary bytes, without having to previously set up direct routes between systems or daemons to handle specific types of connections e.g. if you have sshd set up on a target system, and a route to it, you may do: src $ tar -cf - -C /export/mnt/home . | ssh dest tar -xf - -C /nfs/home with nc if you don't have any direct route to the target or sshd set up still you may do: dest $ nc -dl 9000 | tar -xf - -C /nfs/home inter $ nc -dl 9000 | nc 10.123.456.789 9000 src $ tar -cf - -C /export/mnt/home . | nc 192.168.123.456 9000 -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: reply: problem with nc 1.107-4
Greetings, 高锋! Please don' top-post. Thank you. > Two days ago,i wanted to determine whether a udp port of another machine is > open or not, which is deployed on different subnet. > But windows platform does not provide utility that can dose this.So i > downloaded a setup.exe from cygwin,of which version is 2.877(64 bit),and i > had never use this utility before. UDP protocol is inherently stateless. You can't determine remote port state unless it explicitly reported (i.e. answers to the messages sent on that port). -- With best regards, Andrey Repin Thursday, March 30, 2017 19:36:15 Sorry for my terrible english... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: reply: problem with nc 1.107-4
On Wed, Mar 29, 2017 at 11:28 PM, 高锋 wrote: > Two days ago,i wanted to determine whether a udp port of another machine is > open or not, which is deployed on different subnet. > But windows platform does not provide utility that can dose this.So i > downloaded a setup.exe from cygwin,of which version is 2.877(64 bit),and i > had never use this utility before. I tried this command on Debian 8.7. My conclusion is that this didn't tell me that the UDP port is listened to by another machine. I used your exact command, which had similarly uninformative results as yours. There is no 10.31.x.x machine that I can reach, yet 'nc -u' allowed me to send text to that address and port. Strace of 'nc -uz' showed that the special -z option (zero i/o port scan) code "sent successfully" a single byte to the destination, even though it doesn't exist. I conclude that "nc -uz" can't be used to determine unambiguously if a UDP host is available, because it will succeed even if the host is not present. And that carries to all systems that use the same 'nc' utility as Debian or Cygwin. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: problem with nc 1.107-4
On 30 March 2017 at 04:24, 高锋 wrote: > I just installed the latest nc 1.107-4 on windows 7 platform.When lauched > the command like: > nc -vuz 10.31.28.188 6110 > ,each time it reported connecting successed,even if the target ip > 10.31.28.188 does not really exists. What exactly does it say? Because with UDP there are no connections, so there can not be any successful connection. Regards, David -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
reply: problem with nc 1.107-4
Two days ago,i wanted to determine whether a udp port of another machine is open or not, which is deployed on different subnet. But windows platform does not provide utility that can dose this.So i downloaded a setup.exe from cygwin,of which version is 2.877(64 bit),and i had never use this utility before. -邮件原件- 发件人: cygwin-ow...@cygwin.com [mailto:cygwin-ow...@cygwin.com] 代表 Michael Enright 发送时间: 2017年3月30日 12:30 收件人: cygwin@cygwin.com 主题: Re: problem with nc 1.107-4 On Wed, Mar 29, 2017 at 7:24 PM, 高锋 wrote: > I just installed the latest nc 1.107-4 on windows 7 platform.When > lauched the command like: > nc -vuz 10.31.28.188 6110 > ,each time it reported connecting successed,even if the target ip > 10.31.28.188 does not really exists. > Could someone tell what wrong with me? > It's possible that you are accustomed to using, or using a script written for, the 'nc' command that was included in the 'netcat' package, which was superceded in Cygwin some years ago. This could have happened if you were using Cygwin 1.7 (I think) and then upgraded to a brand new version of Cygwin. It is common, in my experience, that someone would have installed an old version of Cygwin, used it for years, and then upgraded to a new version. Message from Vinschen about this change: https://cygwin.com/ml/cygwin-announce/2012-05/msg00015.html -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: problem with nc 1.107-4
On Wed, Mar 29, 2017 at 7:24 PM, 高锋 wrote: > I just installed the latest nc 1.107-4 on windows 7 platform.When lauched > the command like: > nc -vuz 10.31.28.188 6110 > ,each time it reported connecting successed,even if the target ip > 10.31.28.188 does not really exists. > Could someone tell what wrong with me? > It's possible that you are accustomed to using, or using a script written for, the 'nc' command that was included in the 'netcat' package, which was superceded in Cygwin some years ago. This could have happened if you were using Cygwin 1.7 (I think) and then upgraded to a brand new version of Cygwin. It is common, in my experience, that someone would have installed an old version of Cygwin, used it for years, and then upgraded to a new version. Message from Vinschen about this change: https://cygwin.com/ml/cygwin-announce/2012-05/msg00015.html -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
problem with nc 1.107-4
I just installed the latest nc 1.107-4 on windows 7 platform.When lauched the command like: nc -vuz 10.31.28.188 6110 ,each time it reported connecting successed,even if the target ip 10.31.28.188 does not really exists. Could someone tell what wrong with me? -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple