From e8e13f3218804ff1016785db830111913f182a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 22 Dec 2017 17:22:07 +0100 Subject: [PATCH] chg: Update documentation --- docs/source/conf.py | 4 --- docs/source/index.rst | 6 ++-- docs/source/modules.rst | 80 ++++++++++++++++++++++++++++++++++++++++- docs/source/pymisp.rst | 22 ------------ docs/source/tools.rst | 69 +++++++++++++++++++++++++++++++++++ pymisp/__init__.py | 2 +- pymisp/api.py | 5 +-- pymisp/tools/openioc.py | 14 -------- 8 files changed, 152 insertions(+), 50 deletions(-) delete mode 100644 docs/source/pymisp.rst create mode 100644 docs/source/tools.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index bdaadc8..78715f6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,10 +17,6 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -import os -import sys -sys.path.insert(0, os.path.abspath('.')) - from recommonmark.parser import CommonMarkParser # -- General configuration ------------------------------------------------ diff --git a/docs/source/index.rst b/docs/source/index.rst index 68863a5..f519501 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -9,12 +9,11 @@ Welcome to PyMISP's documentation! Contents: .. toctree:: - :maxdepth: 2 + :maxdepth: 4 README modules - - + tools Indices and tables ================== @@ -22,4 +21,3 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` - diff --git a/docs/source/modules.rst b/docs/source/modules.rst index 1bb98dd..7db7414 100644 --- a/docs/source/modules.rst +++ b/docs/source/modules.rst @@ -4,4 +4,82 @@ pymisp .. toctree:: :maxdepth: 4 - pymisp +.. automodule:: pymisp + :members: + + +PyMISP +------ + +.. autoclass:: PyMISP + :members: + +MISPAbstract +------------ + +.. autoclass:: AbstractMISP + :members: + +MISPEncode +---------- + +.. autoclass:: MISPEncode + :members: + +MISPEvent +--------- + +.. autoclass:: MISPEvent + :members: + :inherited-members: + +MISPAttribute +------------- + +.. autoclass:: MISPAttribute + :members: + :inherited-members: + +MISPObject +---------- + +.. autoclass:: MISPObject + :members: + :inherited-members: + +MISPObjectAttribute +------------------- + +.. autoclass:: MISPObjectAttribute + :members: + :inherited-members: + +MISPObjectReference +------------------- + +.. autoclass:: MISPObjectReference + :members: + :inherited-members: + +MISPTag +------- + +.. autoclass:: MISPTag + :members: + :inherited-members: + +MISPUser +-------- + +.. autoclass:: MISPUser + :members: + :inherited-members: + + +MISPOrganisation +---------------- + +.. autoclass:: MISPOrganisation + :members: + :inherited-members: + diff --git a/docs/source/pymisp.rst b/docs/source/pymisp.rst deleted file mode 100644 index 28ca0d9..0000000 --- a/docs/source/pymisp.rst +++ /dev/null @@ -1,22 +0,0 @@ -pymisp package -============== - -Submodules ----------- - -pymisp.api module ------------------ - -.. automodule:: pymisp.api - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: pymisp - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/tools.rst b/docs/source/tools.rst new file mode 100644 index 0000000..36e1e8f --- /dev/null +++ b/docs/source/tools.rst @@ -0,0 +1,69 @@ +pymisp - Tools +============== + +.. toctree:: + :maxdepth: 4 + +.. automodule:: pymisp.tools + :members: + +File Object +----------- + +.. autoclass:: FileObject + :members: + :inherited-members: + +ELF Object +---------- + +.. autoclass:: ELFObject + :members: + :inherited-members: + +.. autoclass:: ELFSectionObject + :members: + :inherited-members: + +PE Object +--------- + +.. autoclass:: PEObject + :members: + :inherited-members: + +.. autoclass:: PESectionObject + :members: + :inherited-members: + +Mach-O Object +------------- + +.. autoclass:: MachOObject + :members: + :inherited-members: + +.. autoclass:: MachOSectionObject + :members: + :inherited-members: + +VT Report Object +---------------- + +.. autoclass:: VTReportObject + :members: + :inherited-members: + +STIX +---- + +.. automodule:: pymisp.tools.stix + :members: + +OpenIOC +-------- + +.. automethod:: pymisp.tools.load_openioc + +.. automethod:: pymisp.tools.load_openioc_file + diff --git a/pymisp/__init__.py b/pymisp/__init__.py index e9ad297..5624525 100644 --- a/pymisp/__init__.py +++ b/pymisp/__init__.py @@ -30,7 +30,7 @@ try: from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate # noqa from .api import PyMISP # noqa from .abstract import AbstractMISP, MISPEncode # noqa - from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject # noqa + from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject, MISPTag, MISPUser, MISPOrganisation # noqa from .tools import AbstractMISPObjectGenerator # noqa from .tools import Neo4j # noqa from .tools import stix # noqa diff --git a/pymisp/api.py b/pymisp/api.py index 1d25d38..b885b16 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -49,10 +49,7 @@ class PyMISP(object): :param url: URL of the MISP instance you want to connect to :param key: API key of the user you want to use - :param ssl: can be True or False (to check ot not the validity - of the certificate. Or a CA_BUNDLE in case of self - signed certiifcate (the concatenation of all the - *.crt of the chain) + :param ssl: can be True or False (to check ot not the validity of the certificate. Or a CA_BUNDLE in case of self signed certiifcate (the concatenation of all the \*.crt of the chain) :param out_type: Type of object (json) NOTE: XML output isn't supported anymore, keeping the flag for compatibility reasons. :param debug: Write all the debug information to stderr :param proxies: Proxy dict as describes here: http://docs.python-requests.org/en/master/user/advanced/#proxies diff --git a/pymisp/tools/openioc.py b/pymisp/tools/openioc.py index ea0c880..1c2329a 100755 --- a/pymisp/tools/openioc.py +++ b/pymisp/tools/openioc.py @@ -278,17 +278,3 @@ def set_all_attributes(openioc, misp_event): misp_event.add_attribute(**attribute_values) return misp_event - - -if __name__ == '__main__': - import requests - # test file for composite - url = 'https://raw.githubusercontent.com/fireeye/iocs/master/BlogPosts/9cee306d-5441-4cd3-932d-f3119752634c.ioc' - # ~ url = 'https://raw.githubusercontent.com/MISP/misp-modules/master/tests/openioc.xml' - x = requests.get(url) - mispEvent = load_openioc(x.text) - print(mispEvent) - # ~ from pymisp import PyMISP - # ~ misp = PyMISP('http://misp.local', 'xxxxx') - # ~ r = misp.add_event(mispEvent) - # ~ print(r)