2022-11-19 19:30:56 +08:00
|
|
|
:
|
|
|
|
|
|
|
|
check_os()
|
|
|
|
{
|
|
|
|
if cat /etc/issue | grep -i 'ubuntu' >> /dev/null 2>&1 ; then
|
|
|
|
OS=ubuntu
|
|
|
|
OS_VER=$(cat /etc/issue | head -n1 | awk '{print$2}')
|
|
|
|
echo -e SYSTEM: UBUNTU $(uname -m) ${OS_VER}\\nKERNEL: $(uname -sr)
|
|
|
|
elif test -f /etc/debian_version ; then
|
|
|
|
OS=debian
|
|
|
|
OS_VER=$(cat /etc/debian_version)
|
|
|
|
echo -e SYSTEM: DEBIAN $(uname -m) ${OS_VER}\\nKERNEL: $(uname -sr)
|
|
|
|
elif test -f /etc/centos-release ; then
|
|
|
|
OS=centos
|
|
|
|
OS_VER=$(cat /etc/centos-release | grep -o -E '[0-9.]{3,}') 2>> /dev/null
|
|
|
|
echo -e SYSTEM: CENTOS $(uname -m) ${OS_VER}\\nKERNEL: $(uname -sr)
|
|
|
|
else
|
|
|
|
echo The system does not support
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
pkg_install()
|
|
|
|
{
|
|
|
|
if test "$OS" = "ubuntu" -o "$OS" = "debian"; then
|
2023-01-16 14:42:14 +08:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh;
|
2022-11-19 19:30:56 +08:00
|
|
|
apt -y install build-essential
|
|
|
|
apt -y install make
|
|
|
|
apt -y install tmux
|
|
|
|
apt -y install libclamav-dev libip4tc-dev libcurl4-openssl-dev #(或者libcurl4-gnutls-dev)
|
|
|
|
apt -y install libsystemd-dev libjson-c-dev libpcre2-dev clamav-freshclam
|
|
|
|
apt -y install libltdl-dev
|
|
|
|
|
2022-12-02 09:31:34 +08:00
|
|
|
# Debian系统使用libiptc库需要nftables切换到iptables
|
|
|
|
# Switching to the legacy version:(切换到 iptables)
|
2022-11-19 19:30:56 +08:00
|
|
|
update-alternatives --set iptables /usr/sbin/iptables-legacy
|
|
|
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
|
|
|
|
update-alternatives --set arptables /usr/sbin/arptables-legacy
|
|
|
|
update-alternatives --set ebtables /usr/sbin/ebtables-legacy
|
|
|
|
|
|
|
|
freshclam # 更新病毒库(必要)
|
|
|
|
else
|
2023-01-16 14:42:14 +08:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh;
|
2022-11-19 19:30:56 +08:00
|
|
|
yum -y groupinstall "Development Tools"
|
|
|
|
yum -y install make
|
|
|
|
yum -y install tmux
|
2022-11-23 13:15:49 +08:00
|
|
|
|
|
|
|
yum -y install bzip2-devel
|
2022-11-25 18:35:33 +08:00
|
|
|
yum -y install libxslt-devel libxml2-devel
|
2022-11-23 13:15:49 +08:00
|
|
|
|
2022-11-19 19:30:56 +08:00
|
|
|
yum -y install clamav clamav-update clamav-lib clamav-devel json-c-devel pcre2-devel
|
|
|
|
yum -y install iptables-devel libcurl-devel
|
|
|
|
yum -y install systemd-devel libtool-ltdl-devel
|
|
|
|
|
|
|
|
yum -y install centos-release-scl
|
|
|
|
yum -y install devtoolset-11-gcc
|
2022-12-02 09:31:34 +08:00
|
|
|
#source /opt/rh/devtoolset-11/enable #临时
|
2022-11-25 18:35:33 +08:00
|
|
|
|
2022-12-02 09:31:34 +08:00
|
|
|
if test "`grep "devtoolset" /etc/profile`" = ""; then
|
2022-11-25 18:35:33 +08:00
|
|
|
echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile #永久
|
|
|
|
fi
|
2022-11-23 13:15:49 +08:00
|
|
|
source /opt/rh/devtoolset-11/enable
|
2022-11-19 19:30:56 +08:00
|
|
|
|
|
|
|
freshclam # 更新病毒库(必要)
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
2022-11-23 13:15:49 +08:00
|
|
|
#cd clamscan/libclamav
|
|
|
|
#bash build.sh
|
|
|
|
|
|
|
|
#cd ../..
|
|
|
|
|
2023-01-16 14:42:14 +08:00
|
|
|
make clean
|
|
|
|
make libclamav_rust
|
|
|
|
make libclamav
|
|
|
|
make all
|
2022-11-19 19:30:56 +08:00
|
|
|
|
2022-12-02 09:31:34 +08:00
|
|
|
if test "$OS" = "centos"; then
|
|
|
|
if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库
|
|
|
|
mv /etc/cron.d/clamav-update /root
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -f /etc/freshclam.conf; then # 更改病毒库镜像
|
|
|
|
sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/freshclam.conf
|
|
|
|
fi
|
|
|
|
|
2022-11-19 19:30:56 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if test -f /etc/clamav/freshclam.conf; then
|
2022-11-23 13:15:49 +08:00
|
|
|
sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/clamav/freshclam.conf
|
|
|
|
else
|
|
|
|
:
|
2022-11-19 19:30:56 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2023-01-16 14:42:14 +08:00
|
|
|
tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
|
2022-11-19 19:30:56 +08:00
|
|
|
tmux at -t main
|
2022-12-08 15:49:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
binary()
|
|
|
|
{
|
|
|
|
cd ~
|
|
|
|
|
|
|
|
|
|
|
|
if ! test -f RHOST; then
|
|
|
|
mkdir -p RHOST
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$OS" = "centos"; then
|
|
|
|
wget -T 30 https://git.aixiao.me/attachments/18147490-6d10-4407-8537-03b3c1eeb357 -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/1ddf1579-b660-4d91-821d-82fe5f0ec8c0 -O RHOST/freshclam.conf
|
|
|
|
|
|
|
|
if test -f /etc/cron.d/clamav-update; then # 去除自动更新病毒库
|
|
|
|
mv /etc/cron.d/clamav-update /root
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -f /etc/freshclam.conf; then # 更改病毒库镜像
|
|
|
|
sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/freshclam.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if test -f /etc/clamav/freshclam.conf; then
|
|
|
|
sed -i "s/DatabaseMirror .*/DatabaseMirror clamavdb.c3sl.ufpr.br/g" /etc/clamav/freshclam.conf
|
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod +x RHOST/rhost
|
|
|
|
|
|
|
|
cd ~/RHOST/
|
2023-01-16 14:42:14 +08:00
|
|
|
tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
|
2022-12-08 15:49:50 +08:00
|
|
|
tmux at -t main
|
|
|
|
|
|
|
|
elif test "$OS" = "debian"; then
|
2023-01-16 14:42:14 +08:00
|
|
|
|
2022-12-08 15:49:50 +08:00
|
|
|
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/1ddf1579-b660-4d91-821d-82fe5f0ec8c0 -O RHOST/freshclam.conf
|
|
|
|
|
|
|
|
chmod +x RHOST/rhost
|
|
|
|
|
|
|
|
cd ~/RHOST/
|
2023-01-16 14:42:14 +08:00
|
|
|
tmux new-session -s main -d; tmux send -t main 'cd ~/RHOST/; killall rhost; ./rhost -d' ENTER
|
2022-12-08 15:49:50 +08:00
|
|
|
tmux at -t main
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-19 19:30:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
check_os
|
|
|
|
pkg_install
|
2022-12-08 15:49:50 +08:00
|
|
|
if test "${1}" = "binary"; then
|
|
|
|
binary
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
2022-11-19 19:30:56 +08:00
|
|
|
main
|