-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMalebolgia.sh
executable file
·134 lines (88 loc) · 3.22 KB
/
Malebolgia.sh
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
echo " "
echo " _______ ______ _____ _____ ______ ___ _ "
echo " |__ __| ____| /\ | __ \ | __ \ / __ \ \ / / \ | | "
echo " | | | |__ / \ | |__) | | | | | | | \ \ /\ / /| \| | "
echo " | | | __| / /\ \ | _ / | | | | | | |\ \/ \/ / | | "
echo " | | | |____ / ____ \| | \ \ | |__| | |__| | \ /\ / | |\ | "
echo " |_| |______/_/ \_\_| \_\ |_____/ \____/ \/ \/ |_| \_| "
echo " "
#Must use Cloud1 for accounts (any way to change this?)
#Some variables are modified later by fetching data from etcd
. /home/$USER/Cloud1
echo "loaded Config file"
echo ""
echo "STARTING"
echo ""
MYNAMEVALUE=`(curl http://127.0.0.1:4001/v2/keys/cf-honeypot1/appname | jq '.node.value' | sed 's/.//;s/.$//')`
#curl -L http://127.0.0.1:4001/v2/keys/cf-honeypot1/appname -XPUT -d value=$MYNAMEVALUE
echo ""
echo "$(tput setaf 1)Destroying serverless workloads $(tput sgr 0)"
echo ""
kubectl delete function tcfaas
kubectl delete topic tcfaas
echo ""
echo "$(tput setaf 1)Destroying ELK Setup $(tput sgr 0)"
echo ""
echo ""
echo "$(tput setaf 1) Removing nginxproxy ip from GCP $(tput sgr 0)"
echo ""
gcloud compute addresses delete --quiet kubernetes-ingress --global
gcloud compute addresses delete --quiet logstash-ingress --global
gcloud compute addresses delete --quiet tcpnginx-ingress --global
gcloud compute addresses delete --quiet grafana-ingress --global
gcloud compute addresses delete --quiet honey-istio-ingress --global
kubectl delete cm nginxproxy-config
kubectl delete cm logstash-config
kubectl delete service nginxproxy
kubectl delete service logstash
kubectl delete -f kubefiles/ -R --namespace=default
kubectl delete -f nginxproxy/ -R --namespace=default
kubectl delete -f logstash/ -R --namespace=default
#destroys honeypot-istio
kubectl delete -f honeypot-istio/ -R --namespace=default
#destroys local honeypot instance in Kubernetes (testing instance)
kubectl delete -f honeypot/ -R --namespace=default
#destroys ghost
kubectl delete deploy ghost
kubectl delete service ghost
kubectl get pods,deployments,services,ingress,configmaps
echo "Sleeping for 2 mins to let the de-provisioning finish"
sleep 2m
kubectl get pods,deployments,services,ingress,configmaps
echo ""
echo "$(tput setaf 1)Destroying riff installation $(tput sgr 0)"
echo ""
helm delete --purge projectriff
echo ""
echo "$(tput setaf 1)Destroying Kubernetes Cluster $(tput sgr 0)"
echo ""
echo ""
echo "Remote Kubernetes clusters instances running: "
gcloud container clusters delete delltechdemo123 --quiet
kubectl get nodes
#Delete local docker containers
#Kill local containers
echo ""
echo "$(tput setaf 1) Destroying Local Containers $(tput sgr 0)"
echo ""
docker rm -f etcd-browserk$instidk
docker rm -f etcd-browserk
sleep 1
docker rm -f honeypot-logstash-1
sleep 1
docker rm -f honeypot-nginx-2
sleep 1
docker rm -f etcdk
echo ""
echo "Local Docker instances running: "
docker ps
# kill remote cf honeypots
echo ""
echo "$(tput setaf 1) Destroying cf honeypots $(tput sgr 0)"
echo ""
cf api $cfapik1
cf login -u $cflogink1 -p $cfpassk1 -o $cforgk1 -s EMC
cf delete -f $MYNAMEVALUE
echo ""
echo "$(tput setaf 1) Everything has been destroyed by Malebolgia ;) $(tput sgr 0)"
echo ""