示例#1
0
 def from_dict(object_dict):
     if not object_dict:
         return None
     obj = Object.from_dict(object_dict, AssociatedObject())
     obj.association_type = VocabString.from_dict(
         object_dict.get('association_type', None))
     return obj
示例#2
0
 def from_obj(object_obj):
     if not object_obj:
         return None
     obj = Object.from_obj(object_obj, AssociatedObject())
     obj.association_type = VocabString.from_obj(
         object_obj.Association_Type)
     return obj
示例#3
0
def convert_network_traffic_to_network_icmp_packet(icmp_ext, nc, obs20_id):
    obj1x = NetworkPacket()
    obj1x.internet_layer = InternetLayer()
    info("Assuming imcp packet in %s is v4", 701, obs20_id)
    icmpv4 = ICMPv4Packet()
    icmpv4.icmpv4_header = ICMPv4Header()
    icmpv4.icmpv4_header.type_ = icmp_ext["icmp_type_hex"]
    icmpv4.icmpv4_header.code = icmp_ext["icmp_code_hex"]
    obj1x.internet_layer.icmpv4 = icmpv4
    nc.add_related(obj1x, VocabString("ICMP_Packet"), inline=True)
示例#4
0
def convert_network_traffic_to_network_socket(socket_ext, nc, obs20_id):
    obj1x = NetworkSocket()
    convert_obj(socket_ext, obj1x, SOCKET_MAP, obs20_id)
    if "options" in socket_ext:
        obj1x.options = SocketOptions()
        convert_obj(socket_ext["options"], obj1x.options, SOCKET_OPTIONS_MAP,
                    obs20_id)
    if "socket_handle" in socket_ext:
        warn("%s not representable in a STIX 1.x %s.  Found in %s", 503,
             "socket_handle", "NetworkSocket", obs20_id)
    nc.add_related(obj1x, VocabString("Related_Socket"), inline=True)
 def from_dict(object_dict):
     if not object_dict:
         return None
     obj = Object.from_dict(object_dict, AssociatedObject())
     obj.association_type = VocabString.from_dict(object_dict.get('association_type', None))
     return obj
 def from_obj(object_obj):
     if not object_obj:
         return None
     obj = Object.from_obj(object_obj, AssociatedObject())
     obj.association_type = VocabString.from_obj(object_obj.Association_Type)
     return obj
 def test_plain(self):
     a = VocabString("test_value")
     self.assertTrue(a.is_plain())