program to Ping ip addresses

shawn s desktop_specialist at yahoo.com
Tue Apr 15 10:24:05 EDT 2008


Hi 

I am trying to modify a small program i found off the internet as follows... I can get the 'tracert' to work and it gives me all the info back. However, when i replace the tracert with 'ping',  the commamd prompt shows 'testing' and the script freezes... any suggestions as why it is doing that.

import os
import sys 
xyz = 1

while xyz==1:
    ip = raw_input("command >> ")
    zx = open("log.txt", "a")
    
    if ip.lower()=="exit":
        ask = raw_input("Are you sure you want to exit? (Y\\N) ")
        
        if ask.lower()=="y":
            sys.exit()
        elif ask.lower()=="n":
            print("That's what I thought.")
        else:
            print("Wrong choice. Retard.")
            
    elif ip.lower()=="range":
                stin = raw_input("Enter function: ")
        sec = raw_input("Enter the first 3 sections: ")
        b = raw_input("Enter beginning number: ")
        intb=int(b)
        e = int(raw_input("Enter ending number: "))
        
        while intb<=e:
            print (stin + ' ' + sec + '.' + b )
            z = os.system(stin + ' ' + sec + '.' + b )
            print z
            
            if z==0:
                print(""+str(sec)+"."+str(b)+" is online.")
                zx.write(""+str(sec)+"."+str(b)+" is online.\n")
            elif z==1:
                print("Either "+str(sec)+"."+str(b)+" is offline, or ping request has been blocked.")
                zx.write("Either "+str(sec)+"."+str(b)+" is offline, or ping request has been blocked.\n")

            intb = intb + 1
            b=str(intb)

    else:
        
        print("Wrong choice. Retard.")









      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080415/28c6fbfd/attachment.html>


More information about the Python-list mailing list