python raw socket / ping
hankoifi
hak at iki.fi
Fri Apr 12 14:49:12 EDT 2002
Hi
I have been searching for raw socket examples for python.
Main idea is to build something like pathchar or clink with python
(activepython 2.1 , win2k and/or linux). For these i mainly need ICMP
but i also have to incrementally decrease/increase TTL-field in IP
header (like in traceroute). Found these:
1)http://www.python.org/~jeremy/python.html
Very nice packet, includes ping, traceroute etc.
However: made with version 1.4 and doesn't work straight way.
2)ftp://ftp.visi.com/users/mdc/ping.py
Only ping, but works straight with v2.1
3) couple of other ping variants using os.popen()
ping = os.popen('ping -c 3 -i 1 ' + host + ' 2>&1')
data = ping.read()
Number 3) is probably the easiest way to do it, but still
I wonder if somebody has already made revisions for jeremy's packet
for activepython v2.1 or otherwise got it working wit win2k
- hankoifi
More information about the Python-list
mailing list