This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathinstall.sh
executable file
·154 lines (133 loc) · 5.02 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
#!/bin/bash
PWD=$(pwd)
##### Setting working environment #####
mkdir /usr/local/scan 2> /dev/null
#choose y/N to install
yesno(){ read -p "$question " choice;case "$choice" in y|Y|yes|Yes|YES ) decision=1;; n|N|no|No|NO ) decision=0;; * ) echo "invalid" && yesno; esac; }
##### formatting #####
#Creates variable for red color
red='\e[0;31m'
#Creates variable for bold red color
redbold='\e[1;31m'
#Creates variable for green color
green='\e[0;32m'
#Creates variable for yellow color
yellow='\e[1;33m'
#Creates variable for purple color
purple='\e[1;35m'
#Creates variable for no color
whi='\e[0m'
#blue
blue='\e[34m'
##### Install functions #####
wpcliinstall(){
pushd /usr/local/src/
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
popd
}
maldetinstall(){
pushd /usr/local/src/
rm -vrf /usr/local/src/maldetect-*
rm -vrf /usr/local/src/linux-malware-detect*
wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -zxvf maldetect-current.tar.gz
cd maldetect-*
sh ./install.sh
maldet --update-ver
#sed patch - commands added to address current problem with maldet overriding values in the conf file
sed -i 's/quarantine_hits=\"1\"/quarantine_hits=\"0\"/' /usr/local/maldetect/conf.maldet
sed -i 's/quarantine_clean=\"1\"/quarantine_clean=\"0\"/' /usr/local/maldetect/conf.maldet
sed -i 's/email_alert=\"1\"/email_alert=\"0\"/' /usr/local/maldetect/conf.maldet
sed -i 's/email_addr=\"[email protected]\"/email_addr=\"\"/' /usr/local/maldetect/conf.maldet
#end sed patch
maldet --update
if [ -e /usr/local/cpanel/3rdparty/bin/clamscan ]
then
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/bin/freshclam
if [ ! -d /var/lib/clamav ]
then mkdir /var/lib/clamav
fi
ln -s /usr/local/cpanel/3rdparty/share/clamav/main.cld /var/lib/clamav/main.cld
ln -s /usr/local/cpanel/3rdparty/share/clamav/daily.cld /var/lib/clamav/daily.cld
ln -s /usr/local/cpanel/3rdparty/share/clamav/bytecode.cld /var/lib/clamav/bytecode.cld
else
echo -e "\n\e[31mClamAV does not appear to be installed through cPanel.\nThe ClamAV definitions will not be used.\e[39m\n"
fi
popd
}
###### Checking for required software and offering to install if needed #####
if [[ -x $(which whmapi1) ]]; then #cpanel try to link to clamAV
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/bin/clamscan 2> /dev/null
ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/bin/freshclam 2> /dev/null
else #continue
echo -e "$green Installing... $whi"
fi
if [[ -x $(which clamscan 2> /dev/null) ]]; then #clamav installed
echo -e "$green\n Found ClamAV installed continuing\n$whi"
else
echo -e "$redbold Please install ClamAV first, then run this script again\n $whi"
exit 0
fi
if [[ -x $(which clamdscan 2> /dev/null) ]]; then #clamd installed
cp -av $PWD/blazescand.conf /usr/local/scan/
echo -e "MaxThreads $(expr $(nproc) / 2)" >> /usr/local/scan/blazescand.conf
echo -e "$green\n Found Clamd installed continuing\n $whi"
else
echo -e "$yellow\n Clamd not found, consider installing for multithread support\n"
fi
if [[ -x $(which maldet 2> /dev/null) ]]; then #maldet installed
echo -e "$green Maldet installed continuing\n $whi"
else
echo -e "$yellow Would you like to install Maldet?\n $whi"
yesno; if [ $decision = 1 ]; then
echo -e "Installing maldet\n"
maldetinstall
else echo -e "continuing install\n"
fi
fi
if [[ -x $(which wp 2> /dev/null) ]]; then #wpcli installed
echo -e "$green Checking for wpcli updates $whi"
wp cli update
echo -e "$green WPCLI is installed continuing\n $whi"
else
echo -e "$yellow Would you like to install WPCLI?\n $whi"
yesno; if [ $decision = 1 ];then
echo -e "$green Installing WPCLI\n $whi"
wpcliinstall
else
echo -e "$green continuing install $whi"
fi
fi
if [[ -x $(which zip 2> /dev/null) ]]; then #zip installed
echo -e "$green zip installed continuing\n $whi"
else
echo -e "$yellow zip needs to be installed for -R reportings to function properly"
echo -e " please run apt-get install, or yum install for zip package $whi"
sleep 2
fi
if [[ -x $(which json_pp) ]]; then #json_pp install
echo -e "$green json_pp installed\n $whi"
else
echo -e "$yellow json_pp needs to be installed to run VirusTotal check"
echo -e " please run apt-get install json_pp or yum install json_pp to install package$whi"
sleep 1
fi
##### moving scanner to proper dir to complete the install #####
if [[ -e /usr/local/scan/blazescand.conf ]];then
cp -av $PWD/blazescan /usr/local/scan/
ln -s /usr/local/scan/blazescan /usr/local/bin/blazescan 2> /dev/null
cp -av $PWD/blazescan-man /usr/local/man/man1/blazescan.1
gzip -f /usr/local/man/man1/blazescan.1
else
cp -av $PWD/blazescand.conf /usr/local/scan/
cp -av $PWD/blazescan /usr/local/scan/
ln -s /usr/local/scan/blazescan /usr/local/bin/blazescan 2> /dev/null
cp -av $PWD/blazescan-man /usr/local/man/man1/blazescan.1
gzip -f /usr/local/man/man1/blazescan.1
fi
echo -e "$green\n Install complete\n Good Hunting\n $whi"