How to use the networkml.parsers.pcap.pcap_utils.clean_session_dict function in networkml

To help you get started, we’ve selected a few networkml 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 CyberReboot / NetworkML / networkml / algorithms / base.py View on Github external
source_mac,
                        reps,
                        timestamps,
                        preds,
                        others,
                        self.model_hash
                    )

                ## Get the sessions that the model looked at
                sessions = self.model.sessions
                ## Clean the sessions
                clean_sessions = []
                inferred_mac = None
                for session_dict in sessions:
                    cleaned_sessions, inferred_mac = \
                        clean_session_dict(
                            session_dict,
                            source_address=source_mac
                        )
                    clean_sessions.append(cleaned_sessions)

                if source_mac is None:
                    source_mac = inferred_mac

                ## Make simple decisions based on vector differences and update
                ## times
                timestamp = timestamps[0].timestamp()
                labels, confs = zip(*preds)
                abnormality = 0.0
                if self.has_avx():
                    from networkml.algorithms.sos.eval_SoSModel import eval_pcap
                    try:
github CyberReboot / NetworkML / networkml / algorithms / randomforest / RandomForest.py View on Github external
source_mac,
                        reps,
                        timestamps,
                        preds,
                        others,
                        self.model_hash
                    )

                # Get the sessions that the model looked at
                sessions = self.model.sessions
                # Clean the sessions
                clean_sessions = []
                inferred_mac = None
                for session_dict in sessions:
                    cleaned_sessions, inferred_mac = \
                        clean_session_dict(
                            session_dict,
                            source_address=source_mac
                        )
                    clean_sessions.append(cleaned_sessions)

                if source_mac is None:
                    source_mac = inferred_mac

                # Make simple decisions based on vector differences and update times
                timestamp = timestamps[0].timestamp()
                labels, confs = zip(*preds)
                abnormality = eval_pcap(
                    str(fi), self.conf_labels, self.time_const, label=labels[0],
                    rnn_size=self.rnn_size, model_path=self.model_path, model_type='randomforest')
                prev_s = self.common.get_address_info(
                    source_mac,