コード例 #1
0
    def hop_channels(self):
        """
        Hops through the available channels to find more access points.
        """
        try:
            card = NetworkCard(self.running_interface)
            available_channels = card.get_available_channels()
            n_available_channels = len(available_channels)
            current_channel_index = 0
            while self.sniffer_running:
                try:
                    if self.configs["hop_channels"].lower() == "true":
                        if current_channel_index < n_available_channels:
                            card.set_channel(
                                available_channels[current_channel_index])
                        else:
                            card.set_channel(1)
                            current_channel_index = 0
                    else:
                        card.set_channel(
                            int(self.configs["fixed_sniffing_channel"]))

                    sleep(.25)
                except Exception:
                    pass

                current_channel_index += 1
        except Exception:
            pass  # The sniffer has already been aborted
コード例 #2
0
    def hop_channels(self):
        """
        Hops through the available channels to find more access points.
        """
        try:
            card = NetworkCard(self.running_interface)
            available_channels = card.get_available_channels()
            n_available_channels = len(available_channels)
            current_channel_index = 0
            while self.sniffer_running:
                try:
                    if self.configs["hop_channels"].lower() == "true":
                        if current_channel_index < n_available_channels:
                            card.set_channel(available_channels[current_channel_index])
                        else:
                            card.set_channel(1)
                            current_channel_index = 0
                    else:
                        card.set_channel(int(self.configs["fixed_sniffing_channel"]))

                    sleep(.25)
                except Exception:
                    pass

                current_channel_index += 1
        except Exception:
            pass  # The sniffer has already been aborted
コード例 #3
0
    def start_sniffer(self, plugins = []):
        """
        This method starts the AirScanner sniffing service.
        """
        # Sniffing options
        if not self.air_scanner.sniffer_running:
            self.add_plugins(plugins, self.air_scanner, AirScannerPlugin)
            card = NetworkCard(self.configs["airscanner"]["sniffing_interface"])
            try:
                fixed_sniffing_channel = int(self.configs["airscanner"]["fixed_sniffing_channel"])
                if fixed_sniffing_channel not in card.get_available_channels():
                    raise
            except:
                print "Chosen operating channel is not supported by the Wi-Fi card.\n"
                return

            sniffing_interface = self.configs["airscanner"]["sniffing_interface"]
            if  sniffing_interface not in winterfaces():
                print "[-] sniffing_interface '{}' does not exist".format(sniffing_interface)
                return

            if not self.network_manager.set_mac_and_unmanage(sniffing_interface, card.get_mac(), retry = True):
                print "[-] Unable to set mac and unmanage, resetting interface and retrying."
                print "[-] Sniffer will probably crash."

            self.air_scanner.start_sniffer(sniffing_interface)

        else:
            print "[-] Sniffer already running"
コード例 #4
0
    def start_sniffer(self, plugins=[]):
        """
        This method starts the AirScanner sniffing service.
        """
        # Sniffing options
        if not self.air_scanner.sniffer_running:
            self.add_plugins(plugins, self.air_scanner, AirScannerPlugin)
            card = NetworkCard(
                self.configs["airscanner"]["sniffing_interface"])
            try:
                fixed_sniffing_channel = int(
                    self.configs["airscanner"]["fixed_sniffing_channel"])
                if fixed_sniffing_channel not in card.get_available_channels():
                    raise
            except:
                print "Chosen operating channel is not supported by the Wi-Fi card.\n"
                return

            sniffing_interface = self.configs["airscanner"][
                "sniffing_interface"]
            if sniffing_interface not in winterfaces():
                print "[-] sniffing_interface '{}' does not exist".format(
                    sniffing_interface)
                return

            if not self.network_manager.set_mac_and_unmanage(
                    sniffing_interface, card.get_mac(), retry=True):
                print "[-] Unable to set mac and unmanage, resetting interface and retrying."
                print "[-] Sniffer will probably crash."

            self.air_scanner.start_sniffer(sniffing_interface)

        else:
            print "[-] Sniffer already running"
コード例 #5
0
	def hop_channels(self):
		# Hop through channels to get find more beacons
		try:
			card = NetworkCard(self.running_interface)
			available_channels = card.get_available_channels()
			n_available_channels = len(available_channels)
			current_channel_index = 0
			while self.sniffer_running:
				try:

					if current_channel_index < n_available_channels:
						card.set_channel(available_channels[current_channel_index])
					else:
						card.set_channel(1)
						current_channel_index = 0

					sleep(.25)
				except Exception as e:
					pass

				current_channel_index += 1
		except Exception as e:
			pass # The sniffer has already been aborted