Merge branch 'master' of https://github.com/MISP/PyMISP into messageidtype

pull/119/head
c-goes 2017-10-16 13:38:54 +02:00
commit 4bc3ec91bf
5 changed files with 39 additions and 3 deletions

View File

@ -2,6 +2,19 @@ Changelog
=========
v2.4.81 (2017-10-09)
--------------------
Fix
~~~
- Changelog config + update. [Raphaël Vinot]
Other
~~~~~
- Up: bump version. [Raphaël Vinot]
- Up: Bump misp-objects. [Raphaël Vinot]
v2.4.80.1 (2017-10-04)
----------------------

View File

@ -59,3 +59,26 @@ Documentation can be generated with epydoc:
```
epydoc --url https://github.com/CIRCL/PyMISP --graph all --name PyMISP --pdf pymisp -o doc
```
## Everything is a Mutable Mapping
... or at least everything that can be imported/exported from/to a json blob
`AbstractMISP` is the master class, and inherit `collections.MutableMapping` which means
the class can be represented as a python dictionary.
The abstraction assumes every property that should not be seen in the dictionary is prepended with a `_`,
or its name is added to the private list `__not_jsonable` (accessible through `update_not_jsonable` and `set_not_jsonable`.
This master class has helpers that will make it easy to load, and export, to, and from, a json string.
`MISPEvent`, `MISPAttribute`, `MISPObjectReference`, `MISPObjectAttribute`, and `MISPObject`
are subclasses of AbstractMISP, which mean that they can be handled as python dictionaries.
## MISP Objects
Creating a new MISP object generator should be done using a pre-defined template and inherit `AbstractMISPObjectGenerator`.
Your new MISPObject generator need to generate attributes, and add them as class properties using `add_attribute`.
When the object is sent to MISP, all the class properties will be exported to the JSON export.

View File

@ -1,4 +1,4 @@
__version__ = '2.4.80.1'
__version__ = '2.4.81'
try:
from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate # noqa

View File

@ -535,7 +535,7 @@ class PyMISP(object):
encodedData = base64.b64encode(fileData).decode("utf-8")
# Send it on its way
return self.add_named_attribute(event, 'attachment', filename, category, to_ids, comment, distribution, proposal, data=encodedData)
return self.add_named_attribute(event, 'attachment', filename, category, to_ids, comment, distribution, proposal, data=encodedData, **kwargs)
def add_regkey(self, event, regkey, rvalue=None, category='Artifacts dropped', to_ids=True, comment=None, distribution=None, proposal=False, **kwargs):
if rvalue:

@ -1 +1 @@
Subproject commit 028bb2e0c168ff57a9c68e405dedb3a377d4e3ae
Subproject commit bc5795dc189bcf9cd001527656fe10e6ed10dc5f