Skip to content

Commit 1397f90

Browse files
authored
Merge pull request STIXProject#330 from emmanvg/master
Add equivalent JSON output for example
2 parents 034bc55 + e1593de commit 1397f90

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

docs/api/extensions/marking/ais.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ function.
6262
# Print the XML.
6363
print stix_package.to_xml()
6464
65+
# Print the JSON.
66+
print stix_package.to_json()
67+
6568
This corresponds to the XML result:
6669

6770
.. code-block:: xml
@@ -125,6 +128,85 @@ This corresponds to the XML result:
125128
</stix:Indicators>
126129
</stix:STIX_Package>
127130
131+
The following corresponds to the JSON result:
132+
133+
.. code-block:: json
134+
135+
{
136+
"stix_header": {
137+
"handling": [
138+
{
139+
"controlled_structure": "//node() | //@*",
140+
"information_source": {
141+
"identity": {
142+
"xsi:type": "stix-ciqidentity:CIQIdentity3.0InstanceType",
143+
"specification": {
144+
"organisation_info": {
145+
"industry_type": "Information Technology Sector|Communications Sector"
146+
},
147+
"party_name": {
148+
"organisation_names": [
149+
{
150+
"name_elements": [
151+
{
152+
"value": "Example Corporation"
153+
}
154+
]
155+
}
156+
]
157+
},
158+
"addresses": [
159+
{
160+
"country": {
161+
"name_elements": [
162+
{
163+
"name_code_type": "ISO 3166-1 alpha-2",
164+
"name_code": "US"
165+
}
166+
]
167+
},
168+
"administrative_area": {
169+
"name_elements": [
170+
{
171+
"name_code_type": "ISO 3166-2",
172+
"name_code": "US-VA"
173+
}
174+
]
175+
}
176+
}
177+
]
178+
}
179+
}
180+
},
181+
"marking_structures": [
182+
{
183+
"xsi:type": "AIS:AISMarkingStructure",
184+
"not_proprietary": {
185+
"tlp_marking": {
186+
"color": "GREEN"
187+
},
188+
"ais_consent": {
189+
"consent": "EVERYONE"
190+
},
191+
"cisa_proprietary": "false"
192+
}
193+
}
194+
]
195+
}
196+
]
197+
},
198+
"version": "1.2",
199+
"indicators": [
200+
{
201+
"description": "Example using AIS",
202+
"title": "My Indicator Example",
203+
"timestamp": "2017-10-02T14:26:57.510000+00:00",
204+
"id": "example:indicator-81466b8d-4efb-460f-ba13-b072420b9540"
205+
}
206+
],
207+
"id": "example:Package-a8c8135d-18d8-4384-903f-71285a02346e"
208+
}
209+
128210
Parsing AIS Markings
129211
--------------------
130212

@@ -140,6 +222,7 @@ consumer of AIS would parse the data.
140222
141223
# Parse STIX Package
142224
stix_package = STIXPackage.from_xml("stix_input.xml")
225+
# stix_package = STIXPackage.from_json("stix_input.json")
143226
144227
# Print all indicators
145228
for indicator in stix_package.indicators:

0 commit comments

Comments
 (0)