Ejemplo n.º 1
0
    def _deauth_stop_sniffer(self):

        # region Set network filter
        network_filters = {'Ethernet': {'source': self._target['mac-address']}}

        if self._mitm_technique == 2:
            network_filters = {
                'Ethernet': {
                    'source': self._target['mac-address'],
                    'destination': 'ff:ff:ff:ff:ff:ff'
                },
                'IPv4': {
                    'source-ip': '0.0.0.0',
                    'destination-ip': '255.255.255.255'
                },
                'UDP': {
                    'source-port': 68,
                    'destination-port': 67
                }
            }
        # endregion

        # region Start sniffer
        sniff = RawSniff()
        sniff.start(protocols=['IPv4', 'IPv6', 'ICMPv6', 'UDP', 'DHCPv4'],
                    prn=self._deauth_stop_prn, filters=network_filters,
                    network_interface=self._your['network-interface'],
                    scapy_filter='icmp6 or (udp and (port 67 or 68))',
                    scapy_lfilter=lambda eth: eth.src == self._target['mac-address'])
Ejemplo n.º 2
0
def requests_sniffer(source_mac_address: str = '12:34:56:78:90:ab'):

    # region Set network filter
    network_filters = {'Ethernet': {'source': source_mac_address}}

    if technique_index == 2:
        network_filters = {
            'Ethernet': {
                'source': source_mac_address,
                'destination': 'ff:ff:ff:ff:ff:ff'
            },
            'IPv4': {
                'source-ip': '0.0.0.0',
                'destination-ip': '255.255.255.255'
            },
            'UDP': {
                'source-port': 68,
                'destination-port': 67
            }
        }
    # endregion

    # region Start sniffer
    sniff = RawSniff()
    sniff.start(protocols=['ARP', 'IPv4', 'IPv6', 'ICMPv6', 'UDP', 'DHCPv4'],
                prn=requests_sniffer_prn,
                filters=network_filters)
Ejemplo n.º 3
0
                                request[proto][key][value])

    print(dumps(request, sort_keys=True, indent=4))


# endregion

# region Main function
if __name__ == "__main__":

    # region Print info message
    base.print_info(
        "Available protocols: ",
        "Radiotap 802.11 Ethernet ARP IPv4 IPv6 UDP DNS ICMPv4 DHCPv4 ICMPv6 DHCPv4"
    )
    base.print_info("Start test sniffing ...")
    # endregion

    # region Start sniffer
    sniff = RawSniff()
    sniff.start(protocols=['IPv4', 'IPv6', 'UDP', 'DNS', 'ICMPv4'],
                prn=print_packet,
                filters={'UDP': {
                    'source-port': 53
                }})
    # sniff.start(protocols=['Radiotap', '802.11'], prn=print_packet,
    #             network_interface='wlan0', filters={'802.11': {'type': 0x88, 'bss id': '70:f1:1c:15:15:b8'}})
    # endregion

# endregion