Class: LTools::Tshark
Instance Attribute Summary
Attributes inherited from Tool
#cmd, #stderr, #stdin, #stdout, #verbose
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Tool
check?, #command, inherited, #initialize, #io_inherit!, #start, #stop, #wait
Constructor Details
This class inherits a constructor from LTools::Tool
Class Method Details
.capture(interface: nil, bpf: nil, fields: nil, filter: nil, append: nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tools/tshark.rb', line 6 def self.capture(interface: nil, bpf: nil, fields:nil, filter: nil, append: nil) cmd = 'tshark' cmd << ToolOpts.build {|opts| opts.on('-i', interface) opts.on('-f', bpf) opts.on('-Y', filter) } if fields fields = fields.split if fields.is_a? String fields.unshift ' -T fields' cmd << fields.join(' -e ') end cmd << append if append new cmd end |
Instance Method Details
#records ⇒ Object
22 23 24 25 26 |
# File 'lib/tools/tshark.rb', line 22 def records @stdout.each_line.map do |line| line.split("\t") end end |