-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathinstall-arm.sh
executable file
·388 lines (346 loc) · 15.6 KB
/
install-arm.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#!/bin/bash
# global stuff
BASE_PATH="$HOME/osmedeus-base"
BINARIES_PATH="$BASE_PATH/binaries"
DATA_PATH="$BASE_PATH/data"
TMP_DIST="/tmp/tmp-binaries"
BAK_DIST="/tmp/bak-osm"
DEFAULT_SHELL="$HOME/.bashrc"
CWD=$(pwd)
PACKGE_MANAGER="apt-get"
SUDO="sudo"
if [ "$(whoami)" == "root" ]; then
SUDO=""
fi
[ -x "$(command -v apt)" ] && PACKGE_MANAGER="apt"
if [ -f "$HOME/.zshrc" ]; then
DEFAULT_SHELL="$HOME/.zshrc"
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
PACKGE_MANAGER="brew"
else
PACKGE_MANAGER="apt"
fi
install_banner() {
echo -e "\033[1;37m[\033[1;34m+\033[1;37m]\033[1;32m Installing $1 \033[0m"
}
announce() {
echo -e "\033[1;37m[\033[1;31m+\033[1;37m]\033[1;32m $1 \033[0m"
}
download() {
wget -q -O $1 $2
if [ ! -f "$1" ]; then
wget -q -O $1 $2
fi
}
download_multi_platform() {
if [[ "$OSTYPE" == "darwin"* ]]; then
DOWNLOAD_URL=$(echo $2 | sed -E 's/linux/darwin/g')
else
DOWNLOAD_URL=$(echo $2 | sed -E 's/darwin|osx|macos/linux/g')
fi
if [[ $(uname -p) == "arm" || $(uname -p) == "aarch64" ]]; then
DOWNLOAD_URL=$(echo $DOWNLOAD_URL | sed -E 's/amd/arm/g')
else
DOWNLOAD_URL=$(echo $DOWNLOAD_URL | sed -E 's/arm/amd/g')
fi
wget -q -O $1 $DOWNLOAD_URL
if [ ! -f "$1" ]; then
wget -q -O $1 $DOWNLOAD_URL
fi
}
extractZip() {
unzip -q -o -j $1 -d $BINARIES_PATH/
rm -rf $1
}
extractGz() {
tar -xf $1 -C $BINARIES_PATH/
rm -rf $1
}
detect_package_manager() {
if command -v apt-get &> /dev/null; then
PACKAGE_MANAGER="apt-get"
elif command -v apt &> /dev/null; then
PACKAGE_MANAGER="apt"
elif command -v yum &> /dev/null; then
PACKAGE_MANAGER="yum"
elif command -v dnf &> /dev/null; then
PACKAGE_MANAGER="dnf"
elif command -v pacman &> /dev/null; then
PACKAGE_MANAGER="pacman"
else
echo "No supported package manager found!"
exit 1
fi
announce "Detected package manager: $PACKAGE_MANAGER"
}
detect_package_manager
if [[ "$OSTYPE" == "linux"* ]]; then
$SUDO $PACKGE_MANAGER update -qq >/dev/null 2>&1
touch /var/lib/cloud/instance/locale-check.skip >/dev/null 2>&1
install_banner "wget, git, make, nmap, masscan, chromium, golang"
[ -x "$(command -v wget)" ] || $SUDO $PACKGE_MANAGER install wget -y >/dev/null 2>&1
[ -x "$(command -v curl)" ] || $SUDO $PACKGE_MANAGER install curl -y >/dev/null 2>&1
[ -x "$(command -v tmux)" ] || $SUDO $PACKGE_MANAGER install tmux -y >/dev/null 2>&1
[ -x "$(command -v git)" ] || $SUDO $PACKGE_MANAGER install git -y >/dev/null 2>&1
[ -x "$(command -v jq)" ] || $SUDO $PACKGE_MANAGER install jq -y >/dev/null 2>&1
[ -x "$(command -v nmap)" ] || $SUDO $PACKGE_MANAGER install nmap -y >/dev/null 2>&1
[ -x "$(command -v masscan)" ] || $SUDO $PACKGE_MANAGER install masscan -y >/dev/null 2>&1
[ -x "$(command -v chromium)" ] || $SUDO $PACKGE_MANAGER install chromium -y >/dev/null 2>&1
[ -x "$(command -v make)" ] || $SUDO $PACKGE_MANAGER install build-essential -y >/dev/null 2>&1
[ -x "$(command -v rg)" ] || $SUDO $PACKGE_MANAGER install ripgrep -y >/dev/null 2>&1
[ -x "$(command -v unzip)" ] || $SUDO $PACKGE_MANAGER install unzip -y >/dev/null 2>&1
[ -x "$(command -v chromium-browser)" ] || $SUDO $PACKGE_MANAGER install chromium-browser -y >/dev/null 2>&1
[ -x "$(command -v make)" ] || $SUDO $PACKGE_MANAGER install build-essential -y >/dev/null 2>&1
[ -x "$(command -v pip)" ] || $SUDO $PACKGE_MANAGER install python3 python3-pip -y >/dev/null 2>&1
else
PACKGE_MANAGER="brew"
[ -x "$(command -v wget)" ] || $PACKGE_MANAGER install wget -q >/dev/null 2>&1
[ -x "$(command -v curl)" ] || $PACKGE_MANAGER install curl -q >/dev/null 2>&1
[ -x "$(command -v tmux)" ] || $PACKGE_MANAGER install tmux -q >/dev/null 2>&1
[ -x "$(command -v git)" ] || $PACKGE_MANAGER install git -q >/dev/null 2>&1
[ -x "$(command -v jq)" ] || $PACKGE_MANAGER install jq -q >/dev/null 2>&1
[ -x "$(command -v nmap)" ] || $PACKGE_MANAGER install nmap -q >/dev/null 2>&1
[ -x "$(command -v masscan)" ] || $PACKGE_MANAGER install masscan -q >/dev/null 2>&1
[ -x "$(command -v chromium)" ] || $PACKGE_MANAGER install chromium -q >/dev/null 2>&1
[ -x "$(command -v make)" ] || $PACKGE_MANAGER install build-essential -q >/dev/null 2>&1
[ -x "$(command -v rg)" ] || $PACKGE_MANAGER install ripgrep -q >/dev/null 2>&1
[ -x "$(command -v unzip)" ] || $PACKGE_MANAGER install unzip -q >/dev/null 2>&1
[ -x "$(command -v chromium-browser)" ] || $PACKGE_MANAGER install chromium-browser -q >/dev/null 2>&1
[ -x "$(command -v timeout)" ] || $PACKGE_MANAGER install coreutils -q >/dev/null 2>&1
fi
announce "\033[1;34mSet Data Directory:\033[1;37m $DATA_PATH \033[0m"
announce "\033[1;34mSet Binaries Directory:\033[1;37m $BINARIES_PATH \033[0m"
announce "Clean up old stuff first"
rm -rf $BINARIES_PATH/* $TMP_DIST && mkdir -p $BINARIES_PATH >/dev/null 2>&1
mkdir -p "$GO_DIR" >/dev/null 2>&1
if [ -d "$HOME/osmedeus-base/data" ]; then
announce "Backup old osmedeus custom data. If you want a fresh install please run the command: \033[0mrm -rf $HOME/osmedeus-base $HOME/.osmedeus\033[0m"
rm -rf $BAK_DIST
mv $HOME/osmedeus-base $BAK_DIST
fi
announce "Cloning Osmedeus base repo:\033[0m https://github.com/osmedeus/osmedeus-base"
rm -rf $BASE_PATH && git clone --quiet --depth=1 https://github.com/osmedeus/osmedeus-base $BASE_PATH
# retry to clone in case of anything wrong with the connection
if [ ! -d "$BASE_PATH" ]; then
git clone --quiet --depth=1 https://github.com/osmedeus/osmedeus-base $BASE_PATH
fi
######## Start to install binaries
mkdir -p $BINARIES_PATH $TMP_DIST >/dev/null 2>&1
install_banner "massdns"
cd $BINARIES_PATH
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install massdns -q
cp $(which massdns) $BINARIES_PATH/massdns
else
git clone --quiet https://github.com/blechschmidt/massdns build-massdns
cd build-massdns
make 2>&1 >/dev/null
cp bin/massdns $BINARIES_PATH/massdns 2>&1 >/dev/null
rm -rf build-massdns/.git
fi
cd $BASE_PATH
install_banner "semgrep"
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install semgrep -q
else
python3 -m pip -q install semgrep
fi
cp $(which semgrep) $BINARIES_PATH/semgrep
install_banner "findomain"
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ $(uname -p) == "arm" ]]; then
download $TMP_DIST/findomain.zip https://github.com/Findomain/Findomain/releases/download/9.0.4/findomain-osx-arm64.zip
else
download $TMP_DIST/findomain.zip https://github.com/Findomain/Findomain/releases/download/9.0.4/findomain-osx-x86_64.zip
fi
else
if [[ $(uname -p) == "arm" || $(uname -p) == "aarch64" ]]; then
download $TMP_DIST/findomain.zip https://github.com/Findomain/Findomain/releases/download/9.0.4/findomain-linux.zip
else
download $TMP_DIST/findomain.zip https://github.com/Findomain/Findomain/releases/download/9.0.4/findomain-aarch64.zip
fi
extractZip $TMP_DIST/findomain.zip
fi
install_banner "packer"
rm -rf $TMP_DIST/packer.zip 2>&1 >/dev/null
export PACKER_VERSION=1.10.2
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ $(uname -p) == "arm" ]]; then
download $TMP_DIST/packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_darwin_arm64.zip
else
download $TMP_DIST/packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_darwin_amd64.zip
fi
else
if [[ $(uname -p) != "arm" ]]; then
download $TMP_DIST/packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip
else
download $TMP_DIST/packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_arm64.zip
fi
fi
extractZip $TMP_DIST/packer.zip
install_banner "csvtk"
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install csvtk -q
cp $(which csvtk) $BINARIES_PATH/csvtk
else
if [[ $(uname -p) == "arm" || $(uname -p) == "aarch64" ]]; then
download $TMP_DIST/csvtk.gz https://github.com/shenwei356/csvtk/releases/download/v0.30.0/csvtk_linux_arm64.tar.gz
else
download $TMP_DIST/csvtk.gz https://github.com/shenwei356/csvtk/releases/download/v0.30.0/csvtk_linux_amd64.tar.gz
fi
extractGz $TMP_DIST/csvtk.gz
fi
install_banner "rustscan"
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install rustscan -q
else
wget -q -O /tmp/rustscan.deb https://github.com/RustScan/RustScan/releases/download/2.0.1/rustscan_2.0.1_amd64.deb 2>&1 >/dev/null
dpkg -i /tmp/rustscan.deb 2>&1 >/dev/null
rm -rf /tmp/rustscan.deb 2>&1 >/dev/null
fi
cp $(which rustscan) $BINARIES_PATH/rustscan 2>&1 >/dev/null
install_banner "metabigor"
download_multi_platform $TMP_DIST/metabigor.gz https://github.com/j3ssie/metabigor/releases/download/v2.0.0/metabigor_v2.0.0_darwin_arm64.tar.gz
extractGz $TMP_DIST/metabigor.gz
install_banner "trufflehog"
TRUFFLEHOG_VERSION=$(curl -s https://api.github.com/repos/trufflesecurity/trufflehog/releases/latest | jq -r '.name' | sed 's/v//g')
download_multi_platform $TMP_DIST/trufflehog.gz https://github.com/trufflesecurity/trufflehog/releases/download/v${TRUFFLEHOG_VERSION}/trufflehog_${TRUFFLEHOG_VERSION}_darwin_arm64.tar.gz
extractGz $TMP_DIST/trufflehog.gz
######## Start to install golang
cd $CWD
# update golang version
install_banner "Golang"
export GO_BIN=$(which go)
if [ -f "$GO_BIN" ]; then
announce "Detected go binary: $GO_BIN"
announce "Skipping golang installation"
fi
export GOPATH=$(go env GOPATH)
export GO_DIR="$GOPATH/bin"
export GO_BIN=$(which go)
if [ -d "$GOPATH" ]; then
announce "The current GOPATH already exists. Try to install the latest version of Golang"
fi
# (re)install fresh golang
# brew install golang -q 2>&1 > /dev/null
export GO_LATEST_VERSION=$(curl -s 'https://go.dev/VERSION?m=text' | grep 'go' | sed 's/go//g')
install_banner "latest go version: $GO_LATEST_VERSION"
wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash -s -- --version $GO_LATEST_VERSION
export GOROOT=$HOME/.go
export PATH=$GOROOT/bin:$PATH
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export GO_DIR="$GOPATH/bin"
export GO_BIN=$(which go)
announce "Detected go binary:\033[1;37m $GO_BIN\033[0m"
announce "Detected go tools:\033[1;37m $GO_DIR\033[0m"
CURRENT_GO=$(go version)
announce "Required golang verion >= v1.17"
announce "Detected current golang version:\033[1;37m $CURRENT_GO\033[0m"
cd $CWD
##
# Install go stuff
##
install_banner "osmedeus"
$GO_BIN install github.com/j3ssie/osmedeus@latest 2>&1 >/dev/null
install_banner "goaltdns"
$GO_BIN install github.com/subfinder/goaltdns@latest 2>&1 >/dev/null
install_banner "assetfinder"
$GO_BIN install github.com/tomnomnom/assetfinder@latest 2>&1 >/dev/null
install_banner "httprobe"
$GO_BIN install github.com/tomnomnom/httprobe@latest 2>&1 >/dev/null
install_banner "unfurl"
$GO_BIN install github.com/tomnomnom/unfurl@latest 2>&1 >/dev/null
$GO_BIN install github.com/tomnomnom/anew@latest 2>&1 >/dev/null
install_banner "go cli-utils"
$GO_BIN install github.com/shenwei356/rush@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/go-auxs/chrunk@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/cinfo@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/cdnstrip@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/str-replace@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/durl@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/json-cleaner@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/go-auxs/ourl@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/go-auxs/urp@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/go-auxs/cleansub@latest 2>&1 >/dev/null
$GO_BIN install github.com/j3ssie/go-auxs/junique@latest 2>&1 >/dev/null
$GO_BIN install github.com/theblackturtle/ptools/wurl@latest 2>&1 >/dev/null
install_banner "github-endpoints"
$GO_BIN install github.com/gwen001/github-endpoints@latest 2>&1 >/dev/null
install_banner "github-subdomains"
$GO_BIN install github.com/gwen001/github-subdomains@latest 2>&1 >/dev/null
GO111MODULE=off $GO_BIN get -u github.com/Josue87/gotator 2>&1 >/dev/null
install_banner "puredns"
$GO_BIN install github.com/d3mondev/puredns/v2@latest 2>&1 >/dev/null
install_banner "amass"
$GO_BIN install github.com/owasp-amass/amass/v4/...@master 2>&1 >/dev/null
install_banner "gau"
$GO_BIN install github.com/lc/gau@latest 2>&1 >/dev/null
install_banner "shuffledns"
$GO_BIN install github.com/projectdiscovery/shuffledns/cmd/shuffledns@latest 2>&1 >/dev/null
install_banner "dnsx"
$GO_BIN install github.com/projectdiscovery/dnsx/cmd/dnsx@latest 2>&1 >/dev/null
install_banner "tlsx"
$GO_BIN install github.com/projectdiscovery/tlsx/cmd/tlsx@latest 2>&1 >/dev/null
install_banner "alterx"
$GO_BIN install github.com/projectdiscovery/alterx/cmd/alterx@latest 2>&1 >/dev/null
install_banner "katana"
$GO_BIN install github.com/projectdiscovery/katana/cmd/katana@latest 2>&1 >/dev/null
install_banner "httpx"
$GO_BIN install github.com/projectdiscovery/httpx/cmd/httpx@latest 2>&1 >/dev/null
install_banner "nuclei"
$GO_BIN install github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest 2>&1 >/dev/null
install_banner "naabu"
$GO_BIN install github.com/projectdiscovery/naabu/v2/cmd/naabu@latest 2>&1 >/dev/null
install_banner "subfinder"
$GO_BIN install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest 2>&1 >/dev/null
install_banner "notify"
$GO_BIN install github.com/projectdiscovery/notify/cmd/notify@latest 2>&1 >/dev/null
install_banner "gospider"
$GO_BIN install github.com/jaeles-project/gospider@latest 2>&1 >/dev/null
install_banner "jaeles"
$GO_BIN install github.com/jaeles-project/jaeles@latest 2>&1 >/dev/null
install_banner "ffuf"
$GO_BIN install github.com/ffuf/ffuf/v2@latest 2>&1 >/dev/null
# just to make sure the binary has been installed
[ -x "$(command -v osmedeus)" ] || $GO_BIN install github.com/j3ssie/osmedeus@latest 2>&1 >/dev/null
announce "Copy all go tools from:\033[1;37m $GO_DIR\033[0m"
cp $GO_DIR/* $BINARIES_PATH/ >/dev/null 2>&1
chmod +x $BINARIES_PATH/*
export PATH=$BINARIES_PATH:$PATH
###### done the binaries part
install_banner "Osmedeus Web UI"
rm -rf $HOME/.osmedeus/server/* >/dev/null 2>&1
mkdir -p $HOME/.osmedeus/server >/dev/null 2>&1
cp -R $BASE_PATH/ui $HOME/.osmedeus/server/ui >/dev/null 2>&1
install_banner "Osmedeus Community Workflow:\033[0m https://github.com/osmedeus/osmedeus-workflow"
rm -rf $BASE_PATH/workflow >/dev/null 2>&1
git clone --quiet --depth=1 https://github.com/osmedeus/osmedeus-workflow $BASE_PATH/workflow
## retry to clone in case of anything wrong with the connection
if [ ! -d "$BASE_PATH/workflow" ]; then
git clone --quiet --depth=1 https://github.com/osmedeus/osmedeus-workflow $BASE_PATH
fi
announce "Downloading Vulnerability templates"
jaeles config init >/dev/null 2>&1
rm -rf $HOME/nuclei-templates && git clone --quiet --depth=1 https://github.com/projectdiscovery/nuclei-templates.git $HOME/nuclei-templates >/dev/null 2>&1
if [ -d "$BAK_DIST/data" ]; then
announce "Updating old data + cloud config ..."
rm -rf $HOME/osmedeus-base/data && cp -R $BAK_DIST/data $HOME/osmedeus-base/data
fi
if [ -d "$BAK_DIST/cloud" ]; then
rm -rf $HOME/osmedeus-base/cloud && cp -R $BAK_DIST/cloud $HOME/osmedeus-base/cloud
fi
if [ -d "$BAK_DIST/token" ]; then
rm -rf $HOME/osmedeus-base/token && cp -R $BAK_DIST/token $HOME/osmedeus-base/token
fi
rm -rf $BAK_DIST >/dev/null 2>&1
echo "---->>>"
osmedeus health
echo "---->>>"
announce "The installation is done..."
announce "Check here if you want to setup API & token:\033[0m https://docs.osmedeus.org/installation/token/"
announce "Run\033[0m source $DEFAULT_SHELL \033[1;32mto complete the install"
osmedeus config set --threads-hold=10
osmedeus config set --client-name PublicIP
announce "You can change the default Threads Hold with the command:\033[0m osmedeus config set --threads-hold=<number-of-threads> \033[1;32m"