473,624 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 (ni**@stinemate s.org)
http://nick.stinemates.org
Jun 27 '08 #1
0 1283

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8401
by: Sean Cody | last post by:
Does anyone know of an ping module that will work with Windows? I'm currently using os.popen("ping -n1 host") but it's terribly slow when using it a few hundred times. After enumerating my domain of machines I'm trying to ping them to determine if they are active before connecting to them via WMI (which takes forever to timeout). --
8
4364
by: DCK | last post by:
Hello :) Into group-archive i found most e-mails, which touches PINGing. In my work i've used TELNET for testing if host is operational. Sometimes, for unknown reasons, workstation doesn't respond for PINGing. But in WinNT network, all hosts has a nbsession listening on port 139. I always use this script instead PING command (hope, will be usefull for someone :) ):
1
29980
by: gallaczmit | last post by:
Will this code give me a true view of a computer's status? All I am looking for is to see if the computer is reachable or not. My end goal is to get a list of IP addresses from a MS SQL Server, see if the IP is reachable(if yes I will assume the pc is operational), update the database with the result and generate a web page displaying the results. I am using port 135 because I have an all windows network and this port should be open...
2
5179
by: Vitali Gontsharuk | last post by:
Hi! I have a problem programming a simple client-server game, which is called pingpong ;-) The final program will first be started as a server (nr. 2) and then as a client. The client then sends the message "Ping" to the server, which reads it and answers with a "Pong". The game is really simple and the coding should be also very simple! But for me it isn't. By the way, the program uses datagram sockets (UDP). And, I'm using
5
5578
by: Deepak | last post by:
I am programing a ping application which pings various centers . I used timer loop and it pings one by one. Now when i finish pinging one center it should wait for the ping_completed function to be executed and then continue pinging another certer. The ping_completed function is called on completion of ping by the os and i have no control on it .
7
6538
by: Linus Cohen | last post by:
Hi all, I'm a newbie to python and programming in general, so I wanted a simple project to start off. What I'm trying to do here is write a python command-line ping program, much like the Unix and Windows ping programs. I've got this much worked out already: class ping def PING(IP, pings, size): and that's where I stop, because I realize I have no idea how to make
2
1749
by: airwot4 | last post by:
I've been using ADSI to lookup a complete hostname from active directory from a partial as part of a script. It goes something like: Retrieve partial hostname from excel spreadsheet - authenticate this to a full hostname from active directory - ping the host to determine if it is reachable - if reachable perform a task. The difficult is at the ping stage, some of the hostnames on active
1
2715
by: Mauro \Baba\ Mascia | last post by:
Hi, this is my question: I want to know if several switch (about 50) in a big lan are up and then know their MAC addresses to do a list that contains host name, ip and mac. I know only the range of their IP addresses (the host name it's simply to know using socket.gethostn. The first idea it's to ping all ip, parse the response and then execute the command "arp -a" and parse the response. However this way depends on the operating...
5
2315
by: SyGC | last post by:
Greetings All, I have established a working Remote Connection to a MySQL DB using ODBC which allows me to select data in a Datagridview in my Form. The data is a list of IP addresses. What i want to do is take each IP address, parse it to My.Computer.Network.Ping if the result returns false then the IP address is diaplayed in a TextBox1. If the result is true then the IP address is either disgarded or displayed in another TextBox field. ...
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.