How to use the nfstream.entry.NFEntry function in nfstream

To help you get started, we’ve selected a few nfstream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aouinizied / nfstream / nfstream / cache.py View on Github external
""" consume an observable and produce entry """
        # classical create/update
        try:  # update entry
            entry = self._roots[obs.root_idx][obs.nfhash].update(obs,
                                                                 self.core_plugins,
                                                                 self.user_plugins,
                                                                 self.active_timeout)
            if entry is not None:
                if entry.expiration_id < 0:  # custom expiration
                    self.producer.send_pyobj(entry)
                    del self._roots[obs.root_idx][obs.nfhash]
                    self.active_entries -= 1
                else:  # active expiration
                    self.producer.send_pyobj(entry)
                    del self._roots[obs.root_idx][obs.nfhash]
                    self._roots[obs.root_idx][obs.nfhash] = NFEntry(obs,
                                                                    self.core_plugins,
                                                                    self.user_plugins,
                                                                    self.idx_generator)
                    self.idx_generator += 1
        except KeyError:  # create entry
            self._roots[obs.root_idx][obs.nfhash] = NFEntry(obs,
                                                            self.core_plugins,
                                                            self.user_plugins,
                                                            self.idx_generator)
            self.active_entries += 1
            self.idx_generator += 1
github aouinizied / nfstream / nfstream / cache.py View on Github external
self.active_timeout)
            if entry is not None:
                if entry.expiration_id < 0:  # custom expiration
                    self.producer.send_pyobj(entry)
                    del self._roots[obs.root_idx][obs.nfhash]
                    self.active_entries -= 1
                else:  # active expiration
                    self.producer.send_pyobj(entry)
                    del self._roots[obs.root_idx][obs.nfhash]
                    self._roots[obs.root_idx][obs.nfhash] = NFEntry(obs,
                                                                    self.core_plugins,
                                                                    self.user_plugins,
                                                                    self.idx_generator)
                    self.idx_generator += 1
        except KeyError:  # create entry
            self._roots[obs.root_idx][obs.nfhash] = NFEntry(obs,
                                                            self.core_plugins,
                                                            self.user_plugins,
                                                            self.idx_generator)
            self.active_entries += 1
            self.idx_generator += 1