/usr/lib/python2.7/dist-packages/impacket/Dot11KeyManager.py is in python-impacket 0.9.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Copyright (c) 2003-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Description:
# IEEE 802.11 Network packet codecs.
#
# Author:
# Gustavo Moreira
from array import array
class KeyManager:
def __init__(self):
self.keys = {}
def __get_bssid_hasheable_type(self, bssid):
# List is an unhashable type
if not isinstance(bssid, (list,tuple,array)):
raise Exception('BSSID datatype must be a tuple, list or array')
return tuple(bssid)
def add_key(self, bssid, key):
bssid=self.__get_bssid_hasheable_type(bssid)
if not bssid in self.keys:
self.keys[bssid] = key
return True
else:
return False
def replace_key(self, bssid, key):
bssid=self.__get_bssid_hasheable_type(bssid)
self.keys[bssid] = key
return True
def get_key(self, bssid):
bssid=self.__get_bssid_hasheable_type(bssid)
if self.keys.has_key(bssid):
return self.keys[bssid]
else:
return False
def delete_key(self, bssid):
bssid=self.__get_bssid_hasheable_type(bssid)
if not isinstance(bssid, list):
raise Exception('BSSID datatype must be a list')
if self.keys.has_key(bssid):
del self.keys[bssid]
return True
return False
|