mirror of https://github.com/MISP/PyMISP
chg: Make mail-parser an optional dependency
parent
9ef5a340c8
commit
9fed66eb2b
|
@ -271,7 +271,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
|||
|
||||
[[package]]
|
||||
name = "importlib-metadata"
|
||||
version = "3.0.0"
|
||||
version = "3.1.0"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -282,14 +282,14 @@ zipp = ">=0.5"
|
|||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "rst.linker"]
|
||||
testing = ["packaging", "pep517", "importlib-resources (>=1.3)"]
|
||||
testing = ["packaging", "pep517", "unittest2", "importlib-resources (>=1.3)"]
|
||||
|
||||
[[package]]
|
||||
name = "ipaddress"
|
||||
version = "1.0.23"
|
||||
description = "IPv4/IPv6 manipulation library"
|
||||
category = "main"
|
||||
optional = false
|
||||
optional = true
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
|
@ -497,7 +497,7 @@ name = "mail-parser"
|
|||
version = "3.12.0"
|
||||
description = "Wrapper for email standard library"
|
||||
category = "main"
|
||||
optional = false
|
||||
optional = true
|
||||
python-versions = "*"
|
||||
|
||||
[package.dependencies]
|
||||
|
@ -951,7 +951,7 @@ name = "simplejson"
|
|||
version = "3.17.0"
|
||||
description = "Simple, fast, extensible JSON encoder/decoder for Python"
|
||||
category = "main"
|
||||
optional = false
|
||||
optional = true
|
||||
python-versions = ">=2.5, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
|
@ -1225,6 +1225,7 @@ testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake
|
|||
|
||||
[extras]
|
||||
docs = ["sphinx-autodoc-typehints", "recommonmark"]
|
||||
email = ["mail-parser"]
|
||||
fileobjects = ["python-magic", "pydeep", "lief"]
|
||||
openioc = ["beautifulsoup4"]
|
||||
pdfexport = ["reportlab"]
|
||||
|
@ -1234,7 +1235,7 @@ virustotal = ["validators"]
|
|||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.6"
|
||||
content-hash = "23aa8f0499f0012761ac2f91c02c2ad02a3a4fb53dd57bdcdca5db2b32b54634"
|
||||
content-hash = "dc046a32aca97b89566cce465977e52a94176d6155798bf19bc719938ba67e76"
|
||||
|
||||
[metadata.files]
|
||||
alabaster = [
|
||||
|
@ -1422,8 +1423,8 @@ imagesize = [
|
|||
{file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"},
|
||||
]
|
||||
importlib-metadata = [
|
||||
{file = "importlib_metadata-3.0.0-py2.py3-none-any.whl", hash = "sha256:fc3b3f9697703d3833d2803162d60cbe8b9f57b5da5e6496ac81e3cb82bd8d9c"},
|
||||
{file = "importlib_metadata-3.0.0.tar.gz", hash = "sha256:d582eb5c35b2f16c78e365e0f89e369f36af38fdaad0146208aa973c693ba247"},
|
||||
{file = "importlib_metadata-3.1.0-py2.py3-none-any.whl", hash = "sha256:590690d61efdd716ff82c39ca9a9d4209252adfe288a4b5721181050acbd4175"},
|
||||
{file = "importlib_metadata-3.1.0.tar.gz", hash = "sha256:d9b8a46a0885337627a6430db287176970fff18ad421becec1d64cfc763c2099"},
|
||||
]
|
||||
ipaddress = [
|
||||
{file = "ipaddress-1.0.23-py2.py3-none-any.whl", hash = "sha256:6e0f4a39e66cb5bb9a137b00276a2eff74f93b71dcbdad6f10ff7df9d3557fcc"},
|
||||
|
|
|
@ -7,8 +7,11 @@ from typing import Union, List, Tuple
|
|||
import email.utils
|
||||
import ipaddress
|
||||
import logging
|
||||
try:
|
||||
import mailparser # type: ignore
|
||||
from mailparser.utils import msgconvert # type: ignore
|
||||
except ImportError:
|
||||
mailparser = None
|
||||
from ..exceptions import InvalidMISPObject
|
||||
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||
|
||||
|
@ -25,6 +28,10 @@ class MISPMailObjectOutlookException(InvalidMISPObject):
|
|||
pass
|
||||
|
||||
|
||||
if not mailparser:
|
||||
raise MISPMailObjectOutlookException('mail-parser is required to use this module, you can install it by running pip3 install pymisp[email]')
|
||||
|
||||
|
||||
class EMailObject(AbstractMISPObjectGenerator):
|
||||
def __init__(self, filepath: Union[Path, str] = None, pseudofile: BytesIO = None,
|
||||
attach_original_email: bool = True, **kwargs):
|
||||
|
|
|
@ -46,7 +46,7 @@ requests = "^2.22.0"
|
|||
python-dateutil = "^2.8.1"
|
||||
jsonschema = "^3.2.0"
|
||||
deprecated = "^1.2.7"
|
||||
mail-parser = {version = "3.12.0"}
|
||||
mail-parser = {version = "^3.12.0", optional = true}
|
||||
python-magic = {version = "^0.4.15", optional = true}
|
||||
pydeep = {version = "^0.4", optional = true}
|
||||
lief = {version = "^0.10.1", optional = true}
|
||||
|
@ -64,6 +64,7 @@ virustotal = ['validators']
|
|||
docs = ['sphinx-autodoc-typehints', 'recommonmark']
|
||||
pdfexport = ['reportlab']
|
||||
url = ['pyfaup']
|
||||
email = ['mail-parser']
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
nose = "^1.3.7"
|
||||
|
|
Loading…
Reference in New Issue