Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add_related, inline, <cybox:Related_Object> without <cybox:Properties> #287

@dilyanpalauzov

Description

@dilyanpalauzov

This code

import cybox.objects.file_object
import stix.core

stix_package = stix.core.STIXPackage()
file_object1 = cybox.objects.file_object.File()
file_object2 = cybox.objects.file_object.File()
stix_package.add_observable(file_object1)
file_object1.add_related(file_object2, 'Related_To', inline=False)
stix_package.add_observable(file_object2)

print(stix_package.to_xml().decode('utf-8'))

produces

<stix:STIX_Package 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:FileObj="http://cybox.mitre.org/objects#FileObject-2"
        xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns:cybox="http://cybox.mitre.org/cybox-2"
        xmlns:example="http://example.com"
        xmlns:stix="http://stix.mitre.org/stix-1"
         id="example:Package-0981f992-21e7-4482-8b77-81c3ed00c94e" version="1.2">
    <stix:Observables cybox_major_version="2" cybox_minor_version="1" cybox_update_version="0">
        <cybox:Observable id="example:Observable-7802bae4-958f-418e-b146-093761399aaf">
            <cybox:Object id="example:File-b58b6afe-e586-449e-83e9-63ebf0a4cce8">
                <cybox:Properties xsi:type="FileObj:FileObjectType">
                </cybox:Properties>
                <cybox:Related_Objects>
                    <cybox:Related_Object idref="example:File-1a2b459a-9b2f-4ef6-9fad-a78784b00744">
                        <cybox:Properties xsi:type="FileObj:FileObjectType">
                        </cybox:Properties>
                        <cybox:Relationship xsi:type="cyboxVocabs:ObjectRelationshipVocab-1.1">Related_To</cybox:Relationship>
                    </cybox:Related_Object>
                </cybox:Related_Objects>
            </cybox:Object>
        </cybox:Observable>
        <cybox:Observable id="example:Observable-34c3c3f4-185a-4ce1-be5e-b2357f32115d">
            <cybox:Object id="example:File-1a2b459a-9b2f-4ef6-9fad-a78784b00744">
                <cybox:Properties xsi:type="FileObj:FileObjectType">
                </cybox:Properties>
            </cybox:Object>
        </cybox:Observable>
    </stix:Observables>
</stix:STIX_Package>

How shall rewrite the code, so that <cybox:Related_Object idref="example:File-1a2b459a-9b2f-4ef6-9fad-a78784b00744" /> has no cybox:Properties/ (contains just idref and cybox:Relationship/ ?

What is inline supposed to do?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions