Re: nc missing option -z

2016-11-02 Thread Cameron Simpson
On 15Feb2013 08:48, Cameron Simpson wrote: On 13Feb2013 16:03, Suvayu Ali wrote: | I know about redirection, but was not aware that I could also open | sockets! Thanks a lot for the nice explanation, I'll read up more. Unless bash has even more weirdness in it than I thought, the redirection

Re: nc missing option -z

2013-02-14 Thread Cameron Simpson
On 13Feb2013 16:03, Suvayu Ali wrote: | I know about redirection, but was not aware that I could also open | sockets! Thanks a lot for the nice explanation, I'll read up more. Unless bash has even more weirdness in it than I thought, the redirection is probably relying on a Linuxism to open a po

Re: nc missing option -z

2013-02-14 Thread Cameron Simpson
On 13Feb2013 09:36, James Hogarth wrote: | > That prints all the existing connections and sockets. | > -rn prints the routing table. | > | and neither has anything to do with the OPs query... The OP, Suvayu Ali, had as part of his query "or if I have internet connection ... What can I use as rep

Re: nc missing option -z

2013-02-14 Thread Cameron Simpson
On 13Feb2013 08:02, Patrick O'Callaghan wrote: | On Wed, 2013-02-13 at 20:31 +1100, Cameron Simpson wrote: | > On 13Feb2013 01:06, Patrick O'Callaghan wrote: | > | On Wed, 2013-02-13 at 14:40 +1100, Cameron Simpson wrote: | > | > If I want to know if I have an internet connection I look for a | >

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 10:43 PM, inode0 wrote: > On Wed, Feb 13, 2013 at 7:57 AM, Ed Greshko wrote: >> One thing of interest to note but which may not affect what the OP is >> doing >> >> If the port being tested is listed as "filtered" by nmap >> >> [egreshko@meimei ~]$ nmap -Pn -p143 imap.gmail.com

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
Hi John, On Wed, Feb 13, 2013 at 07:44:56AM -0600, inode0 wrote: > On Wed, Feb 13, 2013 at 3:12 AM, Suvayu Ali > wrote: > > On Tue, Feb 12, 2013 at 08:37:27PM -0600, inode0 wrote: > >> > >> Something like this perhaps. > >> > >> $ 2>/dev/null >/dev/tcp/imap.gmail.com/993 && sync-my-email.sh > >

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
On Wed, Feb 13, 2013 at 02:11:09PM +, Bill Oliver wrote: > On Wed, 13 Feb 2013, Ed Greshko wrote: > >On 02/13/2013 06:24 PM, Suvayu Ali wrote: > >> > >>Installing anything is out of the question since I do not have admin > >>rights in any of these other machines. > >> > >>I guess checking for i

Re: nc missing option -z

