#!/usr/bin/ruby ######################################## # # This code is part of the SANS/GIAC Gold Paper titled # # Programming Wireless Security # # by Robin Wood (dninja@gmail.com), accepted May 2008 # # For more information you can find the paper in the "Wireless Access" section of the # SANS Reading Room at http://www.sans.org/reading_room/ or at www.digininja.org # ######################################## require 'scruby' module Scruby def sniff_beacon(pcap, packet) # get the link type linktype = pcap.datalink # dissect the packet based on the link type dec = Scruby.linklayer_dissector(pcap.datalink, packet) # check to see if it is a 802.11 packet unless (dec.has_layer(Dot11)) return end # check to see if it is a beacon unless (dec.has_layer(Dot11Beacon)) return end puts dec.to_s end end scruby = ScrubyBasic.new scruby.sniff(:iface=>"ath0", :prn=>"sniff_beacon")