Пример #1
0
def create_markdown_dirs():
    config = DATAutils.load_config('config.yml')
    base_dir = Path(
        config.get('md_name_of_root_directory', '../Atomic_Threat_Coverage'))

    target_dir_list = ['Logging_Policies', 'Data_Needed', 'Enrichments']

    for item in target_dir_list:
        (base_dir / item).mkdir(parents=True, exist_ok=True)
Пример #2
0
    from scripts.datautils import DATAutils
    from scripts.attack_mapping import te_mapping, ta_mapping
except:
    from data.atc_data.scripts.datautils import DATAutils
    from data.atc_data.scripts.attack_mapping import te_mapping, ta_mapping

from pathlib import Path

import csv
import sys
import getopt
from os import listdir
from os.path import isfile, join
from yaml.scanner import ScannerError

ATCconfig = DATAutils.load_config("config.yml")

HELP_MESSAGE = """Usage: python3 yamls2csv.py [OPTIONS]\n\n\n
\t\tPossible options are --detectionrules_path, --dataneeded_path
--loggingpolicies path
\t\tDefaults are
\t\tdataneeded_path = ../data_needed/;
\t\tloggingpolicies_path=../logging_policies/"""


class GenerateCSV:
    def __init__(self):

        dn_path = ATCconfig.get('data_needed_dir')
        lp_path = ATCconfig.get('logging_policies_dir')
        en_path = ATCconfig.get('enrichments_dir')
Пример #3
0
def main(c_auth=None):

    try:
        ATCconfig = DATAutils.load_config("config.yml")
        confluence_space_name = ATCconfig.get('confluence_space_name')
        confluence_space_home_page_name = ATCconfig.get(
            'confluence_space_home_page_name')
        confluence_rest_api_url = ATCconfig.get('confluence_rest_api_url')
        confluence_name_of_root_directory = ATCconfig.get(
            'confluence_name_of_root_directory')

    except Exception as e:
        raise e
        pass

    if not c_auth:
        mail = input("Login: "******""

    print("[*] Creating ATC root page...")

    data = {
        "title":
        confluence_name_of_root_directory,
        "spacekey":
        confluence_space_name,
        "parentid":
        str(
            DATAutils.confluence_get_page_id(url, auth, confluence_space_name,
                                             confluence_space_home_page_name)),
        "confluencecontent":
        content,
    }

    if not DATAutils.push_to_confluence(data, url, auth):
        raise Exception("[-] Could not create or update the page. " +
                        "Is the parent name correct?")

    pages = ["Logging Policies", "Data Needed", "Enrichments"]

    for page in pages:
        print("Creating %s..." % page)
        data = {
            "title":
            page,
            "spacekey":
            confluence_space_name,
            "parentid":
            str(
                DATAutils.confluence_get_page_id(
                    url, auth, confluence_space_name,
                    confluence_name_of_root_directory)),
            "confluencecontent":
            content,
        }

        if not DATAutils.push_to_confluence(data, url, auth):
            raise Exception("[-] Could not create or update the page. " +
                            "Is the parent name correct?")
    print("[+] Initial Confluence page structure created!")
    return True