Beispiel #1
0
def main(c_auth=None):

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

    except Exception as e:
        raise e
        pass

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

    print("[*] Creating RE&CT root page...")

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

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

    pages = ["Response Actions","Response Playbooks","Response Stages"]

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

        if not REACTutils.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
Beispiel #2
0
def react_create_markdown_dirs():
    REACTConfig = REACTutils.load_config('config.yml')
    base_dir = Path(REACTConfig.get('md_name_of_root_directory', '../docs'))

    target_dir_list = [
        'Response_Actions', 'Response_Playbooks', 'Response_Stages'
    ]

    for item in target_dir_list:
        (base_dir / item).mkdir(parents=True, exist_ok=True)
Beispiel #3
0
#!/usr/bin/env python3

from jinja2 import Environment, FileSystemLoader
import os

try:
    from scripts.reactutils import REACTutils
    from scripts.react_mapping import rs_mapping
    env = Environment(loader=FileSystemLoader('scripts/templates'))
except:
    from response.atc_react.scripts.reactutils import REACTutils
    from response.atc_react.scripts.react_mapping import rs_mapping
    env = Environment(loader=FileSystemLoader(
        'response/atc_react/scripts/templates'))

REACTConfig = REACTutils.load_config("config.yml")


class ResponseAction:
    """Class for the Playbook Actions entity"""

    def __init__(self, yaml_file, apipath=None, auth=None, space=None):
        """Init method"""

        # Init vars
        self.yaml_file = yaml_file
        self.apipath = apipath
        self.auth = auth
        self.space = space
        # The name of the directory containing future markdown Response_Actions
        self.parent_title = "Response_Actions"