Module: Wishbone

Defined in:
lib/wishbone.rb

Overview

Top level comment

Class Method Summary collapse

Class Method Details

.captureObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wishbone.rb', line 4

def self.capture
  pcap = FFI::PCap::Live.new(dev: 'wlp2s0',
                             timeout: 1,
                             promisc: true,
                             handler: FFI::PCap::Handler)

  begin
    pcap.loop do |_this, pkt|
      print pkt.header.timestamp.to_time
      puts "#{pkt.time}:"
      pkt.body.each_byte { |x| print '%0.2x ' % x }
      print "\n\n"
    end
  rescue Exception => e
    print "test",e
  end
end