File: test_Target.py

package info (click to toggle)
wifite 2.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,196 kB
  • sloc: python: 6,457; sh: 10; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,157 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest
from wifite.tools.airodump import Airodump


class TestTarget(unittest.TestCase):
    """ Test suite for Target parsing an generation """
    airodump_csv = 'airodump.csv'

    def getTargets(self, filename):
        """ Helper method to parse targets from filename """
        import os
        import inspect
        this_file = os.path.abspath(inspect.getsourcefile(TestTarget.getTargets))
        this_dir = os.path.dirname(this_file)
        csv_file = os.path.join(this_dir, 'files', filename)
        # Load targets from CSV file
        return Airodump.get_targets_from_csv(csv_file)

    def testTargetParsing(self):
        """ Asserts target parsing finds targets """
        targets = self.getTargets(TestTarget.airodump_csv)
        assert(len(targets) > 0)

    def testTargetClients(self):
        """ Asserts target parsing captures clients properly """
        targets = self.getTargets(TestTarget.airodump_csv)
        for t in targets:
            if t.bssid == '00:1D:D5:9B:11:00':
                assert(len(t.clients) > 0)


if __name__ == '__main__':
    unittest.main()