优化Makefile

This commit is contained in:
aixiao 2023-01-16 14:42:14 +08:00
parent be6b92fc60
commit faccc6426c
3 changed files with 14 additions and 26 deletions

View File

@ -82,3 +82,6 @@ clean:
rm -rf ./clamav/libfreshclam.so.2.0.2 rm -rf ./clamav/libfreshclam.so.2.0.2
rm -rf ${PWD}/clamav/libclamav.so.11 rm -rf ${PWD}/clamav/libclamav.so.11
rm -rf ${PWD}/clamav/libfreshclam.so.2 rm -rf ${PWD}/clamav/libfreshclam.so.2
rm -rf clamav/libclamav_rust/debug
rm -rf clamav/libclamav_rust/x86_64-unknown-linux-gnu

View File

@ -23,6 +23,7 @@ check_os()
pkg_install() pkg_install()
{ {
if test "$OS" = "ubuntu" -o "$OS" = "debian"; then if test "$OS" = "ubuntu" -o "$OS" = "debian"; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh;
apt -y install build-essential apt -y install build-essential
apt -y install make apt -y install make
apt -y install tmux apt -y install tmux
@ -39,6 +40,7 @@ pkg_install()
freshclam # 更新病毒库(必要) freshclam # 更新病毒库(必要)
else else
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh;
yum -y groupinstall "Development Tools" yum -y groupinstall "Development Tools"
yum -y install make yum -y install make
yum -y install tmux yum -y install tmux
@ -71,7 +73,10 @@ main()
#cd ../.. #cd ../..
make clean; make make clean
make libclamav_rust
make libclamav
make all
if test "$OS" = "centos"; then if test "$OS" = "centos"; then
if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库 if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库
@ -92,19 +97,7 @@ main()
fi fi
if test "$OS" = "debian"; then tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
condition=$(awk -v num1=${OS_VER} -v num2=11 'BEGIN{print(num1>num2)?"0":"1"}')
if test "$condition" = "1"; then # Debian系统版本小于11时, libclamav库版本低时
cd clamscan/libclamav/; bash build.sh
cp /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5.backup
cp .libs/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/
cd ../../
fi
fi
tmux new-session -s main -d; tmux send -t main 'killall rhost; ./rhost -d' ENTER
tmux at -t main tmux at -t main
} }
@ -140,27 +133,19 @@ binary()
chmod +x RHOST/rhost chmod +x RHOST/rhost
cd ~/RHOST/ cd ~/RHOST/
tmux new-session -s main -d; tmux send -t main 'killall rhost; ./rhost -d' ENTER tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
tmux at -t main tmux at -t main
elif test "$OS" = "debian"; then elif test "$OS" = "debian"; then
wget -T 30 https://git.aixiao.me/attachments/40a3317f-48eb-4465-9ae3-fc46251c5bcc -O RHOST/rhost wget -T 30 https://git.aixiao.me/attachments/40a3317f-48eb-4465-9ae3-fc46251c5bcc -O RHOST/rhost
wget -T 30 https://git.aixiao.me/attachments/e6309b7b-0e98-4a11-8fc1-7c624649f3b8 -O RHOST/rhost.conf wget -T 30 https://git.aixiao.me/attachments/e6309b7b-0e98-4a11-8fc1-7c624649f3b8 -O RHOST/rhost.conf
wget -T 30 https://git.aixiao.me/attachments/1ddf1579-b660-4d91-821d-82fe5f0ec8c0 -O RHOST/freshclam.conf wget -T 30 https://git.aixiao.me/attachments/1ddf1579-b660-4d91-821d-82fe5f0ec8c0 -O RHOST/freshclam.conf
chmod +x RHOST/rhost chmod +x RHOST/rhost
condition=$(awk -v num1=${OS_VER} -v num2=11 'BEGIN{print(num1>num2)?"0":"1"}')
if test "$condition" = "1"; then # Debian系统版本小于11时, libclamav库版本低时
cd clamscan/libclamav/; bash build.sh
cp /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/libclamav.so.9.0.5.backup
cp .libs/libclamav.so.9.0.5 /usr/lib/x86_64-linux-gnu/
cd ../../
fi
cd ~/RHOST/ cd ~/RHOST/
tmux new-session -s main -d; tmux send -t main 'killall rhost; ./rhost -d' ENTER tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
tmux at -t main tmux at -t main
fi fi

View File

@ -12,7 +12,7 @@ global {
IS_BLOCKED = 1; // 是否封禁攻击IP(1开启,非1关闭) IS_BLOCKED = 1; // 是否封禁攻击IP(1开启,非1关闭)
REFUSE_NUMBER = 3; // 拒绝攻击次数 REFUSE_NUMBER = 3; // 拒绝攻击次数
CLAMAV = 1; // clamav 是否扫描病毒(测试阶段)(1开启,非1关闭) CLAMAV = 1; // clamav 是否扫描病毒(1开启,非1关闭)
CLAMAV_ARG = "-r / --exclude-dir=^/sys|^/dev|^/proc|^/opt/infected|^/root|^/home|^/mnt|^/usr|^/var --move=/opt/infected --max-filesize 1024M -l clamscan.log"; CLAMAV_ARG = "-r / --exclude-dir=^/sys|^/dev|^/proc|^/opt/infected|^/root|^/home|^/mnt|^/usr|^/var --move=/opt/infected --max-filesize 1024M -l clamscan.log";
CLAMAV_TIME = "* 35 16 * * *"; // clamav 扫描时间(Cron格式, 秒 分 时 天 月 周) CLAMAV_TIME = "* 35 16 * * *"; // clamav 扫描时间(Cron格式, 秒 分 时 天 月 周)