title: Python Packet Sniffing / Packet Capture - pcapy not capturing packets
body: <p>I have my wireless interface in monitor mode, and I'm able to successfully sniff network packets and analyze them with Wireshark. I've been trying to implement something similar with <a href="http://corelabs.coresecurity.com/index.php?module=Wiki&amp;action=view&amp;type=tool&amp;name=Pcapy" rel="nofollow"><code>pcapy</code></a> and <a href="http://corelabs.coresecurity.com/index.php?module=Wiki&amp;action=view&amp;type=tool&amp;name=Impacket" rel="nofollow"><code>impacket</code></a>. It looks as if <code>pcapy</code> is not capturing the same packets that Wireshark is. I'm currently running on Mac OS X 10.9 w/ a 2012 Macbook Pro, but noticed the same behavior on Ubuntu with the TP-LINK TL-WN722N wireless usb adapter.</p>
  
  <p>Here's an example of a script I've written that is clearly not working. I'm picking up no Probe Requests with <code>pcapy</code>, even though I see them in Wireshark.</p>
  
  <pre><code>import pcapy
  import impacket
  
  DECODER = impacket.ImpactDecoder.RadioTapDecoder()
  
  
  def packet_handler(header, data):
     radio_packet = DECODER.decode(data)
     dot11 = radio_packet.child()
     if dot11.get_subtype() == impacket.dot11.Dot11Types.DOT11_SUBTYPE_MANAGEMENT_PROBE_REQUEST:
         management_base = dot11.child()
         if management_base.__class__ == impacket.dot11.Dot11ManagementFrame:
             print management_base.get_source_address(), management_base.get_destination_address()
  
  
  p = pcapy.open_live("your_interface_here", 2000, 0, 1000)
  p.loop(-1, packet_handler)
  </code></pre>
  
  <p>In this example, en1 is in monitor mode. This works fine using a pcap file generated from Wireshark, simply changing <code>open_live</code> to <code>open_offline</code>:</p>
  
  <pre><code>p = open_offline('path_to_file')
  </code></pre>
  
  <p>Am I not setting up <code>pcapy</code> correctly?</p>