We needed a tool which could
measure the number of hops to reach a remote host.
We wanted to call this script from a grid job, so we had the following constraints:
- The tool must use TCP (because UDP is often blocked by firewalls)
- The tool must work when run by an unpriviledged user
- The tool should be written in an OS-independent language
- The tool should be reasonably fast
The resulting python script is composed of two files, in order to make it faster (because this way the second file which contains most of the code is compiled into bytecode at the first call, and the following calls are faster). They are available
here and
here.
In order to use this tool, download these files, rename them to "counthops.py" and "counthops_lib.py" (the .txt was appended for security reason), make "counthops.py" executable, and run it by:
./counthops.py < remote_host > < remote_port >
where < remote_port > should be a TCP port known to be open and accessible on the < remote_host >.
For example:
./counthops.py www.google.fr 80
or
./counthops.py ce-ipv6-testbed.paris.urec.cnrs.fr 2811
--
EtienneDUBLE - 14 May 2009