packetz

🦈 Packet capturing library built with LibPcap

🦈 Packetz

Packet capturing library built with LibPcap.

Installation

Add this to your application's shard.yml:

dependencies:
  packetz:
    github: picatz/packetz

Basic Usage

require "packetz"

# start packet capture on default interface
Packetz.capture do |packet|
  puts packet.hexdump
end

Craft your Capture

# create capture handler
cap = Packetz.capture

# stop the capture with ctl+C
Signal::INT.trap do
  puts "Stopping!"
  cap.stop!
  exit
end

# setup the handler
cap.snapshot_length  = 33333
cap.promiscuous_mode = true
cap.monitor_mode     = true

# start capturing
cap.start!

# do something with each packet and its pcap header
cap.each do |packet, pcap_header|
  # something
end

Network Interfaces

# get default interface to capture on
Packetz.interfaces.default
# get all possible interfaces
Packetz.interfaces.all do |interface|
  puts interface
end

Contributors

  • picat Kent 'picat' Gruber - creator, maintainer
  • maiha maiha - pcap.cr
  • puppetpies Brian Hood - libpcap.cr
Repository

packetz

Owner
Statistic
  • 24
  • 3
  • 0
  • 1
  • 0
  • almost 7 years ago
  • November 6, 2017
License

MIT License

Links
Synced at

Fri, 22 Nov 2024 03:19:55 GMT

Languages