コード例 #1
0
    def test_broadcast_off(self, setUp):
        """ Verify disabled SSID broadcast status"""

        assertion = Assert()
        network = conn()

        # select wireless interface and disable wireless
        radio_page = RadioPage(self.firefox)
        radio_page.select_wifi_interface(iface="2.4GHZ")
        radio_page.disable(radio_page.get_wireless())
        radio_page.apply_changes()

        # assert wireless and bandwidth
        assertion.is_equal(radio_page.get_wifi_interface(), "2.4 Ghz")
        wireless = radio_page.get_wireless()
        assertion.is_false(radio_page.is_enabled(wireless), "Wireless")

        # disable primary network
        network_page = NetworkPage(self.firefox)
        network_page.disable(network_page.get_primary_network())
        network_page.apply_changes()

        # assert primary network is enabled
        netwrk = network_page.get_primary_network()
        assertion.is_false(network_page.is_enabled(netwrk), 'Primary Network')

        # Check if ssid shows up on wifi scan
        wifi_24_ssid = network_page.get_ssid_name()
        ssid_online = network.ssid_check(ssid=wifi_24_ssid)
        try:
            assertion.is_false(ssid_online, "SSID is offline")
        finally:
            # reset changes
            radio_page = RadioPage(self.firefox)
            radio_page.reset_wireless_default()
コード例 #2
0
    def test_open_sec(self, setUp):
        """Connect station to open wifi network"""

        network = conn()
        assertion = Assert()

        # select wireless interface and enable wireless
        radio_page = RadioPage(self.firefox)
        radio_page.select_wifi_interface(iface="2.4GHZ")
        radio_page.enable_wireless()
        radio_page.apply_changes()

        # assert wireless and bandwidth
        assertion.is_equal(radio_page.get_wifi_interface(), "2.4 Ghz")
        assertion.is_equal(radio_page.wireless_isenabled(), "Enabled")

        # disable WPA2
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_primary_network())
        network_page.disable(network_page.get_wpa2())
        network_page.apply_changes()

        # assert WPA2 (therefore WPA too for 3P Box) is disabled
        assertion.is_true(
            network_page.is_enabled(network_page.get_primary_network()),
            'Primary Network')
        assertion.is_false(network_page.is_enabled(network_page.get_wpa2()),
                           'WPA 2')

        # Wifi connection attempt
        network.reset_network_mngr()
        time.sleep(5)
        wifi_connection = network.wifi_connection_nosec(ssid=self.SSID)
        try:
            assertion.is_wificonnected(wifi_connection)
        except WifiConnError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # Disconnect wired interface
        eth_iface = network.eth_iface_name()  # get name of wired iface
        eth_disc_attempt = network.disconnect_iface(eth_iface)
        try:
            assertion.is_sucessful(eth_disc_attempt, "ethernet disconnect")
        except NetworkError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # ping attempt
        wifi_iface = network.wifi_iface_name()  # get name of wifi iface
        ip = 'www.google.com'
        ping_attempt = network.ping_attempt(wifi_iface, ip)
        try:
            assertion.is_sucessful(ping_attempt, "ping attempt")
        finally:
            network.connect_iface(eth_iface)
            self.reset_wifisession(self.firefox, self.SSID)
