-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: Method to get the new version of the templates
- Loading branch information
Showing
4 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule misp-objects
updated
5 files
+1 −0 | README.md | |
+41 −0 | objects/bgp-ranking/definition.json | |
+81 −0 | objects/github-user/definition.json | |
+2 −2 | objects/twitter-account/definition.json | |
+21 −0 | relationships/definition.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |