Skip to content

Instantly share code, notes, and snippets.

@igorhrq
Last active October 4, 2018 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorhrq/14a824e13a002a49cbbb8668128c4293 to your computer and use it in GitHub Desktop.
Save igorhrq/14a824e13a002a49cbbb8668128c4293 to your computer and use it in GitHub Desktop.
#!/bin/bash
#IgorA HDBR Team Abuse 03/10/2018
green="\033[01;32m"
azul="\033[01;34m"
red="\033[01;31m"
white="\033[01;37m"
ver=$(rpm -qa | grep ^python-2. | cut -d. -f2)
echo -e "$green>> $white Checking if the WebMalwareScanner is installed... please wait"
ls /root/WebMalwareScanner/wms.py >/dev/null 2>&1
sv=$?
scan() {
echo -e "$green>> $white The WebMalwareScanner is alredy installed"
echo -e "$green>> $white Pip is installed: `rpm -qa | grep python.*pip`"
echo -e "$green>> $white The yara is installed `pip list | grep -o yara.* >/dev/null 2>&1`"
echo -e "$green>> $white All the steps was been completed and checked, proceeding with the script for start the scan"
sleep 3
clear
echo -e "$blue>> $white Please inform the directory that need be scanned ex:. /home/casaarru/public_html/admin"
read dir
if [ -z $dir ]; then
echo -e -n "$red>> $white Please inform a valid directory for scan\n"
exit;
else
if [ ! -d "$dir" ]; then
echo -e -n "$red>> $white directory doesnt exist\n"
exit;
# else
fi
fi
echo -e "$blue >> $white Starting the Scan of $dir"
python /root/WebMalwareScanner/wms.py $dir /root/output/ok.log
echo -e "$green>> $white Everything was logged in /root/output/ok.log"
echo -e "$green>> $white any doubt or concerns let me know igor.a@hostdime.com.br"
}
instala() {
if [ $sv -ne 0 ]
then
echo -e "$red>> $white The WebMalwareScanner is not installed, starting the proccess of instalation right now, be atent with errors of package manager Yum and pip for python"
git clone https://github.com/maxlabelle/WebMalwareScanner.git /root/WebMalwareScanner/ && echo "directory cloned from git in /root/WebMalwareScanner"
if [ "$ver" -eq "6" ];then
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/p/python-pip-7.1.0-1.el6.noarch.rpm
rpm -i python-pip-7.1.0-1.el6.noarch.rpm
rm rf python-pip-7.1.0-1.el6.noarch.rpm
else
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/python2-pip-8.1.2-6.el7.noarch.rpm
rpm -i python2-pip-8.1.2-6.el7.noarch.rpm
rm -rf python2-pip-8.1.2-6.el7.noarch.rpm
fi
#yum -y install epel-release && echo "The epel release was installed with success" || echo "error to install Epel Release"
#yum -y install python-pip && echo "The python-pip was installed with success" || echo "error to install python-pip"
pip install yara-python && echo "The yara-python was installed with success" || echo "error to install yara-python"
#yum -y remove epel-release && echo "epel-release removed with success" || echo "error to remove epel-release"
mkdir /root/output/ && echo "Directory /root/output/ for store data of scan was been created" || echo "Error to create /root/output/"
echo -e "$green>> $white Finished the instalation :) "
echo -e "$green>> $white any doubt or concerns let me know igor.a@hostdime.com.br"
else
echo -e "$green>> $white is not necessary install, cause the WebMalwareScanner alredy installed on this server"
return 1
fi
}
instala
scan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment