Created
June 5, 2013 17:28
-
-
Save reu/4afae4d610d98cab899e to your computer and use it in GitHub Desktop.
Simple sniffer in Ruby using pcap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'pcaprub' | |
capture = PCAPRUB::Pcap.open_live('lo0', 65535, true, 0) | |
capture.setfilter('icmp') | |
while 1==1 | |
puts(capture.stats()) | |
pkt = capture.next() | |
if pkt | |
puts "captured packet" | |
end | |
sleep(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment