Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33467 > unrolled thread

Python Script for Colorizing Traceroute Output

Started byJordan Bylsma <jordan.bylsma1@gmail.com>
First post2012-11-17 07:04 -0800
Last post2012-11-17 11:59 -0800
Articles 11 — 6 participants

Back to article view | Back to comp.lang.python


Contents

  Python Script for Colorizing Traceroute Output Jordan Bylsma <jordan.bylsma1@gmail.com> - 2012-11-17 07:04 -0800
    Re: Python Script for Colorizing Traceroute Output garabik-news-2005-05@kassiopeia.juls.savba.sk - 2012-11-17 15:18 +0000
    Re: Python Script for Colorizing Traceroute Output wrw@mac.com - 2012-11-17 12:06 -0500
    Re: Python Script for Colorizing Traceroute Output (apologies for top-post) wrw@mac.com - 2012-11-17 12:07 -0500
      Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Roy Smith <roy@panix.com> - 2012-11-17 13:38 -0500
        Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Chris Angelico <rosuav@gmail.com> - 2012-11-18 05:45 +1100
          Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Jordan Bylsma <jordan.bylsma1@gmail.com> - 2012-11-17 11:59 -0800
            Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Chris Angelico <rosuav@gmail.com> - 2012-11-18 09:00 +1100
              Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-18 01:18 +0000
                Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Chris Angelico <rosuav@gmail.com> - 2012-11-18 12:27 +1100
          Re: Python Script for Colorizing Traceroute Output (apologies for top-post) Jordan Bylsma <jordan.bylsma1@gmail.com> - 2012-11-17 11:59 -0800

#33467 — Python Script for Colorizing Traceroute Output

FromJordan Bylsma <jordan.bylsma1@gmail.com>
Date2012-11-17 07:04 -0800
SubjectPython Script for Colorizing Traceroute Output
Message-ID<6ea528f6-e4c2-4da9-a011-d81f13b83d28@googlegroups.com>
I'm looking into writing a python script that colorizes particular hops when using traceroute. Anyone run across something like this? I don't think it would be extremely difficult to write but some example code would help.

Basically particular hops in traceroute output would match a table as either a router, firewall or layer 3 switch and be colorized accordingly. 

[toc] | [next] | [standalone]


#33468

Fromgarabik-news-2005-05@kassiopeia.juls.savba.sk
Date2012-11-17 15:18 +0000
Message-ID<k889t0$g2p$2@speranza.aioe.org>
In reply to#33467
Jordan Bylsma <jordan.bylsma1@gmail.com> wrote:
> I'm looking into writing a python script that colorizes particular
> hops when using traceroute. Anyone run across something like this? I
> don't think it would be extremely difficult to write but some example
> code would help.
> 

<shameless self-advertising>
Generic Colouriser
http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
</shameless self-advertising>

It includes configuration file for traceroute.

-- 
 -----------------------------------------------------------
| Radovan GarabĂ­k http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__    garabik @ kassiopeia.juls.savba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!

[toc] | [prev] | [next] | [standalone]


#33474

Fromwrw@mac.com
Date2012-11-17 12:06 -0500
Message-ID<mailman.3773.1353175585.27098.python-list@python.org>
In reply to#33467
Don't forget that most firewalls don't decrement) the time-to-live number, and unless you REALLY know what to look for, are invisible.

-Bill

On Nov 17, 2012, at 10:04 AM, Jordan Bylsma <jordan.bylsma1@gmail.com> wrote:

> I'm looking into writing a python script that colorizes particular hops when using traceroute. Anyone run across something like this? I don't think it would be extremely difficult to write but some example code would help.
> 
> Basically particular hops in traceroute output would match a table as either a router, firewall or layer 3 switch and be colorized accordingly. 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#33475 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

