forked from decrypto-org/rupture
-
Notifications
You must be signed in to change notification settings - Fork 6
/
install
executable file
·125 lines (111 loc) · 2.73 KB
/
install
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
#!/bin/bash
function install_python {
sudo apt-get install -y python2.7
sudo apt-get install -y python-pip
}
function activate_virtualenv {
sudo pip install virtualenv
virtualenv env
source env/bin/activate
pip install -r requirements.txt
}
install_nvm_node() {
if [ -z "$NVM_DIR" ]; then
sudo apt-get install -y build-essential libssl-dev curl
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
fi
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 6.3
nvm use 6.3
}
function error_checking() {
for arg in "$@";
do
case $arg in
injection|client|realtime|backend|sniffer|all) :;;
*) return 1;;
esac
done
return 0
}
install_bettercap() {
sudo apt-get install build-essential ruby-dev libpcap-dev
sudo gem install bettercap
}
show_config_info_message() {
echo "###################################################"
echo "# Don't forget to update the configuration files: #"
echo "# backend/target_config.yml #"
echo "# backend/victim_config.yml #"
echo "###################################################"
}
USAGE="Usage: $0 options
options:
client
injection
realtime
backend
sniffer
all"
command -v apt-get >/dev/null 2>&1 ||
{ echo >&2 "Installation script requires apt-get but it's not installed. Aborting.";
exit 1; }
## no argument passed
if [ "$1" == "" ]
then
echo "$USAGE"
exit 0
fi
## Check all arguments for validation before beginning installation
error_checking $@
if [ $? == 1 ]
then
echo "Invalid arguments"
echo "$USAGE"
exit 1
fi
for var in "$@"; do
case "$var" in
client)
install_nvm_node
(cd client
npm install) ##install required packages for compilation of the client code
;;
injection)
install_bettercap
;;
realtime)
install_nvm_node
(cd realtime
npm install) ##install required packages for deploying the realtime server
;;
backend)
install_python
(cd backend
activate_virtualenv
python manage.py migrate)
show_config_info_message
;;
sniffer)
install_python
(cd sniffer
activate_virtualenv)
;;
all)
install_nvm_node
(cd client
npm install)
install_bettercap
(cd realtime
npm install)
install_python
(cd backend
activate_virtualenv
python manage.py migrate)
(cd sniffer
activate_virtualenv)
show_config_info_message
;;
esac
done