Exemplo n.º 1
0
 def dict_from_object(cls, process_obj):
     process_dict = {}
     if process_obj.get_is_hidden() is not None: process_dict['is_hidden'] = {'value' : process_obj.get_is_hidden()}
     if process_obj.get_PID() is not None: process_dict['pid'] = Base_Object_Attribute.dict_from_object(process_obj.get_PID())
     if process_obj.get_Creation_Time() is not None: process_dict['creation_time'] = Base_Object_Attribute.dict_from_object(process_obj.get_Creation_Time())
     if process_obj.get_Parent_PID() is not None: process_dict['parent_pid'] = Base_Object_Attribute.dict_from_object(process_obj.get_Parent_PID())
     if process_obj.get_Child_PID_List() is not None:
         child_pid_list = []
         for child_pid in process_obj.get_Child_PID_List().get_Child_PID():
             child_pid_list.append(Base_Object_Attribute.dict_from_object(child_pid)) 
         process_dict['child_pid_list'] = child_pid_list
     if process_obj.get_Image_Info() is not None:
         image_info = process_obj.get_Image_Info()
         image_info_dict = {}
         if image_info.get_File_Name() is not None: image_info_dict['file_name'] = Base_Object_Attribute.dict_from_object(image_info.get_File_Name())
         if image_info.get_Command_Line() is not None: image_info_dict['command_line'] = Base_Object_Attribute.dict_from_object(image_info.get_Command_Line())
         if image_info.get_Current_Directory() is not None: image_info_dict['current_directory'] = Base_Object_Attribute.dict_from_object(image_info.get_Current_Directory())
         if image_info.get_Path() is not None: image_info_dict['path'] = Base_Object_Attribute.dict_from_object(image_info.get_Path())
         process_dict['image_info'] = image_info_dict
     if process_obj.get_Argument_List() is not None:
         argument_list = []
         for argument in process_obj.get_Argument_List().get_Argument():
             argument_list.append(Base_Object_Attribute.dict_from_object(argument))
         process_dict['argument_list'] = argument_list
     if process_obj.get_Environment_Variable_List() is not None: process_dict['Environment_Variable_List'] = Environment_Variable_List.dict_from_object(process_obj.get_Environment_Variable_List())
     if process_obj.get_Kernel_Time() is not None: process_dict['kernel_time'] = Base_Object_Attribute.dict_from_object(image_info.get_Kernel_Time())
     if process_obj.get_Port_List() is not None: 
         port_list = []
         for port in process_obj.get_Port_List().get_Port():
             port_list.append(port.dict_from_object(port))
         process_dict['port_list'] = port_list
     if process_obj.get_Network_Connection_List() is not None:
         network_connection_list = []
         for network_connection in process_obj.get_Network_Connection_List().get_Network_Connection():
             network_connection_dict = {}
             if network_connection.get_Creation_Time() is not None: network_connection_dict['creation_time'] = Base_Object_Attribute.dict_from_object(network_connection.get_Creation_Time())
             if network_connection.get_Destination_IP_Address() is not None: network_connection_dict['destination_ip_Address'] = Address.dict_from_object(network_connection.get_Destination_IP_Address())
             if network_connection.get_Destination_Port() is not None: network_connection_dict['destination_port'] = port.dict_from_object(network_connection.get_Destination_Port())
             if network_connection.get_Source_IP_Address() is not None: network_connection_dict['source_ip_Address'] = Address.dict_from_object(network_connection.get_Source_IP_Address())
             if network_connection.get_Destination_Port() is not None: network_connection_dict['source_port'] = port.dict_from_object(network_connection.get_Source_Port())
             if network_connection.get_TCP_State() is not None: network_connection_dict['tcp_state'] = Base_Object_Attribute.dict_from_object(network_connection.get_TCP_State())
             network_connection_list.append(network_connection_dict)
         process_dict['network_connection_list'] = network_connection_list
     if process_obj.get_Start_Time() is not None: process_dict['start_time'] = Base_Object_Attribute.dict_from_object(process_obj.get_Start_Time())
     if process_obj.get_Status() is not None: process_dict['status'] = Base_Object_Attribute.dict_from_object(process_obj.get_Status())
     if process_obj.get_String_List() is not None: process_dict['Extracted_String_List'] = Extracted_String_List.dict_from_object(process_obj.get_String_List())
     if process_obj.get_Username() is not None: process_dict['username'] = Base_Object_Attribute.dict_from_object(process_obj.get_Username())
     if process_obj.get_User_Time() is not None: process_dict['user_time'] = Base_Object_Attribute.dict_from_object(process_obj.get_User_Time())
     return process_dict