From 725e59105e621002a658ea2ab2853226281d6db8 Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Mon, 18 Jun 2018 19:13:52 +0900 Subject: [PATCH 01/17] =?UTF-8?q?-=20Set=20my=20misp-objects=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index d0e9062..8f7dbe3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "pymisp/data/misp-objects"] path = pymisp/data/misp-objects - url = https://github.com/MISP/misp-objects + url = https://github.com/SteveClement/misp-objects From 036139ef25c23532b2ce4fa0173628bb3069ad3b Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Thu, 21 Feb 2019 10:39:12 +0530 Subject: [PATCH 02/17] new: [badge] Added pypi and python version badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 68a087d..b598d84 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ README [![Documentation Status](https://readthedocs.org/projects/pymisp/badge/?version=latest)](http://pymisp.readthedocs.io/?badge=latest) [![Build Status](https://travis-ci.org/MISP/PyMISP.svg?branch=master)](https://travis-ci.org/MISP/PyMISP) [![Coverage Status](https://coveralls.io/repos/github/MISP/PyMISP/badge.svg?branch=master)](https://coveralls.io/github/MISP/PyMISP?branch=master) +[![Python 3.6](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/release/python-360/) +[![PyPi version](https://img.shields.io/pypi/v/pymisp.svg)](https://pypi.python.org/pypi/pymisp/) # PyMISP - Python Library to access MISP From 731acea4dcdc2b8c382e4064d0e5516ae1372816 Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Thu, 21 Feb 2019 13:11:33 +0000 Subject: [PATCH 03/17] fix: Do not override sub-path from root URL --- pymisp/api.py | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index fbc4b80..396d9fc 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1779,7 +1779,7 @@ class PyMISP(object): def get_roles_list(self): """Get the list of existing roles""" - url = urljoin(self.root_url, '/roles') + url = urljoin(self.root_url, 'roles') response = self._prepare_request('GET', url) return self._check_response(response) @@ -1787,13 +1787,13 @@ class PyMISP(object): def get_tags_list(self): """Get the list of existing tags.""" - url = urljoin(self.root_url, '/tags') + url = urljoin(self.root_url, 'tags') response = self._prepare_request('GET', url) return self._check_response(response)['Tag'] def get_tag(self, tag_id): """Get a tag by id.""" - url = urljoin(self.root_url, '/tags/view/{}'.format(tag_id)) + url = urljoin(self.root_url, 'tags/view/{}'.format(tag_id)) response = self._prepare_request('GET', url) return self._check_response(response) @@ -1827,7 +1827,7 @@ class PyMISP(object): old_tag = self.get_tag(tag_id) new_tag = self._set_tag_parameters(name, colour, exportable, hide_tag, org_id, count, user_id, numerical_value, attribute_count, old_tag) - url = urljoin(self.root_url, '/tags/edit/{}'.format(tag_id)) + url = urljoin(self.root_url, 'tags/edit/{}'.format(tag_id)) response = self._prepare_request('POST', url, json.dumps(new_tag)) return self._check_response(response) @@ -1835,7 +1835,7 @@ class PyMISP(object): """Edit the tag using a json file.""" with open(json_file, 'rb') as f: jdata = json.load(f) - url = urljoin(self.root_url, '/tags/edit/{}'.format(tag_id)) + url = urljoin(self.root_url, 'tags/edit/{}'.format(tag_id)) response = self._prepare_request('POST', url, json.dumps(jdata)) return self._check_response(response) @@ -1853,38 +1853,38 @@ class PyMISP(object): def get_taxonomies_list(self): """Get all the taxonomies.""" - url = urljoin(self.root_url, '/taxonomies') + url = urljoin(self.root_url, 'taxonomies') response = self._prepare_request('GET', url) return self._check_response(response) def get_taxonomy(self, taxonomy_id): """Get a taxonomy by id.""" - url = urljoin(self.root_url, '/taxonomies/view/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/view/{}'.format(taxonomy_id)) response = self._prepare_request('GET', url) return self._check_response(response) def update_taxonomies(self): """Update all the taxonomies.""" - url = urljoin(self.root_url, '/taxonomies/update') + url = urljoin(self.root_url, 'taxonomies/update') response = self._prepare_request('POST', url) return self._check_response(response) def enable_taxonomy(self, taxonomy_id): """Enable a taxonomy by id.""" - url = urljoin(self.root_url, '/taxonomies/enable/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/enable/{}'.format(taxonomy_id)) response = self._prepare_request('POST', url) return self._check_response(response) def disable_taxonomy(self, taxonomy_id): """Disable a taxonomy by id.""" self.disable_taxonomy_tags(taxonomy_id) - url = urljoin(self.root_url, '/taxonomies/disable/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/disable/{}'.format(taxonomy_id)) response = self._prepare_request('POST', url) return self._check_response(response) def get_taxonomy_tags_list(self, taxonomy_id): """Get all the tags of a taxonomy by id.""" - url = urljoin(self.root_url, '/taxonomies/view/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/view/{}'.format(taxonomy_id)) response = self._prepare_request('GET', url) return self._check_response(response)["entries"] @@ -1892,13 +1892,13 @@ class PyMISP(object): """Enable all the tags of a taxonomy by id.""" enabled = self.get_taxonomy(taxonomy_id)['Taxonomy']['enabled'] if enabled: - url = urljoin(self.root_url, '/taxonomies/addTag/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/addTag/{}'.format(taxonomy_id)) response = self._prepare_request('POST', url) return self._check_response(response) def disable_taxonomy_tags(self, taxonomy_id): """Disable all the tags of a taxonomy by id.""" - url = urljoin(self.root_url, '/taxonomies/disableTag/{}'.format(taxonomy_id)) + url = urljoin(self.root_url, 'taxonomies/disableTag/{}'.format(taxonomy_id)) response = self._prepare_request('POST', url) return self._check_response(response) @@ -1906,19 +1906,19 @@ class PyMISP(object): def get_warninglists(self): """Get all the warninglists.""" - url = urljoin(self.root_url, '/warninglists') + url = urljoin(self.root_url, 'warninglists') response = self._prepare_request('GET', url) return self._check_response(response) def get_warninglist(self, warninglist_id): """Get a warninglist by id.""" - url = urljoin(self.root_url, '/warninglists/view/{}'.format(warninglist_id)) + url = urljoin(self.root_url, 'warninglists/view/{}'.format(warninglist_id)) response = self._prepare_request('GET', url) return self._check_response(response) def update_warninglists(self): """Update all the warninglists.""" - url = urljoin(self.root_url, '/warninglists/update') + url = urljoin(self.root_url, 'warninglists/update') response = self._prepare_request('POST', url) return self._check_response(response) @@ -1940,7 +1940,7 @@ class PyMISP(object): query['name'] = warninglist_name if force_enable is not None: query['enabled'] = force_enable - url = urljoin(self.root_url, '/warninglists/toggleEnable') + url = urljoin(self.root_url, 'warninglists/toggleEnable') response = self._prepare_request('POST', url, json.dumps(query)) return self._check_response(response) @@ -1954,7 +1954,7 @@ class PyMISP(object): def check_warninglist(self, value): """Check if IOC values are in warninglist""" - url = urljoin(self.root_url, '/warninglists/checkValue') + url = urljoin(self.root_url, 'warninglists/checkValue') response = self._prepare_request('POST', url, json.dumps(value)) return self._check_response(response) @@ -1962,31 +1962,31 @@ class PyMISP(object): def get_noticelists(self): """Get all the noticelists.""" - url = urljoin(self.root_url, '/noticelists') + url = urljoin(self.root_url, 'noticelists') response = self._prepare_request('GET', url) return self._check_response(response) def get_noticelist(self, noticelist_id): """Get a noticelist by id.""" - url = urljoin(self.root_url, '/noticelists/view/{}'.format(noticelist_id)) + url = urljoin(self.root_url, 'noticelists/view/{}'.format(noticelist_id)) response = self._prepare_request('GET', url) return self._check_response(response) def update_noticelists(self): """Update all the noticelists.""" - url = urljoin(self.root_url, '/noticelists/update') + url = urljoin(self.root_url, 'noticelists/update') response = self._prepare_request('POST', url) return self._check_response(response) def enable_noticelist(self, noticelist_id): """Enable a noticelist by id.""" - url = urljoin(self.root_url, '/noticelists/enableNoticelist/{}/true'.format(noticelist_id)) + url = urljoin(self.root_url, 'noticelists/enableNoticelist/{}/true'.format(noticelist_id)) response = self._prepare_request('POST', url) return self._check_response(response) def disable_noticelist(self, noticelist_id): """Disable a noticelist by id.""" - url = urljoin(self.root_url, '/noticelists/enableNoticelist/{}'.format(noticelist_id)) + url = urljoin(self.root_url, 'noticelists/enableNoticelist/{}'.format(noticelist_id)) response = self._prepare_request('POST', url) return self._check_response(response) @@ -1994,19 +1994,19 @@ class PyMISP(object): def get_galaxies(self): """Get all the galaxies.""" - url = urljoin(self.root_url, '/galaxies') + url = urljoin(self.root_url, 'galaxies') response = self._prepare_request('GET', url) return self._check_response(response) def get_galaxy(self, galaxy_id): """Get a galaxy by id.""" - url = urljoin(self.root_url, '/galaxies/view/{}'.format(galaxy_id)) + url = urljoin(self.root_url, 'galaxies/view/{}'.format(galaxy_id)) response = self._prepare_request('GET', url) return self._check_response(response) def update_galaxies(self): """Update all the galaxies.""" - url = urljoin(self.root_url, '/galaxies/update') + url = urljoin(self.root_url, 'galaxies/update') response = self._prepare_request('POST', url) return self._check_response(response) @@ -2064,7 +2064,7 @@ class PyMISP(object): :param context: Add event level context (event_info,event_member_org,event_source_org,event_distribution,event_threat_level_id,event_analysis,event_date,event_tag) :param ignore: Returns the attributes even if the event isn't published, or the attribute doesn't have the to_ids flag set """ - url = urljoin(self.root_url, '/events/csv/download') + url = urljoin(self.root_url, 'events/csv/download') to_post = {} if eventid: to_post['eventid'] = eventid @@ -2217,7 +2217,7 @@ class PyMISP(object): :extend: Allow the organisation to extend the group ''' to_jsonify = {'sg_id': sharing_group, 'org_id': organisation, 'extend': extend} - url = urljoin(self.root_url, '/sharingGroups/addOrg') + url = urljoin(self.root_url, 'sharingGroups/addOrg') response = self._prepare_request('POST', url, json.dumps(to_jsonify)) return self._check_response(response) @@ -2227,7 +2227,7 @@ class PyMISP(object): :organisation: Organisation's local instance ID, or Organisation's global UUID, or Organisation's name as known to the curent instance ''' to_jsonify = {'sg_id': sharing_group, 'org_id': organisation} - url = urljoin(self.root_url, '/sharingGroups/removeOrg') + url = urljoin(self.root_url, 'sharingGroups/removeOrg') response = self._prepare_request('POST', url, json.dumps(to_jsonify)) return self._check_response(response) @@ -2238,7 +2238,7 @@ class PyMISP(object): :all_orgs: Add all the organisations of the server to the group ''' to_jsonify = {'sg_id': sharing_group, 'server_id': server, 'all_orgs': all_orgs} - url = urljoin(self.root_url, '/sharingGroups/addServer') + url = urljoin(self.root_url, 'sharingGroups/addServer') response = self._prepare_request('POST', url, json.dumps(to_jsonify)) return self._check_response(response) @@ -2248,7 +2248,7 @@ class PyMISP(object): :server: Server's local instance ID, or URL of the Server, or Server's name as known to the curent instance ''' to_jsonify = {'sg_id': sharing_group, 'server_id': server} - url = urljoin(self.root_url, '/sharingGroups/removeServer') + url = urljoin(self.root_url, 'sharingGroups/removeServer') response = self._prepare_request('POST', url, json.dumps(to_jsonify)) return self._check_response(response) @@ -2324,7 +2324,7 @@ class PyMISP(object): return self._check_response(response) def update_object_templates(self): - url = urljoin(self.root_url, '/objectTemplates/update') + url = urljoin(self.root_url, 'objectTemplates/update') response = self._prepare_request('POST', url) return self._check_response(response) From c5e5ad50504647c640a042ae09cb3156ee4383df Mon Sep 17 00:00:00 2001 From: Hannah Ward Date: Thu, 21 Feb 2019 13:15:24 +0000 Subject: [PATCH 04/17] fix: URLJoin condition for double quotes --- pymisp/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymisp/api.py b/pymisp/api.py index 396d9fc..849ddf1 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -2046,7 +2046,7 @@ class PyMISP(object): if tags: if isinstance(tags, list): tags = "&&".join(tags) - url = urljoin(self.root_url, "/events/stix/download/{}/{}/{}/{}/{}".format( + url = urljoin(self.root_url, "events/stix/download/{}/{}/{}/{}/{}".format( event_id, with_attachments, tags, from_date, to_date)) logger.debug("Getting STIX event from %s", url) response = self._prepare_request('GET', url) From 8b77bb693de469b498fec0fe2cee9bff9faaa737 Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Fri, 22 Feb 2019 06:48:52 +0530 Subject: [PATCH 05/17] fix: [gitmodules] revert to official misp-objects --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 8f7dbe3..d0e9062 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "pymisp/data/misp-objects"] path = pymisp/data/misp-objects - url = https://github.com/SteveClement/misp-objects + url = https://github.com/MISP/misp-objects From 634ecc3ac308d01ebf5f5fbb9aace7746a2b8707 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Mon, 25 Feb 2019 20:26:55 +0100 Subject: [PATCH 06/17] chg: [pipenv] Pipfile.lock generated --- Pipfile.lock | 176 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 127 insertions(+), 49 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index 1258507..309c003 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "2551d32f7430eba34eac975cc1b28eca13fe9faff7197d83f312d7de8df187da" + "sha256": "3b84b36dba62f12dd8b636886c4a14b3580a77b5a4ceccf0c30ea6c08cd2b7eb" }, "pipfile-spec": 6, "requires": { @@ -23,6 +23,13 @@ ], "version": "==0.24.0" }, + "attrs": { + "hashes": [ + "sha256:10cbf6e27dbce8c30807caf056c8eb50917e0eaafe86347671b57254006c3e69", + "sha256:ca4be454458f9dec299268d472aaa5a11f67a4ff70093396e1ceae9c76cf4bbb" + ], + "version": "==18.2.0" + }, "beautifulsoup4": { "hashes": [ "sha256:034740f6cb549b4e932ae1ab975581e6103ac8f942200a0e9759065984391858", @@ -40,40 +47,36 @@ }, "cffi": { "hashes": [ - "sha256:151b7eefd035c56b2b2e1eb9963c90c6302dc15fbd8c1c0a83a163ff2c7d7743", - "sha256:1553d1e99f035ace1c0544050622b7bc963374a00c467edafac50ad7bd276aef", - "sha256:1b0493c091a1898f1136e3f4f991a784437fac3673780ff9de3bcf46c80b6b50", - "sha256:2ba8a45822b7aee805ab49abfe7eec16b90587f7f26df20c71dd89e45a97076f", - "sha256:3bb6bd7266598f318063e584378b8e27c67de998a43362e8fce664c54ee52d30", - "sha256:3c85641778460581c42924384f5e68076d724ceac0f267d66c757f7535069c93", - "sha256:3eb6434197633b7748cea30bf0ba9f66727cdce45117a712b29a443943733257", - "sha256:495c5c2d43bf6cebe0178eb3e88f9c4aa48d8934aa6e3cddb865c058da76756b", - "sha256:4c91af6e967c2015729d3e69c2e51d92f9898c330d6a851bf8f121236f3defd3", - "sha256:57b2533356cb2d8fac1555815929f7f5f14d68ac77b085d2326b571310f34f6e", - "sha256:770f3782b31f50b68627e22f91cb182c48c47c02eb405fd689472aa7b7aa16dc", - "sha256:79f9b6f7c46ae1f8ded75f68cf8ad50e5729ed4d590c74840471fc2823457d04", - "sha256:7a33145e04d44ce95bcd71e522b478d282ad0eafaf34fe1ec5bbd73e662f22b6", - "sha256:857959354ae3a6fa3da6651b966d13b0a8bed6bbc87a0de7b38a549db1d2a359", - "sha256:87f37fe5130574ff76c17cab61e7d2538a16f843bb7bca8ebbc4b12de3078596", - "sha256:95d5251e4b5ca00061f9d9f3d6fe537247e145a8524ae9fd30a2f8fbce993b5b", - "sha256:9d1d3e63a4afdc29bd76ce6aa9d58c771cd1599fbba8cf5057e7860b203710dd", - "sha256:a36c5c154f9d42ec176e6e620cb0dd275744aa1d804786a71ac37dc3661a5e95", - "sha256:a6a5cb8809091ec9ac03edde9304b3ad82ad4466333432b16d78ef40e0cce0d5", - "sha256:ae5e35a2c189d397b91034642cb0eab0e346f776ec2eb44a49a459e6615d6e2e", - "sha256:b0f7d4a3df8f06cf49f9f121bead236e328074de6449866515cea4907bbc63d6", - "sha256:b75110fb114fa366b29a027d0c9be3709579602ae111ff61674d28c93606acca", - "sha256:ba5e697569f84b13640c9e193170e89c13c6244c24400fc57e88724ef610cd31", - "sha256:be2a9b390f77fd7676d80bc3cdc4f8edb940d8c198ed2d8c0be1319018c778e1", - "sha256:ca1bd81f40adc59011f58159e4aa6445fc585a32bb8ac9badf7a2c1aa23822f2", - "sha256:d5d8555d9bfc3f02385c1c37e9f998e2011f0db4f90e250e5bc0c0a85a813085", - "sha256:e55e22ac0a30023426564b1059b035973ec82186ddddbac867078435801c7801", - "sha256:e90f17980e6ab0f3c2f3730e56d1fe9bcba1891eeea58966e89d352492cc74f4", - "sha256:ecbb7b01409e9b782df5ded849c178a0aa7c906cf8c5a67368047daab282b184", - "sha256:ed01918d545a38998bfa5902c7c00e0fee90e957ce036a4000a88e3fe2264917", - "sha256:edabd457cd23a02965166026fd9bfd196f4324fe6032e866d0f3bd0301cd486f", - "sha256:fdf1c1dc5bafc32bc5d08b054f94d659422b05aba244d6be4ddc1c72d9aa70fb" + "sha256:0b5f895714a7a9905148fc51978c62e8a6cbcace30904d39dcd0d9e2265bb2f6", + "sha256:27cdc7ba35ee6aa443271d11583b50815c4bb52be89a909d0028e86c21961709", + "sha256:2d4a38049ea93d5ce3c7659210393524c1efc3efafa151bd85d196fa98fce50a", + "sha256:3262573d0d60fc6b9d0e0e6e666db0e5045cbe8a531779aa0deb3b425ec5a282", + "sha256:358e96cfffc185ab8f6e7e425c7bb028931ed08d65402fbcf3f4e1bff6e66556", + "sha256:37c7db824b5687fbd7ea5519acfd054c905951acc53503547c86be3db0580134", + "sha256:39b9554dfe60f878e0c6ff8a460708db6e1b1c9cc6da2c74df2955adf83e355d", + "sha256:42b96a77acf8b2d06821600fa87c208046decc13bd22a4a0e65c5c973443e0da", + "sha256:5b37dde5035d3c219324cac0e69d96495970977f310b306fa2df5910e1f329a1", + "sha256:5d35819f5566d0dd254f273d60cf4a2dcdd3ae3003dfd412d40b3fe8ffd87509", + "sha256:5df73aa465e53549bd03c819c1bc69fb85529a5e1a693b7b6cb64408dd3970d1", + "sha256:7075b361f7a4d0d4165439992d0b8a3cdfad1f302bf246ed9308a2e33b046bd3", + "sha256:7678b5a667b0381c173abe530d7bdb0e6e3b98e062490618f04b80ca62686d96", + "sha256:7dfd996192ff8a535458c17f22ff5eb78b83504c34d10eefac0c77b1322609e2", + "sha256:8a3be5d31d02c60f84c4fd4c98c5e3a97b49f32e16861367f67c49425f955b28", + "sha256:9812e53369c469506b123aee9dcb56d50c82fad60c5df87feb5ff59af5b5f55c", + "sha256:9b6f7ba4e78c52c1a291d0c0c0bd745d19adde1a9e1c03cb899f0c6efd6f8033", + "sha256:a85bc1d7c3bba89b3d8c892bc0458de504f8b3bcca18892e6ed15b5f7a52ad9d", + "sha256:aa6b9c843ad645ebb12616de848cc4e25a40f633ccc293c3c9fe34107c02c2ea", + "sha256:bae1aa56ee00746798beafe486daa7cfb586cd395c6ce822ba3068e48d761bc0", + "sha256:bae96e26510e4825d5910a196bf6b5a11a18b87d9278db6d08413be8ea799469", + "sha256:bd78df3b594013b227bf31d0301566dc50ba6f40df38a70ded731d5a8f2cb071", + "sha256:c2711197154f46d06f73542c539a0ff5411f1951fab391e0a4ac8359badef719", + "sha256:d998c20e3deed234fca993fd6c8314cb7cbfda05fd170f1bd75bb5d7421c3c5a", + "sha256:df4f840d77d9e37136f8e6b432fecc9d6b8730f18f896e90628712c793466ce6", + "sha256:f5653c2581acb038319e6705d4e3593677676df14b112f13e0b5b44b6a18df1a", + "sha256:f7c7aa485a2e2250d455148470ffd0195eecc3d845122635202d7467d6f7b4cf", + "sha256:f9e2c66a6493147de835f207f198540a56b26745ce4f272fbc7c2f2cfebeb729" ], - "version": "==1.11.5" + "version": "==1.12.1" }, "chardet": { "hashes": [ @@ -143,10 +146,10 @@ }, "jsonschema": { "hashes": [ - "sha256:000e68abd33c972a5248544925a0cae7d1125f9bf6c58280d37546b946769a08", - "sha256:6ff5f3180870836cae40f06fa10419f557208175f13ad7bc26caa77beb1f6e02" + "sha256:acc8a90c31d11060516cfd0b414b9f8bcf4bc691b21f0f786ea57dd5255c79db", + "sha256:dd3f8ecb1b52d94d45eedb67cb86cac57b94ded562c5d98f63719e55ce58557b" ], - "version": "==2.6.0" + "version": "==3.0.0" }, "lief": { "hashes": [ @@ -156,9 +159,9 @@ }, "neobolt": { "hashes": [ - "sha256:f70df7422568f3f92f065482237dabe3b96cd49a921c5e17feb1c9e68fdd0357" + "sha256:3324f2b319e84acb82e37a81ef75f3f7ce71c149387daf900589377db48bed2a" ], - "version": "==1.7.3" + "version": "==1.7.4" }, "neotime": { "hashes": [ @@ -166,13 +169,48 @@ ], "version": "==1.7.4" }, + "pillow": { + "hashes": [ + "sha256:051de330a06c99d6f84bcf582960487835bcae3fc99365185dc2d4f65a390c0e", + "sha256:0ae5289948c5e0a16574750021bd8be921c27d4e3527800dc9c2c1d2abc81bf7", + "sha256:0b1efce03619cdbf8bcc61cfae81fcda59249a469f31c6735ea59badd4a6f58a", + "sha256:163136e09bd1d6c6c6026b0a662976e86c58b932b964f255ff384ecc8c3cefa3", + "sha256:18e912a6ccddf28defa196bd2021fe33600cbe5da1aa2f2e2c6df15f720b73d1", + "sha256:24ec3dea52339a610d34401d2d53d0fb3c7fd08e34b20c95d2ad3973193591f1", + "sha256:267f8e4c0a1d7e36e97c6a604f5b03ef58e2b81c1becb4fccecddcb37e063cc7", + "sha256:3273a28734175feebbe4d0a4cde04d4ed20f620b9b506d26f44379d3c72304e1", + "sha256:4c678e23006798fc8b6f4cef2eaad267d53ff4c1779bd1af8725cc11b72a63f3", + "sha256:4d4bc2e6bb6861103ea4655d6b6f67af8e5336e7216e20fff3e18ffa95d7a055", + "sha256:505738076350a337c1740a31646e1de09a164c62c07db3b996abdc0f9d2e50cf", + "sha256:5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f", + "sha256:5d95cb9f6cced2628f3e4de7e795e98b2659dfcc7176ab4a01a8b48c2c2f488f", + "sha256:7eda4c737637af74bac4b23aa82ea6fbb19002552be85f0b89bc27e3a762d239", + "sha256:801ddaa69659b36abf4694fed5aa9f61d1ecf2daaa6c92541bbbbb775d97b9fe", + "sha256:825aa6d222ce2c2b90d34a0ea31914e141a85edefc07e17342f1d2fdf121c07c", + "sha256:9c215442ff8249d41ff58700e91ef61d74f47dfd431a50253e1a1ca9436b0697", + "sha256:a3d90022f2202bbb14da991f26ca7a30b7e4c62bf0f8bf9825603b22d7e87494", + "sha256:a631fd36a9823638fe700d9225f9698fb59d049c942d322d4c09544dc2115356", + "sha256:a6523a23a205be0fe664b6b8747a5c86d55da960d9586db039eec9f5c269c0e6", + "sha256:a756ecf9f4b9b3ed49a680a649af45a8767ad038de39e6c030919c2f443eb000", + "sha256:b117287a5bdc81f1bac891187275ec7e829e961b8032c9e5ff38b70fd036c78f", + "sha256:ba04f57d1715ca5ff74bb7f8a818bf929a204b3b3c2c2826d1e1cc3b1c13398c", + "sha256:cd878195166723f30865e05d87cbaf9421614501a4bd48792c5ed28f90fd36ca", + "sha256:cee815cc62d136e96cf76771b9d3eb58e0777ec18ea50de5cfcede8a7c429aa8", + "sha256:d1722b7aa4b40cf93ac3c80d3edd48bf93b9208241d166a14ad8e7a20ee1d4f3", + "sha256:d7c1c06246b05529f9984435fc4fa5a545ea26606e7f450bdbe00c153f5aeaad", + "sha256:e9c8066249c040efdda84793a2a669076f92a301ceabe69202446abb4c5c5ef9", + "sha256:f227d7e574d050ff3996049e086e1f18c7bd2d067ef24131e50a1d3fe5831fbc", + "sha256:fc9a12aad714af36cf3ad0275a96a733526571e52710319855628f476dcb144e" + ], + "version": "==5.4.1" + }, "prompt-toolkit": { "hashes": [ - "sha256:88002cc618cacfda8760c4539e76c3b3f148ecdb7035a3d422c7ecdc90c2a3ba", - "sha256:c6655a12e9b08edb8cf5aeab4815fd1e1bdea4ad73d3bbf269cf2e0c4eb75d5e", - "sha256:df5835fb8f417aa55e5cafadbaeb0cf630a1e824aad16989f9f0493e679ec010" + "sha256:11adf3389a996a6d45cc277580d0d53e8a5afd281d0c9ec71b28e6f121463780", + "sha256:2519ad1d8038fd5fc8e770362237ad0364d16a7650fb5724af6997ed5515e3c1", + "sha256:977c6583ae813a37dc1c2e1b715892461fcbdaa57f6fc62f33a528c4886c8f55" ], - "version": "==2.0.8" + "version": "==2.0.9" }, "py2neo": { "hashes": [ @@ -220,6 +258,12 @@ ], "version": "==19.0.0" }, + "pyrsistent": { + "hashes": [ + "sha256:3ca82748918eb65e2d89f222b702277099aca77e34843c5eb9d52451173970e2" + ], + "version": "==0.14.11" + }, "python-dateutil": { "hashes": [ "sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb", @@ -241,6 +285,40 @@ ], "version": "==2018.9" }, + "reportlab": { + "hashes": [ + "sha256:069f684cd0aaa518a27dc9124aed29cee8998e21ddf19604e53214ec8462bdd7", + "sha256:09b68ec01d86b4b120456b3f3202570ec96f57624e3a4fc36f3829323391daa4", + "sha256:0c32be9a406172c29ea20ff55a709ccac1e7fb09f15aba67cb7b455fd1d3dbe0", + "sha256:233196cf25e97cfe7c452524ea29d9a4909f1cb66599299233be1efaaaa7a7a3", + "sha256:2b5e4533f3e5b962835a5ce44467e66d1ecc822761d1b508077b5087a06be338", + "sha256:2e860bcdace5a558356802a92ae8658d7e5fdaa00ded82e83a3f2987c562cb66", + "sha256:3546029e63a9a9dc24ee38959eb417678c2425b96cd27b31e09e216dafc94666", + "sha256:4452b93f9c73b6b70311e7d69082d64da81b38e91bfb4766397630092e6da6fd", + "sha256:528c74a1c6527d1859c2c7a64a94a1cba485b00175162ea23699ae58a1e94939", + "sha256:6116e750f98018febc08dfee6df20446cf954adbcfa378d2c703d56c8864aff3", + "sha256:6b2b3580c647d75ef129172cb3da648cdb24566987b0b59c5ebb80ab770748d6", + "sha256:727b5f2bed08552d143fc99649b1863c773729f580a416844f9d9967bb0a1ae8", + "sha256:74c24a3ec0a3d4f8acb13a07192f45bdb54a1cc3c2286241677e7e8bcd5011fa", + "sha256:98ccd2f8b4f8636db05f3f14db0b471ad6bb4b66ae0dc9052c4822b3bd5d6a7d", + "sha256:a5905aa567946bc938b489a7249c7890c3fd3c9b7b5680dece5bc551c2ddbe0d", + "sha256:acbb7f676b8586b770719e9683eda951fdb38eb7970d46fcbf3cdda88d912a64", + "sha256:b5e30f865add48cf880f1c363eb505b97f2f7baaa88c155f87a335a76515a3e5", + "sha256:be2a7c33a2c28bbd3f453ffe4f0e5200b88c803a097f4cf52d69c6b53fad7a8f", + "sha256:c356bb600f59ac64955813d6497a08bfd5d0c451cb5829b61e3913d0ac084e26", + "sha256:c7ec4ae2393beab584921b1287a04e94fd98c28315e348362d89b85f4b464546", + "sha256:d476edc831bb3e9ebd04d1403abaf3ea57b3e4c2276c91a54fdfb6efbd3f9d97", + "sha256:db059e1a0691c872784062421ec51848539eb4f5210142682e61059a5ca7cc55", + "sha256:dd423a6753509ab14a0ac1b5be39d219c8f8d3781cce3deb4f45eda31969b5e8", + "sha256:ed9b7c0d71ce6fe2b31c6cde530ad8238632b876a5d599218739bda142a77f7c", + "sha256:f0a2465af4006f97b05e1f1546d67d3a3213d414894bf28be7f87f550a7f4a55", + "sha256:f20bfe26e57e8e1f575a9e0325be04dd3562db9f247ffdd73b5d4df6dec53bc2", + "sha256:f3463f2cb40a1b515ac0133ba859eca58f53b56760da9abb27ed684c565f853c", + "sha256:facc3c9748ab1525fb8401a1223bce4f24f0d6aa1a9db86c55db75777ccf40f9" + ], + "index": "pypi", + "version": "==3.5.13" + }, "requests": { "hashes": [ "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", @@ -257,10 +335,10 @@ }, "soupsieve": { "hashes": [ - "sha256:466910df7561796a60748826781ebe9a888f7a1668a636ae86783f44d10aae73", - "sha256:87db12ae79194f0ff9808d2b1641c4f031ae39ffa3cab6b907ea7c1e5e5ed445" + "sha256:afa56bf14907bb09403e5d15fbed6275caa4174d36b975226e3b67a3bb6e2c4b", + "sha256:eaed742b48b1f3e2d45ba6f79401b2ed5dc33b2123dfe216adb90d4bfa0ade26" ], - "version": "==1.7.3" + "version": "==1.8" }, "urllib3": { "extras": [ @@ -347,11 +425,11 @@ }, "coveralls": { "hashes": [ - "sha256:ab638e88d38916a6cedbf80a9cd8992d5fa55c77ab755e262e00b36792b7cd6d", - "sha256:b2388747e2529fa4c669fb1e3e2756e4e07b6ee56c7d9fce05f35ccccc913aa0" + "sha256:6f213e461390973f4a97fb9e9d4ebd4956af296ff0a4d868e622108145835cb7", + "sha256:a7d0078c9e9b5692c03dcd3884647e837836c265c01e98094632feadef767d36" ], "index": "pypi", - "version": "==1.5.1" + "version": "==1.6.0" }, "docopt": { "hashes": [ From 4d792bd7a5236276f04997224d7f1521caf53b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 11:13:43 -0800 Subject: [PATCH 07/17] new: add auth parameter to pass to python-requests --- pymisp/api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index fbc4b80..488f705 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -69,9 +69,10 @@ class PyMISP(object): :param proxies: Proxy dict as describes here: http://docs.python-requests.org/en/master/user/advanced/#proxies :param cert: Client certificate, as described there: http://docs.python-requests.org/en/master/user/advanced/#client-side-certificates :param asynch: Use asynchronous processing where possible + :param auth: The auth parameter is passed directly to requests, as described here: http://docs.python-requests.org/en/master/user/authentication/ """ - def __init__(self, url, key, ssl=True, out_type='json', debug=None, proxies=None, cert=None, asynch=False): + def __init__(self, url, key, ssl=True, out_type='json', debug=None, proxies=None, cert=None, asynch=False, auth=None): if not url: raise NoURL('Please provide the URL of your MISP instance.') if not key: @@ -83,6 +84,7 @@ class PyMISP(object): self.proxies = proxies self.cert = cert self.asynch = asynch + self.auth = auth if asynch and not ASYNC_OK: logger.critical("You turned on Async, but don't have requests_futures installed") self.asynch = False @@ -178,9 +180,9 @@ class PyMISP(object): if logger.isEnabledFor(logging.DEBUG): logger.debug(prepped.headers) if self.asynch and background_callback is not None: - return s.send(prepped, verify=self.ssl, proxies=self.proxies, cert=self.cert, background_callback=background_callback) + return s.send(prepped, verify=self.ssl, proxies=self.proxies, auth=self.auth, cert=self.cert, background_callback=background_callback) else: - return s.send(prepped, verify=self.ssl, proxies=self.proxies, cert=self.cert) + return s.send(prepped, verify=self.ssl, proxies=self.proxies, auth=self.auth, cert=self.cert) # ##################### # ### Core helpers #### From 2e93aad34a2e71d3bb8f6454579a2c7b72100f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 21:16:49 -0800 Subject: [PATCH 08/17] fix: Make sure install works even without reportlab installed. --- Pipfile | 3 +- Pipfile.lock | 104 ++++++++++++++-------------- pymisp/__init__.py | 9 ++- pymisp/tools/reportlab_generator.py | 17 ++--- setup.py | 3 +- 5 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Pipfile b/Pipfile index a6b48c8..1a384db 100644 --- a/Pipfile +++ b/Pipfile @@ -10,10 +10,9 @@ codecov = "*" requests-mock = "*" [packages] -pymisp = {editable = true,extras = ["fileobjects", "neo", "openioc", "virustotal"],path = "."} +pymisp = {editable = true,extras = ["fileobjects", "neo", "openioc", "virustotal", "pdfexport"],path = "."} pydeep = {editable = true,git = "https://github.com/kbandla/pydeep.git"} pymispwarninglists = {editable = true,git = "https://github.com/MISP/PyMISPWarningLists.git"} -reportlab = "*" [requires] python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock index 309c003..bde1f40 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "3b84b36dba62f12dd8b636886c4a14b3580a77b5a4ceccf0c30ea6c08cd2b7eb" + "sha256": "c95b6920af9d48d6e38e0456394f752479064c9f3091cf3e6b93e751de21cfad" }, "pipfile-spec": 6, "requires": { @@ -47,36 +47,36 @@ }, "cffi": { "hashes": [ - "sha256:0b5f895714a7a9905148fc51978c62e8a6cbcace30904d39dcd0d9e2265bb2f6", - "sha256:27cdc7ba35ee6aa443271d11583b50815c4bb52be89a909d0028e86c21961709", - "sha256:2d4a38049ea93d5ce3c7659210393524c1efc3efafa151bd85d196fa98fce50a", - "sha256:3262573d0d60fc6b9d0e0e6e666db0e5045cbe8a531779aa0deb3b425ec5a282", - "sha256:358e96cfffc185ab8f6e7e425c7bb028931ed08d65402fbcf3f4e1bff6e66556", - "sha256:37c7db824b5687fbd7ea5519acfd054c905951acc53503547c86be3db0580134", - "sha256:39b9554dfe60f878e0c6ff8a460708db6e1b1c9cc6da2c74df2955adf83e355d", - "sha256:42b96a77acf8b2d06821600fa87c208046decc13bd22a4a0e65c5c973443e0da", - "sha256:5b37dde5035d3c219324cac0e69d96495970977f310b306fa2df5910e1f329a1", - "sha256:5d35819f5566d0dd254f273d60cf4a2dcdd3ae3003dfd412d40b3fe8ffd87509", - "sha256:5df73aa465e53549bd03c819c1bc69fb85529a5e1a693b7b6cb64408dd3970d1", - "sha256:7075b361f7a4d0d4165439992d0b8a3cdfad1f302bf246ed9308a2e33b046bd3", - "sha256:7678b5a667b0381c173abe530d7bdb0e6e3b98e062490618f04b80ca62686d96", - "sha256:7dfd996192ff8a535458c17f22ff5eb78b83504c34d10eefac0c77b1322609e2", - "sha256:8a3be5d31d02c60f84c4fd4c98c5e3a97b49f32e16861367f67c49425f955b28", - "sha256:9812e53369c469506b123aee9dcb56d50c82fad60c5df87feb5ff59af5b5f55c", - "sha256:9b6f7ba4e78c52c1a291d0c0c0bd745d19adde1a9e1c03cb899f0c6efd6f8033", - "sha256:a85bc1d7c3bba89b3d8c892bc0458de504f8b3bcca18892e6ed15b5f7a52ad9d", - "sha256:aa6b9c843ad645ebb12616de848cc4e25a40f633ccc293c3c9fe34107c02c2ea", - "sha256:bae1aa56ee00746798beafe486daa7cfb586cd395c6ce822ba3068e48d761bc0", - "sha256:bae96e26510e4825d5910a196bf6b5a11a18b87d9278db6d08413be8ea799469", - "sha256:bd78df3b594013b227bf31d0301566dc50ba6f40df38a70ded731d5a8f2cb071", - "sha256:c2711197154f46d06f73542c539a0ff5411f1951fab391e0a4ac8359badef719", - "sha256:d998c20e3deed234fca993fd6c8314cb7cbfda05fd170f1bd75bb5d7421c3c5a", - "sha256:df4f840d77d9e37136f8e6b432fecc9d6b8730f18f896e90628712c793466ce6", - "sha256:f5653c2581acb038319e6705d4e3593677676df14b112f13e0b5b44b6a18df1a", - "sha256:f7c7aa485a2e2250d455148470ffd0195eecc3d845122635202d7467d6f7b4cf", - "sha256:f9e2c66a6493147de835f207f198540a56b26745ce4f272fbc7c2f2cfebeb729" + "sha256:00b97afa72c233495560a0793cdc86c2571721b4271c0667addc83c417f3d90f", + "sha256:0ba1b0c90f2124459f6966a10c03794082a2f3985cd699d7d63c4a8dae113e11", + "sha256:0bffb69da295a4fc3349f2ec7cbe16b8ba057b0a593a92cbe8396e535244ee9d", + "sha256:21469a2b1082088d11ccd79dd84157ba42d940064abbfa59cf5f024c19cf4891", + "sha256:2e4812f7fa984bf1ab253a40f1f4391b604f7fc424a3e21f7de542a7f8f7aedf", + "sha256:2eac2cdd07b9049dd4e68449b90d3ef1adc7c759463af5beb53a84f1db62e36c", + "sha256:2f9089979d7456c74d21303c7851f158833d48fb265876923edcb2d0194104ed", + "sha256:3dd13feff00bddb0bd2d650cdb7338f815c1789a91a6f68fdc00e5c5ed40329b", + "sha256:4065c32b52f4b142f417af6f33a5024edc1336aa845b9d5a8d86071f6fcaac5a", + "sha256:51a4ba1256e9003a3acf508e3b4f4661bebd015b8180cc31849da222426ef585", + "sha256:59888faac06403767c0cf8cfb3f4a777b2939b1fbd9f729299b5384f097f05ea", + "sha256:59c87886640574d8b14910840327f5cd15954e26ed0bbd4e7cef95fa5aef218f", + "sha256:610fc7d6db6c56a244c2701575f6851461753c60f73f2de89c79bbf1cc807f33", + "sha256:70aeadeecb281ea901bf4230c6222af0248c41044d6f57401a614ea59d96d145", + "sha256:71e1296d5e66c59cd2c0f2d72dc476d42afe02aeddc833d8e05630a0551dad7a", + "sha256:8fc7a49b440ea752cfdf1d51a586fd08d395ff7a5d555dc69e84b1939f7ddee3", + "sha256:9b5c2afd2d6e3771d516045a6cfa11a8da9a60e3d128746a7fe9ab36dfe7221f", + "sha256:9c759051ebcb244d9d55ee791259ddd158188d15adee3c152502d3b69005e6bd", + "sha256:b4d1011fec5ec12aa7cc10c05a2f2f12dfa0adfe958e56ae38dc140614035804", + "sha256:b4f1d6332339ecc61275bebd1f7b674098a66fea11a00c84d1c58851e618dc0d", + "sha256:c030cda3dc8e62b814831faa4eb93dd9a46498af8cd1d5c178c2de856972fd92", + "sha256:c2e1f2012e56d61390c0e668c20c4fb0ae667c44d6f6a2eeea5d7148dcd3df9f", + "sha256:c37c77d6562074452120fc6c02ad86ec928f5710fbc435a181d69334b4de1d84", + "sha256:c8149780c60f8fd02752d0429246088c6c04e234b895c4a42e1ea9b4de8d27fb", + "sha256:cbeeef1dc3c4299bd746b774f019de9e4672f7cc666c777cd5b409f0b746dac7", + "sha256:e113878a446c6228669144ae8a56e268c91b7f1fafae927adc4879d9849e0ea7", + "sha256:e21162bf941b85c0cda08224dade5def9360f53b09f9f259adb85fc7dd0e7b35", + "sha256:fb6934ef4744becbda3143d30c6604718871495a5e36c408431bf33d9c146889" ], - "version": "==1.12.1" + "version": "==1.12.2" }, "chardet": { "hashes": [ @@ -101,27 +101,27 @@ }, "cryptography": { "hashes": [ - "sha256:05b3ded5e88747d28ee3ef493f2b92cbb947c1e45cf98cfef22e6d38bb67d4af", - "sha256:06826e7f72d1770e186e9c90e76b4f84d90cdb917b47ff88d8dc59a7b10e2b1e", - "sha256:08b753df3672b7066e74376f42ce8fc4683e4fd1358d34c80f502e939ee944d2", - "sha256:2cd29bd1911782baaee890544c653bb03ec7d95ebeb144d714b0f5c33deb55c7", - "sha256:31e5637e9036d966824edaa91bf0aa39dc6f525a1c599f39fd5c50340264e079", - "sha256:42fad67d7072216a49e34f923d8cbda9edacbf6633b19a79655e88a1b4857063", - "sha256:4946b67235b9d2ea7d31307be9d5ad5959d6c4a8f98f900157b47abddf698401", - "sha256:522fdb2809603ee97a4d0ef2f8d617bc791eb483313ba307cb9c0a773e5e5695", - "sha256:6f841c7272645dd7c65b07b7108adfa8af0aaea57f27b7f59e01d41f75444c85", - "sha256:7d335e35306af5b9bc0560ca39f740dfc8def72749645e193dd35be11fb323b3", - "sha256:8504661ffe324837f5c4607347eeee4cf0fcad689163c6e9c8d3b18cf1f4a4ad", - "sha256:9260b201ce584d7825d900c88700aa0bd6b40d4ebac7b213857bd2babee9dbca", - "sha256:9a30384cc402eac099210ab9b8801b2ae21e591831253883decdb4513b77a3cd", - "sha256:9e29af877c29338f0cab5f049ccc8bd3ead289a557f144376c4fbc7d1b98914f", - "sha256:ab50da871bc109b2d9389259aac269dd1b7c7413ee02d06fe4e486ed26882159", - "sha256:b13c80b877e73bcb6f012813c6f4a9334fcf4b0e96681c5a15dac578f2eedfa0", - "sha256:bfe66b577a7118e05b04141f0f1ed0959552d45672aa7ecb3d91e319d846001e", - "sha256:e091bd424567efa4b9d94287a952597c05d22155a13716bf5f9f746b9dc906d3", - "sha256:fa2b38c8519c5a3aa6e2b4e1cf1a549b54acda6adb25397ff542068e73d1ed00" + "sha256:066f815f1fe46020877c5983a7e747ae140f517f1b09030ec098503575265ce1", + "sha256:210210d9df0afba9e000636e97810117dc55b7157c903a55716bb73e3ae07705", + "sha256:26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6", + "sha256:2afb83308dc5c5255149ff7d3fb9964f7c9ee3d59b603ec18ccf5b0a8852e2b1", + "sha256:2db34e5c45988f36f7a08a7ab2b69638994a8923853dec2d4af121f689c66dc8", + "sha256:409c4653e0f719fa78febcb71ac417076ae5e20160aec7270c91d009837b9151", + "sha256:45a4f4cf4f4e6a55c8128f8b76b4c057027b27d4c67e3fe157fa02f27e37830d", + "sha256:48eab46ef38faf1031e58dfcc9c3e71756a1108f4c9c966150b605d4a1a7f659", + "sha256:6b9e0ae298ab20d371fc26e2129fd683cfc0cfde4d157c6341722de645146537", + "sha256:6c4778afe50f413707f604828c1ad1ff81fadf6c110cb669579dea7e2e98a75e", + "sha256:8c33fb99025d353c9520141f8bc989c2134a1f76bac6369cea060812f5b5c2bb", + "sha256:9873a1760a274b620a135054b756f9f218fa61ca030e42df31b409f0fb738b6c", + "sha256:9b069768c627f3f5623b1cbd3248c5e7e92aec62f4c98827059eed7053138cc9", + "sha256:9e4ce27a507e4886efbd3c32d120db5089b906979a4debf1d5939ec01b9dd6c5", + "sha256:acb424eaca214cb08735f1a744eceb97d014de6530c1ea23beb86d9c6f13c2ad", + "sha256:c8181c7d77388fe26ab8418bb088b1a1ef5fde058c6926790c8a0a3d94075a4a", + "sha256:d4afbb0840f489b60f5a580a41a1b9c3622e08ecb5eec8614d4fb4cd914c4460", + "sha256:d9ed28030797c00f4bc43c86bf819266c76a5ea61d006cd4078a93ebf7da6bfd", + "sha256:e603aa7bb52e4e8ed4119a58a03b60323918467ef209e6ff9db3ac382e5cf2c6" ], - "version": "==2.5" + "version": "==2.6.1" }, "decorator": { "hashes": [ @@ -242,7 +242,8 @@ "fileobjects", "neo", "openioc", - "virustotal" + "virustotal", + "pdfexport" ], "path": "." }, @@ -316,7 +317,6 @@ "sha256:f3463f2cb40a1b515ac0133ba859eca58f53b56760da9abb27ed684c565f853c", "sha256:facc3c9748ab1525fb8401a1223bce4f24f0d6aa1a9db86c55db75777ccf40f9" ], - "index": "pypi", "version": "==3.5.13" }, "requests": { diff --git a/pymisp/__init__.py b/pymisp/__init__.py index b4b7264..a015380 100644 --- a/pymisp/__init__.py +++ b/pymisp/__init__.py @@ -42,7 +42,14 @@ try: from .tools import openioc # noqa from .tools import load_warninglists # noqa from .tools import ext_lookups # noqa - from .tools import reportlab_generator # noqa + + if sys.version_info >= (3, 4): + # Let's not bother with python 2 + try: + from .tools import reportlab_generator # noqa + except ImportError: + # FIXME: The import should not raise an exception if reportlab isn't installed + pass if sys.version_info >= (3, 6): from .aping import ExpandedPyMISP # noqa logger.debug('pymisp loaded properly') diff --git a/pymisp/tools/reportlab_generator.py b/pymisp/tools/reportlab_generator.py index ec9d44c..7f85b0a 100644 --- a/pymisp/tools/reportlab_generator.py +++ b/pymisp/tools/reportlab_generator.py @@ -8,14 +8,8 @@ import pprint from io import BytesIO from functools import partial -import sys - -if sys.version_info.major >= 3: - from html import escape - # import PIL -else: - print( - "ExportPDF running with Python < 3 : stability and output not guaranteed. Please run exportPDF with at least Python3") +# NOTE: The module isn't loaded at all unless we're using python 3.4+ +from html import escape logger = logging.getLogger('pymisp') @@ -36,7 +30,6 @@ try: HAS_REPORTLAB = True except ImportError: HAS_REPORTLAB = False - print("ReportLab cannot be imported. Please verify that ReportLab is installed on the system.") ######################################################################## @@ -880,7 +873,7 @@ def create_flowable_description_from_event(misp_event, config=None): ''' ''' - The event "{EventName}" | that occurred on {EventDate}, | had been shared by {Organisation Name} | on the {Date}. + The event "{EventName}" | that occurred on {EventDate}, | had been shared by {Organisation Name} | on the {Date}. ''' text = "" @@ -915,7 +908,7 @@ def create_flowable_description_from_event(misp_event, config=None): text += "." ''' - The threat level of this event is {ThreatLevel} and the analysis that was made of this event is {AnalysisLevel}. + The threat level of this event is {ThreatLevel} and the analysis that was made of this event is {AnalysisLevel}. ''' item = ["Threat level", 'threat_level_id', "None"] @@ -1031,7 +1024,7 @@ def create_flowable_table_from_tags(misp_event): def create_flowable_table_from_objects(misp_event): ''' Returns a list of flowables representing the list of objects of a misp event. - The list is composed of a serie of + The list is composed of a serie of [ header object, table of object information, [ header of attribute, table of attribute]*] to add to the pdf :param misp_event: A misp event :return: a table of flowables diff --git a/setup.py b/setup.py index 5e6c7b9..e6d47b3 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,8 @@ setup( 'neo': ['py2neo'], 'openioc': ['beautifulsoup4'], 'virustotal': ['validators'], - 'docs': ['sphinx-autodoc-typehints']}, + 'docs': ['sphinx-autodoc-typehints'], + 'pdfexport': ['reportlab']}, tests_require=[ 'jsonschema', 'python-magic', From 3e64a7b03d39e64ee9502430dd85e2057d08f9cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 21:23:59 -0800 Subject: [PATCH 09/17] fix: Properly catch error if reportlab isn't installed --- pymisp/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pymisp/__init__.py b/pymisp/__init__.py index a015380..2f8144d 100644 --- a/pymisp/__init__.py +++ b/pymisp/__init__.py @@ -47,7 +47,7 @@ try: # Let's not bother with python 2 try: from .tools import reportlab_generator # noqa - except ImportError: + except NameError: # FIXME: The import should not raise an exception if reportlab isn't installed pass if sys.version_info >= (3, 6): diff --git a/setup.py b/setup.py index e6d47b3..27ea70f 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup( ], install_requires=['six', 'requests', 'python-dateutil', 'jsonschema', 'python-dateutil', 'enum34;python_version<"3.4"', - 'functools32;python_version<"3.0"', 'reportlab'], + 'functools32;python_version<"3.0"'], extras_require={'fileobjects': ['lief>=0.8', 'python-magic'], 'neo': ['py2neo'], 'openioc': ['beautifulsoup4'], From e688a3e99fda06414c1d2131838e9e97fbf87497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 21:38:31 -0800 Subject: [PATCH 10/17] fix: properly pass the auth parameter to the request --- pymisp/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index d23ecb5..2ae60fa 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -171,6 +171,7 @@ class PyMISP(object): else: local_session = requests.Session with local_session() as s: + req.auth = self.auth prepped = s.prepare_request(req) prepped.headers.update( {'Authorization': self.key, @@ -180,9 +181,9 @@ class PyMISP(object): if logger.isEnabledFor(logging.DEBUG): logger.debug(prepped.headers) if self.asynch and background_callback is not None: - return s.send(prepped, verify=self.ssl, proxies=self.proxies, auth=self.auth, cert=self.cert, background_callback=background_callback) + return s.send(prepped, verify=self.ssl, proxies=self.proxies, cert=self.cert, background_callback=background_callback) else: - return s.send(prepped, verify=self.ssl, proxies=self.proxies, auth=self.auth, cert=self.cert) + return s.send(prepped, verify=self.ssl, proxies=self.proxies, cert=self.cert) # ##################### # ### Core helpers #### From 227a6e89269964fdcb43f66b51d7a915d82f26f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 22:02:12 -0800 Subject: [PATCH 11/17] fix: Let's act as if python2 doesn't exists. --- tests/test_reportlab.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tests/test_reportlab.py b/tests/test_reportlab.py index 721cb7f..d35784e 100644 --- a/tests/test_reportlab.py +++ b/tests/test_reportlab.py @@ -12,14 +12,19 @@ import time manual_testing = False +if sys.version_info < (3, 6): + print('This test suite requires Python 3.6+, breaking.') + sys.exit(0) + + class TestMISPEvent(unittest.TestCase): def setUp(self): self.maxDiff = None self.mispevent = MISPEvent() - if not manual_testing : + if not manual_testing: self.root = "tests/" - else : + else: self.root = "" self.test_folder = self.root + "reportlab_testfiles/" self.test_batch_folder = self.root + "OSINT_output/" @@ -28,7 +33,6 @@ class TestMISPEvent(unittest.TestCase): self.storage_image_folder = self.root + "reportlab_test_image_outputs/" self.moduleconfig = ["MISP_base_url_for_dynamic_link", "MISP_name_for_metadata", "Activate_textual_description"] - def init_event(self): self.mispevent.info = 'This is a test' self.mispevent.distribution = 1 @@ -94,7 +98,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'very_long_event.json') @@ -120,7 +124,7 @@ class TestMISPEvent(unittest.TestCase): else: config = {} - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'very_long_event.json') @@ -134,7 +138,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'image_event.json') @@ -148,7 +152,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'mainly_objects_1.json') @@ -162,7 +166,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'mainly_objects_2.json') @@ -176,7 +180,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'sighting_1.json') @@ -190,7 +194,7 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[1]] = "My Wonderful CERT" self.init_event() self.mispevent.load_file(self.test_folder + 'sighting_2.json') @@ -204,21 +208,20 @@ class TestMISPEvent(unittest.TestCase): config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" - config[self.moduleconfig[2]] = True + config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[2]] = True self.init_event() self.mispevent.load_file(self.test_folder + 'very_long_event.json') reportlab_generator.register_value_to_file(reportlab_generator.convert_event_in_pdf_buffer(self.mispevent, config), self.storage_folder + "textual.pdf") - def test_batch_image_events(self): # Test case ONLY for manual testing. Needs to download a full list of image events ! if self.check_python_2(): self.assertTrue(True) - elif not manual_testing : + elif not manual_testing: self.assertTrue(True) else: self.init_event() @@ -246,7 +249,7 @@ class TestMISPEvent(unittest.TestCase): if self.check_python_2(): self.assertTrue(True) - elif not manual_testing : + elif not manual_testing: self.assertTrue(True) else: self.init_event() @@ -274,15 +277,15 @@ class TestMISPEvent(unittest.TestCase): if self.check_python_2(): self.assertTrue(True) - elif not manual_testing : + elif not manual_testing: self.assertTrue(True) else: self.init_event() config = {} config[self.moduleconfig[0]] = "http://localhost:8080" - config[self.moduleconfig[1]] = "My Wonderful CERT" - config[self.moduleconfig[2]] = True + config[self.moduleconfig[1]] = "My Wonderful CERT" + config[self.moduleconfig[2]] = True file_nb = str(len(os.listdir(self.test_batch_folder))) i = 0 From 59f1f0f9eb9e011a49aa7830a3f9236515f6431f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 23:17:27 -0800 Subject: [PATCH 12/17] chg: Bump misp-objects --- pymisp/data/misp-objects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymisp/data/misp-objects b/pymisp/data/misp-objects index 75ae30f..d0886ba 160000 --- a/pymisp/data/misp-objects +++ b/pymisp/data/misp-objects @@ -1 +1 @@ -Subproject commit 75ae30f44df997280255eec60b981b9f376c5ac4 +Subproject commit d0886ba6aff1526868efcd59fccb99e920372f3b From 0f56a306beae3f412a75e5b262064f1690e4c486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 23:22:05 -0800 Subject: [PATCH 13/17] chg: Enforce strict in object testing to ease debugging --- tests/testlive_comprehensive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 4c7e673..52b2676 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -496,7 +496,7 @@ class TestComprehensive(unittest.TestCase): self.assertEqual(new_obj['Object']['distribution'], str(Distribution.inherit.value)) self.assertEqual(new_obj['Object']['Attribute'][0]['distribution'], str(Distribution.inherit.value)) # Object - edit - clean_obj = MISPObject(**new_obj['Object']) + clean_obj = MISPObject(strict=True, **new_obj['Object']) clean_obj.from_dict(**new_obj['Object']) clean_obj.add_attribute('filename', value='blah.exe') new_obj = self.user_misp_connector.edit_object(clean_obj) From ece54a942b2c0f17d654af3bd1d98bca72fb20e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 23:30:19 -0800 Subject: [PATCH 14/17] fix: Bump tests relatively to the file template --- .../event_obj_attr_tag.json | 2 +- .../event_obj_def_param.json | 4 ++-- tests/reportlab_testfiles/image_event.json | 22 +++++++++---------- .../reportlab_testfiles/mainly_objects_1.json | 14 ++++++------ .../reportlab_testfiles/mainly_objects_2.json | 10 ++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/mispevent_testfiles/event_obj_attr_tag.json b/tests/mispevent_testfiles/event_obj_attr_tag.json index 6b2b637..87ad93a 100644 --- a/tests/mispevent_testfiles/event_obj_attr_tag.json +++ b/tests/mispevent_testfiles/event_obj_attr_tag.json @@ -31,7 +31,7 @@ "name": "file", "sharing_group_id": "0", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "uuid": "a" }, { diff --git a/tests/mispevent_testfiles/event_obj_def_param.json b/tests/mispevent_testfiles/event_obj_def_param.json index e18fe9e..b6857e8 100644 --- a/tests/mispevent_testfiles/event_obj_def_param.json +++ b/tests/mispevent_testfiles/event_obj_def_param.json @@ -23,7 +23,7 @@ "name": "file", "sharing_group_id": "0", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "uuid": "a" }, { @@ -48,7 +48,7 @@ "name": "file", "sharing_group_id": "0", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "uuid": "b" } ] diff --git a/tests/reportlab_testfiles/image_event.json b/tests/reportlab_testfiles/image_event.json index 5cc4933..e619c6d 100644 --- a/tests/reportlab_testfiles/image_event.json +++ b/tests/reportlab_testfiles/image_event.json @@ -715,7 +715,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "1db36cab-7b13-4758-b16a-9e9862d0973e", "timestamp": "1550871228", @@ -887,7 +887,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "3b8f6a45-0b7f-4bea-ad61-0369f01cc306", "timestamp": "1550871228", @@ -1059,7 +1059,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "8cc1ffb8-e4b2-4641-a536-ea843ff9bc7a", "timestamp": "1550871228", @@ -1231,7 +1231,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "89e0ad73-a186-4959-b978-2311ee49e4af", "timestamp": "1550871229", @@ -1403,7 +1403,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "4dbf697b-11ce-447f-85c6-cd02a2365a7f", "timestamp": "1550871229", @@ -1575,7 +1575,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "6860e975-938c-413d-b144-74cde72c25dc", "timestamp": "1550871229", @@ -1747,7 +1747,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "df5dd372-ecd6-4595-ab34-45bff1decb63", "timestamp": "1550871229", @@ -1919,7 +1919,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "3061d73f-2f4f-4c6e-8478-3d5d1e74c1bc", "timestamp": "1550871229", @@ -2091,7 +2091,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "fd57be37-61cc-4452-85b5-518d55586335", "timestamp": "1550871230", @@ -2263,7 +2263,7 @@ "meta-category": "file", "description": "File object describing a file with meta-information", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": "15", + "template_version": "16", "event_id": "1203", "uuid": "56b391e4-f005-4caa-ae12-a90db6664ebd", "timestamp": "1550871270", @@ -2487,4 +2487,4 @@ } ] } -} \ No newline at end of file +} diff --git a/tests/reportlab_testfiles/mainly_objects_1.json b/tests/reportlab_testfiles/mainly_objects_1.json index 61b04a6..733758c 100644 --- a/tests/reportlab_testfiles/mainly_objects_1.json +++ b/tests/reportlab_testfiles/mainly_objects_1.json @@ -70,7 +70,7 @@ "timestamp": "1543921748", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -114,7 +114,7 @@ "timestamp": "1543921750", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -158,7 +158,7 @@ "timestamp": "1543921751", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -482,7 +482,7 @@ "timestamp": "1543921755", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -875,7 +875,7 @@ "timestamp": "1543921759", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -988,7 +988,7 @@ "timestamp": "1543921762", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -1089,4 +1089,4 @@ } ] } -} \ No newline at end of file +} diff --git a/tests/reportlab_testfiles/mainly_objects_2.json b/tests/reportlab_testfiles/mainly_objects_2.json index 0c01864..3471c1f 100644 --- a/tests/reportlab_testfiles/mainly_objects_2.json +++ b/tests/reportlab_testfiles/mainly_objects_2.json @@ -82,7 +82,7 @@ "timestamp": "1543922168", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -126,7 +126,7 @@ "timestamp": "1543922169", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -450,7 +450,7 @@ "timestamp": "1543922173", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -857,7 +857,7 @@ "timestamp": "1543922178", "description": "File object describing a file with meta-information", "distribution": "3", - "template_version": "15", + "template_version": "16", "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", "comment": "", "name": "file", @@ -974,4 +974,4 @@ } ] } -} \ No newline at end of file +} From 0d6aa428effd72d53b9ceeea3900cf2632162ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 23:43:49 -0800 Subject: [PATCH 15/17] fix: Python 2.7 blah foo. --- pymisp/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pymisp/__init__.py b/pymisp/__init__.py index 2f8144d..512de05 100644 --- a/pymisp/__init__.py +++ b/pymisp/__init__.py @@ -47,6 +47,9 @@ try: # Let's not bother with python 2 try: from .tools import reportlab_generator # noqa + except ImportError: + # FIXME: The import should not raise an exception if reportlab isn't installed + pass except NameError: # FIXME: The import should not raise an exception if reportlab isn't installed pass From c35a2aea5544f323282b4737ce51b8fa4881b002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 27 Feb 2019 23:53:47 -0800 Subject: [PATCH 16/17] fix: Hopefully last fix for python 2.7 & reportlab. --- tests/test_reportlab.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_reportlab.py b/tests/test_reportlab.py index d35784e..7661f38 100644 --- a/tests/test_reportlab.py +++ b/tests/test_reportlab.py @@ -4,7 +4,6 @@ import unittest from pymisp import MISPEvent -from pymisp.tools import reportlab_generator import sys import os @@ -15,6 +14,8 @@ manual_testing = False if sys.version_info < (3, 6): print('This test suite requires Python 3.6+, breaking.') sys.exit(0) +else: + from pymisp import reportlab_generator class TestMISPEvent(unittest.TestCase): From 33186b6ec8f8adef1593e624c7d4a27e1900d189 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Thu, 28 Feb 2019 19:49:32 +0100 Subject: [PATCH 17/17] chg: [jupyter] remove all the response key (as response is removing it) --- docs/tutorial/Usage-NG.ipynb | 38 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/docs/tutorial/Usage-NG.ipynb b/docs/tutorial/Usage-NG.ipynb index a0479c6..c3a4eac 100644 --- a/docs/tutorial/Usage-NG.ipynb +++ b/docs/tutorial/Usage-NG.ipynb @@ -23,7 +23,7 @@ "misp_url = 'http://127.0.0.1:8080'\n", "# Can be found in the MISP web interface under \n", "# http://+MISP_URL+/users/view/me -> Authkey\n", - "misp_key = 'LBelWqKY9SQyG0huZzAMqiEBl6FODxpgRRXMsZFu'\n", + "misp_key = 'aJAmQQoBhVL5jqUDSucIkPrEYIbFyW0wwQnxyBfc'\n", "# Should PyMISP verify the MISP certificate\n", "misp_verifycert = False" ] @@ -87,10 +87,11 @@ }, "outputs": [], "source": [ - "response = misp.search(publish_timestamp='2h')\n", + "response = misp.search(publish_timestamp='2d')\n", "\n", + "print (response)\n", "events = []\n", - "for event in response['response']:\n", + "for event in response:\n", " me = MISPEvent()\n", " me.load(event)\n", " events.append(me)\n", @@ -133,7 +134,7 @@ "response = misp.search(timestamp=ts-36000)\n", "\n", "events = []\n", - "for event in response['response']:\n", + "for event in response:\n", " me = MISPEvent()\n", " me.load(event)\n", " events.append(me)\n", @@ -179,10 +180,10 @@ "metadata": {}, "outputs": [], "source": [ - "response = misp.search(controller='attributes', publish_timestamp='1h')\n", + "response = misp.search(controller='attributes', publish_timestamp='1d')\n", "\n", "attributes = []\n", - "for attribute in response['response']['Attribute']:\n", + "for attribute in response['Attribute']:\n", " ma = MISPAttribute()\n", " ma.from_dict(**attribute)\n", " attributes.append(ma)\n", @@ -197,10 +198,10 @@ "metadata": {}, "outputs": [], "source": [ - "response = misp.search(controller='attributes', publish_timestamp=['2h', '1h'])\n", + "response = misp.search(controller='attributes', publish_timestamp=['2d', '1h'])\n", "\n", "attributes = []\n", - "for attribute in response['response']['Attribute']:\n", + "for attribute in response['Attribute']:\n", " ma = MISPAttribute()\n", " ma.from_dict(**attribute)\n", " attributes.append(ma)\n", @@ -229,7 +230,7 @@ "response = misp.search(controller='attributes', timestamp=ts - 36000)\n", "\n", "attributes = []\n", - "for attribute in response['response']['Attribute']:\n", + "for attribute in response['Attribute']:\n", " ma = MISPAttribute()\n", " ma.from_dict(**attribute)\n", " attributes.append(ma)\n", @@ -256,7 +257,7 @@ "response = misp.search_index(eventinfo='Cobalt Strike')\n", "\n", "events = []\n", - "for event in response['response']:\n", + "for event in response:\n", " me = MISPEvent()\n", " me.from_dict(**event)\n", " events.append(me)\n", @@ -280,10 +281,10 @@ "metadata": {}, "outputs": [], "source": [ - "response = misp.search_index(tag='malware_classification:malware-category=\"Ransomware\"')\n", + "response = misp.search_index(tags='malware_classification:malware-category=\"Ransomware\"')\n", "\n", "events = []\n", - "for event in response['response']:\n", + "for event in response:\n", " me = MISPEvent()\n", " me.from_dict(**event)\n", " events.append(me)\n", @@ -303,7 +304,7 @@ "response = misp.search_index(timestamp='1h')\n", "\n", "events = []\n", - "for event in response['response']:\n", + "for event in response:\n", " me = MISPEvent()\n", " me.from_dict(**event)\n", " events.append(me)\n", @@ -328,8 +329,9 @@ "outputs": [], "source": [ "event = MISPEvent()\n", - "event.load(misp.get(events[0].id))\n", - "print(event.to_json())" + "#event.load(misp.get(events[0].id))\n", + "print (misp.get(events[0].id))\n", + "#print(event.to_json())" ] }, { @@ -345,7 +347,7 @@ "metadata": {}, "outputs": [], "source": [ - "complex_query = misp.build_complex_query(or_parameters=['59.157.4.2', 'hotfixmsupload.com'])\n", + "complex_query = misp.build_complex_query(or_parameters=['59.157.4.2', 'hotfixmsupload.com', '8.8.8.8'])\n", "events = misp.search(value=complex_query, pythonify=True)\n", "\n", "for e in events:\n", @@ -365,7 +367,7 @@ "metadata": {}, "outputs": [], "source": [ - "misp.sighting(value=e.attributes[3].value)" + "misp.sighting(value=e.attributes[1].value)" ] }, { @@ -374,7 +376,7 @@ "metadata": {}, "outputs": [], "source": [ - "misp.sighting_list(e.attributes[3].id)" + "misp.sighting_list(e.attributes[1].id)" ] }, {