Fromwrw@mac.com
Date2012-11-17 12:07 -0500
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<mailman.3774.1353175657.27098.python-list@python.org>
In reply to#33467
On Nov 17, 2012, at 10:04 AM, Jordan Bylsma <jordan.bylsma1@gmail.com> wrote:

> I'm looking into writing a python script that colorizes particular hops when using traceroute. Anyone run across something like this? I don't think it would be extremely difficult to write but some example code would help.
> 
> Basically particular hops in traceroute output would match a table as either a router, firewall or layer 3 switch and be colorized accordingly. 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Don't forget that most firewalls don't decrement) the time-to-live number, and unless you REALLY know what to look for, are invisible.

-Bill

[toc] | [prev] | [next] | [standalone]


#33479 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromRoy Smith <roy@panix.com>
Date2012-11-17 13:38 -0500
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<roy-EFAEEF.13385317112012@news.panix.com>
In reply to#33475
In article <mailman.3774.1353175657.27098.python-list@python.org>,
 wrw@mac.com wrote:

> On Nov 17, 2012, at 10:04 AM, Jordan Bylsma <jordan.bylsma1@gmail.com> wrote:
> 
> > I'm looking into writing a python script that colorizes particular hops 
> > when using traceroute. Anyone run across something like this? I don't think 
> > it would be extremely difficult to write but some example code would help.
> > 
> > Basically particular hops in traceroute output would match a table as 
> > either a router, firewall or layer 3 switch and be colorized accordingly. 
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> Don't forget that most firewalls don't decrement) the time-to-live number, 
> and unless you REALLY know what to look for, are invisible.

Interesting.  If the firewall doesn't decrement TTL (a particular nasty 
thing to do, and thus completely expected of a firewall) what REALLY 
knowledge would enable you to detect its presence in a traceroute 
printout at all?

[toc] | [prev] | [next] | [standalone]


#33480 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromChris Angelico <rosuav@gmail.com>
Date2012-11-18 05:45 +1100
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<mailman.3778.1353177966.27098.python-list@python.org>
In reply to#33479
On Sun, Nov 18, 2012 at 5:38 AM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.3774.1353175657.27098.python-list@python.org>,
>  wrw@mac.com wrote:
>> Don't forget that most firewalls don't decrement) the time-to-live number,
>> and unless you REALLY know what to look for, are invisible.
>
> Interesting.  If the firewall doesn't decrement TTL (a particular nasty
> thing to do, and thus completely expected of a firewall) what REALLY
> knowledge would enable you to detect its presence in a traceroute
> printout at all?

If it's a router, then it definitely should be decrementing TTLs,
though if the firewall is simply a part of another hop, you won't
notice it specifically. What's more common, though, is devices that
decrement TTL and drop packets but don't send back Time Exceeded
messages, giving the classic "* * *" line. I'm not sure if that's what
was being referred to, though. (And they aren't necessarily
firewalls.)

ChrisA

[toc] | [prev] | [next] | [standalone]


#33482 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromJordan Bylsma <jordan.bylsma1@gmail.com>
Date2012-11-17 11:59 -0800
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<c5f40ace-71eb-4e02-a400-1cfb88543e66@googlegroups.com>
In reply to#33480
For this case the firewalls DO respond to TTL(in most cases) and will show in a traceroute. The objective here is to colorize particular devices to easily see what type of devices traffic would traverse across the network. I would be using a database of device hostnames that when they match in traceroute they would be printed a particular color. Something like router=green, layer 3 switch yellow, and firewall red. I'm just looking for a basic script to accomplish this. Nothing too fancy. 

[toc] | [prev] | [next] | [standalone]


