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

Home Posts Topics Members FAQ

Re: Python script for tracert

En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <ma*******@gmai l.com>
escribió:
Hello.. I'm trying to do a scripting for tracert in windows using
python...
I'm using popen(), but it displays only after the tracert is completed. i
want the results to be displayed for every route.

can anyone help me in this..
Use the subprocess module:

import subprocess
host = 'www.microsoft. com'
p = subprocess.Pope n(["tracert", '-d', '-w', '100', host],
stdout=subproce ss.PIPE, stderr=subproce ss.STDOUT)
while True:
line = p.stdout.readli ne()
if not line: break
print '-->',line,
p.wait()

--
Gabriel Genellina

Sep 30 '08 #1
1 4845
Hi,

I wrote small python only script for tcptraceroute some time ago.
This works without a subprocess:

http://www.thomas-guettler.de/script...ceroute.py.txt

Gabriel Genellina schrieb:
En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <ma*******@gmai l.com>
escribió:
>Hello.. I'm trying to do a scripting for tracert in windows using
python...
I'm using popen(), but it displays only after the tracert is completed. i
want the results to be displayed for every route.

can anyone help me in this..

Use the subprocess module:

import subprocess
host = 'www.microsoft. com'
p = subprocess.Pope n(["tracert", '-d', '-w', '100', host],
stdout=subproce ss.PIPE, stderr=subproce ss.STDOUT)
while True:
line = p.stdout.readli ne()
if not line: break
print '-->',line,
p.wait()

--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
Oct 1 '08 #2

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

Similar topics

28
4601
by: Erik Johnson | last post by:
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather cool language. I've done Perl and like it, there are a few features of PHP I like but overall am not too excited about it. I have found PHP's strtotime() function to be quite flexible and handy and we make liberal use of it. I have not yet really...
1
4807
by: carramba | last post by:
Hi! Iam runing php on win32.. and Iam wondering if there is enyposibility to run tracert in php? if yes how should I do it? -- just keep swiming
1
2206
by: Paul Bergson | last post by:
I need to code a tracert function from an asp page. I can write some asp but I'm saddled with notepad as my development suite. Any pointers on getting a tracert type function from within asp? -- Thanks
4
12211
by: Just D. | last post by:
We all know that we can use TRACERT as a standalone application in Windows to get a whole way of IP nodes to go through. I need to implement almost same feature from my own application. What's the easiest way to do that? The idea is to enter the remote address or URL and call some method to get a full trace between two machines in the form like: 111.111.111;222.222.222;333.333.333 Is it already done by somebody or maybe we have some...
2
2347
by: Kishan Hathiwala | last post by:
how do i make tracert command in .net without using 3rd party software?
2
4044
by: Adrian | last post by:
Hi I need a VB dotnet ping and tracert GUI utility written in VB.net 2003 (not 2005). I was sure there would have been many working examples for ping but I cannot find any :( I was hoping to find one I could just add to my app as there is no point in reinventing the wheel! I could live without the tracert, but I do need it to run from a windows form.
2
3394
by: whitethomas12 | last post by:
Hi, I am kind of stuck on a project and I need some help with creating a VB.NET (Visual Studios 2008) application to do traceroute. I have looked all over the web and I cannot find anything really useful. Can some one please post some sample code so I can view it. Once I have an I dea of how to do it then I can simply add it to the rest of my code.
0
1266
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me find a way that I can used my code to run tracert on mutiple instances at the same time. The following is my current code.
2
2021
by: whitethomas12 | last post by:
Hi, I currently have some basic code that allows me to run the tracert command through VB.NET and it also updates my database based on the results. I was wondering if someone can help me find a way that I can used my code to run tracert on mutiple instances at the same time. The following is my current code.
0
8231
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
8168
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8614
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7153
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...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4075
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
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.