예제 #1
0
    def _wifi_scanner(self):
        # reset the known access points
        self.access_points = []
        # walk through all known wireless interfaces to get complete coverage
        for interface in self.wireless_interfaces:
            # create a card instance to work with
            card = pyw.getcard(interface)
            # check if the card is still valid
            if pyw.validcard(card):
                # skip the card if it is hard blocked
                if pyw.isblocked(card)[1]:
                    continue
                else:
                    # try to unblock a softblock, put the card up and disable the powersave mode
                    try:
                        pyw.unblock(card)
                        pyw.up(card)
                        pyw.pwrsaveset(card, False)
                    except:
                        # ignore failures
                        pass
                    # start scanning
                    wifi_scanner = get_scanner(interface)
                    # extend the access point list
                    self.access_points.extend(wifi_scanner.get_access_points())

        # the first scan has been completed
        self.first_scan_complete = True
    def unblock_interface(self, interface_name):
        """
        Unblock interface if it is blocked

        :param self: A NetworkManager object
        :param interface_name: Name of an interface
        :type self: NetworkManager
        :type interface_name: str
        :return: None
        :rtype: None
        """

        card = self._name_to_object[interface_name].card

        # unblock card if it is blocked
        if pyw.isblocked(card):
            pyw.unblock(card)
예제 #3
0
    def unblock_interface(self, interface_name):
        """
        Unblock interface if it is blocked

        :param self: A NetworkManager object
        :param interface_name: Name of an interface
        :type self: NetworkManager
        :type interface_name: str
        :return: None
        :rtype: None
        """

        card = self._name_to_object[interface_name].card

        # unblock card if it is blocked
        if pyw.isblocked(card):
            pyw.unblock(card)
 def rf_unblock(self, iface):
     '''
     Turn off the softblock
     '''
     w0 = self.get_wifi_chard(iface)  # get a card for interface
     pyw.unblock(w0)  # turn off the softblock
예제 #5
0
 def test_unblock(self):
     self.assertEquals(None, pyw.unblock(self.card))
     self.assertFalse(pyw.isblocked(self.card)[0])
예제 #6
0
 def test_block(self):
     self.assertEquals(None, pyw.block(self.card))
     self.assertTrue(pyw.isblocked(self.card))
     self.assertEquals(None, pyw.unblock(self.card))
예제 #7
0
 def test_unblock(self):
     self.assertEqual(None,pyw.unblock(self.card))
     self.assertFalse(pyw.isblocked(self.card)[0])
예제 #8
0
 def test_block(self):
     self.assertEqual(None,pyw.block(self.card))
     self.assertTrue(pyw.isblocked(self.card))
     self.assertEqual(None,pyw.unblock(self.card))
예제 #9
0
 def reset_interface(self, interface):
         pyw.down(interface)
         if pyw.isblocked(interface):
             pyw.unblock(interface)
         pyw.up(interface)