-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
238 lines (202 loc) · 10.3 KB
/
makefile
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
.PHONY: help install uninstall k3s-install argo-workflow-install docker-registry-install run-argo-workflow show-pods build-container apply-workflow delete-workflow restart-k3s redis-install redisinsight-install apply-share-volume delete-share-volume website-backend-install website-backend-build website-frontend-install apply-subdomain-enumeration delete-subdomain-enumeration apply-subdomain-ping-check delete-subdomain-ping-check apply-network-scanning delete-network-scanning apply-web-fingerprint-scanning delete-web-fingerprint-scanning apply-web-vuln-scanning delete-web-vuln-scanning apply-web-subdirectory-enumeration delete-web-subdirectory-enumeration kubernetes-api-token-install
help:
@echo "Available commands:"
@echo " make install - Installs k3s, Argo, Docker registry, Redis and RedisInsight"
@echo " make uninstall - Uninstalls k3s and Argo Workflow"
@echo " make docker-registry-install - Installs Docker registry"
@echo " make run-argo-workflow - Runs Argo workflow"
@echo " make show-pods - Displays pods in the Argo namespace"
@echo " make build-container - Builds and pushes Docker images"
@echo " make restart-k3s - Restarts k3s service"
@echo " make redis-install - Installs Redis"
@echo " make redisinsight-install - Installs RedisInsight"
@echo " make kubernetes-api-token-install - Installs Kubernetes API token"
# @echo " make website-backend-install - Installs website backend"
# @echo " make website-backend-build - Builds website backend"
# @echo " make website-frontend-install - Installs website frontend"
@echo " make apply-share-volume - Applies shared volume configuration"
@echo " make delete-share-volume - Deletes shared volume configuration"
@echo " make apply-subdomain-enumeration - Applies subdomain enumeration workflow"
@echo " make delete-subdomain-enumeration - Deletes subdomain enumeration workflow"
@echo " make apply-subdomain-ping-check - Applies subdomain ping check workflow"
@echo " make delete-subdomain-ping-check - Deletes subdomain ping check workflow"
@echo " make apply-network-scanning - Applies network scanning workflow"
@echo " make delete-network-scanning - Deletes network scanning workflow"
@echo " make apply-web-fingerprint-scanning - Applies web fingerprint scanning workflow"
@echo " make delete-web-fingerprint-scanning - Deletes web fingerprint scanning workflow"
@echo " make apply-web-vuln-scanning - Applies web vulnerability scanning workflow"
@echo " make delete-web-vuln-scanning - Deletes web vulnerability scanning workflow"
@echo " make apply-web-subdirectory-enumeration - Applies web subdirectory enumeration workflow"
@echo " make delete-web-subdirectory-enumeration - Deletes web subdirectory enumeration workflow"
.DEFAULT_GOAL := help
install: k3s-install argo-workflow-install docker-registry-install redis-install redisinsight-install apply-share-volume # website-install
uninstall:
# Uninstall Argo Workflow
echo "Uninstalling Argo Workflow..."
kubectl delete namespace argo
# Uninstall k3s
echo "Uninstalling k3s..."
sudo /usr/local/bin/k3s-killall.sh
sudo /usr/local/bin/k3s-uninstall.sh
# Remove user and group
echo "Removing user and group..."
sudo gpasswd -d `whoami` k3s
sudo groupdel k3s
# Remove k3s related files
echo "Cleaning up k3s related files..."
sudo rm -rf /etc/rancher/k3s
echo "Uninstallation completed."
k3s-install:
# Install k3s
curl -sfL https://get.k3s.io | sh -
sudo k3s kubectl get node
sudo groupadd k3s
sudo usermod -aG k3s `whoami`
sudo chown `whoami`:k3s /etc/rancher/k3s/k3s.yaml
kubectl get pods
argo-workflow-install:
# Install Argo Workflow
kubectl create namespace argo
kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.5.4/install.yaml
kubectl patch deployment argo-server --namespace argo --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/args", "value": ["server", "--auth-mode=server","--access-control-allow-origin=*"]}]'
docker-registry-install:
kubectl apply -f sidecar/docker-registry/argo-role.yaml
kubectl apply -f sidecar/docker-registry/argo-rolebinding.yaml
kubectl create -f sidecar/docker-registry/docker-registry.yaml
run-argo-workflow:
# Run Argo Workflow
kubectl -n argo port-forward deployment/argo-server 2746:2746
show-pods:
kubectl -n argo get pods
build-container:
for file in tools/*/Dockerfile; do \
dir_name=$$(dirname "$$file"); \
base_name=$$(basename "$$dir_name"); \
image_name="$$base_name-local"; \
sudo docker build -t $$image_name -f $$file $$dir_name; \
sudo docker tag $$image_name localhost:30000/$$image_name; \
sudo docker push localhost:30000/$$image_name; \
done
restart-k3s:
sudo systemctl restart k3s
redis-install:
kubectl apply -f sidecar/redis/redis-deployment.yaml
kubectl apply -f sidecar/redis/redis-service.yaml
redisinsight-install:
kubectl apply -f sidecar/redisinsight/redisinsight-deployment.yaml
kubectl apply -f sidecar/redisinsight/redisinsight-service.yaml
kubernetes-api-token-install:
kubectl apply -f common/kubernetes-api-token/kubernetes-api-token.yaml
kubectl apply -f common/kubernetes-api-token/kubernetes-role.yaml
kubectl apply -f common/kubernetes-api-token/kubernetes-rolebinding.yaml
kubectl apply -f common/kubernetes-api-token/kubernetes-secret.yaml
kubectl get secret $(kubectl get serviceaccount k8s-service-account -n default -o jsonpath="{.secrets[0].name}") -n default -o jsonpath="{.data.token}" | base64 --decode
# website-backend-install:
# kubectl apply -f sidecar/website-backend/backend-deployment.yaml
# kubectl apply -f sidecar/website-backend/backend-service.yaml
# website-backend-build:
# git clone https://github.com/astroicers/dark-nebula-backend.git dark-nebula-backend; \
# sudo docker build -t dark-nebula-backend -f dark-nebula-backend/Dockerfile ./dark-nebula-backend; \
# sudo docker tag dark-nebula-backend localhost:30000/dark-nebula-backend; \
# sudo docker push localhost:30000/dark-nebula-backend; \
# website-frontend-install:
# kubectl apply -f sidecar/website-frontend/frontend-deployment.yaml
# kubectl apply -f sidecar/website-frontend/frontend-service.yaml
apply-share-volume:
kubectl apply -f common/share-volume/share-pv.yaml
kubectl apply -f common/share-volume/share-pvc.yaml
delete-share-volume:
kubectl delete pvc shared-pvc --force --grace-period=0
kubectl delete pv shared-pv --force --grace-period=0
# Workflows
apply-subdomain-enumeration:
for file in workflows/subdomain-enumeration/*.yaml; do \
if [ "$$file" != "workflows/subdomain-enumeration/subdomain-enumeration.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
kubectl create -f workflows/subdomain-enumeration/subdomain-enumeration.yaml
delete-subdomain-enumeration:
for file in workflows/subdomain-enumeration/*.yaml; do \
if [ "$$file" != "workflows/subdomain-enumeration/subdomain-enumeration.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/subdomain-enumeration/subdomain-enumeration.yaml
apply-subdomain-ping-check:
for file in workflows/subdomain-ping-check/*.yaml; do \
if [ "$$file" != "workflows/subdomain-ping-check/subdomain-ping-check.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
kubectl create -f workflows/subdomain-ping-check/subdomain-ping-check.yaml
delete-subdomain-ping-check:
for file in workflows/subdomain-ping-check/*.yaml; do \
if [ "$$file" != "workflows/subdomain-ping-check/subdomain-ping-check.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/subdomain-ping-check/subdomain-ping-check.yaml
apply-network-scanning:
for file in workflows/network-scanning/*.yaml; do \
if [ "$$file" != "workflows/network-scanning/network-scanning.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
kubectl create -f workflows/network-scanning/network-scanning.yaml
delete-network-scanning:
for file in workflows/network-scanning/*.yaml; do \
if [ "$$file" != "workflows/network-scanning/network-scanning.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/network-scanning/network-scanning.yaml
apply-web-fingerprint-scanning:
for file in workflows/web-fingerprint-scanning/*.yaml; do \
if [ "$$file" != "workflows/web-fingerprint-scanning/web-fingerprint-scanning.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
kubectl create -f workflows/web-fingerprint-scanning/web-fingerprint-scanning.yaml
delete-web-fingerprint-scanning:
for file in workflows/web-fingerprint-scanning/*.yaml; do \
if [ "$$file" != "workflows/web-fingerprint-scanning/web-fingerprint-scanning.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/web-fingerprint-scanning/web-fingerprint-scanning.yaml
apply-web-vuln-scanning:
for file in workflows/web-vuln-scanning/*.yaml; do \
if [ "$$file" != "workflows/web-vuln-scanning/web-vuln-scanning.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
kubectl create -f workflows/web-vuln-scanning/web-vuln-scanning.yaml
delete-web-vuln-scanning:
for file in workflows/web-vuln-scanning/*.yaml; do \
if [ "$$file" != "workflows/web-vuln-scanning/web-vuln-scanning.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/web-vuln-scanning/web-vuln-scanning.yaml
apply-web-subdirectory-enumeration:
for file in workflows/web-subdirectory-enumeration/*.yaml; do \
if [ "$$file" != "workflows/web-subdirectory-enumeration/web-subdirectory-enumeration.yaml" ]; then \
kubectl apply -f "$$file"; \
fi; \
done
@if kubectl get configmap gobuster-wordlist > /dev/null 2>&1; then \
echo "ConfigMap 'gobuster-wordlist' already exists."; \
else \
echo "Creating ConfigMap 'gobuster-wordlist'..."; \
kubectl create configmap gobuster-wordlist --from-file=wordlists/wordlists; \
fi
kubectl create -f workflows/web-subdirectory-enumeration/web-subdirectory-enumeration.yaml
delete-web-subdirectory-enumeration:
for file in workflows/web-subdirectory-enumeration/*.yaml; do \
if [ "$$file" != "workflows/web-subdirectory-enumeration/web-subdirectory-enumeration.yaml" ]; then \
kubectl delete -f "$$file"; \
fi; \
done
kubectl delete -f workflows/web-subdirectory-enumeration/web-subdirectory-enumeration.yaml
kubectl delete configmap gobuster-wordlist