Sending ICMP Packets
python-list at qbcon.com
Tue Mar 23 15:24:49 CET 2004
I'd like to generate my own icmp packets from within python.
Typically this would include sending an ECHO_REQUEST and checking if I get
an ECHO_REPLY back. But I would also like to send/receive other icmp
types, like timestamp and timestamp replies.
At the moment I'm playing with the socket module:
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp)
My "s" object has a sendto() method which accepts a string and an address
(according to the socket docs), but I'm not sure what the value of the
string should be.
Does anyone have some simple example code that will ping a host?
This is part of some firewall tests that I'm writing as unit tests, so if
anyone knows of tools out there that can help with firewall testing I'd
appreciate that aswell.
More information about the Python-list