Re: program to Ping ip addresses

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nick Stinemates

    Re: program to Ping ip addresses

    On Tue, Apr 15, 2008 at 07:24:05AM -0700, shawn s wrote:
    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("comm and >")
    zx = open("log.txt", "a")
    >
    if ip.lower()=="ex it":
    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()=="ra nge":
    stin = raw_input("Ente r function: ")
    sec = raw_input("Ente r the first 3 sections: ")
    b = raw_input("Ente r 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(se c)+"."+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("Eithe r "+str(sec)+"."+ str(b)+" is offline, or ping request has been blocked.\n")
    >
    intb = intb + 1
    b=str(intb)
    >
    else:
    >
    print("Wrong choice. Retard.")
    >
    I love that you call the users of your app retards :) That rocks!

    ping runs forever. tracert doesnt.
    try:
    ping -w 5

    --
    Nick Stinemates (nick@stinemate s.org)

Working...