http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n336.

    Positional arguments:
    data -- bytearray data to read.

    Returns:
    WiFi stream cipher used by the access point (string).

def get_cipher(data):
    """http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17#n336.

    Positional arguments:
    data -- bytearray data to read.

    Returns:
    WiFi stream cipher used by the access point (string).
    """
    legend = {0: 'Use group cipher suite', 1: 'WEP-40', 2: 'TKIP', 4: 'CCMP', 5: 'WEP-104', }
    key = data[3]
    if ieee80211_oui == bytes(data[:3]):
        legend.update({6: 'AES-128-CMAC', 8: 'GCMP', })
    elif ms_oui != bytes(data[:3]):
        key = None
    return legend.get(key, '{0:02x}-{1:02x}-{2:02x}:{3}'.format(data[0], data[1], data[2], data[3]))