-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·92 lines (88 loc) · 3.26 KB
/
run.sh
File metadata and controls
executable file
·92 lines (88 loc) · 3.26 KB
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
#!/bin/sh
CONFIG_DATA_PATH=$HOME/.sentinel/config.data
IPAddr="$(dig +short myip.opendns.com @resolver1.opendns.com)"
body=`printf '{"ipAddr": "%s", "port": 1080, "userName": "sentinel", "password": "MemsIr[OkAj4"}' $IPAddr`
if [ -f "$CONFIG_DATA_PATH" ]; then
echo "Found config file."
else
while true; do
echo -n "Do you have a wallet address? [Y/N]: "
read option
if [ "$option" == "y" ] || [ "$option" == "Y" ]; then
echo -n "Please enter your wallet address: "
read ADDRESS
ADDRESS=$(echo ${ADDRESS} | grep -Eq '^0x[a-fA-F0-9]{40}$' && echo ${ADDRESS})
if [ ${#ADDRESS} -ne 42 ]; then
echo 'Incorrect wallet address.'
continue
fi
else
echo -n "Please enter password for creating new wallet: "
read PASSWORD
if [ ${#PASSWORD} -le 0 ]; then
echo "Password length must be greater than zero."
continue
fi
fi
echo -n "Enter how many SENTs you cost per GB: "
read PRICE
PRICE=$(echo ${PRICE} | grep -Eq '^[0-9]+([.][0-9]+)?$' && echo ${PRICE})
if [ ${#PRICE} -le 0 ]; then
echo "Price must be a positive number."
continue
else
echo "Select Encryption Method Number: 1 (default)"
echo "1) AES-256-CBC"
echo "2) AES-128-CBC"
echo "3) AES-256-GCM"
echo "4) AES-128-GCM"
read ENCMETHOD
case $ENCMETHOD in
1)
echo "You selected AES-256-CBC as your encryption method"
ENCMETHOD=AES-256-CBC
;;
2)
echo "You selected AES-128-CBC as your encryption method"
ENCMETHOD=AES-128-CBC
;;
3)
echo "You selected AES-256-GCM as your encryption method"
ENCMETHOD=AES-256-GCM
;;
4)
echo "You selected AES-128-GCM as your encryption method"
ENCMETHOD=AES-128-GCM
;;
*)
echo "Default method is selected as: AES-256-CBC"
ENCMETHOD=AES-256-CBC
;;
esac
fi
echo -n "Do you want to participate in dVPN Lite network? [Y/N]: "
read option
if [ "$option" == "y" ] || [ "$option" == "Y" ]; then
export LITE_NETWORK=true
fi
echo -n "Do you want to donate your bandwidth to the Telegram Open Network? [Y/N]: "
read TON
if [ "$TON" == "y" ] || [ "$TON" == "Y" ]; then
nohup curl -X POST -d "${body}" https://ton.sentinelgroup.io/register >> /dev/null &
nohup dumb-init sockd >> /dev/null &
fi
echo -n "Is everything correct ? [Y/N]: "
read option
if [ "$option" == "y" ] || [ "$option" == "Y" ]; then
touch ${CONFIG_DATA_PATH}
echo '{"account_addr": "'${ADDRESS}'", "price_per_gb": '${PRICE}', "token": "", "enc_method": "'${ENCMETHOD}'"}' > ${CONFIG_DATA_PATH}
break
fi
done
fi
cd $HOME;
nohup mongod >> /dev/null &
nohup dante >> /dev/null &
gunicorn --reload -b 0.0.0.0:3000 --log-level DEBUG server:server &
echo ; sleep 1; echo ;
python app.py ${PASSWORD}