-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (58 loc) · 1.88 KB
/
Copy pathMakefile
File metadata and controls
70 lines (58 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Makefile for MITRE ATT&CK KnowledgeBase Script
# Variables
PYTHON = python3
PIP = pip
VENV = .venv
ACTIVATE = . $(VENV)/bin/activate
SCRIPT = main.py
DATA_DIR = data
ATOMICS_DIR = $(DATA_DIR)/atomics
# Default target
all: run
# Create a virtual environment
venv:
$(PYTHON) -m venv $(VENV)
@echo "Virtual environment created at $(VENV)"
# Install dependencies
install: venv
$(ACTIVATE) && $(PIP) install -r requirements.txt
@echo "Dependencies installed"
# Fetch data files
fetch_data: install
$(ACTIVATE) && $(PYTHON) fetch_data.py
@echo "Data files fetched"
# Download the atomics folder
atomics: $(ATOMICS_DIR)
$(ATOMICS_DIR):
@echo "Downloading Atomic Red Team atomics..."
mkdir -p $(DATA_DIR)
cd $(DATA_DIR) && curl -LO https://github.com/redcanaryco/atomic-red-team/archive/refs/heads/master.zip
cd $(DATA_DIR) && unzip master.zip
mv $(DATA_DIR)/atomic-red-team-master/atomics $(DATA_DIR)/
rm -rf $(DATA_DIR)/master.zip $(DATA_DIR)/atomic-red-team-master
@echo "Atomics downloaded to $(ATOMICS_DIR)"
# Run the script
run: fetch_data atomics
$(ACTIVATE) && $(PYTHON) $(SCRIPT)
# Clean up generated files and virtual environment
clean:
rm -rf MITRE_ATT&CK_Analysis/
rm -rf $(VENV)/
rm -rf $(ATOMICS_DIR)/
@echo "Cleaned up generated files and virtual environment"
# Set up the environment and run the script
setup: run
# Help message
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " venv Create a virtual environment"
@echo " install Install dependencies"
@echo " fetch_data Fetch necessary data files"
@echo " atomics Download the Atomic Red Team atomics folder"
@echo " run Run the script"
@echo " clean Remove generated files and virtual environment"
@echo " setup Set up the environment and run the script"
@echo " help Show this help message"
.PHONY: all venv install fetch_data atomics run clean setup help