By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,764 Members | 1,389 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,764 IT Pros & Developers. It's quick & easy.

Sending ICMP Packets

P: n/a

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
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.

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.