From 9b785cf41d9e3a6c4ea99e0583cc96eacd470b1f Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sat, 5 Feb 2022 15:43:06 +0800 Subject: [PATCH] feat: docker test script --- test/docker/shadowsocks.py | 233 ++++++++++++++++++++++++++++++ test/docker/shadowsocksr.py | 110 ++++++++++++++ test/docker/sip003.py | 277 ++++++++++++++++++++++++++++++++++++ 3 files changed, 620 insertions(+) create mode 100644 test/docker/shadowsocks.py create mode 100644 test/docker/shadowsocksr.py create mode 100644 test/docker/sip003.py diff --git a/test/docker/shadowsocks.py b/test/docker/shadowsocks.py new file mode 100644 index 0000000..f48fc5e --- /dev/null +++ b/test/docker/shadowsocks.py @@ -0,0 +1,233 @@ +#!/usr/bin/python +method_list = { + "ss-python": [ + "aes-128-gcm", + "aes-192-gcm", + "aes-256-gcm", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "aes-128-ocb", + "aes-192-ocb", + "aes-256-ocb", + "aes-128-ofb", + "aes-192-ofb", + "aes-256-ofb", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-cfb1", + "aes-192-cfb1", + "aes-256-cfb1", + "aes-128-cfb8", + "aes-192-cfb8", + "aes-256-cfb8", + "aes-128-cfb128", + "aes-192-cfb128", + "aes-256-cfb128", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "camellia-128-cfb128", + "camellia-192-cfb128", + "camellia-256-cfb128", + "table", + "rc4", + "rc4-md5", + "rc2-cfb", + "bf-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "seed-cfb", + "salsa20", + "xchacha20", + "chacha20", + "chacha20-ietf", + "chacha20-poly1305", + "chacha20-ietf-poly1305", + "xchacha20-ietf-poly1305", + ], + "ss-python-legacy": [ + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "aes-128-ofb", + "aes-192-ofb", + "aes-256-ofb", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-cfb1", + "aes-192-cfb1", + "aes-256-cfb1", + "aes-128-cfb8", + "aes-192-cfb8", + "aes-256-cfb8", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "table", + "rc4", + "rc4-md5", + "rc2-cfb", + "bf-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "seed-cfb", + "salsa20", + "salsa20-ctr", + "chacha20", + ], + "ss-libev": [ + "aes-128-gcm", + "aes-192-gcm", + "aes-256-gcm", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "rc4", + "rc4-md5", + "bf-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", + "chacha20-ietf-poly1305", + "xchacha20-ietf-poly1305", + ], + "ss-libev-legacy": [ + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "table", + "rc4", + "rc4-md5", + "rc2-cfb", + "bf-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "seed-cfb", + "salsa20", + "chacha20", + "chacha20-ietf", + ], + "ss-rust": [ + "aes-128-gcm", + "aes-256-gcm", + "plain", + "none", + "chacha20-ietf-poly1305", + ] +} + +import sys + +client_port_start = 10001 +server_port_start = 20001 +password = "dnomd343" + +def type_to_filename(type): + if type == "ss-python" or type == "ss-python-legacy": + return "ss-bootstrap-" + elif type == "ss-libev" or type == "ss-libev-legacy" or type == "ss-rust": + return type + "-" + else: + return None + +def gen_server_cmd(type, method, port): + if type == "ss-python": + if method == "aes-128-cfb128" or method == "aes-192-cfb128" or method == "aes-256-cfb128": + method = "mbedtls:" + method + if method == "camellia-128-cfb128" or method == "camellia-192-cfb128" or method == "camellia-256-cfb128": + method = "mbedtls:" + method + cmd = type_to_filename(type) + "server --shadowsocks ss-python-server" + cmd += " -p " + port + " -k " + password + " -m " + method + if method == "idea-cfb" or method == "seed-cfb": + cmd += " --libopenssl=libcrypto.so.1.0.0" + elif type == "ss-python-legacy": + cmd = type_to_filename(type) + "server --shadowsocks ss-python-legacy-server" + cmd += " -p " + port + " -k " + password + " -m " + method + elif type == "ss-libev" or type == "ss-libev-legacy": + cmd = type_to_filename(type) + "server -u -p " + port + " -k " + password + " -m " + method + elif type == "ss-rust": + cmd = type_to_filename(type) + "server -U -s 0.0.0.0:" + port + " -k " + password + " -m " + method + else: + print("unknow server type") + sys.exit(1) + return cmd + " > /dev/null 2>&1 &" + +def gen_client_cmd(type, method, target_port, local_port): + if type == "ss-python": + if method == "aes-128-cfb128" or method == "aes-192-cfb128" or method == "aes-256-cfb128": + method = "mbedtls:" + method + if method == "camellia-128-cfb128" or method == "camellia-192-cfb128" or method == "camellia-256-cfb128": + method = "mbedtls:" + method + cmd = type_to_filename(type) + "local --shadowsocks ss-python-local" + cmd += " -l " + local_port + " -s 127.0.0.1 -p " + target_port + " -k " + password + " -m " + method + if method == "idea-cfb" or method == "seed-cfb": + cmd += " --libopenssl=libcrypto.so.1.0.0" + elif type == "ss-python-legacy": + cmd = type_to_filename(type) + "local --shadowsocks ss-python-legacy-local" + cmd += " -l " + local_port + " -s 127.0.0.1 -p " + target_port + " -k " + password + " -m " + method + elif type == "ss-libev" or type == "ss-libev-legacy": + cmd = type_to_filename(type) + "local -l " + local_port + " -s 127.0.0.1 -p " + target_port + " -k " + password + " -m " + method + elif type == "ss-rust": + cmd = type_to_filename(type) + "local -b 127.0.0.1:" + local_port + " -s 127.0.0.1:" + target_port + " -k " + password + " -m " + method + else: + print("unknow client type") + sys.exit(1) + return cmd + " > /dev/null 2>&1 &" + +command_list = [] +method_port_list = {} +client_port = client_port_start +server_port = server_port_start + +# Server +command_list.append('echo -n "Start the servers..."') +for (type, methods) in method_list.items(): + for method in methods: + if not method in method_port_list: + method_port_list[method] = [] + method_port_list[method].append(server_port) + command_list.append(gen_server_cmd(type, method, str(server_port))) + server_port += 1 +command_list.append('sleep 5 && echo "OK"') + +# Client +for (type, methods) in method_list.items(): + command_list.append('echo -n "Start the ' + type + ' clients..."') + for method in methods: + for server_port in method_port_list[method]: + command_list.append(gen_client_cmd(type, method, str(server_port), str(client_port))) + client_port += 1 + command_list.append('sleep 5 && echo "OK"') + # Curl test + for port in range(client_port_start, client_port): + command_list.append('echo -n "' + str(port) + ' -> " && curl ip.343.re --socks5 127.0.0.1:' + str(port)) + client_port_start = client_port + command_list.append("kill `ps aux | grep " + type_to_filename(type) + "local | grep -v grep | awk '{print $1}'`") + command_list.append('sleep 1') +command_list.append("kill `ps aux | grep ss-bootstrap-server | grep -v grep | awk '{print $1}'`") +command_list.append("kill `ps aux | grep ss-libev-server | grep -v grep | awk '{print $1}'`") +command_list.append("kill `ps aux | grep ss-libev-legacy-server | grep -v grep | awk '{print $1}'`") +command_list.append("kill `ps aux | grep ss-rust-server | grep -v grep | awk '{print $1}'`") +command_list.append('echo "Done"') + +# Output +for cmd in command_list: + print(cmd) diff --git a/test/docker/shadowsocksr.py b/test/docker/shadowsocksr.py new file mode 100644 index 0000000..0580093 --- /dev/null +++ b/test/docker/shadowsocksr.py @@ -0,0 +1,110 @@ +method_list = [ + "aes-128-cfb", + "aes-192-cfb", + "aes-256-cfb", + "aes-128-cfb1", + "aes-192-cfb1", + "aes-256-cfb1", + "aes-128-cfb8", + "aes-192-cfb8", + "aes-256-cfb8", + "aes-128-ctr", + "aes-192-ctr", + "aes-256-ctr", + "aes-128-gcm", + "aes-192-gcm", + "aes-256-gcm", + "aes-128-ofb", + "aes-192-ofb", + "aes-256-ofb", + "camellia-128-cfb", + "camellia-192-cfb", + "camellia-256-cfb", + "none", + "table", + "rc4", + "rc4-md5", + "rc4-md5-6", + "bf-cfb", + "cast5-cfb", + "des-cfb", + "idea-cfb", + "seed-cfb", + "rc2-cfb", + "salsa20", + "xsalsa20", + "chacha20", + "xchacha20", + "chacha20-ietf", +] + +protocol_list = [ + "origin", + "verify_sha1", + "verify_simple", + "verify_deflate", + "auth_simple", + "auth_sha1", + "auth_sha1_v2", + "auth_sha1_v4", + "auth_aes128", + "auth_aes128_md5", + "auth_aes128_sha1", + "auth_chain_a", + "auth_chain_b", + "auth_chain_c", + "auth_chain_d", + "auth_chain_e", + "auth_chain_f", +] + +obfs_list = [ + "plain", + "http_post", + "http_simple", + "tls_simple", + "tls1.2_ticket_auth", + "tls1.2_ticket_fastauth", + "random_head", +] + +command_list = [] + +server_port_start = 20001 +client_port_start = 10001 + +server_port = server_port_start +client_port = client_port_start + +# methods test +command_list.append('echo -n "Start SSR servers and clients..."') +for method in method_list: + command_list.append("ssr-server -s 0.0.0.0 -p " + str(server_port) + " -k dnomd343 -m " + method + " > /dev/null 2>&1 &") + command_list.append("ssr-local -s 127.0.0.1 -p " + str(server_port) + " -b 0.0.0.0 -l " + str(client_port) + " -k dnomd343 -m " + method + " > /dev/null 2>&1 &") + server_port += 1 + client_port += 1 +command_list.append('sleep 8 && echo "OK"') +for port in range(client_port_start, client_port): + command_list.append('echo -n "' + str(port) + ' -> " && curl ip.343.re --socks5 127.0.0.1:' + str(port)) +command_list.append("kill `ps aux | grep ssr- | grep -v grep | awk '{print $1}'`") + +# protocol and obfs +# for protocol in protocol_list: +for obfs in obfs_list: + client_port_start = client_port + command_list.append('echo -n "Start SSR servers and clients..."') + # for obfs in obfs_list: + for protocol in protocol_list: + command_list.append("ssr-server -s 0.0.0.0 -p " + str(server_port) + " -k dnomd343 -m aes-256-ctr -O " + protocol + " -o " + obfs + " > /dev/null 2>&1 &") + command_list.append("ssr-local -s 127.0.0.1 -p " + str(server_port) + " -b 0.0.0.0 -l " + str(client_port) + " -k dnomd343 -m aes-256-ctr -O " + protocol + " -o " + obfs + " > /dev/null 2>&1 &") + server_port += 1 + client_port += 1 + command_list.append('sleep 5 && echo "OK"') + for port in range(client_port_start, client_port): + command_list.append('echo -n "' + str(port) + ' -> " && curl ip.343.re --socks5 127.0.0.1:' + str(port)) + command_list.append("kill `ps aux | grep ssr- | grep -v grep | awk '{print $1}'`") + command_list.append('sleep 1') +command_list.append('echo "Done"') + +for cmd in command_list: + print(cmd) diff --git a/test/docker/sip003.py b/test/docker/sip003.py new file mode 100644 index 0000000..32a974e --- /dev/null +++ b/test/docker/sip003.py @@ -0,0 +1,277 @@ +#!/usr/bin/python + +testHost = "dns.343.re" +testCert = "/etc/ssl/certs/dns.343.re/certificate.crt" +testKey = "/etc/ssl/certs/dns.343.re/private.key" + +testGoQuiet = ''' +{ + "key": "dnomd343" +} +''' + +testCloak = ''' +{ + "BypassUID": [ + "Q3iw2bAbC3KZvpm58XR6+Q==" + ], + "RedirAddr": "www.bing.com", + "PrivateKey": "SFMUZ2g7e0jqzXXhBh5/rh/Odslnyu8A3LuZqH4ySVM=" +} +''' + +testRabbitPort = 12345 + +plugin_cmds = [ + # simple-obfs + { + "server": '--plugin obfs-server --plugin-opts "obfs=http"', + "client": '--plugin obfs-local --plugin-opts "obfs=http;obfs-host=www.bing.com"', + }, + { + "server": '--plugin obfs-server --plugin-opts "obfs=tls"', + "client": '--plugin obfs-local --plugin-opts "obfs=tls;obfs-host=www.bing.com"', + }, + { + "server": '--plugin obfs-server --plugin-opts "obfs=http"', + "client": '--plugin obfs-local --plugin-opts "obfs=http;http-method=POST;obfs-host=www.bing.com"', + }, + { + "server": '--plugin obfs-server --plugin-opts "obfs=http"', + "client": '--plugin obfs-local --plugin-opts "obfs=http;obfs-host=www.bing.com;obfs-uri=/test"', + }, + # simple-tls + { + "server": '--plugin simple-tls --plugin-opts "s;n=$HOST"', + "client": '--plugin simple-tls --plugin-opts "n=$HOST;no-verify"', + }, + { + "server": '--plugin simple-tls --plugin-opts "s;n=$HOST;auth=dnomd343"', + "client": '--plugin simple-tls --plugin-opts "n=$HOST;no-verify;auth=dnomd343"', + }, + { + "server": '--plugin simple-tls --plugin-opts "s;n=$HOST;ws;ws-path=/test"', + "client": '--plugin simple-tls --plugin-opts "n=$HOST;no-verify;ws;ws-path=/test"', + }, + # v2ray-plugin + { + "server": '--plugin v2ray-plugin --plugin-opts "server"', + "client": '--plugin v2ray-plugin', + }, + { + "server": '--plugin v2ray-plugin --plugin-opts "server;path=/test"', + "client": '--plugin v2ray-plugin --plugin-opts "path=/test"', + }, + { + "server": '--plugin v2ray-plugin --plugin-opts "server;tls;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin v2ray-plugin --plugin-opts "tls;host=$HOST"', + }, + { + "server": '--plugin v2ray-plugin --plugin-opts "server;mode=quic;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin v2ray-plugin --plugin-opts "mode=quic;host=$HOST"', + }, + # xray-plugin + { + "server": '--plugin xray-plugin --plugin-opts "server"', + "client": '--plugin xray-plugin', + }, + { + "server": '--plugin xray-plugin --plugin-opts "server;tls;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin xray-plugin --plugin-opts "tls;host=$HOST"', + }, + { + "server": '--plugin xray-plugin --plugin-opts "server;mode=quic;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin xray-plugin --plugin-opts "mode=quic;host=$HOST"', + }, + { + "server": '--plugin xray-plugin --plugin-opts "server;mode=grpc;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin xray-plugin --plugin-opts "mode=grpc"', + }, + { + "server": '--plugin xray-plugin --plugin-opts "server;tls;mode=grpc;host=$HOST;cert=$CERT;key=$KEY"', + "client": '--plugin xray-plugin --plugin-opts "tls;mode=grpc;host=$HOST"', + }, + # kcptun + { + "server": '--plugin kcptun-server', + "client": '--plugin kcptun-client', + }, + { + "server": '--plugin kcptun-server --plugin-opts "nocomp"', + "client": '--plugin kcptun-client --plugin-opts "nocomp"', + }, + { + "server": '--plugin kcptun-server --plugin-opts "key=dnomd343"', + "client": '--plugin kcptun-client --plugin-opts "key=dnomd343"', + }, + { + "server": '--plugin kcptun-server --plugin-opts "crypt=twofish;mode=fast3"', + "client": '--plugin kcptun-client --plugin-opts "crypt=twofish;mode=fast3"', + }, + # gost-plugin + { + "server": '--plugin gost-plugin --plugin-opts "server;mode=ws"', + "client": '--plugin gost-plugin --plugin-opts "mode=ws"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;mode=mws"', + "client": '--plugin gost-plugin --plugin-opts "mode=mws;mux=1"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=tls"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=tls"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=xtls"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=xtls"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=mtls"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=mtls;mux=1"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=h2"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=h2"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=wss"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=wss"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=mwss"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=mwss;mux=1"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=quic"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=quic"', + }, + { + "server": '--plugin gost-plugin --plugin-opts "server;cert=$CERT;key=$KEY;mode=grpc"', + "client": '--plugin gost-plugin --plugin-opts "serverName=$HOST;mode=grpc"', + }, + # Cloak + { + "server": '--plugin ck-server --plugin-opts "/tmp/Cloak.json"', + "client": '--plugin ck-client --plugin-opts "UID=Q3iw2bAbC3KZvpm58XR6+Q==;PublicKey=xTbqKW4Sg/xjDXDhys26ChXUQSrgxO+mBflTUeQpfWQ=;ServerName=www.bing.com;BrowserSig=chrome;NumConn=4;EncryptionMethod=plain;StreamTimeout=300"', + }, + # GoQuiet + { + "server": '--plugin gq-server --plugin-opts "/tmp/GoQuiet.json"', + "client": '--plugin gq-client --plugin-opts "ServerName=www.bing.com;key=dnomd343;TicketTimeHint=300;Browser=chrome"', + }, + # mos-tls-tunnel + { + "server": '--plugin mtt-server --plugin-opts "cert=$CERT;key=$KEY"', + "client": '--plugin mtt-client --plugin-opts "n=$HOST"', + }, + { + "server": '--plugin mtt-server --plugin-opts "wss;cert=$CERT;key=$KEY"', + "client": '--plugin mtt-client --plugin-opts "wss;n=$HOST"', + }, + { + "server": '--plugin mtt-server --plugin-opts "wss;wss-path=/test;cert=$CERT;key=$KEY"', + "client": '--plugin mtt-client --plugin-opts "wss;wss-path=/test;n=$HOST"', + }, + # qtun + { + "server": '--plugin qtun-server --plugin-opts "cert=$CERT;key=$KEY"', + "client": '--plugin qtun-client --plugin-opts "host=$HOST"', + }, + # gun-plugin + { + "server": '--plugin gun-plugin --plugin-opts "server:cleartext"', + "client": '--plugin gun-plugin --plugin-opts "client:cleartext"', + }, + { + "server": '--plugin gun-plugin --plugin-opts "server:$CERT:$KEY"', + "client": '--plugin gun-plugin --plugin-opts "client:$HOST"', + }, +] + +shadowsocks_cmds = [ + { + "server": "ss-bootstrap-server --shadowsocks ss-python-server --no-udp -s 0.0.0.0 -p $SERVER_PORT -k dnomd343 -m aes-256-ctr", + "client": "ss-bootstrap-local --shadowsocks ss-python-local --no-udp -s 127.0.0.1 -p $SERVER_PORT -b 0.0.0.0 -l $LOCAL_PORT -k dnomd343 -m aes-256-ctr", + "killFlag": "ss-bootstrap-", + "name": "ss-python" + }, + { + "server": "ss-bootstrap-server --shadowsocks ss-python-legacy-server --no-udp -s 0.0.0.0 -p $SERVER_PORT -k dnomd343 -m aes-256-ctr", + "client": "ss-bootstrap-local --shadowsocks ss-python-legacy-local --no-udp -s 127.0.0.1 -p $SERVER_PORT -b 0.0.0.0 -l $LOCAL_PORT -k dnomd343 -m aes-256-ctr", + "killFlag": "ss-bootstrap-", + "name": "ss-python-legacy" + }, + { + "server": "ss-libev-server -s 0.0.0.0 -p $SERVER_PORT -k dnomd343 -m aes-256-ctr", + "client": "ss-libev-local -s 127.0.0.1 -p $SERVER_PORT -b 0.0.0.0 -l $LOCAL_PORT -k dnomd343 -m aes-256-ctr", + "killFlag": "ss-libev-", + "name": "ss-libev" + }, + { + "server": "ss-libev-legacy-server -s 0.0.0.0 -p $SERVER_PORT -k dnomd343 -m aes-256-ctr", + "client": "ss-libev-legacy-local -s 127.0.0.1 -p $SERVER_PORT -b 0.0.0.0 -l $LOCAL_PORT -k dnomd343 -m aes-256-ctr", + "killFlag": "ss-libev-legacy-", + "name": "ss-libev-legacy" + }, + { + "server": "ss-rust-server -s 0.0.0.0:$SERVER_PORT -k dnomd343 -m aes-256-gcm", + "client": "ss-rust-local -s 127.0.0.1:$SERVER_PORT -b 0.0.0.0:$LOCAL_PORT -k dnomd343 -m aes-256-gcm", + "killFlag": "ss-rust-", + "name": "ss-rust" + } +] + +command_list = [] + +server_port_start = 20001 +client_port_start = 10001 + +server_port = server_port_start +client_port = client_port_start + +command_list.append("cat>/tmp/Cloak.json</tmp/GoQuiet.json< /dev/null 2>&1 &") + command_list.append((ssType['client'] + " " + pluginType['client']).replace("$SERVER_PORT", str(server_port)).replace("$LOCAL_PORT", str(client_port)) + " > /dev/null 2>&1 &") + server_port += 1 + client_port += 1 + command_list.append('sleep 8 && echo "OK"') + for port in range(client_port_start, client_port): + command_list.append('echo -n "' + str(port) + ' -> " && curl ip.343.re --socks5 127.0.0.1:' + str(port)) + command_list.append("kill `ps aux | grep " + ssType['killFlag'] + " | grep -v grep | awk '{print $1}'`") + command_list.append('sleep 1') +command_list.append("rm -f /tmp/Cloak.json") +command_list.append("rm -f /tmp/GoQuiet.json") + +# Rabbit test (no server plugin) +command_list.append('echo -n "Start the rabbit..."') +command_list.append("rabbit -mode s -password dnomd343 -rabbit-addr :" + str(testRabbitPort) + " > /dev/null 2>&1 &") +server_port_start = server_port +client_port_start = client_port +for ssType in shadowsocks_cmds: + command_list.append(ssType['server'].replace("$SERVER_PORT", str(server_port)) + " > /dev/null 2>&1 &") + command_list.append(ssType['client'].replace("$SERVER_PORT", str(testRabbitPort)).replace("$LOCAL_PORT", str(client_port)) + ' --plugin rabbit-plugin --plugin-opts "serviceAddr=127.0.0.1:' + str(server_port) + ';password=dnomd343" > /dev/null 2>&1 &') + server_port += 1 + client_port += 1 +command_list.append('sleep 3 && echo "OK"') +for port in range(client_port_start, client_port): + command_list.append('echo -n "' + str(port) + ' -> " && curl ip.343.re --socks5 127.0.0.1:' + str(port)) +command_list.append("kill `ps aux | grep ss- | grep -v grep | awk '{print $1}'`") +command_list.append("kill `ps aux | grep rabbit | grep -v grep | awk '{print $1}'`") +command_list.append('echo "Done"') + +# Output +for cmd in command_list: + cmd = cmd.replace("$HOST", testHost).replace("$CERT", testCert).replace("$KEY", testKey) + print(cmd)