mirror of https://github.com/MISP/PyMISP
new: Method to get the new version of the templates
parent
e3815a41f1
commit
9c48079d88
|
@ -30,6 +30,7 @@ try:
|
|||
from .tools import stix # noqa
|
||||
from .tools import openioc # noqa
|
||||
from .tools import ext_lookups # noqa
|
||||
from .tools import update_objects # noqa
|
||||
|
||||
from .api import PyMISP, register_user # noqa
|
||||
from .api import PyMISP as ExpandedPyMISP # noqa
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6c98bf536f6ffa8f9ad3fb1dfc852c4235f93e4e
|
||||
Subproject commit 054899d28bbdafc0d316f980e31292da34a833ee
|
|
@ -17,6 +17,7 @@ from .vehicleobject import VehicleObject # noqa
|
|||
from .csvloader import CSVLoader # noqa
|
||||
from .sshauthkeyobject import SSHAuthorizedKeysObject # noqa
|
||||
from .feed import feed_meta_generator # noqa
|
||||
from .update_objects import update_objects # noqa
|
||||
try:
|
||||
from .urlobject import URLObject # noqa
|
||||
except ImportError:
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
from ..abstract import resources_path
|
||||
|
||||
static_repo = "https://github.com/MISP/misp-objects/archive/main.zip"
|
||||
|
||||
|
||||
def update_objects():
|
||||
r = requests.get(static_repo)
|
||||
|
||||
zipped_repo = BytesIO(r.content)
|
||||
|
||||
with zipfile.ZipFile(zipped_repo, 'r') as myzip:
|
||||
for name in myzip.namelist():
|
||||
if not name.endswith('.json'):
|
||||
continue
|
||||
name_on_disk = name.replace('misp-objects-main', 'misp-objects')
|
||||
path = resources_path / Path(name_on_disk)
|
||||
if not path.parent.exists():
|
||||
path.parent.mkdir(parents=True)
|
||||
with path.open('wb') as f:
|
||||
f.write(myzip.read(name))
|
Loading…
Reference in New Issue