コード例 #1
0
 def set_connection(self, connection):
     self._pName = connection[1]
     self._src_ip = hex_to_ip(connection[4])
     self._src_port = connection[5]
     self._dst_ip = hex_to_ip(connection[6])
     self._dst_port = connection[7]
     self._state = connection[8]
コード例 #2
0
 def _manage_connections(self, connections):
     for src_ip, src_port, dst_ip, dst_port, protocol, state in connections:
         conn = (src_ip, src_port, dst_ip, dst_port, state)
         if (conn[2] == 0) or (conn in self._connections_history) or (IPAddress(hex_to_ip(conn[2])).is_loopback()):
             continue
         self._connections_history.append(conn)
         output = (int(time()), self.name, self.pid, protocol, src_ip, src_port, dst_ip, dst_port, state)
         self._console_writer.put(output)
         self._log_file_writer.put(output)
         self._metadata_file_writer.put(output)