Ejemplo n.º 1
0
    def test_unencrypted(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = False

        scheme = Scheme.for_cell('wlan0', 'test', cell)

        self.assertEqual(scheme.options, {
            'wireless-essid': 'SSID',
            'wireless-channel': 'auto',
        })
Ejemplo n.º 2
0
    def test_unencrypted(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = False

        scheme = Scheme.for_cell('wlan0', 'test', cell)

        self.assertEqual(scheme.options, {
            'wireless-essid': 'SSID',
            'wireless-channel': 'auto',
        })
Ejemplo n.º 3
0
    def test_wep(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wep'

        scheme = Scheme.for_cell('wlan0', 'test', cell, 'passkey')

        self.assertEqual(scheme.options, {
            'wireless-essid': 'SSID',
            'wireless-key': 'passkey',
        })
Ejemplo n.º 4
0
    def test_wpa(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wpa'

        scheme = Scheme.for_cell('wlan0', 'test', cell, 'passkey')

        self.assertEqual(scheme.options, {
            'wpa-ssid': 'SSID',
            'wpa-psk': 'ea1548d4e8850c8d94c5ef9ed6fe483981b64c1436952cb1bf80c08a68cdc763',
            'wireless-channel': 'auto',
        })
Ejemplo n.º 5
0
    def test_wpa(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wpa'

        scheme = Scheme.for_cell('wlan0', 'test', cell, 'passkey')

        self.assertEqual(scheme.options, {
            'wpa-ssid': 'SSID',
            'wpa-psk': 'ea1548d4e8850c8d94c5ef9ed6fe483981b64c1436952cb1bf80c08a68cdc763',
            'wireless-channel': 'auto',
        })
Ejemplo n.º 6
0
    def test_unencrypted(self):
        cell = Cell()
        cell.ssid = "SSID"
        cell.encrypted = False

        scheme = Scheme.for_cell("wlan0", "test", cell)

        self.assertEqual(
            scheme.options,
            {
                "wireless-essid": ["SSID"],
                "wireless-channel": ["auto"],
            },
        )
Ejemplo n.º 7
0
    def test_wep_ascii(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wep'

        # ascii key lengths: 5, 13, 16, 29
        ascii_keys = ('a' * 5, 'a' * 13, 'a' * 16, 'a' * 29)
        for key in ascii_keys:
            scheme = Scheme.for_cell('wlan0', 'test', cell, key)

            self.assertEqual(scheme.options, {
                'wireless-essid': 'SSID',
                'wireless-key': 's:' + key
            })
Ejemplo n.º 8
0
    def test_wep_hex(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wep'

        # hex key lengths: 10, 26, 32, 58
        hex_keys = ("01234567ab", "0123456789abc" * 2, "0123456789abcdef" * 2, "0123456789abc" * 2 + "0123456789abcdef" * 2)
        for key in hex_keys:
            scheme = Scheme.for_cell('wlan0', 'test', cell, key)

            self.assertEqual(scheme.options, {
                'wireless-essid': 'SSID',
                'wireless-key': key
            })
Ejemplo n.º 9
0
    def test_wep_ascii(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wep'

        # ascii key lengths: 5, 13, 16, 29
        ascii_keys = ('a' * 5, 'a' * 13, 'a' * 16, 'a' * 29)
        for key in ascii_keys:
            scheme = Scheme.for_cell('wlan0', 'test', cell, key)

            self.assertEqual(scheme.options, {
                'wireless-essid': 'SSID',
                'wireless-key': 's:' + key
            })
Ejemplo n.º 10
0
    def test_wep_hex(self):
        cell = Cell()
        cell.ssid = 'SSID'
        cell.encrypted = True
        cell.encryption_type = 'wep'

        # hex key lengths: 10, 26, 32, 58
        hex_keys = ("01234567ab", "0123456789abc" * 2, "0123456789abcdef" * 2, "0123456789abc" * 2 + "0123456789abcdef" * 2)
        for key in hex_keys:
            scheme = Scheme.for_cell('wlan0', 'test', cell, key)

            self.assertEqual(scheme.options, {
                'wireless-essid': ['SSID'],
                'wireless-key': [key]
            })
Ejemplo n.º 11
0
    def test_wpa(self):
        cell = Cell()
        cell.ssid = "SSID"
        cell.encrypted = True
        cell.encryption_type = "wpa"

        scheme = Scheme.for_cell("wlan0", "test", cell, "passkey")

        self.assertEqual(
            scheme.options,
            {
                "wpa-ssid": ["SSID"],
                "wpa-psk": [
                    "ea1548d4e8850c8d94c5ef9ed6fe483981b64c1436952cb1bf80c08a68cdc763"
                ],
                "wireless-channel": ["auto"],
            },
        )
Ejemplo n.º 12
0
    def test_wep_ascii(self):
        cell = Cell()
        cell.ssid = "SSID"
        cell.encrypted = True
        cell.encryption_type = "wep"

        # ascii key lengths: 5, 13, 16, 29
        ascii_keys = ("a" * 5, "a" * 13, "a" * 16, "a" * 29)
        for key in ascii_keys:
            scheme = Scheme.for_cell("wlan0", "test", cell, key)

            self.assertEqual(
                scheme.options,
                {
                    "wireless-essid": ["SSID"],
                    "wireless-key": ["s:" + key]
                },
            )
Ejemplo n.º 13
0
    def test_wep_hex(self):
        cell = Cell()
        cell.ssid = "SSID"
        cell.encrypted = True
        cell.encryption_type = "wep"

        # hex key lengths: 10, 26, 32, 58
        hex_keys = (
            "01234567ab",
            "0123456789abc" * 2,
            "0123456789abcdef" * 2,
            "0123456789abc" * 2 + "0123456789abcdef" * 2,
        )
        for key in hex_keys:
            scheme = Scheme.for_cell("wlan0", "test", cell, key)

            self.assertEqual(scheme.options, {
                "wireless-essid": ["SSID"],
                "wireless-key": [key]
            })
Ejemplo n.º 14
0
def test():
    a = Cell()
    a.ssid = "networkA"
    b = Cell()
    b.ssid = "networkB"
    return [a, b]