What would I have to do in order to be able to send an ARP Ping or a
regular ICMP_ECHO_REQUEST in Ruby? Is it possible?
···
--
Posted via http://www.ruby-forum.com/.
What would I have to do in order to be able to send an ARP Ping or a
regular ICMP_ECHO_REQUEST in Ruby? Is it possible?
--
Posted via http://www.ruby-forum.com/.
Ruby Rubyruby wrote:
What would I have to do in order to be able to send an ARP Ping or a
regular ICMP_ECHO_REQUEST in Ruby? Is it possible?
require 'ping'
Ping.pingecho('example.com')
or
system('ping -c1 www.example.com')
--
Posted via http://www.ruby-forum.com/\.
require 'net/ping'
include Net
icmp = Ping::ICMP.new('foo.com')
if icmp.ping?
# Successful
else
# Failed
end
gem install net-ping
Regards,
Dan
On Aug 10, 8:42 am, Ruby Rubyruby <netwer...@yahoo.com> wrote:
What would I have to do in order to be able to send an ARP Ping or a
regular ICMP_ECHO_REQUEST in Ruby? Is it possible?
pingecho() uses a TCP echo (_not_ an ICMP echo) to determine if the
remote host is reachable. This is usually adequate to tell that a remote
host is available to rsh(1), ftp(1), or telnet(1) to.
So the standard library may be sufficient, but not necessarily so.
In addition to the above, you can also try the net/ping from rubyforge, or
possibly even rubyforger to craft your own ARP or ICMP packets.
HTH,
Felix
-----Original Message-----
From: list-bounce@example.com
[mailto:list-bounce@example.com] On Behalf Of Klodus Klodus
Sent: Friday, August 10, 2007 3:20 PM
To: ruby-talk ML
Subject: Re: ARP Ping and ICMP in Ruby?Ruby Rubyruby wrote:
> What would I have to do in order to be able to send an ARP
Ping or a
> regular ICMP_ECHO_REQUEST in Ruby? Is it possible?require 'ping'
Ping.pingecho('example.com')
or
system('ping -c1 www.example.com')
--
Posted via http://www.ruby-forum.com/\.
Ruby Rubyruby wrote:
> What would I have to do in order to be able to send an ARP Ping or a
> regular ICMP_ECHO_REQUEST in Ruby? Is it possible?require 'ping'
Ping.pingecho('example.com')
Unfortunately, this isn't a 'ICMP_ECHO_REQUEST', it's an attempt to connect
to the remote machine on the 'echo' port. If the connection is refused or
allowed, pingecho() returns true. If it times out, or otherwise errors,
it returns false. Either way, it's not ICMP if you *need* ICMP.
or
system('ping -c1 www.example.com')
Shelling out to a ping command is probably a bad idea for portability
reasons.
If a TCP connection test works for you then go with the stdlib Ping library.
If it doesn't, you might look into RubyInline or writing a simple C
extension for basic ICMP requests.
Cheers!
On Friday 10 August 2007 03:20:19 pm Klodus Klodus wrote:
--
Konrad Meyer <konrad@tylerc.org> http://konrad.sobertillnoon.com/
http://raa.ruby-lang.org/project/icmpping/
hope it helps
Gordon
On Aug 10, 6:02 pm, Konrad Meyer <kon...@tylerc.org> wrote:
On Friday 10 August 2007 03:20:19 pm Klodus Klodus wrote:
> Ruby Rubyruby wrote:
> > What would I have to do in order to be able to send an ARP Ping or a
> > regular ICMP_ECHO_REQUEST in Ruby? Is it possible?