Module: Nmunch

Defined in:
lib/nmunch.rb,
lib/nmunch/node.rb,
lib/nmunch/report.rb,
lib/nmunch/version.rb,
lib/nmunch/dissectors/ip.rb,
lib/nmunch/dissectors/arp.rb,
lib/nmunch/mac_oui_lookup.rb,
lib/nmunch/dissectors/base.rb,
lib/nmunch/subscribers/base.rb,
lib/nmunch/subscribers/stdout.rb

Overview

Public: Main Nmunch module

Acts as a facade in front of the ruby-pcap gem and abstracts away the packet analysis.

Defined Under Namespace

Modules: Dissectors, Subscribers Classes: MacOuiLookup, Node, Report

Constant Summary collapse

CAPTURE_FILTER =

Internal: PCAP filter expression to only get ARP and broadcast packets

'arp or broadcast'
VERSION =

Public: Current version of Nmunch

"0.1.0"

Class Method Summary collapse

Class Method Details

Internal: Get the awesome Nmunch ASCII banner

Returns ASCII banner



34
35
36
37
38
39
40
41
42
# File 'lib/nmunch.rb', line 34

def self.banner
  banner = <<EOB

 88b 88 8b    d8 88   88 88b 88  dP""b8 88  88
 88Yb88 88b  d88 88   88 88Yb88 dP   `" 88  88
 88 Y88 88YbdP88 Y8   8P 88 Y88 Yb      888888
 88  Y8 88 YY 88 `YbodP' 88  Y8  YboodP 88  88
EOB
end

.munch!(options) ⇒ Object

Public: Start munching on packets on interface or from PCAP file

options - Hash of command line options

Yields an Nmunch::Node with IP and MAC address information



24
25
26
27
28
29
# File 'lib/nmunch.rb', line 24

def self.munch!(options)
  create_capture_object(options).each_packet do |packet|
    dissector = Nmunch::Dissectors::Base.factory(packet)
    yield Nmunch::Node.create_from_dissector(dissector)
  end
end