コード例 #3
0
    def test_wpa2_to_wpa(self, setUp):
        """Connect WS to DUT then change sec wpa2 to wpa/wpa2
        """

        network = conn()
        assertion = Assert()

        # select wireless interface and enable wireless
        radio_page = RadioPage(self.firefox)
        radio_page.select_wifi_interface(iface="2.4GHZ")
        radio_page.enable(radio_page.get_wireless())
        radio_page.apply_changes()

        # assert wireless is enabled and wifi interface is 2.4Ghz
        assertion.is_equal(radio_page.get_wifi_interface(), "2.4 Ghz")
        wireless = radio_page.get_wireless()
        assertion.is_true(radio_page.is_enabled(wireless), "Wireless")

        # enable primary network and wpa2 and disable wpa
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_primary_network())
        network_page.enable(network_page.get_wpa2())
        network_page.disable(network_page.get_wpa())

        network_page.apply_changes()

        # check primary network and wpa2 are enabled and encryption is AES
        netwrk = network_page.get_primary_network()
        assertion.is_true(network_page.is_enabled(netwrk), 'Primary Network')
        wpa2 = network_page.get_wpa2()
        assertion.is_true(network_page.is_enabled(wpa2), 'WPA2 enabled')
        wpa = network_page.get_wpa()
        assertion.is_false(network_page.is_enabled(wpa), 'WPA disabled')

        # Wifi connection attempt
        network.reset_network_mngr()
        wifi_connection = network.wifi_connection(ssid=self.SSID,
                                                  pswd=self.SSID_PASS,
                                                  timeout=20)
        try:
            assertion.is_wificonnected(wifi_connection)
        except WifiConnError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # enable wpa
        time.sleep(30)
        network_page.enable(network_page.get_wpa())

        # Set encryption to TKIP
        network_page.set_encryption("TKIP")

        network_page.apply_changes()

        # check wpa-psk is enabled and encryption is TKIP
        print(network_page.is_enabled(network_page.get_wpa()))
        assertion.is_true(network_page.is_enabled(network_page.get_wpa()),
                          'WPA is enabled')
        assertion.is_equal(network_page.get_encryption(), 'TKIP+AES')

        # Disconnect wired interface
        eth_iface = network.eth_iface_name()  # get name of wired iface
        eth_disc_attempt = network.disconnect_iface(eth_iface)
        try:
            assertion.is_sucessful(eth_disc_attempt, "ethernet disconnect")
        except NetworkError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # ping attempt
        ip = 'www.google.com'
        wifi_iface = network.wifi_iface_name()  # get name of wifi iface
        ping_attempt = network.ping_attempt(wifi_iface, ip)
        try:
            assertion.is_sucessful(ping_attempt, "ping attempt")
        finally:
            network.connect_iface(eth_iface)
            self.reset_wifisession(self.firefox, self.SSID)
コード例 #4
0
    def test_custom_key(self, setUp):
        """Set new key passphrase then connect WS to DUT.
        """

        network = conn()
        assertion = Assert()

        # select wireless interface and enable wireless
        radio_page = RadioPage(self.firefox)
        radio_page.select_wifi_interface(iface="2.4GHZ")
        radio_page.enable_wireless()
        radio_page.apply_changes()

        # assert wireless and bandwidth
        assertion.is_equal(radio_page.get_wifi_interface(), "2.4 Ghz")
        assertion.is_equal(radio_page.wireless_isenabled(), "Enabled")

        # enable primary network, enable WPA2 and disable WPA
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_primary_network())
        network_page.enable(network_page.get_wpa2())
        network_page.disable(network_page.get_wpa())
        network_page.apply_changes()

        # Assert only WPA2 is enabled
        assertion.is_true(
            network_page.is_enabled(network_page.get_primary_network()),
            'Primary Network')
        assertion.is_true(network_page.is_enabled(network_page.get_wpa2()),
                          'WPA 2')
        assertion.is_false(network_page.is_enabled(network_page.get_wpa()),
                           'WPA')

        # change key passphrase to '1234567890'
        password = '******'
        network_page.set_password(password)
        network_page.apply_changes()

        # assert password was changed
        print(network_page.get_password())
        assertion.is_equal(network_page.get_password(), password)

        # Wifi connection attempt
        network.reset_network_mngr()
        wifi_connection = network.wifi_connection(ssid=self.SSID,
                                                  pswd=password,
                                                  timeout=20)
        try:
            assertion.is_wificonnected(wifi_connection)
        except WifiConnError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # Disconnect wired interface
        eth_iface = network.eth_iface_name()  # get name of wired iface
        eth_disc_attempt = network.disconnect_iface(eth_iface)
        try:
            assertion.is_sucessful(eth_disc_attempt, "ethernet disconnect")
        except NetworkError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # ping attempt
        wifi_iface = network.wifi_iface_name()  # get name of wifi iface
        ip = 'www.google.com'
        time.sleep(10)
        ping_attempt = network.ping_attempt(wifi_iface, ip)
        time.sleep(10)
        try:
            assertion.is_sucessful(ping_attempt, "ping attempt")
        finally:
            network.connect_iface(eth_iface)
            self.reset_wifisession(self.firefox, self.SSID)

        # enable wpa
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_wpa())

        # Set encryption to TKIP
        network_page.set_encryption("TKIP")

        # Change WiFi password
        new_pass = '******'
        network_page.set_password(new_pass)
        network_page.apply_changes()

        # check wpa-psk is enabled and encryption is TKIP
        assertion.is_true(network_page.is_enabled(network_page.get_wpa()),
                          'WPA is enabled')
        assertion.is_equal(network_page.get_encryption(), 'TKIP+AES')

        # check password is 'WpaPskChange'
        assertion.is_equal(network_page.get_password(), new_pass)

        # Wifi connection attempt
        network.reset_network_mngr()
        wifi_connection = network.wifi_connection(ssid=self.SSID,
                                                  pswd=new_pass,
                                                  timeout=20)
        try:
            assertion.is_wificonnected(wifi_connection)
        except WifiConnError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # Disconnect wired interface
        eth_disc_attempt = network.disconnect_iface(eth_iface)
        try:
            assertion.is_sucessful(eth_disc_attempt, "ethernet disconnect")
        except NetworkError:
            self.reset_wifisession(self.firefox, self.SSID)
            raise

        # ping attempt
        ip = 'www.google.com'
        ping_attempt = network.ping_attempt(wifi_iface, ip)
        try:
            assertion.is_sucessful(ping_attempt, "ping attempt")
        finally:
            network.connect_iface(eth_iface)
            self.reset_wifisession(self.firefox, self.SSID)
