Esempio n. 1
0
    def GetNetworks(self, essid=None):
        """Get a list of available wireless networks.

        NOTE: the essid parameter is not used here,
        it was added for the iwlist scan for hidden networks.

        Returns:
        A list containing available wireless networks.

        """
        if not IWSCAN_AVAIL:
            # Use the slow version if python-iwscan isn't available.
            return BaseWirelessInterface.GetNetworks(self)

        if not self.scan_iface:
            try:
                self.scan_iface = iwscan.WirelessInterface(self.iface)
            except iwscan.error as e:
                print(("GetNetworks caught an exception: %s" % e))
                return []

        try:
            results = self.scan_iface.Scan()
        except iwscan.error as e:
            print(("ERROR: %s" % e))
            return []
        return [_f for _f in [self._parse_ap(cell) for cell in results] if _f]
Esempio n. 2
0
    def GetNetworks(self):
        """ Get a list of available wireless networks.

        Returns:
        A list containing available wireless networks.

        """
        print("IWSCAN_AVAIL {0}".format(IWSCAN_AVAIL))
        if not IWSCAN_AVAIL:
            # Use the slow version if python-iwscan isn't available.
            return BaseWirelessInterface.GetNetworks(self)

        if not self.scan_iface:
            try:
                self.scan_iface = iwscan.WirelessInterface(self.iface)
            except iwscan.error as e:
                print("GetNetworks caught an exception: {0}".format(e))
                return []

        try:
            results = self.scan_iface.Scan()
        except iwscan.error as e:
            print("ERROR: {0}".format(e))
            return []
        print("result {0}".format(results))
        return filter(None, [self._parse_ap(cell) for cell in results])
Esempio n. 3
0
    def GetNetworks(self):
        """ Get a list of available wireless networks.

        Returns:
        A list containing available wireless networks.

        """
        if not IWSCAN_AVAIL:
            # Use the slow version if python-iwscan isn't available.
            return BaseWirelessInterface.GetNetworks(self)

        if not self.scan_iface:
            try:
                self.scan_iface = iwscan.WirelessInterface(self.iface)
            except iwscan.error, e:
                print "GetNetworks caught an exception: %s" % e
                return []
Esempio n. 4
0
    def GetNetworks(self, essid=None):
        """ Get a list of available wireless networks.
	
        NOTE: the essid parameter is not used here,
        it was added for the iwlist scan for hidden networks.

        Returns:
        A list containing available wireless networks.

        """
        if not IWSCAN_AVAIL:
            # Use the slow version if python-iwscan isn't available.
            return BaseWirelessInterface.GetNetworks(self)

        if not self.scan_iface:
            try:
                self.scan_iface = iwscan.WirelessInterface(self.iface)
            except iwscan.error, e:
                print "GetNetworks caught an exception: %s" % e
                return []
Esempio n. 5
0
                print(ierj + 'Pairwise Ciphers (%d) : %s' %
                      (len(ie['pairwise']), ' '.join(ie['pairwise'])))

            if ie.get('auth'):
                print(ierj + 'Authentication Suites (%d) : %s' %
                      (len(ie['auth']), ' '.join(ie['auth'])))

        print


if __name__ == '__main__':
    try:
        print('python-iwscan v%d.%d.%d' % iwscan.version())
        print('iwlib v%d - wext v%d\n' %
              (iwscan.iw_version(), iwscan.we_version()))
        wi = iwscan.enum_devices()
        for w in wi:
            res = iwscan.WirelessInterface(w).Scan()
            if len(res) < 1:
                print("%-10sNo scan results." % w)
            else:
                print("%-10sScan completed :" % w)
                printScanResults(res)
    except iwscan.error, e:
        print("Error: %s" % e)
        sys.exit(1)
    else:
        if len(wi) < 1:
            print("No wireless devices detected!")
            sys.exit(1)