Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
derv82
GitHub Repository: derv82/wifite2
Path: blob/master/tests/test_Airodump.py
410 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
import sys
5
sys.path.insert(0, '..')
6
7
from wifite.tools.airodump import Airodump
8
9
import unittest
10
11
class TestAirodump(unittest.TestCase):
12
''' Test suite for Wifite's interaction with the Airodump tool '''
13
14
15
def test_airodump_weird_characters(self):
16
csv_filename = self.getFile('airodump-weird-ssids.csv')
17
targets = Airodump.get_targets_from_csv(csv_filename)
18
19
target = targets[0]
20
expected = 'Comma, no trailing space'
21
assert target.essid == expected, 'Expected ESSID (%s) but got (%s)' % (expected, target.essid)
22
23
target = targets[1]
24
expected = '"Quoted ESSID, Comma, no trailing spaces. "'
25
assert target.essid == expected, 'Expected ESSID (%s) but got (%s)' % (expected, target.essid)
26
27
target = targets[2]
28
expected = 'Comma, Trailing space '
29
assert target.essid == expected, 'Expected ESSID (%s) but got (%s)' % (expected, target.essid)
30
31
target = targets[3]
32
expected = '"quote" comma, trailing space '
33
assert target.essid == expected, 'Expected ESSID (%s) but got (%s)' % (expected, target.essid)
34
35
# Hidden access point
36
target = targets[4]
37
assert target.essid_known == False, 'ESSID full of null characters should not be known'
38
expected = None
39
assert target.essid == expected, 'Expected ESSID (%s) but got (%s)' % (expected, target.essid)
40
assert target.essid_len == 19, 'ESSID length shold be 19, but got %s' % target.essid_len
41
42
43
def getFile(self, filename):
44
''' Helper method to parse targets from filename '''
45
import os, inspect
46
this_file = os.path.abspath(inspect.getsourcefile(self.getFile))
47
this_dir = os.path.dirname(this_file)
48
return os.path.join(this_dir, 'files', filename)
49
50
51
if __name__ == '__main__':
52
unittest.main()
53
54