Skip to content

Instantly share code, notes, and snippets.

@nevdull77
Created April 12, 2014 04:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevdull77/10519183 to your computer and use it in GitHub Desktop.
Save nevdull77/10519183 to your computer and use it in GitHub Desktop.
--- scapy-2.1.0-rfmon/scapy/arch/pcapdnet.py 2009-09-23 10:27:36.000000000 -0400
+++ scapy-2.1.0/scapy/arch/pcapdnet.py 2014-04-11 20:54:49.000000000 -0400
@@ -52,7 +52,14 @@
class _PcapWrapper_libpcap:
def __init__(self, *args, **kargs):
self.pcap = pcap.pcapObject()
- self.pcap.open_live(*args, **kargs)
+ if sys.platform == 'darwin' and 'pcap_set_rfmon' not in dir(self.pcap):
+ warning("Mac OS WiFI monitor mode not supported unless python-libpcap patched for OS X is used.")
+
+ if sys.platform == 'darwin':
+ self.pcap.pcap_set_rfmon(args[0], 1)
+ self.pcap.pcap_activate()
+ else:
+ self.pcap.open_live(*args, **kargs)
def setfilter(self, filter):
self.pcap.setfilter(filter, 0, 0)
def next(self):
@@ -67,6 +74,8 @@
elif hasattr(pcap,"open_live"): # python-pcapy
class _PcapWrapper_pcapy:
def __init__(self, *args, **kargs):
+ if sys.platform == 'darwin':
+ warning("Mac OS WiFI monitor mode not supported unless patched python-libpcap is used.")
self.pcap = pcap.open_live(*args, **kargs)
def next(self):
try:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment