-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
291 lines (286 loc) · 13.6 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
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
#!/bin/bash
WHITE=('\033[38;5;15m');
GREEN=('\033[38;5;46m');
DARK=('\033[38;5;245m');
BLUE=('\033[38;5;51m');
RED=('\033[38;5;1m');
BOLD=('\033[01m');
ORANGE=('\033[38;5;202m');
UNDERLINE=('\033[04m');
STRIKE=('\033[09m');
DIM=('\033[2m');
RESET=('\033[0m');
BLINK=('\033[5m');
Version=('V-0.2');
filename=$(basename $0)
if [[ ${#1} -le 1 ]]; then
usage
fi
# Determine if user is root or not
if [[ $UID != 0 ]]; then
export user=${USER}
else
export user=root
fi
# Detect distro
if grep -q "bian" /etc/os-release; then
export OS='Debian'
elif grep -q 'arch' /etc/os-release; then
export OS='Arch'
fi
# Detect shell
if echo $SHELL | grep -qi "zsh";
then
export user_shell="zsh"
elif echo $SHELL | grep -qi "bash";
then
export user_shell="bash";
else
export user_shell='bash';
fi
echo -e "${RED} :xXMMMMXx: "
echo -e "${RED} .ckXMMMMMMMMMMMMXkc. "
echo -e "${RED} oNMMMMMMMMMMMMMMMMMMMMNo "
echo -e "${RED} .WMMMMMMMMMMMMMMMMMMMMMMMMW. "
echo -e "${RED} WMMMMMMMMMMMMMMMMMMMMMMMMMMW "
echo -e "${RED}xMMMMMMMMMMMMMMMMMMMMMMMMMMMMk "
echo -e "${RED}MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM "
echo -e "${RED}xMW .:OWMMMMMMMMMMMMMMWOc. NMO "
echo -e "${RED} MM. ,o0WMMMMMMW0o, .WM "
echo -e "${RED} NK:. ,OMMO, .;KW "
echo -e "${RED} xMMMNKOOXMK::KMXOOKNMMMk "
echo -e "${RED} oMMMMM0;MMW.od.WMM;OMMMMMd "
echo -e "${RED} .MMM: MMM0MM0MMM :MMM. "
echo -e "${RED} WMxMkdMxMW "
echo -e "${RED} cM:MdlM:Ml "
echo -e "${RED} ,M,MdoM,M; "
echo -e "${RED} .M.MdoM.M. "
echo -e "${RED} .M.NolW.M. "
echo -e "${RED} d.0c:K.x "
echo -e " ${DARK}╔══════════════════════╗"
echo -e " ${DARK}║${GREEN} ┳━┓${DARK}┳ ┓┏┓┓┏━┓${BLUE}┳━┓┏┓┓┳━┓${DARK}║"
echo -e " ${DARK}║${GREEN} ┃━┫${DARK}┃ ┃ ┃ ┃ ┃${BLUE}┣━ ┃ ┃━┛${DARK}║"
echo -e " ${DARK}║${GREEN} ┛ ┇${DARK}┇━┛ ┇ ┛━┛${BLUE}┇ ┇ ┇ ${DARK}║"
echo -e " ${DARK}║ ${DIM}${GREEN}${Version}${RESET}${BOLD} ${DARK}║"
echo -e " ${DARK}╚══════════════════════╝"
loading() {
zero='0'
e=(' ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏ ')
g=('↰ ↱ ↲ ↳')
d=(' ◜ ◠ ◝ ◞ ◡ ◟ ')
echo -e $ORANGE
for i in {1..10}; do
for z in ${e[@]}; do
printf "\r$z $i$zero%%"
sleep 0.01
done
done
echo
return
}
completion() {
if [[ -d /usr/share/bash-completion ]]; then
sudo cp autoftp.completion /usr/share/bash-completion/completions
if [[ ${user_shell} = 'zsh' ]]; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Setting up tab completion for ${GREEN}${USER}${WHITE}-${GREEN}${user_shell} ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
if grep -q "autoftp.completion" $HOME/.zshrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script found already${WHITE}. ${RED}Doing nothing ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif ! grep -q 'autoftp.completion' $HOME/.zshrc; then
echo 'autoload bashcompinit' >> $HOME/.zshrc
echo 'bashcompinit' >> $HOME/.zshrc
echo 'autoload -U +X compinit && compinit' >> $HOME/.zshrc
echo 'source /usr/share/bash-completion/completions/autoftp.completion' >> $HOME/.zshrc
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script added${WHITE}.${GREEN} Restart your shell for changes to take effect${WHITE}.${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
fi
elif [[ ${user_shell} = 'bash' ]]; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Setting up tab completion for ${GREEN}${USER}${WHITE}-${GREEN}${user_shell} ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
if grep -q "autoftp.completion" $HOME/.bashrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script found already${WHITE}. ${RED}Doing nothing ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif ! grep -q 'autoftp.completion' $HOME/.bashrc; then
echo "source /usr/share/bash-completion/completions/autoftp.completion" >> $HOME/.bashrc
fi
fi
else
echo -e "${DARK}[${RED}!${DARK}]${RED} The tab completion package is not installed in your system ${DARK}[${RED}!${DARK}]"
echo -e "${BLUE}It is not required to have this package installed${WHITE}. ${BLUE}You can choose ${RED}no${BLUE} if you${WHITE}'${BLUE}d like"
echo -e "${GREEN}Install now ${WHITE}? ${DARK}[${BLUE}yes${WHITE}/${RED}no${DARK}]"
read -p "[ ${USER}@AutoFTP ~ ]$ " answer2
if [[ ${answer2} == [yY] || ${answer2} == [yY][eE][sS] ]]; then
echo -e "${GREEN}Detecting your distro"
if [[ ${OS} = 'Debian' ]]; then
sudo apt install bash-completion
completion
elif [[ ${OS} = 'Arch' ]]; then
sudo pacman -S bash-completion
completion
fi
elif [[ ${answer2} == [nN] || ${answer2} == [nN][oO] ]]; then
echo -e "${DARK}[${RED}!${DARK}]${RED} Not installing package${WHITE}: '${GREEN}bash-completion${WHITE}'.${BLUE} Copying included completion files to your system${WHITE}. ${DARK}[${RED}!${DARK}]"
sudo mkdir -p /usr/share/autoftp/completion
sudo cp autoftp.completion /usr/share/autoftp/completion/autoftp.completion
if [[ ${user_shell} = 'zsh' ]]; then
if grep -q "autoftp.completion" $HOME/.zshrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script found already${WHITE}. ${RED}Doing nothing ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif ! grep -q 'autoftp.completion' $HOME/.zshrc; then
echo 'autoload bashcompinit' >> $HOME/.zshrc
echo 'bashcompinit' >> $HOME/.zshrc
echo 'autoload -U +X compinit && compinit' >> $HOME/.zshrc
echo 'source /usr/share/autoftp/completion/autoftp.completion' >> $HOME/.zshrc
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script added${WHITE}.${GREEN} Restart your shell for changes to take effect${WHITE}.${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
fi
elif [[ ${user_shell} = 'bash' ]]; then
if grep -q "autoftp.completion" $HOME/.bashrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Completion script found already${WHITE}. ${RED}Doing nothing ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif ! grep -q 'autoftp.completion' $HOME/.bashrc; then
echo "source /usr/share/autoftp/completion/autoftp.completion" >> $HOME/.bashrc
fi
fi
fi
fi
}
info() {
echo -e "${DARK}Script ${GREEN}A${DARK}uto${BLUE}FTP info${WHITE}:
${GREEN}A${DARK}uto${BLUE}FTP is an automated brute force script written in python${WHITE}.
${BLUE}You have the option of using a local wordlist or remote wordlists${WHITE}.
${BLUE}This script also features bash completion and tab completion${WHITE}. ${BLUE}When at an input function${WHITE},
${BLUE}press tab to see the available completions${WHITE}.
${BLUE}For the bash-completion${WHITE}, ${BLUE}you${WHITE}'${BLUE}ll need to install this script${WHITE}"
}
usage() {
echo -e ${BLUE}"${GREEN}A${DARK}uto${BLUE}FTP Installation Options:
${DARK}-r ${BLUE}Install requirements and run without installing
${DARK}-t ${BLUE}Install requirements and install script
${GREEN}Usage${WHITE}: .${GREEN}/${DARK}$filename ${DARK}-[${BLUE}option${DARK}]"
return
}
run() {
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Running ${GREEN}A${DARK}uto${BLUE}FTP ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
loading
echo -e "${DARK}[${RED}!${DARK}]${RED} Installing necessary dependencies to run ${GREEN}A${DARK}uto${BLUE}FTP${WHITE}. ${DARK}[${RED}!${DARK}]"
if [[ ${OS} = 'Debian' ]]; then
sudo cp /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-distutils
sudo apt-get install python3-apt
fi
}
install() {
if [[ ${user_shell} = 'bash' ]]; then
if grep -q "autoftp.completion" $HOME/.bashrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Installing ${GREEN}A${DARK}uto${BLUE}FTP ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
loading
sudo cp autoftp /usr/bin/ && sudo chmod +x /usr/bin/autoftp && sudo /bin/pip install -r requirements.txt
if [[ ${OS} = 'Debian' ]]; then
sudo cp /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-distutils
sudo apt-get install python3-apt
fi
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${GREEN}A${DARK}uto${BLUE}FTP ${GREEN} has been installed ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
loading
else
echo -e "${DARK}[${RED}!${DARK}]${BLUE} Tab completion for ${GREEN}A${DARK}uto${BLUE}FTP ${BLUE}is not found in system${WHITE}. ${DARK}[${RED}!${DARK}]"
echo -e "${GREEN}Install now ${WHITE}? ${DARK}[${BLUE}yes${WHITE}/${RED}no${DARK}]"
read -p "[ ${USER}@AutoFTP ~ ]$ " answer3
if [[ ${answer3} == [yY] || ${answer3} == [yY][eE][sS] ]]; then
completion
elif [[ ${answer3} == [nN] || ${answer3} == [nN][oO] ]]; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Proceed with installation of ${GREEN}A${DARK}uto${BLUE}FTP ${BLUE}without tab completion installation ${WHITE}? ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
else
install
fi
fi
elif [[ ${user_shell} = 'zsh' ]]; then
if grep -q "autoftp.completion" $HOME/.zshrc; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Installing ${GREEN}A${DARK}uto${BLUE}FTP ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
loading
sudo cp autoftp /usr/bin/ && sudo chmod +x /usr/bin/autoftp && sudo /bin/pip install -r requirements.txt
if [[ ${OS} = 'Debian' ]]; then
sudo cp /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-distutils
sudo apt-get install python3-apt
fi
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${GREEN}Auto${RED}FTP ${GREEN} has been installed ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
loading
else
echo -e "${DARK}[${RED}!${DARK}]${RED} Tab completion for ${GREEN}A${DARK}uto${BLUE}FTP is not found in system${WHITE}. ${DARK}[${RED}!${DARK}]"
echo -e "${GREEN}Install now ${WHITE}? ${DARK}[${BLUE}yes${WHITE}/${RED}no${DARK}]"
read -p "[ ${USER}@AutoFTP ~ ]$ " answer3
if [[ ${answer3} == [yY] || ${answer3} == [yY][eE][sS] ]]; then
completion
elif [[ ${answer3} == [nN] || ${answer3} == [nN][oO] ]]; then
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Proceed with installation of ${GREEN}Auto${RED}FTP ${BLUE}without tab completion installation ${WHITE}? ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
else
install
fi
fi
else
echo -e "Finish this block. Shell not found"
fi
}
# Check if pip is installed
if ! command -v pip &> /dev/null
then
echo -e "${DARK}[${RED}!${DARK}] ${BLUE}Python pip isn't installed and it's needed to install the dependencies for this script ${DARK}[${RED}!${DARK}]"
echo -e "${DARK}Install now ?${DARK}[${BLUE}yes${WHITE}/${RED}no${DARK}]"
read -p "[ ${USER}@AutoFTP ~ ]$ " answer
if [[ ${answer} == [yY] || ${answer} == [yY][eE][sS] ]]; then
echo -e "${GREEN}This package will allow you to download Python libraries in the futrue${WHITE}. ${GREEN}It${WHITE}'${GREEN}s good to have${WHITE}."
if [[ ${user} != 'root' ]]; then
echo -e "${DARK}[${RED}!${DARK}]${RED} You're going to need sudo to install this package ${DARK}[${RED}!${DARK}]"
echo -e "Press any key to continue"
read -n 1
fi
sudo curl -s https://bootstrap.pypa.io/get-pip.py -o /bin/pip && sudo chmod -v +x /bin/pip
#sudo /bin/pip install requests
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Run this script again ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif [[ ${answer} == [nN] || ${answer} == [nN][oO] ]]; then
echo -e "${DARK}[${RED}!${DARK}]${RED} You cannot use this script without the necessary dependencies ${DARK}[${RED}!${DARK}]"
else
echo -e "${DARK}[${RED}!${DARK}]${RED} Invalid choice ${DARK}[${RED}!${DARK}]"
./${filename}
fi
#else
#echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} pip is installed ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
fi
# Check if Python is installed
if ! command -v python3 &> /dev/null
then
echo -e "${DARK}[${RED}!${DARK}] ${BLUE}Python isn't installed and it's needed to install the dependencies for this script ${DARK}[${RED}!${DARK}]"
echo -e "${DARK}Install now ?${DARK}[${BLUE}yes${WHITE}/${RED}no${DARK}]"
read -p "[ ${USER}@AutoFTP ~ ]$ " answer
if [[ ${answer} == [yY] || ${answer} == [yY][eE][sS] ]]; then
echo -e "${GREEN}This package is a necessity in any type of pentesting${WHITE}. ${GREEN}It${WHITE}'${GREEN}s a must-have${WHITE}."
if [[ ${user} != 'root' ]]; then
echo -e "${DARK}[${RED}!${DARK}]${RED} You're going to need sudo to install this package ${DARK}[${RED}!${DARK}]"
echo -e "Press any key to continue"
read -n 1
fi
if [[ ${OS} = 'Debian' ]]; then
sudo apt install python3
elif [[ ${OS} = 'Arch' ]]; then
sudo pacman -S python3
fi
#sudo curl -s https://bootstrap.pypa.io/get-pip.py -o /bin/pip && sudo chmod -v +x /bin/pip
#sudo /bin/pip install -r requirements.txt
#sudo /bin/pip install requests
echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} Run this script again ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
elif [[ ${answer} == [nN] || ${answer} == [nN][oO] ]]; then
echo -e "${DARK}[${RED}!${DARK}]${RED} You cannot use this script without the necessary dependencies ${DARK}[${RED}!${DARK}]"
else
echo -e "${DARK}[${RED}!${DARK}]${RED} Invalid choice ${DARK}[${RED}!${DARK}]"
./${filename}
fi
#else
#echo -e "${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]${BLUE} pip is installed ${DARK}[${GREEN}-${WHITE}*${GREEN}-${DARK}]"
fi
while getopts "rihu" opt; do
case "$opt" in
r) run # Install requirements and run without installing
;;
i) install # Install
;;
u) info # Script info
;;
h) usage # HELP MENU
;;
esac
done