Exemple #1
0
 def create_file_system_object(self, file_system_attributes):
     fs_object = maec.ObjectType(id=self.generator.generate_obj_id())
     fs_object_attributes = maec.File_System_Object_Attributes()
     fs_hashes = maec.Hashes()
     for key, value in file_system_attributes.items():
         if key == 'md5':
             md5_hash = maec.HashType(type_='MD5', Hash_Value=value)
             fs_hashes.add_Hash(md5_hash)
         elif key == 'sha1':
             sha1_hash = maec.HashType(type_='SHA1', Hash_Value=value)
             fs_hashes.add_Hash(sha1_hash)
         elif key == 'packer':
             packing = maec.Packing(is_packed='True')
             packer = maec.Packer_Type(Name=value, Version='Unknown')
             packing.add_Packer_Type(packer)
             fs_object_attributes.set_Packing(packing)
         elif key == 'av_aliases':
             fs_object.set_Classifications(value)
         elif key == 'filename':
             fs_object.set_object_name(value)
         elif key == 'filepath':
             path_obj = maec.Path(type_='Relative', valueOf_=value)
             fs_object_attributes.set_Path(path_obj)
         elif key == 'type':
             fs_object.set_type(value)
         elif key == 'origin':
             uriobj = maec.uriObject(id=self.generator.generate_id())
             uriobj.set_uriString(value)
             fs_object_attributes.set_Origin(uriobj)
     if fs_hashes.hasContent_():
         fs_object_attributes.set_Hashes(fs_hashes)
     if fs_object_attributes.hasContent_():
         fs_object.set_File_System_Object_Attributes(fs_object_attributes)
     return fs_object
Exemple #2
0
 def create_internet_object(self, internet_attributes):
     internet_object = maec.ObjectType(id=self.generator.generate_obj_id(), type_='URI')
     internet_object_attributes = maec.Internet_Object_Attributes()
     #set object attributes
     for key, value in internet_attributes.items():
         if key == 'type':
             internet_object.set_type(value)
         elif key == 'uri':
             uriobj = maec.uriObject(id=self.generator.generate_id())
             uriobj.set_uriString(value)
             internet_object_attributes.set_URI(uriobj)
     
     if internet_object_attributes.hasContent_():
         internet_object.set_Internet_Object_Attributes(internet_object_attributes)
     
     return internet_object