def _get_client_addresses(self): sniffer = WiFiSniffer(self.interface) packets = sniffer.sniff(timeout=self.timeout, lfilter=lambda pkt: not pkt.haslayer(Dot11ProbeResp) and\ pkt.addr3 == self.bssid) clients = set() for packet in packets: if self._is_valid(packet.addr1): clients.add(packet.addr1) if self._is_valid(packet.addr2): clients.add(packet.addr2) return clients
def find(self): sniffer = WiFiSniffer(self.interface) packets = sniffer.sniff(timeout=self.DEFAULT_TIMEOUT, lfilter=lambda pkt: pkt.haslayer(RadioTap) and\ pkt.addr3 == self.bssid) channel_packet = None # Find a packet containing channel information. for packet in packets: if self._packet_has_channel_info(packet[RadioTap]): channel_packet = packet[RadioTap] break sniffer.stop() if channel_packet is None: raise AttackException('Failed to find AP channel!') # Extract channel from radiotap header. return self._extract_channel_from(channel_packet)