Ping Implementation in Python
Hi, I was wondering if there was a ping implementation written in Python. I'd rather using a Python module that implements ping in a platform/OS-independent way than rely on the underlying OS, especially as every OS has a different implementation. Furthermore, if you're going to ping a large number of IPs, using a module would probably be a lot faster. Any ideas if such a module exists? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ping Implementation in Python
On Dec 20, 6:13 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Dec 20, 2007 9:41 AM, Mrown <[EMAIL PROTECTED]> wrote: > > > Hi, > > I was wondering if there was a ping implementation written in > > Python. I'd rather using a Python module that implements ping in a > > platform/OS-independent way than rely on the underlying OS, especially > > as every OS has a different implementation. Furthermore, if you're > > going to ping a large number of IPs, using a module would probably be > > a lot faster. Any ideas if such a module exists? Thanks. > > There's no point in having a script that pings things, especially > large numbers of IPs. If you really want to do network scanning other > tools for that already exist. Thanks. Actually, I was more interested in the OS neutral part than in pinging a large number of IPs. Instead, I want to ping a number of IPs (under 10) in an OS/platform independent manner and take the necessary action depending on the results. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ping Implementation in Python
Roger Miller wrote: > On Dec 20, 5:41 am, Mrown <[EMAIL PROTECTED]> wrote: > > Hi, > > I was wondering if there was a ping implementation written in > > Python. > > http://www.gnist.org/~lars/code/ping/ping.html Thanks for your replies. I'll probably start invesigating with Roger's suggestion. Scapy would definitely be able to do the job, but it's a little too much if all I want is to ping the host. Furthermore, to even get it to run on an OS such as Windows, you have to install a number of additional packages (refer to http://trac.secdev.org/scapy/wiki/WindowsInstallationGuide) which will make deployment in an OS/platform neutral way more difficult. -- http://mail.python.org/mailman/listinfo/python-list
subprocess.Popen spawning cmd shells
Hi, I'm currently writing a python program that relies on a CLI program. What I'm currently doing is using subprocess.Popen on Python 2.5.1. Here's the line that I'm currently running: child = subprocess.Popen(["c:\app.exe", node, "-w", str(tmpTime * 1000), '-n', str(1), '-l'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) The problem is that although the above works, a CMD shell is spawned and becomes visible for each time I run the above. I thought that by redircting stdin, stdout and stderr, no CMD shell should pop-up. Is something wrong in the way I'm using subprocess? Thanks for your help. -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess.Popen spawning cmd shells
On Jan 9, 5:17 pm, Mrown <[EMAIL PROTECTED]> wrote: > Hi, > I'm currently writing a python program that relies on a CLI > program. What I'm currently doing is using subprocess.Popen on Python > 2.5.1. Here's the line that I'm currently running: > > child = subprocess.Popen(["c:\app.exe", node, "-w", > str(tmpTime * 1000), '-n', str(1), '-l'], stdin=subprocess.PIPE, > stdout=subprocess.PIPE, stderr=subprocess.PIPE) > > The problem is that although the above works, a CMD shell is spawned > and becomes visible for each time I run the above. I thought that by > redircting stdin, stdout and stderr, no CMD shell should pop-up. Is > something wrong in the way I'm using subprocess? Thanks for your help. To anyone interested, I found the solution by using the CREATE_NO_WINDOW creation flag. So this is what the code now looks like (and it doesn't spawn any shells): CREATE_NO_WINDOW = 0x800 child = subprocess.Popen(["c:\app.exe", node, "-w", str(tmpTime * 1000), '-n', str(1), '-l'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, creationflags = CREATE_NO_WINDOW) -- http://mail.python.org/mailman/listinfo/python-list