diff --git a/docs/guide/environment.ipynb b/docs/guide/environment.ipynb index 0cb3f3e..d2a0de2 100644 --- a/docs/guide/environment.ipynb +++ b/docs/guide/environment.ipynb @@ -88,47 +88,31 @@ { "cell_type": "code", "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "ename": "RuntimeError", - "evalue": "maximum recursion depth exceeded while calling a Python object", - "output_type": "error", - "traceback": [ - "\u001b[0;31mRuntimeError\u001b[0m\u001b[0;31m:\u001b[0m maximum recursion depth exceeded while calling a Python object\n" - ] - } - ], + "metadata": { + "collapsed": true + }, + "outputs": [], "source": [ "from stix2 import CompositeDataSource, FileSystemSink, FileSystemSource, MemorySource\n", "\n", "src = CompositeDataSource()\n", - "src.add_data_source([MemorySource(), FileSystemSource(\"stix_source\")])\n", + "src.add_data_sources([MemorySource(), FileSystemSource(\"/tmp/stix_source\")])\n", "env2 = Environment(source=src,\n", - " sink=FileSystemSink(\"stix_sink\"))" + " sink=FileSystemSink(\"/tmp/stix_sink\"))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Once you have an ``Environment`` you can store some STIX content in it with ``add()``:" + "Once you have an ``Environment`` you can store some STIX content in its DataSinks with ``add()``:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, - "outputs": [ - { - "ename": "KeyError", - "evalue": "'objects'", - "output_type": "error", - "traceback": [ - "\u001b[0;31mKeyError\u001b[0m\u001b[0;31m:\u001b[0m 'objects'\n" - ] - } - ], + "outputs": [], "source": [ "from stix2 import Indicator\n", "\n", @@ -151,12 +135,96 @@ "metadata": {}, "outputs": [ { - "ename": "IndexError", - "evalue": "list index out of range", - "output_type": "error", - "traceback": [ - "\u001b[0;31mIndexError\u001b[0m\u001b[0;31m:\u001b[0m list index out of range\n" - ] + "data": { + "text/html": [ + "
{\n",
+       "    "type": "indicator",\n",
+       "    "id": "indicator--01234567-89ab-cdef-0123-456789abcdef",\n",
+       "    "created": "2017-10-02T13:20:39.373Z",\n",
+       "    "modified": "2017-10-02T13:20:39.373Z",\n",
+       "    "labels": [\n",
+       "        "malicious-activity"\n",
+       "    ],\n",
+       "    "pattern": "[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",\n",
+       "    "valid_from": "2017-10-02T13:20:39.3737Z"\n",
+       "}\n",
+       "
\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -272,15 +340,15 @@ ".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n", ".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
{\n",
        "    "type": "indicator",\n",
-       "    "id": "indicator--cc2faac7-3c29-4912-bfff-d87935791d17",\n",
+       "    "id": "indicator--c92ad60d-449d-4adf-86b3-4e5951a8f480",\n",
        "    "created_by_ref": "identity--311b2d2d-f010-5473-83ec-1edf84858f4c",\n",
-       "    "created": "2017-09-26T23:35:34.669Z",\n",
-       "    "modified": "2017-09-26T23:35:34.669Z",\n",
+       "    "created": "2017-10-02T13:23:00.607Z",\n",
+       "    "modified": "2017-10-02T13:23:00.607Z",\n",
        "    "labels": [\n",
        "        "malicious-activity"\n",
        "    ],\n",
        "    "pattern": "[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",\n",
-       "    "valid_from": "2017-09-26T23:35:34.669764Z"\n",
+       "    "valid_from": "2017-10-02T13:23:00.607216Z"\n",
        "}\n",
        "
\n" ], @@ -394,14 +462,14 @@ ".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n", ".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
{\n",
        "    "type": "indicator",\n",
-       "    "id": "indicator--fc423952-2088-4182-a5da-65bcc989c0cc",\n",
+       "    "id": "indicator--ae206b9f-8723-4fcf-beb7-8b1b9a2570ab",\n",
        "    "created": "2017-09-25T18:07:46.255Z",\n",
        "    "modified": "2017-09-25T18:07:46.255Z",\n",
        "    "labels": [\n",
        "        "malicious-activity"\n",
        "    ],\n",
        "    "pattern": "[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",\n",
-       "    "valid_from": "2017-09-26T23:35:37.083918Z"\n",
+       "    "valid_from": "2017-10-02T13:23:05.790562Z"\n",
        "}\n",
        "
\n" ], @@ -504,7 +572,7 @@ ".highlight .vm { color: #19177C } /* Name.Variable.Magic */\n", ".highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
{\n",
        "    "type": "indicator",\n",
-       "    "id": "indicator--4850716c-7ff2-4f01-9bef-72c873f8bd29",\n",
+       "    "id": "indicator--a8e2be68-b496-463f-9ff4-f620046e7cf2",\n",
        "    "created_by_ref": "identity--962cabe5-f7f3-438a-9169-585a8c971d12",\n",
        "    "created": "2017-09-25T18:07:46.255Z",\n",
        "    "modified": "2017-09-25T18:07:46.255Z",\n",
@@ -512,7 +580,7 @@
        "        "malicious-activity"\n",
        "    ],\n",
        "    "pattern": "[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",\n",
-       "    "valid_from": "2017-09-26T23:35:39.049647Z"\n",
+       "    "valid_from": "2017-10-02T13:23:08.32424Z"\n",
        "}\n",
        "
\n" ], @@ -548,12 +616,97 @@ "metadata": {}, "outputs": [ { - "ename": "KeyError", - "evalue": "'objects'", - "output_type": "error", - "traceback": [ - "\u001b[0;31mKeyError\u001b[0m\u001b[0;31m:\u001b[0m 'objects'\n" - ] + "data": { + "text/html": [ + "
{\n",
+       "    "type": "indicator",\n",
+       "    "id": "indicator--89ba04ea-cce9-47a3-acd3-b6379ce51581",\n",
+       "    "created_by_ref": "identity--311b2d2d-f010-5473-83ec-1edf84858f4c",\n",
+       "    "created": "2017-10-02T13:23:29.629Z",\n",
+       "    "modified": "2017-10-02T13:23:29.629Z",\n",
+       "    "labels": [\n",
+       "        "malicious-activity"\n",
+       "    ],\n",
+       "    "pattern": "[file:hashes.md5 = 'd41d8cd98f00b204e9800998ecf8427e']",\n",
+       "    "valid_from": "2017-10-02T13:23:29.629857Z"\n",
+       "}\n",
+       "
\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" } ], "source": [