forked from asset-group/5ghoul-5g-nr-attacks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequirements.sh
executable file
·270 lines (238 loc) · 7.68 KB
/
requirements.sh
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/usr/bin/env bash
set -eo pipefail
CLANG_VERSION=15
ARCH="$(uname -m)"
KERNEL="$(uname -r)"
# Configure deploy token
if [[ -v CI_DEPLOY_USER ]]
then
echo "Configuring credentials for CI/CD..."
git config --global credential.helper store
echo "https://$CI_DEPLOY_USER:[email protected]" > ~/.git-credentials
fi
if [ "$1" == "dev" ]
then
# Make sure that .config is used
git config --local include.path ../.gitconfig || true
# Ubuntu dev. requirements
sudo apt install software-properties-common kmod bc gzip curl git wget zstd python3-dev flex bison pkg-config swig graphviz libglib2.0-dev libgcrypt-dev libnl-genl-3-200 \
libgraphviz-dev liblz4-dev libsnappy-dev libgnutls28-dev libxml2-dev libnghttp2-dev libkrb5-dev libnl-3-dev libspandsp-dev libxrandr-dev libxinerama-dev libxcursor-dev \
libxi-dev libnl-genl-3-dev libnl-route-3-dev libnl-nf-3-dev libcap-dev libbrotli-dev libsmi2-dev liblua5.2-dev libc-ares-dev libsbc-dev libspeexdsp-dev libfreetype6-dev libxss1 \
libtbb-dev libnss3-dev libudev-dev libpulse-dev libpcre2-dev libasound2-dev libgl1-mesa-dev libssh-dev libmaxminddb-dev libopus-dev libusb-1.0-0 psmisc sshpass tcpdump -y
# folly requirements
sudo apt install libgoogle-glog-dev libzstd-dev libevent-dev libunwind-dev libdouble-conversion-dev libgflags-dev -y
# Install clang-15 for Ubuntu
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y # add missing libgcc-s1 on Ubuntu18.04
sudo mkdir -p /usr/lib/python3.6/dist-packages/
sudo ./scripts/install_llvm.sh $CLANG_VERSION
CLANG_VERSION_FULL=$(clang-$CLANG_VERSION --version | grep -o -i -E "([0-9]+.){2}[0-9]")
# Fix lldb-15 on ubuntu18.04
sudo ln -sf /usr/lib/llvm-$CLANG_VERSION/lib/python3.6/site-packages/lldb /usr/lib/python3.6/dist-packages/lldb || true
# Install gcc-9 headers and libraries for use with Clang 15
sudo apt install gcc-9 g++-9 libstdc++-9-dev -y
# Install qt 5.12.2 on x86 arch
if [ $ARCH == "x86_64" ]
then
sudo add-apt-repository ppa:beineri/opt-qt-5.12.2-bionic -y
sudo apt install qt512base qt512tools qt512svg qt512multimedia mesa-common-dev -y
fi
# Install nodejs
if ! which node > /dev/null;
then
echo "nodejs not found, installing now..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt update
sudo apt install nodejs -y
else
echo "nodejs found!"
fi
# Install quicktype
if ! which quicktype > /dev/null;
then
echo "quicktype not found, installing now..."
sudo npm install -g quicktype || echo -e "\nError. Make sure to install nodejs"
else
echo "quicktype found!"
fi
# Install python pip
if ! which pip3 > /dev/null;
then
echo "pip3 not found, installing now..."
wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
sudo python3 get-pip.py
rm get-pip.py
else
echo "pip3 found!"
fi
# Python3 packages
sudo python3 -m pip install \
cmake==3.24.1 -U \
ninja==1.11.1 -U \
meson==0.53.0 --use-feature=2020-resolver
elif [ "$1" == "doc" ]
then
sudo apt install python build-essential fonts-noto-color-emoji -y
# Install nodejs
if ! which node > /dev/null;
then
echo "nodejs not found, installing now..."
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt update
sudo apt install nodejs -y
else
echo "nodejs found!"
fi
# Install local nodejs documentation requirements
npm install
cd docs/old_greyhound/
npm install
cd ../../
elif [ "$1" == "3gpp" ]
then
if [ ! -f ".3gpp" ] #
then
# Install basic runtime requirements
./requirements.sh
# Install extra requirements
sudo apt install -y wget xxd libc-bin
# Clone 3rd-party tools and apply patches
./scripts/apply_patches.sh 3rd-party
# Install python pip
if ! which pip3 > /dev/null;
then
echo "pip3 not found, installing now..."
wget https://bootstrap.pypa.io/pip/3.6/get-pip.py
sudo python3 get-pip.py
rm get-pip.py
else
echo "pip3 found!"
fi
# Python3 packages
sudo python3 -m pip install \
cmake==3.24.1 -U \
ninja==1.11.1 -U \
meson==0.53.0 --use-feature=2020-resolver || true
sudo python3 -m pip install \
cmake==3.24.1 -U \
ninja==1.11.1 -U \
meson==0.53.0 || true
# Install ModemManager requirements
cd 3rd-party/ModemManager/
./requirements.sh
./build.sh
cd ../../
cd 3rd-party/open5gs-core/
./requirements.sh
./build.sh
cd ../
# Build and install misc requirements (TODO: remove)
# libzmq
git clone https://github.com/zeromq/libzmq.git --depth=1 || true
cd libzmq
./autogen.sh
./configure
make -j
sudo make install
sudo ldconfig
cd ../
# libczmq
git clone https://github.com/zeromq/czmq.git --depth=1 || true
cd czmq
./autogen.sh
./configure
make -j
sudo make install
sudo ldconfig
cd ../
# libjson-c
git clone https://github.com/json-c/json-c.git --depth=1 || true
cd json-c
mkdir -p build
cd build
cmake ../
make -j
sudo make install
sudo ldconfig
cd ../../../
touch .3gpp
fi
echo -e "3GPP requirements built and installed"
elif [ "$1" == "4g" ]
then
./requirements.sh 3gpp
cd 3rd-party/oai_4g_lte/openair-ran
./build_all.sh
elif [ "$1" == "5g" ]
then
./requirements.sh 3gpp
cd 3rd-party/oai_5g_sa
source oaienv
cd cmake_targets
./build_oai -I -w USRP --gNB --nrUE --ninja --noavx512
# TODO: add --noavx512 later
elif [ "$1" == "all" ]
then
./requirements.sh 3gpp 4g
./requirements.sh 3gpp 5g
# TODO
elif [ "$1" == "wifi" ]
then
# Install basic runtime requirements
./requirements.sh
# Wi-Fi requirements
sudo apt install linux-headers-${KERNEL} -y || true
sudo apt install dnsmasq net-tools iptables -y
sudo cp src/drivers/wifi/rtl8812au/85-nm-unmanaged.rules /etc/udev/rules.d/85-nm-unmanaged.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
cd src/drivers/wifi/rtl8812au/
make -j4
cd ../../../../
elif [ "$1" == "evaluation" ]
then
# Evaluation packages
sudo python3 -m pip install numpy pandas python-pcapng==1.0 matplotlib
sudo apt install expect
else
# Minimal Ubuntu Packages to run binary WDissector and Wireshark distribution
sudo apt update
sudo apt install -y g++ software-properties-common kmod libglib2.0-dev libsnappy1v5 libsmi2ldbl liblua5.2-0 libc-ares2 \
libnl-route-3-200 libnl-genl-3-200 libfreetype6 graphviz libtbb2 libxss1 libnss3 libspandsp2 libsbc1 libbrotli1 libnghttp2-14 \
libasound2 psmisc sshpass libpulse0 libasound2 libpcre2-dev libmaxminddb0 libopus0 libspeex1 bc tcpdump libgoogle-glog0v5 \
libgflags2.2 libzstd1 libunwind8 libcap2 libspeexdsp1 libxtst6 libatk-bridge2.0-0 libusb-1.0-0
# Install updated c++ glibcxx
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt install libstdc++-9-dev -y
# Install qt 5.12.2 runtime for ubuntu
if [ "$(lsb_release -sr)" == "18.04" ]
then
if [ $ARCH == "x86_64" ]
then
sudo add-apt-repository ppa:beineri/opt-qt-5.12.2-bionic -y || true
sudo apt install qt512base qt512multimedia -y || true
fi
else
# For ubuntu 20.04 and beyound
if [ $ARCH == "x86_64" ] # Only install qt for x86_64
then
sudo apt install qtbase5-dev libqt5multimedia5 -y || true
fi
# For ubuntu 22.04 and beyound
if [ $(echo "$(lsb_release -sr) >= 22.04" | bc ) == "1" ]
then
# Install missing libssl1.1.1 for ubuntu 22.04 and beyound
if [ -z "$(dpkg -l | grep libssl1.1)" ]
then
if [ $ARCH == "x86_64" ]
then
wget http://launchpadlibrarian.net/367327833/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo apt install -y ./libssl1.1_1.1.0g-2ubuntu4_amd64.deb
rm libssl1.1_1.1.0g-2ubuntu4_amd64.deb
else
wget http://launchpadlibrarian.net/367327970/libssl1.1_1.1.0g-2ubuntu4_arm64.deb
sudo apt install -y ./libssl1.1_1.1.0g-2ubuntu4_arm64.deb
rm libssl1.1_1.1.0g-2ubuntu4_arm64.deb
fi
fi
fi
fi
fi