2013-02-13 Thread inode0
On Wed, Feb 13, 2013 at 7:57 AM, Ed Greshko wrote: > One thing of interest to note but which may not affect what the OP is > doing > > If the port being tested is listed as "filtered" by nmap > > [egreshko@meimei ~]$ nmap -Pn -p143 imap.gmail.com > > Starting Nmap 6.01 ( http://nmap.org ) at

Re: nc missing option -z

2013-02-13 Thread Bill Oliver
I'm a little hesitant to chime in, since I screwed up last time, but that brings up a question. In reading this thread, my first thought was "Well, if this guy wants GNU netcat, why not just download GNU netcat?" Just for giggles, I dowloaded and compiled it from sourceforge, and it seems to wo

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 09:57 PM, Ed Greshko wrote: > will hang for quite some time Forgot to add The same holds true if the host is down. -- Don't be bullied by the judgmental grammar and spelling police. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 09:44 PM, inode0 wrote: > On Wed, Feb 13, 2013 at 3:12 AM, Suvayu Ali > wrote: >> Hi John, >> >> On Tue, Feb 12, 2013 at 08:37:27PM -0600, inode0 wrote: >>> Something like this perhaps. >>> >>> $ 2>/dev/null >/dev/tcp/imap.gmail.com/993 && sync-my-email.sh >> This works, but I don't

Re: nc missing option -z

2013-02-13 Thread inode0
On Wed, Feb 13, 2013 at 3:12 AM, Suvayu Ali wrote: > Hi John, > > On Tue, Feb 12, 2013 at 08:37:27PM -0600, inode0 wrote: >> >> Something like this perhaps. >> >> $ 2>/dev/null >/dev/tcp/imap.gmail.com/993 && sync-my-email.sh > > This works, but I don't think I understand it. Could you please > e

Re: nc missing option -z

2013-02-13 Thread Patrick O'Callaghan
On Wed, 2013-02-13 at 20:31 +1100, Cameron Simpson wrote: > On 13Feb2013 01:06, Patrick O'Callaghan wrote: > | On Wed, 2013-02-13 at 14:40 +1100, Cameron Simpson wrote: > | > If I want to know if I have an internet connection I look for a > | > default > | > route in the output of "netstat -an", t

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 06:24 PM, Suvayu Ali wrote: > Installing anything is out of the question since I do not have admin > rights in any of these other machines. > > I guess checking for installed packages is the only option left now. It is *not* out of the question. tcping doesn't need system privileges

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
On Wed, Feb 13, 2013 at 10:10:47AM +, James Hogarth wrote: > > > > I would use tcping too, if it were available on these other systems I > > expect my scripts to run on. > > > > Thanks for spotting my dumb mistake in the parsing. > > > > > > > Are you sure nmap is on all these systems? It quite

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> > I would use tcping too, if it were available on these other systems I > expect my scripts to run on. > > Thanks for spotting my dumb mistake in the parsing. > > > Are you sure nmap is on all these systems? It quite often isn't (not a default package anyway) for security reasons (no need to make

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
Hi Ed, On Wed, Feb 13, 2013 at 05:55:53PM +0800, Ed Greshko wrote: > On 02/13/2013 05:47 PM, James Hogarth wrote: > > > I still prefer tcping since there is no need to grep or awk anything. > Or worry about text being changed in a later release. Just rely on > exit status. > I would use tcping

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> > My point being, grepping for "Host is up" doesn't fill the bill. You're > saying what I saidjust differently. > > I still prefer tcping since there is no need to grep or awk anything. Or > worry about text being changed in a later release. Just rely on exit > status. > > > Ah I agree on

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
Hi Ed and James, On Wed, Feb 13, 2013 at 09:45:05AM +, James Hogarth wrote: > > $ nmap -Pn -p993 imap.gmail.com |& grep -q 'Host is up' && { ... } > > > > And of course someday the printed text will change and I'll have to edit > > my scripts again! Oh well. :-/ > > > > > Host is up woul

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 05:47 PM, James Hogarth wrote: > > > > And you still get "Host is up" but, of course, the service you want > isn't > > > Err read the man page? -Pn assumes the host is up (skips the initial ping in > case something drops that when you are interested in a port) so it will say

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> And you still get "Host is up" but, of course, the service you want > isn't > > > Err read the man page? -Pn assumes the host is up (skips the initial ping in case something drops that when you are interested in a port) so it will say the host is up in that case - but we don't care about the

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> $ nmap -Pn -p993 imap.gmail.com |& grep -q 'Host is up' && { ... } > > And of course someday the printed text will change and I'll have to edit > my scripts again! Oh well. :-/ > Host is up wouldn't be right - you need to parse to see if the port is listed as open or closed... Something li

Re: nc missing option -z

2013-02-13 Thread Ed Greshko
On 02/13/2013 05:37 PM, Suvayu Ali wrote: > On Wed, Feb 13, 2013 at 10:18:44AM +0100, Suvayu Ali wrote: >> On Wed, Feb 13, 2013 at 08:45:39AM +, James Hogarth wrote: >>> The other alternative to tcping is nmap ... >>> >>> nmap -Pn -p993 imap.gmail.com >> I guess switching to nmap might resolve

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> Thanks a lot! I had a suspicion the issue was something like this. > This is extremely inconvenient though, since now I have to change quite > a few scripts, more importantly now I also have to figure out the > machine my script is running on (e.g. laptop or institutes servers). > > I guess swit

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
On Wed, Feb 13, 2013 at 10:18:44AM +0100, Suvayu Ali wrote: > On Wed, Feb 13, 2013 at 08:45:39AM +, James Hogarth wrote: > > > > The other alternative to tcping is nmap ... > > > > nmap -Pn -p993 imap.gmail.com > > I guess switching to nmap might resolve the second issue. > This presents a

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> That prints all the existing connections and sockets. > -rn prints the routing table. > > and neither has anything to do with the OPs query... -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users

Re: nc missing option -z

2013-02-13 Thread Cameron Simpson
On 13Feb2013 01:06, Patrick O'Callaghan wrote: | On Wed, 2013-02-13 at 14:40 +1100, Cameron Simpson wrote: | > If I want to know if I have an internet connection I look for a | > default | > route in the output of "netstat -an", thus: | > | > netstat -rn | egrep '\''^(default|0\.0\.0\.0) +[1-9]

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
Hi James, On Wed, Feb 13, 2013 at 08:45:39AM +, James Hogarth wrote: > > Or, will less zeros > > > > tcping -t 1 imap.gmail.com 993:-) :-) > > > > -- > > > > Specifically what's going on here is that fedora netcat is not the old > netcat you know. > > A little while back (I don't re

