Sha256: da113f14155c683860a03cea99f5d53c41d0b591af5d1dc90bc46d47c5de9699
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'command_lion' require 'packetgen' require 'pry' CommandLion::App.run do name "Pcapr" version "1.0.0" description "Pcaprub command-line application to capture network traffic." ctrl_c do puts "Exiting!" exit 0 end command :capture do description "Capture from a given network interface ( default: #{Pcap.lookupdev} )." type :string default Pcap.lookupdev action do capture = Pcap.open_live(argument, options[:snaplen].argument, options[:promisc].argument, options[:buffer].argument) loop do if packet = capture.next puts packet.size end end end option :snaplen do default 65535 type :integer description "Amount of data for each frame that is actually captured." end option :promisc do type :bool default true description "Capture all traffic received rather than only the frames the controller is meant to receive." end option :buffer do type :integer default 1 description "Read time out in milliseconds when capturing packets, and a value of 0 means no time out." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
command_lion-2.0.1 | examples/pcapr.rb |
command_lion-2.0.0 | examples/pcapr.rb |