-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
203 lines (168 loc) · 5.11 KB
/
install.sh
File metadata and controls
203 lines (168 loc) · 5.11 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
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
#!/bin/bash
set -e
INSTALLATION_DIR="$HOME"/ABS
OUTPUT_PREFIX="ABS INSTALLER:"
OUTPUT_ERROR_PREFIX="$OUTPUT_PREFIX ERROR:"
git clone https://github.com/aleonal/ABS "$INSTALLATION_DIR"
cd "$INSTALLATION_DIR"
### Helper functions
#
prompt_accepted_Yn() {
read -r -p "$1 [Y/n] " yn
case $yn in
[nN]*) return 1 ;;
*) return 0 ;;
esac
}
#Install platform specific dependencies
PYTHON_EXEC="python3"
OS_VERSION="UNKNOWN"
if lsb_release -c | grep -iq 'focal'; then
OS_VERSION="ubuntu_focal"
echo "Ubuntu Focal detected; adding repository for suricata"
add-apt-repository ppa:oisf/suricata-stable
apt-get update -y
apt-get install suricata python3-tk -y
fi
if lsb_release -c | grep -q 'bionic'; then
OS_VERSION="ubuntu_bionic"
echo "Ubuntu Bionic detected; adding repository for gcc-9"
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update -y
apt-get install gcc-9 python3-tk -y
fi
if lsb_release -c | grep -iq 'xenial'; then
OS_VERSION="ubuntu_xenial"
echo "Ubuntu Xenial detected; installing dependencies specific to OS"
echo "adding repository for gcc-9"
apt-get install libxcb-xinerama0 -y
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update -y
apt-get install gcc-9 python3-tk -y
fi
if lsb_release -d | grep -iq 'kali'; then
if lsb_release -r | grep -q '2020'; then
OS_VERSION="kali_2020"
#works out of the box
fi
if lsb_release -r | grep -q '2019.2'; then
OS_VERSION="kali_2019.2"
echo "Kali 2019.2 detected; checking for OS specific dependencies"
if apt-cache policy libgcc-8-dev | grep -q 'Installed: 8'; then
echo "Kali 2019 does not work out of the box. Many dependent packages require updated libgcc."
echo "You need to remove libgcc-8-dev and install libgcc-10-dev."
if prompt_accepted_Yn "Run upgrade command? (May take a while)"; then
apt-get -y update
apt-get remove libgcc-8-dev
apt-get install libgcc-10-dev
else
echo "Cannot install due to old version of libgcc"
exit 1
fi
fi
fi
fi
if echo $OS_VERSION | grep -q "UNKNOWN"; then
echo "This version of Linux is currently not support."
echo "Currently Supported:"
echo "Ubuntu: Focal, Xenial"
echo "Kali: 2019.2, 2020"
exit 1
fi
# Updates
#echo "Running apt-get update"
#apt-get -y update
#echo "Running apt-get upgrade"
#apt-get upgrade
### Check if running as root
#
#if [ "$EUID" -ne 0 ]; then
# echo "$OUTPUT_ERROR_PREFIX Please run this installation as root"
# exit 1
#fi
### Install dependencies
#
REQUIRED_PROGRAMS="python3-pip python3-venv git"
REQUIRED_PYTHON_PACKAGES="PyQt5 Pyro4 Pillow pyautogui"
ECELD_DEPS="eceld eceld-wireshark"
# echo "$OUTPUT_PREFIX Installing Additional Dependencies"
# if [ -x "/usr/bin/apt-get" ]; then
# OS_VERSION="Debian"
# #sudo apt dist-upgrade
# sudo apt-get -y install $REQUIRED_PROGRAMS
# elif [ -x "/usr/bin/yum" ]; then
# OS_VERSION="CentOS"
# yum install -y $REQUIRED_PROGRAMS
# else
# echo "$OUTPUT_ERROR_PREFIX Distribution not supported"
# exit 1
# fi
### Create virtualenv if it doesn't currently exist
echo "$OUTPUT_PREFIX Installing python dependencies"
if [ ! -d "venv" ]; then
$PYTHON_EXEC -m venv venv
fi
source venv/bin/activate
pip install pip --upgrade
pip install $REQUIRED_PYTHON_PACKAGES
### Creating executable
echo "Creating runner"
cat > "$INSTALLATION_DIR"/abs-gui <<EOFabs-gui
#!/bin/bash
prompt_accepted_Yn() {
read -r -p "$1 [Y/n] " yn
case \$yn in
[nN]*) return 1 ;;
*) return 0 ;;
esac
}
ECEL_NETSYS_DIR="\$(find /home/kali -type d -name "eceld-netsys" )"
if [ "\$EUID" -ne 0 ]; then
echo "ECELD-NETSYS must be run as root"
exit 1
fi
cd "\$ECEL_NETSYS_DIR"
if pyro4-nsc list | grep -iq 'ecel.service'; then
if prompt_accepted_Yn "ECELd service already running, restart the service?"; then
echo ***** Removing Service *****
pyro4-nsc remove ecel.service
pkill eceld_service -f
pkill pyro4 -f
echo ***** Starting Service, roughly ~5 seconds *****
./eceld/eceld_service &
sleep 0.1
fi
else
echo *****Starting Service, roughly ~5 seconds
./eceld/eceld_service &
sleep 0.1
fi
ABS_DIR=$INSTALLATION_DIR
cd "\$ABS_DIR"
echo \$PWD
venv/bin/python3 main.py
EOFabs-gui
### Creating shortcut
echo "Creating shortcut"
cat > ~/Desktop/ABS.desktop <<EOFabs.desktop
[Desktop Entry]
Name=Agent Build System
StartupABSClass=Abs
Comment=ABS Launcher
GenericName=ABS UI
Exec=sudo $INSTALLATION_DIR/abs-gui
Icon=$INSTALLATION_DIR/UI/A.png
Type=Application
Categories=System;GUIDesigner;
MimeType=image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;application/x-python-code;text/x-python;application/json;image/png;
Keywords=ABS;Agent;BuildSystem;
Path= $INSTALLATION_DIR
Terminal=true
StartupNotify=false
EOFabs.desktop
chmod +x "$INSTALLATION_DIR"/abs-gui
chmod +x ~/Desktop/ABS.desktop
chmod +x "$INSTALLATION_DIR"/main.py
echo
echo "***************************************************"
echo "Installation Complete"