This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
teamserver
82 lines (68 loc) · 3.33 KB
/
teamserver
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
#!/usr/bin/env bash
#clear
echo -e "\033[1;31m __ __ ____ \033[0m"
echo -e "\033[1;32m \ \/ / | _ \ ___ ___ ___ \033[0m"
echo -e "\033[1;33m \ / | |_) | / __| / _ \ / __| \033[0m"
echo -e "\033[1;34m / \ | _ < \__ \ | __/ | (__ \033[0m"
echo -e "\033[1;35m /_/\_\ |_| \_\ |___/ \___| \___| \n\033[0m"
echo -e "\033[1;32m [ help ] \n\033[0m"
echo "${passwd}"
echo
cd /app
#################
function print_good() {
echo -e "\x1B[01;32m[+]\x1B[0m $1"
}
function print_error() {
echo -e "\x1B[01;31m[-]\x1B[0m $1"
}
function print_info() {
echo -e "\x1B[01;34m[*]\x1B[0m $1"
}
# check that we're r00t
if [ $UID -ne 0 ]; then
print_error "Superuser privileges are required to run the team server"
exit
fi
# check if java is available...
if [ "$(command -v java)" ]; then
true
else
print_error "java is not in \$PATH"
echo " is Java installed?"
exit
fi
# check if keytool is available...
if [ "$(command -v keytool)" ]; then
true
else
print_error "keytool is not in \$PATH"
echo " install the Java Developer Kit"
exit
fi
# generate a certificate
# naturally you're welcome to replace this step with your own permanent certificate.
# just make sure you pass -Djavax.net.ssl.keyStore="/path/to/whatever" and
# -Djavax.net.ssl.keyStorePassword="password" to java. This is used for setting up
# an SSL server socket. Also, the SHA-1 digest of the first certificate in the store
# is printed so users may have a chance to verify they're not being owned.
if [ -e /app/cobaltstrike.store ]; then
print_info "Will use existing X509 certificate and keystore (for SSL)"
else
print_info "Generating X509 certificate and keystore (for SSL)"
IFS_BACKUP=$IFS
IFS=$(echo -en "\n\b")
keytool -keystore /app/cobaltstrike.store -storepass "${passwd}" -keypass "${passwd}" -genkey -keyalg RSA -alias "${alias_name}" -dname "${d_name}"
IFS=$IFS_BACKUP
fi
# start the team server.
if [ ! -n "${start_args}" ]; then
start_args='-classpath /app/cobaltstrike.jar -javaagent:CSAgent.jar=f38eb3d1a335b252b58bc2acde81b542 server.TeamServer'
fi
# shellcheck disable=SC2154
#java -XX:ParallelGCThreads=4 -Dcobaltstrike.server_port="${server_port}" -Dcobaltstrike.server_bindto=0.0.0.0 -Djavax.net.ssl.keyStore=/app/cobaltstrike.store -Djavax.net.ssl.keyStorePassword="${passwd}" -XX:+AggressiveHeap -XX:+UseParallelGC -Xms512M -Xmx1024M -Duser.language=UTF-8 -server "${start_args}" "${server_ip}" "${passwd}"
# Cloud function
# java -XX:ParallelGCThreads=4 -Dcobaltstrike.server_port="${server_port}" -Dcobaltstrike.server_bindto=0.0.0.0 -Djavax.net.ssl.keyStore=/app/cobaltstrike.store -Djavax.net.ssl.keyStorePassword="${passwd}" -server -XX:+AggressiveHeap -XX:+UseParallelGC -Xms512M -Xmx1024M -classpath /app/cobaltstrike.jar -javaagent:CSAgent.jar=f38eb3d1a335b252b58bc2acde81b542 -Duser.language=UTF-8 server.TeamServer "${server_ip}" "${passwd}" /app/cs.profile
# DingTalk
# sleep 10
# java -XX:ParallelGCThreads=4 -Dcobaltstrike.server_port="${server_port}" -Dcobaltstrike.server_bindto=0.0.0.0 -Djavax.net.ssl.keyStore=/app/cobaltstrike.store -Djavax.net.ssl.keyStorePassword="${passwd}" -server -XX:+AggressiveHeap -XX:+UseParallelGC -Xms512M -Xmx1024M -classpath /app/cobaltstrike.jar -javaagent:CSAgent.jar=f38eb3d1a335b252b58bc2acde81b542 -Duser.language=UTF-8 server.TeamServer "${server_ip}" "${passwd}" /app/dingding.cna