#NEWLINE# def create_port_obj( search_string , content_string , condition ) : #NEWLINE# #INDENT# from cybox.objects.port_object import Port #NEWLINE# port = Port ( ) #NEWLINE# netconn_keys = ( 'PortItem/CreationTime' , 'PortItem/localIP' , 'PortItem/remoteIP' ) #NEWLINE# attrmap = { #NEWLINE# #INDENT# 'PortItem/localPort' : 'port_value' , #NEWLINE# 'PortItem/remotePort' : 'port_value' , #NEWLINE# 'PortItem/protocol' : 'layer4_protocol' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( search_string in attrmap ) : #NEWLINE# #INDENT# set_field ( condition , attrmap [ search_string ] , content_string , condition ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( search_string in netconn_keys ) : #NEWLINE# #INDENT# return create_network_connection_obj ( search_string , content_string , condition ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# return Object ( port )