Fix for hardcoded init_markdown.sh folder paths.

This commit is contained in:
Thomas Bouve 2019-02-25 22:10:32 +01:00
parent 03ae0ebaea
commit 1c95abed9c
5 changed files with 19 additions and 13 deletions

View File

@ -1,7 +1,7 @@
confluence_space_name: "ATC" # SPACE KEY. GO TO: SPACE TOOLS -> Overview -> Space Details -> Key
confluence_space_home_page_name: 'ATC Home' # SPACE HOME. GO TO: SPACE TOOLS -> Overview -> Space Details -> Home page
confluence_name_of_root_directory: 'Atomic Threat Coverage'
md_name_of_root_directory: 'Atomic_Threat_Coverage'
md_name_of_root_directory: '../Atomic_Threat_Coverage'
detection_rules_directory: '../detection_rules'
triggers_directory: '../triggers/atomic-red-team/atomics'
confluence_rest_api_url: 'https://atomicthreatcoverage.atlassian.net/wiki/rest/api/'

View File

@ -261,7 +261,7 @@ class DetectionRule:
return True
def save_markdown_file(self, atc_dir='../' + ATCconfig.get('md_name_of_root_directory') + '/'):
def save_markdown_file(self, atc_dir=ATCconfig.get('md_name_of_root_directory') + '/'):
"""Write content (md template filled with data) to a file"""
base = os.path.basename(self.yaml_file)
title = os.path.splitext(base)[0]

View File

@ -1,15 +1,20 @@
#!/bin/bash
DIRECTORIES=(
"../Atomic_Threat_Coverage"
"../Atomic_Threat_Coverage/Detection_Rules"
"../Atomic_Threat_Coverage/Logging_Policies"
"../Atomic_Threat_Coverage/Data_Needed"
"../Atomic_Threat_Coverage/Triggers"
"../Atomic_Threat_Coverage/Response_Actions"
"../Atomic_Threat_Coverage/Response_Playbooks"
"../Atomic_Threat_Coverage/Enrichments"
OUTPUT_PATH=`grep md_name_of_root_directory config.yml | sed -e "s/^.*\'\(.*\)\'.*$/\1/"`
if [ -z "$OUTPUT_PATH" ]; then
OUTPUT_PATH="../Atomic_Threat_Coverage"
fi
DIRECTORIES=(
"$OUTPUT_PATH"
"$OUTPUT_PATH/Detection_Rules"
"$OUTPUT_PATH/Logging_Policies"
"$OUTPUT_PATH/Data_Needed"
"$OUTPUT_PATH/Triggers"
"$OUTPUT_PATH/Response_Actions"
"$OUTPUT_PATH/Response_Playbooks"
"$OUTPUT_PATH/Enrichments"
)
for DIRECTORY in ${DIRECTORIES[@]}; do
@ -17,3 +22,4 @@ for DIRECTORY in ${DIRECTORIES[@]}; do
mkdir ${DIRECTORY}
fi
done

View File

@ -35,7 +35,7 @@ class PopulateMarkdown:
self.atc_dir = atc_dir
else:
self.atc_dir = '../'+ATCconfig.get('md_name_of_root_directory')+'/'
self.atc_dir = ATCconfig.get('md_name_of_root_directory')+'/'
# Check if art_dir provided
if art_dir:

View File

@ -98,7 +98,7 @@ class ResponseAction:
self.content = template.render(self.ra_parsed_file)
def save_markdown_file(self, atc_dir='../' + ATCconfig.get('md_name_of_root_directory')):
def save_markdown_file(self, atc_dir=ATCconfig.get('md_name_of_root_directory')):
"""Write content (md template filled with data) to a file"""
base = os.path.basename(self.yaml_file)