Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

adds protocol key to scan #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ def test_noise_data_present(self):
cell = Cell.from_string(LIST_INDEX_ERROR)
self.assertEqual(cell.noise, -92)

def test_protocol(self):
cell = Cell.from_string(IWLIST_SCAN_WPA1)
self.assertEqual(cell.protocol, 'IEEE 802.11bg')


class ScanningTest(TestCase):
def test_scanning(self):
Expand All @@ -86,7 +90,7 @@ def test_scanning(self):
IWLIST_SCAN_NO_ENCRYPTION = """Cell 02 - Address: 38:83:45:CC:58:74
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=59/70 Signal level=-51 dBm
Quality=59/70 Signal level=-51 dBm
Encryption key:off
ESSID:"My Wireless Network"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
Expand All @@ -112,7 +116,7 @@ def test_scanning(self):
IWLIST_SCAN_WEP = """Cell 01 - Address: 00:21:27:35:1B:E8
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=36/70 Signal level=-74 dBm
Quality=36/70 Signal level=-74 dBm
Encryption key:on
ESSID:"WEP Network"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
Expand All @@ -134,7 +138,7 @@ def test_scanning(self):
IWLIST_SCAN_WPA2 = """Cell 08 - Address: 00:22:B0:98:5E:77
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=42/70 Signal level=-68 dBm
Quality=42/70 Signal level=-68 dBm
Encryption key:on
ESSID:"WPA2 network"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s
Expand Down Expand Up @@ -169,7 +173,7 @@ def test_scanning(self):
IE: Unknown: DD750050F204104A00011010440001021041000100103B00010310470010C59BF13CE0C57AA1476C0022B0985E7710210006442D4C696E6B102300074449522D363035102400074449522D3630351042000830303030303030301054000800060050F2040001101100074449522D36303510080002008E
"""

IWLIST_SCAN_WPA1 = """Cell 01 - Address:
IWLIST_SCAN_WPA1 = """Cell 01 - Address:
ESSID:
Protocol:IEEE 802.11bg
Mode:Master
Expand All @@ -181,7 +185,7 @@ def test_scanning(self):
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Quality=100/100 Signal level=74/100
Quality=100/100 Signal level=74/100
"""

ALTERNATIVE_OUTPUT = """Cell 06 - Address: F2:23:DB:A3:3B:A0
Expand Down Expand Up @@ -231,10 +235,10 @@ def test_scanning(self):
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
Quality=84/100 Signal level=43/100
Quality=84/100 Signal level=43/100
"""

NO_CHANNEL_OUTPUT = """Cell 06 - Address:
NO_CHANNEL_OUTPUT = """Cell 06 - Address:
ESSID:
Protocol:IEEE 802.11bgn
Mode:Master
Expand All @@ -246,7 +250,7 @@ def test_scanning(self):
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Quality=93/100 Signal level=10/100
Quality=93/100 Signal level=10/100
"""

LIST_INDEX_ERROR = """Cell 04 - Address: 50:06:04:C3:4D:93
Expand Down Expand Up @@ -295,7 +299,7 @@ def test_scanning(self):
NO_SSID_AT_ALL = """Cell 10 - Address: 02:CA:FE:CA:CA:40
Channel:5
Frequency:2.432 GHz (Channel 5)
Quality=61/70 Signal level=-49 dBm
Quality=61/70 Signal level=-49 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Expand Down
2 changes: 2 additions & 0 deletions wifi/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self):
self.quality = None
self.signal = None
self.noise = None
self.protocol = None

def __repr__(self):
return 'Cell(ssid={ssid})'.format(**vars(self))
Expand Down Expand Up @@ -90,6 +91,7 @@ def normalize_key(key):
'address': identity,
'mode': identity,
'channel': int,
'protocol': identity
}


Expand Down