From: brabuhr@... Date: 2010-01-23T13:10:43+09:00 Subject: Re: Use Ruby to make a MTU sweep utility (Ping) On Fri, Jan 22, 2010 at 11:03 PM, Dale Ackerman wrote: >> You could wrap the OS ping variants (Linux and Mac OS X are probably >> identical, since both use the GNU utils, so you only have to check for >> Windows) in your own code, and use that. >> >> They all should provide a means to modify packet size (Windows' ping.exe >> does), so you can achieve your desired result. > > How would I wrap the command line utilities from ruby?  I am new to the > ruby. Simplistic example: $ ping usage: ping [-AaDdfnoQqRrv] [-c count] [-i wait] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout] [-z tos] host ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-z tos] mcast-group $ irb irb(main):001:0> count = 3 => 3 irb(main):002:0> packetsize = 128 => 128 irb(main):003:0> host = '127.0.0.1' => "127.0.0.1" irb(main):004:0> `ping -c #{count} -s #{packetsize} #{host}` => "PING 127.0.0.1 (127.0.0.1): 128 data bytes\n136 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.171 ms\n136 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.101 ms\n136 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.103 ms\n\n--- 127.0.0.1 ping statistics ---\n3 packets transmitted, 3 packets received, 0% packet loss\nround-trip min/avg/max/stddev = 0.101/0.125/0.171/0.033 ms\n"