al0ne / LinuxCheck

Linux应急处置/信息搜集/漏洞检测工具,支持基础配置/网络流量/任务计划/环境变量/用户信息/Services/bash/恶意文件/内核Rootkit/SSH/Webshell/挖矿文件/挖矿进程/供应链/服务器风险等13类70+项检查

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

centos 和debian安装silver_searcher的差异

ym2011 opened this issue · comments

因为在centos 重复执行脚本的时候,老是提示: silversearcher-ag没有安装,其实已经安装了,是the_silver_searcher,centos 仅需:yum install -y the_silver_searcher
同样,在Debian 重复执行的时候,老是提示:the_silver_searcher 没有安装,其实已经安装了,是silversearcher-ag,Debian仅需:apt install -y silversearcher-ag

所以简单调整了一下代码

安装应急必备工具

cmdline=(
"net-tools"
"telnet"
"nc"
"lrzsz"
"wget"
"strace"
"htop"
"tar"
"lsof"
"tcpdump"
"rkhunter"
)
for prog in "${cmdline[@]}"; do

if [ $OS = 'Centos' ]; then
soft=$(rpm -q "$prog")
if echo "$soft" | grep -E '没有安装|未安装|not installed' >/dev/null 2>&1; then
echo -e "$prog 安装中......"
yum install -y "$prog" >/dev/null 2>&1
yum install -y the_silver_searcher >/dev/null 2>&1
fi
else
if dpkg -L $prog | grep 'does not contain any files' >/dev/null 2>&1; then
echo -e "$prog 安装中......"
apt install -y "$prog" >/dev/null 2>&1
apt install -y silversearcher-ag >/dev/null 2>&1
fi

fi
done