-
Notifications
You must be signed in to change notification settings - Fork 162
/
install.sh
239 lines (231 loc) Β· 11.9 KB
/
install.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
#!/bin/bash
black='\e[38;5;016m'
bluebg='\e[48;5;038m'${black}
red='\e[31m'
redbg='\e[30;41m'${black}
lightred='\e[91m'
blink='\e[5m'
lightblue='\e[38;5;109m'
green='\e[32m'
greenbg='\e[48;5;038m'${black}
yellow='\e[33m'
logo='\033[0;36m'
upper="${lightblue}β$(printf '%.0sβ' $(seq "80"))β${end}"
lower="${lightblue}β$(printf '%.0sβ' $(seq "80"))β${end}"
right=$(printf '\u2714')
cross=$(printf '\u2718')
end='\e[0m'
program="β‘·β πππππ ππΈβ β’Ύ"
version="v2"
description="Premium Shodan Recon"
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
declare -A tools='(
["python3"]="sudo apt install python3 -y -qq"
["cvemap"]="go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest"
["pip3"]="sudo apt install python3-pip -y -qq"
["shodan"]="sudo python3 -m pip install -U shodan"
["mmh3"]="sudo python3 -m pip install -U mmh3"
["jq"]="sudo apt install jq -y -qq"
["httprobe"]="go install github.com/tomnomnom/httprobe@master"
["interlace"]="sudo git clone https://github.com/codingo/Interlace.git"
["nuclei"]="go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest"
["lolcat"]="sudo apt install lolcat -y -qq"
["anew"]="go install github.com/tomnomnom/anew@master"
)'
##########
function banner(){
printf "\n${upper}\n\t${logo}${program} helper script to prepare the environment\n${lower}${end}\n\n">&2
}
function help(){
printf "Usage:\n">&2
printf "\t--check :\t\tTo check installed prerequisite packages/tools/libs\n">&2
printf "\t--install :\t\tTo install prerequisite packages/tools/libs\n">&2
printf "\t-h/--help :\t\tHelp\n">&2
printf '\n\n' >&2
printf "βββββββββ[ ${lightred}me_dheeraj [Author]${end} ]ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n\n" >&2
printf "${logo}\t - https://buymeacoffee.com/medheeraj${end}\n" >&2
printf "${logo}\t - https://github.com/Dheerajmadhukar${end}\n" >&2
printf "${logo}\t - https://twitter.com/Dheerajmadhukar${end}\n" >&2
printf "${logo}\t - https://www.youtube.com/c/DheerajMadhukar${end}\n" >&2
printf "${logo}\t - https://linkedin.com/in/dheerajtechnolegends${end}\n" >&2
printf "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n\n" >&2
}
function check_install(){
for i in "${!tools[@]}";do
if [[ $i == "go" ]];then
if ${i} version &> /dev/null;then
printf "${green} [+] ${i} ${end}\t:\t${logo}`go version | awk '{print $3}'`${end}\n"
else
printf " ${redbg}[-] ${i} ${end}\t:\t${red}Manually install: \`${tools[$i]}\` OR \`bash install.sh --install\`${end}\n"
fi
elif [[ $i == "mmh3" ]];then
if python3 -c "import mmh3" &> /dev/null;then
printf "${green} [+] ${i} ${end}\t:\t${logo}`pip3 list | grep 'mmh3'|awk '{print $NF}'`${end}\n"
else
printf "${redbg} [-] ${i} ${end}\t:\t${red}Manually install: \`pip3 install -U mmh3\` OR \`bash install.sh --install\`${end}\n"
fi
elif [[ $i == "python3" ]];then
if ${i} <<<"exit()"&>/dev/null;then
printf "${green} [+] ${i} ${end}\t:\t${logo}`python3 -V | awk '{print $NF}'`${end}\n"
else
printf " ${redbg}[-] ${i} ${end}\t:\t${red}Manually install: \`${tools[$i]}\` OR \`bash install.sh --install\`${end}\n"
fi
elif [[ $i == "lolcat" ]];then
if ${i} --version&>/dev/null;then
printf "${green} [+] ${i} ${end}\t:\t${logo}`lolcat --version | awk '{print $2}'`${end}\n"
else
printf " ${redbg}[-] ${i} ${end}\t:\t${red}Manually install: \`${tools[$i]}\` OR \`bash install.sh --install\`${end}\n"
fi
else
${i} --help &> /dev/null
if [[ ! $? -eq 0 ]];then
printf "${redbg} [-] ${i} ${end}\t:\t${red}Manually install: \`${tools[$i]}\` OR \`bash install.sh --install\`${end}\n"
else
if [[ ${i} == "cvemap" ]];then
printf " ${green}[+] ${i} ${end}\t:\t${logo}`cvemap -version 2>&1| awk '{print $NF}'`\n${end}"
elif [[ ${i} == "pip3" ]];then
printf " ${green}[+] ${i} ${end}\t:\t${logo}`pip3 -V | awk '{print $2}'`${end}\n"
elif [[ ${i} == "shodan" ]];then
printf " ${green}[+] ${i} ${end}\t:\t${logo}`shodan version`${end}\n"
elif [[ ${i} == "jq" ]];then
printf " ${green}[+] ${i} ${end}\t:\t${logo}`jq --version`${end}\n"
elif [[ ${i} == "nuclei" ]];then
printf " ${green}[+] ${i} ${end}\t:\t${logo}`nuclei -version 2>&1|head -1|awk '{print $NF}'`${end}\n"
elif [[ ${i} == "anew" ]];then
printf " ${green}[+] ${i} ${end}\n"
elif [[ ${i} == "httprobe" ]];then
printf " ${green}[+] ${i} ${end}\n"
elif [[ ${i} == "interlace" ]];then
printf " ${green}[+] ${i} ${end}\n"
fi
fi
fi
done
}
function install_tools(){
for i in ${!tools[@]};do
if [[ $i == "mmh3" ]];then
if ! python3 -c "import mmh3" &> /dev/null;then
echo "Installing tool...: ${tools[$i]}"
${tools[$i]} pip setuptools #&> /dev/null
printf "${green} [+] ${i} Installed${end}\n"
fi
elif [[ $i == "lolcat" ]];then
if ! ${i} --version &> /dev/null;then
${tools[${i}]} #&> /dev/null
fi
elif [[ $i == "interlace" ]];then
if ! ${i} --help &> /dev/null;then
${tools[${i}]} #&> /dev/null
cd ${BASE_DIR}/Interlace #&> /dev/null
pip3 install -r requirements.txt #&> /dev/null
python3 setup.py install #&>/dev/null
fi
else
${i} --help &> /dev/null
if [[ ! $? -eq 0 ]];then
${tools[$i]} #&> /dev/null
if [[ $? -eq 0 ]];then
echo "Installing tool...: ${tools[$i]}"
printf "${green} [+] ${i} Installed${end}\n"
fi
fi
fi
done
}
prarg(){
set +u
case $1 in
'--check')
banner
check_install
shift
;;
'--install')
banner
if ! go version &> /dev/null;then
#${tools[${i}]}
OS="$(uname -s)"
ARCH="$(uname -m)"
case $OS in
"Linux")
case $ARCH in
"x86_64")
ARCH=amd64
;;
"aarch64")
ARCH=arm64
;;
"armv6" | "armv7l")
ARCH=armv6l
;;
"armv8")
ARCH=arm64
;;
"i686")
ARCH=386
;;
.*386.*)
ARCH=386
;;
esac
PLATFORM="linux-$ARCH"
;;
"Darwin")
case $ARCH in
"x86_64")
ARCH=amd64
;;
"arm64")
ARCH=arm64
;;
esac
PLATFORM="darwin-$ARCH"
;;
esac
LATEST_GO_VERSION="$(curl --silent 'https://go.dev/VERSION?m=text' | head -n 1)";
LATEST_GO_DOWNLOAD_URL="https://go.dev/dl/${LATEST_GO_VERSION}.${PLATFORM}.tar.gz"
printf "cd to home ($USER) directory \n"
cd $HOME
printf "Downloading ${LATEST_GO_DOWNLOAD_URL}\n\n";
curl -kOJ -L --progress-bar $LATEST_GO_DOWNLOAD_URL
printf "Extracting file...\n"
tar -xf ${HOME}/${LATEST_GO_VERSION}.linux-amd64.tar.gz -C ${HOME}
export GOROOT="$HOME/go" 2>&1 > /dev/null
export GOPATH="$HOME/go/packages" 2>&1 > /dev/null
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin 2>&1 > /dev/null
printf "APPENDING THIS LINE BELOW TO YOUR ~/.bashrc OR ~/.zshrc: \n
export GOROOT=\"$HOME/go\"\n
export GOPATH=\"$HOME/go/packages\"\n
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin\n
\n"
install_tools
go version
else
install_tools
printf "${bluebg}Ready to rock the digital realm !!!${end}\n"
printf " ${green}[+] GO ${end}\t:\t${logo}`go version 2>&1| grep -v 'warning:'| awk '{print $3}'`${end}\n"
check_install
fi
shift
;;
'-h'|'--help')
banner
help
exit 0
;;
*)
printf "${red}Error: unknown/invalid: $1, check '-h/--help'${end}\n"
help
exit 1
;;
"")
printf "${red}Error: option/argument required, check '-h/--help'${end}\n"
help
exit 2
;;
esac
}
prarg $@
tput sgr0
#####################