Hello community, here is the log from the commit of package python-pymisp for openSUSE:Factory checked in at 2017-10-10 11:42:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pymisp (Old) and /work/SRC/openSUSE:Factory/.python-pymisp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pymisp" Tue Oct 10 11:42:58 2017 rev:3 rq:532855 version:2.4.81 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pymisp/python-pymisp.changes 2017-09-22 21:34:08.654709104 +0200 +++ /work/SRC/openSUSE:Factory/.python-pymisp.new/python-pymisp.changes 2017-10-10 11:42:59.743448157 +0200 @@ -1,0 +2,48 @@ +Mon Oct 9 17:44:18 UTC 2017 - [email protected] + +- update to version 2.4.81: + - Fix + - Changelog config + update. [Raphaël Vinot] + - Other + - Up: bump version. [Raphaël Vinot] + - Up: Bump misp-objects. [Raphaël Vinot] + +------------------------------------------------------------------- +Wed Oct 4 16:16:57 UTC 2017 - [email protected] + +- update to version 2.4.80.1 + - Changes + - Update changelog. [Raphaël Vinot] + - Fix + - Change readme. [Raphaël Vinot] + - Create file object. [Raphaël Vinot] + Was broken in case the file was neither PE/ELF/Mach-O + - Allow again to tag/delete unsaved attributes. [Raphaël Vinot] + - Live tests. [Raphaël Vinot] + - Import the openioc converter from tool again. [Raphaël Vinot] + - Other + - Up: Version bump. [Raphaël Vinot] + - Up: Bump misp-objects & describeTypes. [Raphaël Vinot] + - Update readme. [Raphaël Vinot] + - Merge pull request #116 from cgi1/patch-2. [Raphaël Vinot] + - Similar to #114 on attribute level. [cgi1] + `add_attribute_tag(tag,attribute_identifier)` fails if attribute does not have any tag in before. + - Merge pull request #115 from cgi1/patch-1. [Raphaël Vinot] + Fixing #114 (MISPEvent.add_tag(tag) fails if inital event does not contain tag ) + - Fixing #114. [cgi1] + - Merge pull request #112 from CenturyLinkCIRT/unknown-object-name- + patch. [Raphaël Vinot] + - Formatted "Unknown MISP object" error message. [infosec-intern] + When a user tries to add an object with a name that doesn't exist, the error thrown was missing its format string + This ended up looking like + pymisp.exceptions.UnknownMISPObjectTemplate: {} is unknown in the MISP object directory. + Here's a patch that adds self.name to the format string + - Merge branch 'master' of github.com:MISP/PyMISP. [Raphaël Vinot] + - Merge pull request #111 from wagner-certat/skip-tests. [Raphaël Vinot] + - TST: skip test with optional files if not existing. [Sebastian Wagner] + - TST: update test requirements. [Sebastian Wagner] + - Update: make make_binary_objects more flexible. [Raphaël Vinot] + - fix: use proper exception handlers +- removed fix-tests-pr-111.patch, merged upstream + +------------------------------------------------------------------- Old: ---- fix-tests-pr-111.patch pymisp-2.4.80.tar.gz New: ---- pymisp-2.4.81.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pymisp.spec ++++++ --- /var/tmp/diff_new_pack.xjTe4x/_old 2017-10-10 11:43:00.627409360 +0200 +++ /var/tmp/diff_new_pack.xjTe4x/_new 2017-10-10 11:43:00.639408834 +0200 @@ -20,15 +20,13 @@ %{!?license: %global license %doc} %bcond_without test Name: python-pymisp -Version: 2.4.80 +Version: 2.4.81 Release: 0 Summary: Python API for MISP License: BSD-2-Clause Group: Development/Languages/Python Url: https://github.com/MISP/PyMISP Source: https://files.pythonhosted.org/packages/source/p/pymisp/pymisp-%{version}.tar.gz -# PATCH-FIX-UPSTREAM fix-tests-pr-111.patch -- skip an optional test depending on third party data -Patch0: https://github.com/MISP/PyMISP/pull/111.patch#/fix-tests-pr-111.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -69,7 +67,6 @@ %prep %setup -q -n pymisp-%{version} -%patch0 -p1 find pymisp examples -name "*.py" -type f -exec sed -i '1s/^#!.*//' '{}' \+ %build ++++++ pymisp-2.4.80.tar.gz -> pymisp-2.4.81.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/.travis.yml new/pymisp-2.4.81/.travis.yml --- old/pymisp-2.4.80/.travis.yml 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/.travis.yml 2017-09-20 12:46:11.000000000 +0200 @@ -20,7 +20,7 @@ - pip install -U nose - pip install coveralls - pip install codecov - - pip install requests-mock pytest + - pip install requests-mock - pip install https://github.com/lief-project/packages/raw/lief-master-latest/pylief-0.7.0.dev.zip - pip install git+https://github.com/kbandla/pydeep.git - pip install python-magic diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/PKG-INFO new/pymisp-2.4.81/PKG-INFO --- old/pymisp-2.4.80/PKG-INFO 2017-09-19 01:04:23.000000000 +0200 +++ new/pymisp-2.4.81/PKG-INFO 2017-10-09 16:16:06.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pymisp -Version: 2.4.80 +Version: 2.4.81 Summary: Python API for MISP. Home-page: https://github.com/MISP/PyMISP Author: Raphaël Vinot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/README.md new/pymisp-2.4.81/README.md --- old/pymisp-2.4.80/README.md 2017-09-18 12:37:14.000000000 +0200 +++ new/pymisp-2.4.81/README.md 2017-09-28 13:20:38.000000000 +0200 @@ -25,7 +25,7 @@ ``` git clone https://github.com/CIRCL/PyMISP.git && cd PyMISP -python3 setup.py install +pip3 install -I . ``` ## Samples and how to use PyMISP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/__init__.py new/pymisp-2.4.81/pymisp/__init__.py --- old/pymisp-2.4.80/pymisp/__init__.py 2017-09-18 12:38:00.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/__init__.py 2017-10-09 16:14:02.000000000 +0200 @@ -1,4 +1,4 @@ -__version__ = '2.4.80' +__version__ = '2.4.81' try: from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate # noqa @@ -8,5 +8,6 @@ from .tools import AbstractMISPObjectGenerator # noqa from .tools import Neo4j # noqa from .tools import stix # noqa + from .tools import openioc # noqa except ImportError: pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/api.py new/pymisp-2.4.81/pymisp/api.py --- old/pymisp-2.4.80/pymisp/api.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/api.py 2017-09-19 15:43:03.000000000 +0200 @@ -170,6 +170,7 @@ # ##################### def flatten_error_messages(self, response): + """Dirty dirty method to normalize the error messages between the API calls""" messages = [] if response.get('error'): if isinstance(response['error'], list): @@ -204,6 +205,7 @@ return messages def _check_response(self, response): + """Check if the response from the server is not an unexpected error""" if response.status_code >= 500: response.raise_for_status() try: @@ -243,6 +245,7 @@ return value if isinstance(value, (tuple, list)) else (value,) def _make_mispevent(self, event): + """Transform a Json MISP event into a MISPEvent""" if not isinstance(event, MISPEvent): e = MISPEvent(self.describe_types) e.load(event) @@ -251,6 +254,7 @@ return e def _prepare_full_event(self, distribution, threat_level_id, analysis, info, date=None, published=False, orgc_id=None, org_id=None, sharing_group_id=None): + """Initialize a new MISPEvent from scratch""" misp_event = MISPEvent(self.describe_types) misp_event.set_all_values(info=info, distribution=distribution, threat_level_id=threat_level_id, analysis=analysis, date=date, orgc_id=orgc_id, org_id=org_id, sharing_group_id=sharing_group_id) @@ -259,6 +263,7 @@ return misp_event def _prepare_full_attribute(self, category, type_value, value, to_ids, comment=None, distribution=5, **kwargs): + """Initialize a new MISPAttribute from scratch""" misp_attribute = MISPAttribute(self.describe_types) misp_attribute.set_all_values(type=type_value, value=value, category=category, to_ids=to_ids, comment=comment, distribution=distribution, **kwargs) @@ -353,12 +358,14 @@ return self._check_response(response) def delete_attribute(self, attribute_id): + """Delete an attribute by ID""" session = self.__prepare_session() url = urljoin(self.root_url, 'attributes/{}'.format(attribute_id)) response = session.delete(url) return self._check_response(response) def pushEventToZMQ(self, event_id): + """Force push an event on ZMQ""" session = self.__prepare_session() url = urljoin(self.root_url, 'events/pushEventToZMQ/{}.json'.format(event_id)) response = session.post(url) @@ -369,9 +376,11 @@ # ############################################## def get(self, eid): + """Get an event by event ID""" return self.get_event(eid) def update(self, event): + """Update an event by ID""" e = self._make_mispevent(event) if e.uuid: eid = e.uuid @@ -401,21 +410,25 @@ return self._check_response(response) def change_threat_level(self, event, threat_level_id): + """Change the threat level of an event""" e = self._make_mispevent(event) e.threat_level_id = threat_level_id return self.update(e) def change_sharing_group(self, event, sharing_group_id): + """Change the sharing group of an event""" e = self._make_mispevent(event) e.distribution = 4 # Needs to be 'Sharing group' e.sharing_group_id = sharing_group_id return self.update(e) def new_event(self, distribution=None, threat_level_id=None, analysis=None, info=None, date=None, published=False, orgc_id=None, org_id=None, sharing_group_id=None): + """Create and add a new event""" misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published, orgc_id, org_id, sharing_group_id) return self.add_event(misp_event) def tag(self, uuid, tag): + """Tag an event or an attribute""" if not self._valid_uuid(uuid): raise PyMISPError('Invalid UUID') session = self.__prepare_session() @@ -425,6 +438,7 @@ return self._check_response(response) def untag(self, uuid, tag): + """Untag an event or an attribute""" if not self._valid_uuid(uuid): raise PyMISPError('Invalid UUID') session = self.__prepare_session() @@ -1542,86 +1556,93 @@ # ########################### def fetch_feed(self, feed_id): + """Fetch one single feed""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/fetchFromFeed/{}'.format(feed_id)) response = session.get(url) return self._check_response(response) def view_feeds(self): + """Get the content of all the feeds""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds') response = session.get(url) return self._check_response(response) def view_feed(self, feed_ids): + """Get the content of a single feed""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/view/{}'.format(feed_ids)) response = session.get(url) return self._check_response(response) def cache_feeds_all(self): + """ Cache all the feeds""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/cacheFeeds/all') response = session.get(url) return self._check_response(response) def cache_feed(self, feed_id): + """Cache a specific feed""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/cacheFeeds/{}'.format(feed_id)) response = session.get(url) return self._check_response(response) def cache_feeds_freetext(self): + """Cache all the freetext feeds""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/cacheFeeds/freetext') response = session.get(url) return self._check_response(response) def cache_feeds_misp(self): + """Cache all the MISP feeds""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/cacheFeeds/misp') response = session.get(url) return self._check_response(response) def compare_feeds(self): + """Generate the comparison matrix for all the MISP feeds""" session = self.__prepare_session() url = urljoin(self.root_url, 'feeds/compareFeeds') response = session.get(url) return self._check_response(response) - # ########################### - # ### Cache All Feeds ### - # ########################### - def cache_all_feeds(self): - session = self.__prepare_session() - url = urljoin(self.root_url, 'feeds/cacheFeeds/all') - response = session.post(url) - return self._check_response(response) + """Alias for cache_feeds_all""" + # DEPRECATED + return self.cache_feeds_all() # ################### # ### Objects ### # ################### def add_object(self, event_id, template_id, misp_object): + """Add an object""" session = self.__prepare_session() url = urljoin(self.root_url, 'objects/add/{}/{}'.format(event_id, template_id)) response = session.post(url, data=misp_object.to_json()) return self._check_response(response) def add_object_reference(self, misp_object_reference): + """Add a reference to an object""" session = self.__prepare_session() url = urljoin(self.root_url, 'object_references/add') response = session.post(url, data=misp_object_reference.to_json()) return self._check_response(response) def get_object_templates_list(self): + """Returns the list of Object templates available on the MISP instance""" session = self.__prepare_session() url = urljoin(self.root_url, 'objectTemplates') response = session.get(url) return self._check_response(response)['response'] def get_object_template_id(self, object_uuid): + """Gets the template ID corresponting the UUID passed as parameter""" templates = self.get_object_templates_list() for t in templates: if t['ObjectTemplate']['uuid'] == object_uuid: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/data/describeTypes.json new/pymisp-2.4.81/pymisp/data/describeTypes.json --- old/pymisp-2.4.80/pymisp/data/describeTypes.json 2017-07-21 10:12:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/data/describeTypes.json 2017-10-04 10:02:48.000000000 +0200 @@ -225,6 +225,10 @@ "default_category": "Financial fraud", "to_ids": 1 }, + "phone-number": { + "default_category": "Person", + "to_ids": 0 + }, "threat-actor": { "default_category": "Attribution", "to_ids": 0 @@ -615,6 +619,7 @@ "bin", "cc-number", "prtn", + "phone-number", "threat-actor", "campaign-name", "campaign-id", @@ -811,7 +816,8 @@ "email-mime-boundary", "email-thread-index", "email-message-id", - "mobile-application-id" + "mobile-application-id", + "whois-registrant-email" ], "Artifacts dropped": [ "md5", @@ -922,6 +928,7 @@ "ip-dst", "ip-dst|port", "ip-src|port", + "port", "hostname", "domain", "domain|ip", @@ -1005,6 +1012,7 @@ "bin", "cc-number", "prtn", + "phone-number", "comment", "text", "other", @@ -1029,7 +1037,8 @@ "email-dst", "comment", "text", - "other" + "other", + "whois-registrant-email" ], "Person": [ "first-name", @@ -1057,7 +1066,8 @@ "passenger-name-record-locator-number", "comment", "text", - "other" + "other", + "phone-number" ], "Other": [ "comment", @@ -1069,7 +1079,8 @@ "cpe", "port", "float", - "hex" + "hex", + "phone-number" ] } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/mispevent.py new/pymisp-2.4.81/pymisp/mispevent.py --- old/pymisp-2.4.80/pymisp/mispevent.py 2017-09-18 16:37:11.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/mispevent.py 2017-09-26 11:51:48.000000000 +0200 @@ -76,6 +76,7 @@ self._types = describe_types['types'] self.__category_type_mapping = describe_types['category_type_mappings'] self.__sane_default = describe_types['sane_defaults'] + self.Tag = [] def _reinitialize_attribute(self): # Default values @@ -279,6 +280,7 @@ self._types = describe_types['types'] self.attributes = [] + self.Tag = [] def _reinitialize_event(self): # Default values for a valid event to send to a MISP instance @@ -512,15 +514,17 @@ self.Tag.append({'name': tag}) def add_attribute_tag(self, tag, attribute_identifier): - attribute = None + attributes = [] for a in self.attributes: - if (a.id == attribute_identifier or a.uuid == attribute_identifier or - attribute_identifier == a.value or attribute_identifier in a.value.split('|')): + if ((hasattr(a, 'id') and a.id == attribute_identifier) or + (hasattr(a, 'uuid') and a.uuid == attribute_identifier) or + (hasattr(a, 'value') and attribute_identifier == a.value or + attribute_identifier in a.value.split('|'))): a.add_tag(tag) - attribute = a - if not attribute: + attributes.append(a) + if not attributes: raise Exception('No attribute with identifier {} found.'.format(attribute_identifier)) - return attribute + return attributes def publish(self): self.published = True @@ -531,7 +535,8 @@ def delete_attribute(self, attribute_id): found = False for a in self.attributes: - if a.id == attribute_id or a.uuid == attribute_id: + if ((hasattr(a, 'id') and a.id == attribute_id) or + (hasattr(a, 'uuid') and a.uuid == attribute_id)): a.delete() found = True break @@ -604,7 +609,7 @@ self.__known_template = True else: if self.__strict: - raise UnknownMISPObjectTemplate('{} is unknown in the MISP object directory.') + raise UnknownMISPObjectTemplate('{} is unknown in the MISP object directory.'.format(self.name)) else: self.__known_template = False if self.__known_template: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/tools/create_misp_object.py new/pymisp-2.4.81/pymisp/tools/create_misp_object.py --- old/pymisp-2.4.80/pymisp/tools/create_misp_object.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/tools/create_misp_object.py 2017-09-27 16:02:48.000000000 +0200 @@ -45,9 +45,9 @@ return misp_file, macho_object, macho_sections -def make_binary_objects(filepath): - misp_file = FileObject(filepath) - if HAS_LIEF: +def make_binary_objects(filepath=None, pseudofile=None, filename=None): + misp_file = FileObject(filepath=filepath, pseudofile=pseudofile, filename=filename) + if HAS_LIEF and filepath: try: lief_parsed = lief.parse(filepath) if isinstance(lief_parsed, lief.PE.Binary): @@ -57,13 +57,15 @@ elif isinstance(lief_parsed, lief.MachO.Binary): return make_macho_objects(lief_parsed, misp_file) except lief.bad_format as e: - warnings.warn('\tBad format: ', e) + warnings.warn('\tBad format: {}'.format(e)) except lief.bad_file as e: - warnings.warn('\tBad file: ', e) + warnings.warn('\tBad file: {}'.format(e)) except lief.parser_error as e: - warnings.warn('\tParser error: ', e) + warnings.warn('\tParser error: {}'.format(e)) except FileTypeNotImplemented as e: # noqa warnings.warn(e) - else: + if not HAS_LIEF: warnings.warn('Please install lief, documentation here: https://github.com/lief-project/LIEF') + if not filepath: + warnings.warn('LIEF currently requires a filepath and not a pseudo file') return misp_file, None, None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/tools/elfobject.py new/pymisp-2.4.81/pymisp/tools/elfobject.py --- old/pymisp-2.4.80/pymisp/tools/elfobject.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/tools/elfobject.py 2017-09-20 12:34:19.000000000 +0200 @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- from .abstractgenerator import AbstractMISPObjectGenerator +from ..exceptions import InvalidMISPObject from io import BytesIO from hashlib import md5, sha1, sha256, sha512 import warnings @@ -33,7 +34,7 @@ elif isinstance(pseudofile, bytes): self.__elf = lief.ELF.parse(raw=pseudofile) else: - raise Exception('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) + raise InvalidMISPObject('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) elif filepath: self.__elf = lief.ELF.parse(filepath) elif parsed: @@ -41,7 +42,7 @@ if isinstance(parsed, lief.ELF.Binary): self.__elf = parsed else: - raise Exception('Not a lief.ELF.Binary: {}'.format(type(parsed))) + raise InvalidMISPObject('Not a lief.ELF.Binary: {}'.format(type(parsed))) super(ELFObject, self).__init__('elf') self.generate_attributes() # Mark as non_jsonable because we need to add them manually diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/tools/fileobject.py new/pymisp-2.4.81/pymisp/tools/fileobject.py --- old/pymisp-2.4.80/pymisp/tools/fileobject.py 2017-09-18 16:27:28.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/tools/fileobject.py 2017-09-20 12:32:00.000000000 +0200 @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +from ..exceptions import InvalidMISPObject from .abstractgenerator import AbstractMISPObjectGenerator import os from io import BytesIO @@ -29,18 +30,22 @@ warnings.warn("Please install pydeep: pip install git+https://github.com/kbandla/pydeep.git") if not HAS_MAGIC: warnings.warn("Please install python-magic: pip install python-magic.") + if filename: + # Useful in case the file is copied with a pre-defined name by a script but we want to keep the original name + self.__filename = filename + elif filepath: + self.__filename = os.path.basename(filepath) + else: + raise InvalidMISPObject('A file name is required (either in the path, or as a parameter).') + if filepath: - self.filepath = filepath - self.filename = os.path.basename(self.filepath) with open(filepath, 'rb') as f: self.__pseudofile = BytesIO(f.read()) elif pseudofile and isinstance(pseudofile, BytesIO): # WARNING: lief.parse requires a path - self.filepath = None self.__pseudofile = pseudofile - self.filename = filename else: - raise Exception('File buffer (BytesIO) or a path is required.') + raise InvalidMISPObject('File buffer (BytesIO) or a path is required.') # PY3 way: # super().__init__('file') super(FileObject, self).__init__('file') @@ -50,7 +55,7 @@ self.update_not_jsonable('ObjectReference') def generate_attributes(self): - self.add_attribute('filename', value=self.filename) + self.add_attribute('filename', value=self.__filename) size = self.add_attribute('size-in-bytes', value=len(self.__data)) if int(size.value) > 0: self.add_attribute('entropy', value=self.__entropy_H(self.__data)) @@ -58,7 +63,7 @@ self.add_attribute('sha1', value=sha1(self.__data).hexdigest()) self.add_attribute('sha256', value=sha256(self.__data).hexdigest()) self.add_attribute('sha512', value=sha512(self.__data).hexdigest()) - self.add_attribute('malware-sample', value=self.filename, data=self.__pseudofile) + self.add_attribute('malware-sample', value=self.__filename, data=self.__pseudofile) if HAS_MAGIC: self.add_attribute('mimetype', value=magic.from_buffer(self.__data)) if HAS_PYDEEP: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/tools/machoobject.py new/pymisp-2.4.81/pymisp/tools/machoobject.py --- old/pymisp-2.4.80/pymisp/tools/machoobject.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/tools/machoobject.py 2017-09-20 12:32:47.000000000 +0200 @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +from ..exceptions import InvalidMISPObject from .abstractgenerator import AbstractMISPObjectGenerator from io import BytesIO from hashlib import md5, sha1, sha256, sha512 @@ -33,7 +34,7 @@ elif isinstance(pseudofile, bytes): self.__macho = lief.MachO.parse(raw=pseudofile) else: - raise Exception('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) + raise InvalidMISPObject('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) elif filepath: self.__macho = lief.MachO.parse(filepath) elif parsed: @@ -41,7 +42,7 @@ if isinstance(parsed, lief.MachO.Binary): self.__macho = parsed else: - raise Exception('Not a lief.MachO.Binary: {}'.format(type(parsed))) + raise InvalidMISPObject('Not a lief.MachO.Binary: {}'.format(type(parsed))) # Python3 way # super().__init__('elf') super(MachOObject, self).__init__('macho') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp/tools/peobject.py new/pymisp-2.4.81/pymisp/tools/peobject.py --- old/pymisp-2.4.80/pymisp/tools/peobject.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/pymisp/tools/peobject.py 2017-09-20 12:33:09.000000000 +0200 @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +from ..exceptions import InvalidMISPObject from .abstractgenerator import AbstractMISPObjectGenerator from io import BytesIO from hashlib import md5, sha1, sha256, sha512 @@ -34,7 +35,7 @@ elif isinstance(pseudofile, bytes): self.__pe = lief.PE.parse(raw=pseudofile) else: - raise Exception('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) + raise InvalidMISPObject('Pseudo file can be BytesIO or bytes got {}'.format(type(pseudofile))) elif filepath: self.__pe = lief.PE.parse(filepath) elif parsed: @@ -42,7 +43,7 @@ if isinstance(parsed, lief.PE.Binary): self.__pe = parsed else: - raise Exception('Not a lief.PE.Binary: {}'.format(type(parsed))) + raise InvalidMISPObject('Not a lief.PE.Binary: {}'.format(type(parsed))) # Python3 way # super().__init__('pe') super(PEObject, self).__init__('pe') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/pymisp.egg-info/PKG-INFO new/pymisp-2.4.81/pymisp.egg-info/PKG-INFO --- old/pymisp-2.4.80/pymisp.egg-info/PKG-INFO 2017-09-19 01:04:23.000000000 +0200 +++ new/pymisp-2.4.81/pymisp.egg-info/PKG-INFO 2017-10-09 16:16:06.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pymisp -Version: 2.4.80 +Version: 2.4.81 Summary: Python API for MISP. Home-page: https://github.com/MISP/PyMISP Author: Raphaël Vinot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/setup.py new/pymisp-2.4.81/setup.py --- old/pymisp-2.4.80/setup.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/setup.py 2017-09-20 12:46:11.000000000 +0200 @@ -26,8 +26,15 @@ 'Topic :: Security', 'Topic :: Internet', ], - test_suite="tests", + test_suite="tests.test_offline", install_requires=['six', 'requests', 'python-dateutil', 'jsonschema'], + tests_require=[ + 'jsonschema', + 'python-dateutil', + 'python-magic', + 'requests-mock', + 'six' + ], include_package_data=True, package_data={'pymisp': ['data/*.json', 'data/misp-objects/schema_objects.json', 'data/misp-objects/schema_relationships.json', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/tests/test.py new/pymisp-2.4.81/tests/test.py --- old/pymisp-2.4.80/tests/test.py 2017-07-20 10:21:57.000000000 +0200 +++ new/pymisp-2.4.81/tests/test.py 2017-09-26 11:41:35.000000000 +0200 @@ -11,7 +11,7 @@ def setUp(self): self.maxDiff = None - self.misp = PyMISP(url, key, True, 'json', True) + self.misp = PyMISP(url, key, True, 'json') def _clean_event(self, event): event['Event'].pop('orgc_id', None) @@ -43,7 +43,7 @@ u'attribute_count': u'0', 'disable_correlation': False, u'analysis': u'0', u'ShadowAttribute': [], u'published': False, u'distribution': u'0', u'event_creator_email': u'[email protected]', u'Attribute': [], u'proposal_email_lock': False, - u'Org': {u'name': u'ORGNAME'}, + u'Object': [], u'Org': {u'name': u'ORGNAME'}, u'Orgc': {u'name': u'ORGNAME'}, u'Galaxy': [], u'threat_level_id': u'1'}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pymisp-2.4.80/tests/test_offline.py new/pymisp-2.4.81/tests/test_offline.py --- old/pymisp-2.4.80/tests/test_offline.py 2017-09-18 12:37:18.000000000 +0200 +++ new/pymisp-2.4.81/tests/test_offline.py 2017-09-20 12:46:11.000000000 +0200 @@ -233,9 +233,12 @@ def test_objects(self, m): paths = ['cmd.exe', 'tmux', 'MachO-OSX-x64-ls'] - for path in paths: - json_blob = self.make_objects(os.path.join('tests', - 'viper-test-files', 'test_files', path)) + try: + for path in paths: + json_blob = self.make_objects(os.path.join('tests', + 'viper-test-files', 'test_files', path)) + except IOError: # Can be replaced with FileNotFoundError when support for python 2 is dropped + return unittest.SkipTest() print(json_blob) if __name__ == '__main__':
