title: How can I put mac os x en1 interface into monitor mode to use with python3 scapy?
body: <p>On my mac the wireless interface is the en1 interface. I can put the interface into monitor mode using mac's airport application but then it doesn't work with the scapy module when i use python 3. How can i make this work?</p>
  
  <p>Thanks in advance</p>
  
  <p><strong>ifconfig output</strong></p>
  
  <pre><code>lo0: flags=8049&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; mtu 16384
      options=3&lt;RXCSUM,TXCSUM&gt;
      inet6 ::1 prefixlen 128 
      inet 127.0.0.1 netmask 0xff000000 
      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
      nd6 options=1&lt;PERFORMNUD&gt;
  gif0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1280
  stf0: flags=0&lt;&gt; mtu 1280
  en0: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
      options=10b&lt;RXCSUM,TXCSUM,VLAN_HWTAGGING,AV&gt;
      nd6 options=1&lt;PERFORMNUD&gt;
      media: autoselect (none)
      status: inactive
  fw0: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 4078
      lladdr 00:3e:e1:ff:fe:0f:0a:4a 
      nd6 options=1&lt;PERFORMNUD&gt;
      media: autoselect &lt;full-duplex&gt;
      status: inactive
  en1: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
      inet6 fe80::7ed1:c3ff:fe6e:eeda%en1 prefixlen 64 scopeid 0x6 
      inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
      nd6 options=1&lt;PERFORMNUD&gt;
      media: autoselect
      status: active
  en2: flags=8963&lt;UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST&gt; mtu 1500
      options=60&lt;TSO4,TSO6&gt;
      media: autoselect &lt;full-duplex&gt;
      status: inactive
  p2p0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 2304
      media: autoselect
      status: inactive
  awdl0: flags=8943&lt;UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST&gt; mtu 1452
      inet6 fe80::18b8:64ff:fec8:85%awdl0 prefixlen 64 scopeid 0x9 
      nd6 options=1&lt;PERFORMNUD&gt;
      media: autoselect
      status: active
  bridge0: flags=8863&lt;UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
      options=63&lt;RXCSUM,TXCSUM,TSO4,TSO6&gt;
      Configuration:
          id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
          maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
          root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
          ipfilter disabled flags 0x2
      member: en2 flags=3&lt;LEARNING,DISCOVER&gt;
              ifmaxaddr 0 port 7 priority 0 path cost 0
      nd6 options=1&lt;PERFORMNUD&gt;
      media: &lt;unknown type&gt;
      status: inactive
  </code></pre>
  
  <p><strong>Python Script To Detected Packets (After putting en1 into mon mode using airport)</strong></p>
  
  <pre><code>from scapy.all import *
  
  def pktIdentifier(pkt):
      if pkt.haslayer(Dot11Beacon):
          print ("[+] Detected 802.11 Beacon Frame")
      elif pkt.haslayer(Dot11ProbeReq):
          print ("[+] Detected 802.11 Probe Frame")
      elif pkt.haslayer(TCP):
          print ("[+] Detected TCP Packet")
      elif pky.haslayer(UDP):
          print ("[+] Detected UDP Packet")
  
  conf.iface = 'en1'
  sniff(prn=pktIdentifier)
  </code></pre>
  
  <p><strong>Output of conf.route</strong></p>
  
  <pre><code>Network         Netmask         Gateway         Iface           Output IP
  0.0.0.0         0.0.0.0         192.168.0.1     en1             192.168.0.7    
  127.0.0.0       255.0.0.0       0.0.0.0         lo0             127.0.0.1      
  127.0.0.1       255.255.255.255 0.0.0.0         lo0             127.0.0.1      
  169.254.0.0     255.255.0.0     0.0.0.0         en1             192.168.0.7    
  192.168.0.0     255.255.255.0   0.0.0.0         en1             192.168.0.7    
  192.168.0.1     255.255.255.255 0.0.0.0         en1             192.168.0.7    
  192.168.0.1     255.255.255.255 0.0.0.0         en1             192.168.0.7    
  192.168.0.7     255.255.255.255 0.0.0.0         en1             192.168.0.7    
  192.168.0.255   255.255.255.255 0.0.0.0         en1             192.168.0.7 
  </code></pre>