470,614 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

Sending ICMP Packets

Hi,

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:
import socket
icmp=socket.getprotobyname('icmp')
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.

Regards,
Andreas
Jul 18 '05 #1
0 2123

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by coder_1024 | last post: by
13 posts views Thread by Bob Rivers | last post: by
reply views Thread by billiejoex | last post: by
7 posts views Thread by D. Patrick | last post: by
9 posts views Thread by Miro | last post: by
6 posts views Thread by White Spirit | last post: by
8 posts views Thread by Thomas Dybdahl Ahle | last post: by
13 posts views Thread by Banupriya06 | last post: by
2 posts views Thread by =?Utf-8?B?R3JlZ0lJ?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.