(self)
Initialize the DNS spoofer.
Initialize the DNS spoofer.
Initialize the DNS spoofer .
def initialize(self):
        """Initialize the DNS spoofer.
        """
        dns_spoofed = self.config['dns_spoofed'].value
        dns_name    = self.config['dns_name'].value
        if dns_name in self.dns_spoofed_pair:
            util.Error("DNS pattern is already being spoofed.")
            return None

        if 'www' in dns_spoofed or '.com' in dns_spoofed:
            # hostname, get ip
            dns_spoofed = util.getipbyhost(dns_spoofed)

        dns_name = re.compile(dns_name)
        self.dns_spoofed_pair[dns_name] = dns_spoofed
        self.running = True

        util.Msg('Starting DNS spoofer...')
        thread = Thread(target=self.dns_sniffer)

        self.config['dns_spoofed'].value = dns_spoofed
        self.config['dns_name'].value = dns_name
        thread.start()

        if self.config['victim'].value is None:
            return 'All DNS requests'
        else:
            return self.config['victim'].value
def initialize ( self ) : dns_spoofed = self . config [ 'dns_spoofed' ] . value dns_name = self . config [ 'dns_name' ] . value if dns_name in self . dns_spoofed_pair : util . Error ( "DNS pattern is already being spoofed." ) return None if 'www' in dns_spoofed or '.com' in dns_spoofed : # hostname, get ip dns_spoofed = util . getipbyhost ( dns_spoofed ) dns_name = re . compile ( dns_name ) self . dns_spoofed_pair [ dns_name ] = dns_spoofed self . running = True util . Msg ( 'Starting DNS spoofer...' ) thread = Thread ( target = self . dns_sniffer ) self . config [ 'dns_spoofed' ] . value = dns_spoofed self . config [ 'dns_name' ] . value = dns_name thread . start ( ) if self . config [ 'victim' ] . value is None : return 'All DNS requests' else : return self . config [ 'victim' ] . value