Re: nc missing option -z

2013-02-13 Thread Suvayu Ali
Hi John, On Tue, Feb 12, 2013 at 08:37:27PM -0600, inode0 wrote: > > Something like this perhaps. > > $ 2>/dev/null >/dev/tcp/imap.gmail.com/993 && sync-my-email.sh This works, but I don't think I understand it. Could you please explain? Thanks, -- Suvayu Open source is the future. It sets

Re: nc missing option -z

2013-02-13 Thread James Hogarth
> Or, will less zeros > > tcping -t 1 imap.gmail.com 993:-) :-) > > -- > Specifically what's going on here is that fedora netcat is not the old netcat you know. A little while back (I don't remember which release) it was replaced by nmap netcat (ncat): [root@server ~]# rpm -qf /usr/bin/

Re: nc missing option -z

2013-02-12 Thread Ed Greshko
On 02/13/2013 10:51 AM, Ed Greshko wrote: > tu 100 imap.gmail.com 993 && sync-my-email.sh Or, will less zeros tcping -t 1 imap.gmail.com 993:-) :-) -- Don't be bullied by the judgmental grammar and spelling police. -- users mailing list users@lists.fedoraproject.org To unsubscribe

Re: nc missing option -z

2013-02-12 Thread Patrick O'Callaghan
On Wed, 2013-02-13 at 14:40 +1100, Cameron Simpson wrote: > If I want to know if I have an internet connection I look for a > default > route in the output of "netstat -an", thus: > > netstat -rn | egrep '\''^(default|0\.0\.0\.0) +[1-9]'\'' >/dev/null netstat -an ... poc -- users mailing lis

Re: nc missing option -z

2013-02-12 Thread Cameron Simpson
On 13Feb2013 03:21, Suvayu Ali wrote: | I used to use netcat to check if a particular host is up or if I have | internet connection before I run a few scripts. [...] | Any ideas what happened to it? What can I use as replacement? If I want to know if I have an internet connection I look for a de

Re: nc missing option -z

2013-02-12 Thread Ed Greshko
On 02/13/2013 10:21 AM, Suvayu Ali wrote: > Hi, > > I used to use netcat to check if a particular host is up or if I have > internet connection before I run a few scripts. I would use the -z > option in particular. But now I see that has been removed: > > $ nc -z imap.gmail.com 993 && sync-my-e

Re: nc missing option -z

2013-02-12 Thread inode0
On Tue, Feb 12, 2013 at 8:21 PM, Suvayu Ali wrote: > Hi, > > I used to use netcat to check if a particular host is up or if I have > internet connection before I run a few scripts. I would use the -z > option in particular. But now I see that has been removed: > > $ nc -z imap.gmail.com 993 &&

nc missing option -z

2013-02-12 Thread Suvayu Ali
Hi, I used to use netcat to check if a particular host is up or if I have internet connection before I run a few scripts. I would use the -z option in particular. But now I see that has been removed: $ nc -z imap.gmail.com 993 && sync-my-email.sh ncat: invalid option -- 'z' Here is the exc