chg: Update tutorial for custom objects

pull/786/head
Raphaël Vinot 2021-09-09 12:05:52 +02:00
parent 37731afb9c
commit eafbb76441
2 changed files with 15 additions and 10 deletions

View File

@ -622,6 +622,7 @@
"outputs": [],
"source": [
"from pymisp.tools import GenericObjectGenerator\n",
"from uuid import uuid4\n",
"\n",
"attributeAsDict = [{'MyCoolAttribute': {'value': 'critical thing', 'type': 'text'}}, \n",
" {'MyCoolerAttribute': {'value': 'even worse', 'type': 'text'}}]\n",
@ -629,6 +630,11 @@
"\n",
"misp_object = GenericObjectGenerator('my-cool-template')\n",
"misp_object.generate_attributes(attributeAsDict)\n",
"# The parameters below are required if no template is provided.\n",
"misp_object.template_uuid = uuid4()\n",
"misp_object.templade_id = 1\n",
"misp_object.description = \"foo\"\n",
"setattr(misp_object, 'meta-category', 'bar')\n",
"\n",
"print(misp_object.to_json())"
]
@ -1495,7 +1501,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.9.5"
}
},
"nbformat": 4,

17
poetry.lock generated
View File

@ -87,14 +87,14 @@ tzdata = ["tzdata"]
[[package]]
name = "beautifulsoup4"
version = "4.9.3"
version = "4.10.0"
description = "Screen-scraping library"
category = "main"
optional = true
python-versions = "*"
python-versions = ">3.0.0"
[package.dependencies]
soupsieve = {version = ">1.2", markers = "python_version >= \"3.0\""}
soupsieve = ">1.2"
[package.extras]
html5lib = ["html5lib"]
@ -1283,7 +1283,7 @@ test = ["pytest"]
[[package]]
name = "terminado"
version = "0.12.0"
version = "0.12.1"
description = "Tornado websocket backend for the Xterm.js Javascript terminal emulator library."
category = "dev"
optional = false
@ -1598,9 +1598,8 @@ backcall = [
{file = "backports.zoneinfo-0.2.1.tar.gz", hash = "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2"},
]
beautifulsoup4 = [
{file = "beautifulsoup4-4.9.3-py2-none-any.whl", hash = "sha256:4c98143716ef1cb40bf7f39a8e3eec8f8b009509e74904ba3a7b315431577e35"},
{file = "beautifulsoup4-4.9.3-py3-none-any.whl", hash = "sha256:fff47e031e34ec82bf17e00da8f592fe7de69aeea38be00523c04623c04fb666"},
{file = "beautifulsoup4-4.9.3.tar.gz", hash = "sha256:84729e322ad1d5b4d25f805bfa05b902dd96450f43842c4e99067d5e1369eb25"},
{file = "beautifulsoup4-4.10.0-py3-none-any.whl", hash = "sha256:9a315ce70049920ea4572a4055bc4bd700c940521d36fc858205ad4fcde149bf"},
{file = "beautifulsoup4-4.10.0.tar.gz", hash = "sha256:c23ad23c521d818955a4151a67d81580319d4bf548d3d49f4223ae041ff98891"},
]
bleach = [
{file = "bleach-4.1.0-py2.py3-none-any.whl", hash = "sha256:4d2651ab93271d1129ac9cbc679f524565cc8a1b791909c4a51eac4446a15994"},
@ -2316,8 +2315,8 @@ sphinxcontrib-serializinghtml = [
{file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"},
]
terminado = [
{file = "terminado-0.12.0-py3-none-any.whl", hash = "sha256:bd8c2ecfa0516a2a80b7836421d0be61af6a2e84e1e75eee95eb019e138eb639"},
{file = "terminado-0.12.0.tar.gz", hash = "sha256:00927a0bc2e1e5d5728580910d82191ad7315fef0006a8b74ff940b34a916e16"},
{file = "terminado-0.12.1-py3-none-any.whl", hash = "sha256:09fdde344324a1c9c6e610ee4ca165c4bb7f5bbf982fceeeb38998a988ef8452"},
{file = "terminado-0.12.1.tar.gz", hash = "sha256:b20fd93cc57c1678c799799d117874367cc07a3d2d55be95205b1a88fa08393f"},
]
testpath = [
{file = "testpath-0.5.0-py3-none-any.whl", hash = "sha256:8044f9a0bab6567fc644a3593164e872543bb44225b0e24846e2c89237937589"},