#33486 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromChris Angelico <rosuav@gmail.com>
Date2012-11-18 09:00 +1100
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<mailman.3782.1353189613.27098.python-list@python.org>
In reply to#33482
On Sun, Nov 18, 2012 at 6:59 AM, Jordan Bylsma <jordan.bylsma1@gmail.com> wrote:
> For this case the firewalls DO respond to TTL(in most cases) and will show in a traceroute. The objective here is to colorize particular devices to easily see what type of devices traffic would traverse across the network. I would be using a database of device hostnames that when they match in traceroute they would be printed a particular color. Something like router=green, layer 3 switch yellow, and firewall red. I'm just looking for a basic script to accomplish this. Nothing too fancy.

Sounds like the previously-mentioned Generic Colo(u)?ri(s|z)er (and
yes, its README says exactly that) could do that for you. You'd need
to craft a regexp to identify each hostname set, rather than using a
database, but it shouldn't be difficult to write a script to create
grc's config file.

I've never used the program, though, so I have no idea how good it is.
All I've done is download the tar.gz and glance over a few bits (the
licence, mainly - which is mostly-GPL).

By the way, you may wish to consider identifying your devices by IP
address rather than hostname. If your IPs are stable and readable, you
could save yourself the delays of reverse DNS lookups by simply
colorizing the IPs.

ChrisA

[toc] | [prev] | [next] | [standalone]


#33487 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-11-18 01:18 +0000
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<50a8376f$0$29978$c3e8da3$5496439d@news.astraweb.com>
In reply to#33486
On Sun, 18 Nov 2012 09:00:10 +1100, Chris Angelico wrote:

[...]
> I've never used the program, though, so I have no idea how good it is.
> All I've done is download the tar.gz and glance over a few bits (the
> licence, mainly - which is mostly-GPL).

"Mostly" GPL? You mean "not GPL".

I really wish people wouldn't invent their own licences. It adds 
complexity and confusion to the licencing space. Unless you're a lawyer, 
and sometimes even if you are a lawyer, any modification you make to an 
established licence could be invalid, or possibly even invalidate the 
entire licence.

Licence proliferation hurts us all. Just say No.

http://en.wikipedia.org/wiki/License_proliferation



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#33488 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromChris Angelico <rosuav@gmail.com>
Date2012-11-18 12:27 +1100
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<mailman.3783.1353202025.27098.python-list@python.org>
In reply to#33487
On Sun, Nov 18, 2012 at 12:18 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sun, 18 Nov 2012 09:00:10 +1100, Chris Angelico wrote:
>
> [...]
>> I've never used the program, though, so I have no idea how good it is.
>> All I've done is download the tar.gz and glance over a few bits (the
>> licence, mainly - which is mostly-GPL).
>
> "Mostly" GPL? You mean "not GPL".
>
> I really wish people wouldn't invent their own licences. It adds
> complexity and confusion to the licencing space. Unless you're a lawyer,
> and sometimes even if you are a lawyer, any modification you make to an
> established licence could be invalid, or possibly even invalidate the
> entire licence.
>
> Licence proliferation hurts us all. Just say No.
>
> http://en.wikipedia.org/wiki/License_proliferation

The wording in the file does permit you to use it under the exact
terms of the GPL (though no version is specified). But I agree, we
should stick to a handful of well-known licenses and be done with it.
I like the BSD two-clause, myself, less wordy than the GPL.

ChrisA

[toc] | [prev] | [next] | [standalone]


#33483 — Re: Python Script for Colorizing Traceroute Output (apologies for top-post)

FromJordan Bylsma <jordan.bylsma1@gmail.com>
Date2012-11-17 11:59 -0800
SubjectRe: Python Script for Colorizing Traceroute Output (apologies for top-post)
Message-ID<mailman.3779.1353182360.27098.python-list@python.org>
In reply to#33480
For this case the firewalls DO respond to TTL(in most cases) and will show in a traceroute. The objective here is to colorize particular devices to easily see what type of devices traffic would traverse across the network. I would be using a database of device hostnames that when they match in traceroute they would be printed a particular color. Something like router=green, layer 3 switch yellow, and firewall red. I'm just looking for a basic script to accomplish this. Nothing too fancy. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web