Пример #1
0
    def initialize(self):
        interface.wait_for_interface(self.lan_int)
        self.lan_ip = interface.wait_for_ip(self.lan_int)
        while True:
            if (self.syslog_servers): break

            fast_sleep(FIVE_SEC)

        threading.Thread(target=self.process_message_queue).start()
Пример #2
0
    def __register(cls, intf):
        '''will register interface with ip and socket. a new socket will be used every
        time this method is called.

        Do not override.

        '''
        zone, _intf = intf

        wait_for_interface(interface=_intf)
        ip = wait_for_ip(interface=_intf)

        # sock sender is the direct reference to the socket send method
        cls._registered_socks[zone] = NFQ_SEND_SOCK(*intf, ip,
                                                    cls.sock_sender(_intf))

        cls._Log.notice(f'{cls.__name__}: {_intf} registered.')
    def __register(self, intf):
        '''will register interface with ip and socket. a new socket will be used every
        time this method is called.

        Do not override.

        '''
        zone, _intf = intf
        self._intf = _intf

        interface.wait_for_interface(interface=_intf)
        ip = interface.wait_for_ip(interface=_intf)
        mac = interface.get_mac(interface=_intf)

        self._registered_socks[zone] = NFQ_SOCK(*intf, mac, ip,
                                                self.listener_sock)

        self._Log.notice(f'{self.__class__.__name__}: {_intf} registered.')
    def __register(self, listener, intf=None):
        '''will register interface with listener. requires subclass property for listener_sock returning valid socket object.
        once registration is complete the thread will exit.'''
        # this is being defined here the listener will be able to correlate socket back to interface and send in.
        _intf = intf if intf else self._intf
        self._Log.debug(
            f'{self._name} started interface registration for {_intf}')

        interface.wait_for_interface(interface=_intf)
        self._intf_ip = interface.wait_for_ip(interface=_intf)

        l_sock = self.listener_sock
        listener.__registered_socks[l_sock.fileno()] = L_SOCK(
            l_sock, _intf)  # TODO: make a namedtuple
        # TODO: if we dont re register, and im pretty sure i got rid of that, we shouldnt need to track the interface
        # anymore yea? the fd and socket object is all we need, unless we need to get the source ip address. OH. does the
        # dns proxy need to grab its interface ip for sending to the client? i dont think so, right? it jsut needs to
        # spoof the original destination.
        listener.__epoll.register(l_sock.fileno(), select.EPOLLIN)

        self._Log.notice(f'{self._name} | {_intf} registered.')
Пример #5
0
    def __register(cls, intf):
        '''will register interface with listener. requires subclass property for listener_sock returning valid socket object.
        once registration is complete the thread will exit.'''
        # this is being defined here the listener will be able to correlate socket back to interface and send in.

        cls._Log.debug(
            f'{cls.__name__} started interface registration for {intf}')

        wait_for_interface(interface=intf)

        intf_ip = wait_for_ip(interface=intf)

        l_sock = cls.listener_sock(intf, intf_ip)
        cls.__registered_socks[l_sock.fileno()] = L_SOCK(
            intf, intf_ip, l_sock, l_sock.send, l_sock.sendto, l_sock.recvfrom)

        # TODO: if we dont re register, and im pretty sure i got rid of that, we shouldnt need to track the interface
        # anymore yea? the fd and socket object is all we need, unless we need to get the source ip address. OH. does the
        # dns proxy need to grab its interface ip for sending to the client? i dont think so, right? it jsut needs to
        # spoof the original destination.
        cls.__epoll.register(l_sock.fileno(), select.EPOLLIN)

        cls._Log.notice(f'{cls.__name__} | {intf} registered.')