Created
July 15, 2011 17:09
-
-
Save byingyang/1085082 to your computer and use it in GitHub Desktop.
A little script I whipped together to spit out all network traffic using libpcap
This file contains 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
#!/usr/bin/env ruby | |
# this line imports the libpcap ruby bindings | |
require 'pcaplet' | |
# create packet sniffer on the wireless card | |
network = Pcaplet.new('-s 1500 -i en0') | |
# we only need to look at web packets | |
www_filter = Pcap::Filter.new('tcp and dst port 80', network.capture) | |
network.add_filter(www_filter) | |
network.each_packet { |pkt| puts pkt.tcp_data if !pkt.tcp_data.nil? } | |
network.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment