title: How to use Scapy to determine Wireless Encryption Type?
body: <p>I am doing a Security Research on Wireless networks which involves coding a small tool that scans for Wifi Access points in the vicinity. Based on the Encryption type found it goes on with some other security tests.</p>
  
  <p>So far I have python code that uses Scapy to enumerate different access points and whether they have Encryption Enabled (Enc= Y or Enc=N). The code for this is:</p>
  
  <pre><code>def sniffAP(p):
      if ( (p.haslayer(Dot11Beacon) or p.haslayer(Dot11ProbeResp))
                   and not aps.has_key(p[Dot11].addr3)):
          ssid       = p[Dot11Elt].info
          bssid      = p[Dot11].addr3
          channel    = int( ord(p[Dot11Elt:3].info))
          capability = p.sprintf("{Dot11Beacon:%Dot11Beacon.cap%}\
                  {Dot11ProbeResp:%Dot11ProbeResp.cap%}")
  
          # Check for encrypted networks
          if re.search("privacy", capability): enc = 'Y'
          else: enc  = 'N'
  </code></pre>
  
  <p>What I want is the ability to distinguish between different Encryption Type (WEP, WPA, WPA2, WPS) using python and scapy. Any ideas?</p>