Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
Archivo: dns.py Proyecto: NullMode/zarp
    def initialize(self):
        """Initialize the DNS spoofer.  This is dependent
           on a running ARP spoof; for now!
        """
        try:
            arps = None
            key = None
            if 'ARP Spoof' in stream.HOUSE:
                house = stream.HOUSE['ARP Spoof']
            else:
                util.Error('ARP spoof required!')
                return

            while True:
                stream.dump_module_sessions('ARP Spoof')
                try:
                    num = int(raw_input('[number] > '))
                except TypeError:
                    continue
                if len(house.keys()) > num:
                    key = house.keys()[num]
                    arps = house[key]

                    self.source = arps.victim[0]
                    self.local_mac = arps.local[1]
                    break
                else:
                    return

            dns_name = raw_input('[!] Enter regex to match DNS:\t')
            if dns_name in self.dns_spoofed_pair:
                util.Msg('DNS is already being spoofed (%s).'
                                    % (self.dns_spoofed_pair[dns_name]))
                return

            dns_spoofed = raw_input('[!] Spoof DNS entry matching %s to:\t'
                                % (dns_name))
            tmp = raw_input('[!] Spoof DNS record \'%s\' to \'%s\'.  Is this correct?'%
                                (dns_name,dns_spoofed))

            if 'n' in tmp.lower():
                return

            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)
            thread.start()
        except KeyboardInterrupt:
            return None
        except re.error:
            util.Error('Invalid regex given.')
            return None
        except Exception, j:
            util.Error('Error: %s' % j)
            return None
Ejemplo n.º 4
0
    def initialize(self):
        """Initialize the DNS spoofer.  This is dependent
           on a running ARP spoof; for now!
        """
        try:
            arps = None
            key = None
            if 'ARP Spoof' in stream.HOUSE:
                house = stream.HOUSE['ARP Spoof']
            else:
                util.Error('ARP spoof required!')
                return

            while True:
                stream.dump_module_sessions('ARP Spoof')
                try:
                    num = int(raw_input('[number] > '))
                except TypeError:
                    continue
                if len(house.keys()) > num:
                    key = house.keys()[num]
                    arps = house[key]

                    self.source = arps.victim[0]
                    self.local_mac = arps.local[1]
                    break
                else:
                    return

            dns_name = raw_input('[!] Enter regex to match DNS:\t')
            if dns_name in self.dns_spoofed_pair:
                util.Msg('DNS is already being spoofed (%s).' %
                         (self.dns_spoofed_pair[dns_name]))
                return

            dns_spoofed = raw_input('[!] Spoof DNS entry matching %s to:\t' %
                                    (dns_name))
            tmp = raw_input(
                '[!] Spoof DNS record \'%s\' to \'%s\'.  Is this correct?' %
                (dns_name, dns_spoofed))

            if 'n' in tmp.lower():
                return

            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)
            thread.start()
        except KeyboardInterrupt:
            return None
        except re.error:
            util.Error('Invalid regex given.')
            return None
        except Exception, j:
            util.Error('Error: %s' % j)
            return None