|
|
|
@ -144,12 +144,12 @@
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--548af3be-39d7-4a3e-93c2-1a63cccf8951"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--2f3d4926-163d-4aef-bcd2-19dea96916ae"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"name"</span><span class=\"p\">:</span> <span class=\"s2\">"File hash for malware variant"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"pattern"</span><span class=\"p\">:</span> <span class=\"s2\">"[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"valid_from"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193659Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"valid_from"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509629Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"labels"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"malicious-activity"</span>\n",
|
|
|
|
|
" <span class=\"p\">]</span>\n",
|
|
|
|
@ -465,9 +465,9 @@
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"malware"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--3d7f0c1c-616a-4868-aa7b-150821d2a429"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:46.584Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:46.584Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--1f2aba70-f0ae-49cd-9267-6fcb1e43be67"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:04.698Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:04.698Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"name"</span><span class=\"p\">:</span> <span class=\"s2\">"Poison Ivy"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"labels"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"remote-access-trojan"</span>\n",
|
|
|
|
@ -588,12 +588,12 @@
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--34ddc7b4-4965-4615-b286-1c8bbaa1e7db"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:49.474Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:49.474Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--80c174fa-36d1-47c2-9a9d-ce0c636bedcc"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:13.152Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:13.152Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"relationship_type"</span><span class=\"p\">:</span> <span class=\"s2\">"indicates"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--548af3be-39d7-4a3e-93c2-1a63cccf8951"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--3d7f0c1c-616a-4868-aa7b-150821d2a429"</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--2f3d4926-163d-4aef-bcd2-19dea96916ae"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--1f2aba70-f0ae-49cd-9267-6fcb1e43be67"</span>\n",
|
|
|
|
|
"<span class=\"p\">}</span>\n",
|
|
|
|
|
"</pre></div>\n"
|
|
|
|
|
],
|
|
|
|
@ -700,12 +700,12 @@
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--0a646403-f7e7-4cfd-b945-cab5cde05857"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:51.417Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:51.417Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--47395d23-dedd-45d4-8db1-c9ffaf44493d"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:16.566Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:16.566Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"relationship_type"</span><span class=\"p\">:</span> <span class=\"s2\">"indicates"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--548af3be-39d7-4a3e-93c2-1a63cccf8951"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--3d7f0c1c-616a-4868-aa7b-150821d2a429"</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--2f3d4926-163d-4aef-bcd2-19dea96916ae"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--1f2aba70-f0ae-49cd-9267-6fcb1e43be67"</span>\n",
|
|
|
|
|
"<span class=\"p\">}</span>\n",
|
|
|
|
|
"</pre></div>\n"
|
|
|
|
|
],
|
|
|
|
@ -810,26 +810,26 @@
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"bundle"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"bundle--f83477e5-f853-47e1-a267-43f3aa1bd5b0"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"bundle--388c9b2c-936c-420a-baa5-04f48d682a01"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"spec_version"</span><span class=\"p\">:</span> <span class=\"s2\">"2.0"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"objects"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--548af3be-39d7-4a3e-93c2-1a63cccf8951"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--2f3d4926-163d-4aef-bcd2-19dea96916ae"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"name"</span><span class=\"p\">:</span> <span class=\"s2\">"File hash for malware variant"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"pattern"</span><span class=\"p\">:</span> <span class=\"s2\">"[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"valid_from"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:24.193659Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"valid_from"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:14:48.509629Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"labels"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"malicious-activity"</span>\n",
|
|
|
|
|
" <span class=\"p\">]</span>\n",
|
|
|
|
|
" <span class=\"p\">},</span>\n",
|
|
|
|
|
" <span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"malware"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--3d7f0c1c-616a-4868-aa7b-150821d2a429"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:46.584Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:46.584Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--1f2aba70-f0ae-49cd-9267-6fcb1e43be67"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:04.698Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:04.698Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"name"</span><span class=\"p\">:</span> <span class=\"s2\">"Poison Ivy"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"labels"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"remote-access-trojan"</span>\n",
|
|
|
|
@ -837,12 +837,12 @@
|
|
|
|
|
" <span class=\"p\">},</span>\n",
|
|
|
|
|
" <span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--34ddc7b4-4965-4615-b286-1c8bbaa1e7db"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:49.474Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2018-04-05T18:32:49.474Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"id"</span><span class=\"p\">:</span> <span class=\"s2\">"relationship--80c174fa-36d1-47c2-9a9d-ce0c636bedcc"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"created"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:13.152Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"modified"</span><span class=\"p\">:</span> <span class=\"s2\">"2019-05-13T13:15:13.152Z"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"relationship_type"</span><span class=\"p\">:</span> <span class=\"s2\">"indicates"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--548af3be-39d7-4a3e-93c2-1a63cccf8951"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--3d7f0c1c-616a-4868-aa7b-150821d2a429"</span>\n",
|
|
|
|
|
" <span class=\"nt\">"source_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"indicator--2f3d4926-163d-4aef-bcd2-19dea96916ae"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"target_ref"</span><span class=\"p\">:</span> <span class=\"s2\">"malware--1f2aba70-f0ae-49cd-9267-6fcb1e43be67"</span>\n",
|
|
|
|
|
" <span class=\"p\">}</span>\n",
|
|
|
|
|
" <span class=\"p\">]</span>\n",
|
|
|
|
|
"<span class=\"p\">}</span>\n",
|
|
|
|
@ -863,6 +863,249 @@
|
|
|
|
|
"bundle = Bundle(indicator, malware, relationship)\n",
|
|
|
|
|
"print(bundle)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"### Creating Cyber Observable References\n",
|
|
|
|
|
"Cyber Observable Objects have properties that can reference other Cyber Observable Objects. In order to create those references, use the ``_valid_refs`` property as shown in the following examples. It should be noted that ``_valid_refs`` is necessary when creating references to Cyber Observable Objects since some embedded references can only point to certain types, and ``_valid_refs`` helps ensure consistency. \n",
|
|
|
|
|
"\n",
|
|
|
|
|
"There are two cases."
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"#### Case 1: Specifying the type of the Cyber Observable Objects being referenced\n",
|
|
|
|
|
"In the following example, the IPv4Address object has its ``resolves_to_refs`` property specified. As per the spec, this property's value must be a list of reference(s) to MACAddress objects. In this case, those references are strings that state the type of the Cyber Observable Object being referenced, and are provided in ``_valid_refs``."
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 16,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<style type=\"text/css\">.highlight .hll { background-color: #ffffcc }\n",
|
|
|
|
|
".highlight { background: #f8f8f8; }\n",
|
|
|
|
|
".highlight .c { color: #408080; font-style: italic } /* Comment */\n",
|
|
|
|
|
".highlight .err { border: 1px solid #FF0000 } /* Error */\n",
|
|
|
|
|
".highlight .k { color: #008000; font-weight: bold } /* Keyword */\n",
|
|
|
|
|
".highlight .o { color: #666666 } /* Operator */\n",
|
|
|
|
|
".highlight .ch { color: #408080; font-style: italic } /* Comment.Hashbang */\n",
|
|
|
|
|
".highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */\n",
|
|
|
|
|
".highlight .cp { color: #BC7A00 } /* Comment.Preproc */\n",
|
|
|
|
|
".highlight .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */\n",
|
|
|
|
|
".highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */\n",
|
|
|
|
|
".highlight .cs { color: #408080; font-style: italic } /* Comment.Special */\n",
|
|
|
|
|
".highlight .gd { color: #A00000 } /* Generic.Deleted */\n",
|
|
|
|
|
".highlight .ge { font-style: italic } /* Generic.Emph */\n",
|
|
|
|
|
".highlight .gr { color: #FF0000 } /* Generic.Error */\n",
|
|
|
|
|
".highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
|
|
|
|
|
".highlight .gi { color: #00A000 } /* Generic.Inserted */\n",
|
|
|
|
|
".highlight .go { color: #888888 } /* Generic.Output */\n",
|
|
|
|
|
".highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
|
|
|
|
|
".highlight .gs { font-weight: bold } /* Generic.Strong */\n",
|
|
|
|
|
".highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
|
|
|
|
|
".highlight .gt { color: #0044DD } /* Generic.Traceback */\n",
|
|
|
|
|
".highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
|
|
|
|
|
".highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
|
|
|
|
|
".highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
|
|
|
|
|
".highlight .kp { color: #008000 } /* Keyword.Pseudo */\n",
|
|
|
|
|
".highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
|
|
|
|
|
".highlight .kt { color: #B00040 } /* Keyword.Type */\n",
|
|
|
|
|
".highlight .m { color: #666666 } /* Literal.Number */\n",
|
|
|
|
|
".highlight .s { color: #BA2121 } /* Literal.String */\n",
|
|
|
|
|
".highlight .na { color: #7D9029 } /* Name.Attribute */\n",
|
|
|
|
|
".highlight .nb { color: #008000 } /* Name.Builtin */\n",
|
|
|
|
|
".highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
|
|
|
|
|
".highlight .no { color: #880000 } /* Name.Constant */\n",
|
|
|
|
|
".highlight .nd { color: #AA22FF } /* Name.Decorator */\n",
|
|
|
|
|
".highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */\n",
|
|
|
|
|
".highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */\n",
|
|
|
|
|
".highlight .nf { color: #0000FF } /* Name.Function */\n",
|
|
|
|
|
".highlight .nl { color: #A0A000 } /* Name.Label */\n",
|
|
|
|
|
".highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
|
|
|
|
|
".highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
|
|
|
|
|
".highlight .nv { color: #19177C } /* Name.Variable */\n",
|
|
|
|
|
".highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
|
|
|
|
|
".highlight .w { color: #bbbbbb } /* Text.Whitespace */\n",
|
|
|
|
|
".highlight .mb { color: #666666 } /* Literal.Number.Bin */\n",
|
|
|
|
|
".highlight .mf { color: #666666 } /* Literal.Number.Float */\n",
|
|
|
|
|
".highlight .mh { color: #666666 } /* Literal.Number.Hex */\n",
|
|
|
|
|
".highlight .mi { color: #666666 } /* Literal.Number.Integer */\n",
|
|
|
|
|
".highlight .mo { color: #666666 } /* Literal.Number.Oct */\n",
|
|
|
|
|
".highlight .sa { color: #BA2121 } /* Literal.String.Affix */\n",
|
|
|
|
|
".highlight .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
|
|
|
|
|
".highlight .sc { color: #BA2121 } /* Literal.String.Char */\n",
|
|
|
|
|
".highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
|
|
|
|
|
".highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
|
|
|
|
|
".highlight .s2 { color: #BA2121 } /* Literal.String.Double */\n",
|
|
|
|
|
".highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */\n",
|
|
|
|
|
".highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
|
|
|
|
|
".highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */\n",
|
|
|
|
|
".highlight .sx { color: #008000 } /* Literal.String.Other */\n",
|
|
|
|
|
".highlight .sr { color: #BB6688 } /* Literal.String.Regex */\n",
|
|
|
|
|
".highlight .s1 { color: #BA2121 } /* Literal.String.Single */\n",
|
|
|
|
|
".highlight .ss { color: #19177C } /* Literal.String.Symbol */\n",
|
|
|
|
|
".highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
|
|
|
|
|
".highlight .fm { color: #0000FF } /* Name.Function.Magic */\n",
|
|
|
|
|
".highlight .vc { color: #19177C } /* Name.Variable.Class */\n",
|
|
|
|
|
".highlight .vg { color: #19177C } /* Name.Variable.Global */\n",
|
|
|
|
|
".highlight .vi { color: #19177C } /* Name.Variable.Instance */\n",
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"ipv4-addr"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"value"</span><span class=\"p\">:</span> <span class=\"s2\">"177.60.40.7"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"resolves_to_refs"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"1"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"s2\">"2"</span>\n",
|
|
|
|
|
" <span class=\"p\">]</span>\n",
|
|
|
|
|
"<span class=\"p\">}</span>\n",
|
|
|
|
|
"</pre></div>\n"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<IPython.core.display.HTML object>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 16,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"from stix2 import IPv4Address\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"ip4 = IPv4Address(\n",
|
|
|
|
|
" _valid_refs={\"1\": \"mac-addr\", \"2\": \"mac-addr\"},\n",
|
|
|
|
|
" value=\"177.60.40.7\",\n",
|
|
|
|
|
" resolves_to_refs=[\"1\", \"2\"]\n",
|
|
|
|
|
")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"print(ip4)"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"source": [
|
|
|
|
|
"#### Case 2: Specifying the name of the Cyber Observable Objects being referenced\n",
|
|
|
|
|
"The following example is just like the one provided in Case 1 above, with one key difference: instead of using strings to specify the type of the Cyber Observable Objects being referenced in ``_valid_refs``, the referenced Cyber Observable Objects are created beforehand and then their names are provided in ``_valid_refs``."
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": 17,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/html": [
|
|
|
|
|
"<style type=\"text/css\">.highlight .hll { background-color: #ffffcc }\n",
|
|
|
|
|
".highlight { background: #f8f8f8; }\n",
|
|
|
|
|
".highlight .c { color: #408080; font-style: italic } /* Comment */\n",
|
|
|
|
|
".highlight .err { border: 1px solid #FF0000 } /* Error */\n",
|
|
|
|
|
".highlight .k { color: #008000; font-weight: bold } /* Keyword */\n",
|
|
|
|
|
".highlight .o { color: #666666 } /* Operator */\n",
|
|
|
|
|
".highlight .ch { color: #408080; font-style: italic } /* Comment.Hashbang */\n",
|
|
|
|
|
".highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */\n",
|
|
|
|
|
".highlight .cp { color: #BC7A00 } /* Comment.Preproc */\n",
|
|
|
|
|
".highlight .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */\n",
|
|
|
|
|
".highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */\n",
|
|
|
|
|
".highlight .cs { color: #408080; font-style: italic } /* Comment.Special */\n",
|
|
|
|
|
".highlight .gd { color: #A00000 } /* Generic.Deleted */\n",
|
|
|
|
|
".highlight .ge { font-style: italic } /* Generic.Emph */\n",
|
|
|
|
|
".highlight .gr { color: #FF0000 } /* Generic.Error */\n",
|
|
|
|
|
".highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n",
|
|
|
|
|
".highlight .gi { color: #00A000 } /* Generic.Inserted */\n",
|
|
|
|
|
".highlight .go { color: #888888 } /* Generic.Output */\n",
|
|
|
|
|
".highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n",
|
|
|
|
|
".highlight .gs { font-weight: bold } /* Generic.Strong */\n",
|
|
|
|
|
".highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n",
|
|
|
|
|
".highlight .gt { color: #0044DD } /* Generic.Traceback */\n",
|
|
|
|
|
".highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n",
|
|
|
|
|
".highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n",
|
|
|
|
|
".highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n",
|
|
|
|
|
".highlight .kp { color: #008000 } /* Keyword.Pseudo */\n",
|
|
|
|
|
".highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n",
|
|
|
|
|
".highlight .kt { color: #B00040 } /* Keyword.Type */\n",
|
|
|
|
|
".highlight .m { color: #666666 } /* Literal.Number */\n",
|
|
|
|
|
".highlight .s { color: #BA2121 } /* Literal.String */\n",
|
|
|
|
|
".highlight .na { color: #7D9029 } /* Name.Attribute */\n",
|
|
|
|
|
".highlight .nb { color: #008000 } /* Name.Builtin */\n",
|
|
|
|
|
".highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n",
|
|
|
|
|
".highlight .no { color: #880000 } /* Name.Constant */\n",
|
|
|
|
|
".highlight .nd { color: #AA22FF } /* Name.Decorator */\n",
|
|
|
|
|
".highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */\n",
|
|
|
|
|
".highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */\n",
|
|
|
|
|
".highlight .nf { color: #0000FF } /* Name.Function */\n",
|
|
|
|
|
".highlight .nl { color: #A0A000 } /* Name.Label */\n",
|
|
|
|
|
".highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n",
|
|
|
|
|
".highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */\n",
|
|
|
|
|
".highlight .nv { color: #19177C } /* Name.Variable */\n",
|
|
|
|
|
".highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n",
|
|
|
|
|
".highlight .w { color: #bbbbbb } /* Text.Whitespace */\n",
|
|
|
|
|
".highlight .mb { color: #666666 } /* Literal.Number.Bin */\n",
|
|
|
|
|
".highlight .mf { color: #666666 } /* Literal.Number.Float */\n",
|
|
|
|
|
".highlight .mh { color: #666666 } /* Literal.Number.Hex */\n",
|
|
|
|
|
".highlight .mi { color: #666666 } /* Literal.Number.Integer */\n",
|
|
|
|
|
".highlight .mo { color: #666666 } /* Literal.Number.Oct */\n",
|
|
|
|
|
".highlight .sa { color: #BA2121 } /* Literal.String.Affix */\n",
|
|
|
|
|
".highlight .sb { color: #BA2121 } /* Literal.String.Backtick */\n",
|
|
|
|
|
".highlight .sc { color: #BA2121 } /* Literal.String.Char */\n",
|
|
|
|
|
".highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */\n",
|
|
|
|
|
".highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n",
|
|
|
|
|
".highlight .s2 { color: #BA2121 } /* Literal.String.Double */\n",
|
|
|
|
|
".highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */\n",
|
|
|
|
|
".highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */\n",
|
|
|
|
|
".highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */\n",
|
|
|
|
|
".highlight .sx { color: #008000 } /* Literal.String.Other */\n",
|
|
|
|
|
".highlight .sr { color: #BB6688 } /* Literal.String.Regex */\n",
|
|
|
|
|
".highlight .s1 { color: #BA2121 } /* Literal.String.Single */\n",
|
|
|
|
|
".highlight .ss { color: #19177C } /* Literal.String.Symbol */\n",
|
|
|
|
|
".highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */\n",
|
|
|
|
|
".highlight .fm { color: #0000FF } /* Name.Function.Magic */\n",
|
|
|
|
|
".highlight .vc { color: #19177C } /* Name.Variable.Class */\n",
|
|
|
|
|
".highlight .vg { color: #19177C } /* Name.Variable.Global */\n",
|
|
|
|
|
".highlight .vi { color: #19177C } /* Name.Variable.Instance */\n",
|
|
|
|
|
".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n",
|
|
|
|
|
".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */</style><div class=\"highlight\"><pre><span></span><span class=\"p\">{</span>\n",
|
|
|
|
|
" <span class=\"nt\">"type"</span><span class=\"p\">:</span> <span class=\"s2\">"ipv4-addr"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"value"</span><span class=\"p\">:</span> <span class=\"s2\">"177.60.40.7"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"nt\">"resolves_to_refs"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n",
|
|
|
|
|
" <span class=\"s2\">"1"</span><span class=\"p\">,</span>\n",
|
|
|
|
|
" <span class=\"s2\">"2"</span>\n",
|
|
|
|
|
" <span class=\"p\">]</span>\n",
|
|
|
|
|
"<span class=\"p\">}</span>\n",
|
|
|
|
|
"</pre></div>\n"
|
|
|
|
|
],
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<IPython.core.display.HTML object>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 17,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "execute_result"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"source": [
|
|
|
|
|
"from stix2 import MACAddress\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"mac_addr_a = MACAddress(value=\"a1:b2:c3:d4:e5:f6\")\n",
|
|
|
|
|
"mac_addr_b = MACAddress(value=\"a7:b8:c9:d0:e1:f2\")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"ip4_valid_refs = IPv4Address(\n",
|
|
|
|
|
" _valid_refs={\"1\": mac_addr_a, \"2\": mac_addr_b},\n",
|
|
|
|
|
" value=\"177.60.40.7\",\n",
|
|
|
|
|
" resolves_to_refs=[\"1\", \"2\"]\n",
|
|
|
|
|
")\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"print(ip4_valid_refs)"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
"metadata": {
|
|
|
|
@ -881,7 +1124,7 @@
|
|
|
|
|
"name": "python",
|
|
|
|
|
"nbconvert_exporter": "python",
|
|
|
|
|
"pygments_lexer": "ipython3",
|
|
|
|
|
"version": "3.6.5"
|
|
|
|
|
"version": "3.6.7"
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
|
|
|
|