mirror of
https://github.com/DISARMFoundation/DISARMframeworks.git
synced 2025-05-13 04:02:26 -04:00
Added EEAS framework objects and STIX generator
Added framework objects: - Added technique T0066 "Degrade adversary" to TA02 - Added technique T0067 "Plan to discredit credible sources" to TA02 - Added technique T0068 "respond to breaking news event" to TA02 - Added technique T0069 "respond to active crisis" to TA02 - Added technique T0070 "Analyze existing communities" to TA02 - Added technique T0071 "Find echo chambers" to TA13 - Added technique T0072 "Segment audiences" to TA13 Added STIX generator from repo DISARM-stix2, and added code to generate github files, databases, and STIX from the same Jupyter notebook.
This commit is contained in:
parent
2117dcf09b
commit
c11e9d06ad
46 changed files with 2428 additions and 17533 deletions
82
CODE/DISARM-STIX2/helpers/file.py
Normal file
82
CODE/DISARM-STIX2/helpers/file.py
Normal file
|
@ -0,0 +1,82 @@
|
|||
import json
|
||||
import os
|
||||
from stix2 import Bundle
|
||||
import shutil
|
||||
|
||||
outdir = '../generated_files/DISARM_STIX/'
|
||||
|
||||
def write_disarm_dir(dir, outdir=outdir):
|
||||
"""
|
||||
|
||||
Args:
|
||||
dir (str): a directory name
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
try:
|
||||
os.mkdir(outdir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.mkdir(outdir + dir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
|
||||
def clean_output_dir(outdir=outdir):
|
||||
"""Recursively delete the output folder.
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
try:
|
||||
os.mkdir(outdir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
|
||||
shutil.rmtree(outdir)
|
||||
|
||||
|
||||
def write_file(file_name, file_data):
|
||||
"""Write a JSON file to outdir
|
||||
|
||||
Args:
|
||||
file_name (str): a file name
|
||||
file_data (str): the file json data
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
with open(file_name, 'w') as f:
|
||||
# f.write(json.dumps(file_data, sort_keys=True, indent=4))
|
||||
f.write(file_data.serialize(pretty=True))
|
||||
f.write('\n')
|
||||
|
||||
|
||||
def write_files(stix_objects, outdir=outdir):
|
||||
"""
|
||||
|
||||
Args:
|
||||
stix_objects:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
for i in stix_objects:
|
||||
write_disarm_dir(i.type)
|
||||
write_file(outdir+f"{i.type}/{i.id}.json", Bundle(i, allow_custom=True))
|
||||
|
||||
|
||||
def write_bundle(bundle, bundle_name, outdir=outdir):
|
||||
"""
|
||||
|
||||
Args:
|
||||
bundle:
|
||||
bundle_name:
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
write_file(outdir+f"{bundle_name}.json", bundle)
|
Loading…
Add table
Add a link
Reference in a new issue