コード例 #5
0
    def test_deny_opensec(self, setUp):
        """DUT denies access to client without password"""

        network = conn()
        assertion = Assert()

        # select wireless interface and enable wireless
        radio_page = RadioPage(self.firefox)
        radio_page.select_wifi_interface(iface="2.4GHZ")
        radio_page.enable_wireless()
        radio_page.apply_changes()

        # assert wireless is enabled and bandwidth is 2.4Ghz
        assertion.is_equal(radio_page.get_wifi_interface(), "2.4 Ghz")
        assertion.is_equal(radio_page.wireless_isenabled(), "Enabled")

        # enable Primary Network and WPA2 and disable WPA
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_primary_network())
        network_page.enable(network_page.get_wpa2())
        network_page.disable(network_page.get_wpa())
        network_page.apply_changes()

        # Assert only WPA2 is enabled
        assertion.is_true(
            network_page.is_enabled(network_page.get_primary_network()),
            'Primary Network')
        assertion.is_true(network_page.is_enabled(network_page.get_wpa2()),
                          'WPA 2')
        assertion.is_false(network_page.is_enabled(network_page.get_wpa()),
                           'WPA')

        # Wifi connection attempt
        network.reset_network_mngr()
        wifi_connection = network.wifi_connection_nosec(ssid=self.SSID)
        try:
            assertion.is_false(wifi_connection, 'wifi connection')
        finally:
            self.reset_wifisession(self.firefox, self.SSID)

        # enable wpa and set encryption to TKIP
        network_page = NetworkPage(self.firefox)
        network_page.enable(network_page.get_wpa())
        network_page.set_encryption("TKIP")
        network_page.apply_changes()

        # check wpa-psk is enabled and encryption is TKIP
        assertion.is_true(network_page.is_enabled(network_page.get_wpa()),
                          'WPA is enabled')
        assertion.is_equal(network_page.get_encryption(), 'TKIP+AES')

        # Wifi connection attempt
        network.reset_network_mngr()
        wifi_connection = network.wifi_connection_nosec(ssid=self.SSID)
        try:
            assertion.is_false(wifi_connection, 'wifi connection')
        finally:
            self.reset_wifisession(self.firefox, self.SSID)

        # disable WPA2
        network_page = NetworkPage(self.firefox)
        network_page.disable(network_page.get_wpa2())
        network_page.apply_changes()

        # assert WPA2 (therefore WPA too for 3P Box) is disabled
        assertion.is_false(network_page.is_enabled(network_page.get_wpa2()),
                           'WPA 2')

        # Wifi connection attempt
        network.reset_network_mngr()
        time.sleep(5)
        wifi_connection = network.wifi_connection_nosec(ssid=self.SSID)
        try:
            assertion.is_wificonnected(wifi_connection)
        finally:
            self.reset_wifisession(self.firefox, self.SSID)