日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Shell - 通过hook文件后门实现应用的自动启停

發布時間:2025/3/21 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Shell - 通过hook文件后门实现应用的自动启停 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 啟動腳本
  • daemon

啟動腳本

#!/bin/bashset_network_param() {sysctl -w fs.file-max=999999sysctl -w net.ipv4.tcp_tw_reuse=1sysctl -w net.ipv4.tcp_fin_timeout=15sysctl -w net.core.netdev_max_backlog=4096sysctl -w net.core.somaxconn=40960sysctl -w net.ipv4.tcp_max_syn_backlog=40960sysctl -w net.ipv4.tcp_syncookies=1sysctl -w net.ipv4.tcp_syn_retries=2sysctl -w net.ipv4.tcp_synack_retries=2return }#service start start() {number=`ps -ef | grep "/home/nginx/bin/nginx" | grep -v grep | head -n 1 | wc -l`if [ $number -ge 1 ];thenfiset_network_paramulimit -n 65535if [ -f "/home/nginx/bin/nginx" ]then/home/nginx/bin/nginx -p /home/nginx -c /home/nginx/conf/nginx.conffinumber=`ps -ef | grep "/home/nginx/daemon/nginx_daemon" | grep -v grep | head -n 1 | wc -l`if [ $number -lt 1 ];then# Do Somethingfiif [ -f "/home/nginx/daemon/nginx_daemon" ]thennohup /home/nginx/daemon/nginx_daemon >/dev/null 2>&1 & fi }#service stop stop() {/home/nginx/bin/nginx -p /home/nginx -s stop }#parse cmd case "$1" instart)start;;stop)stop;;restart)stopsleep 1start;;*)echo "Usage: $0 {start|stop|restart}"exit 1;; esacexit 0

姑且稱之為a.sh 在 /home/nginx 目錄下


daemon

通過放入hook文件, 在對應的目錄下touch start \ stop \restart 文件 , 實現應用的啟停

#!/bin/shnumber=`ps -ef | grep "/home/nginx/daemon/nginx_daemon" | grep -v grep | head -n 1 | wc -l` if [ $number -lt 1 ];then#do something fiwhile [ 1 -eq 1 ] doif [ -f "/home/nginx/daemon/start" ]; thenrm -rf /home/nginx/daemon/start/home/nginx/a.sh startfiif [ -f "/home/nginx/daemon/stop" ]; thenrm -rf /home/nginx/daemon/stop/home/nginx/a.sh stopfiif [ -f "/home/nginx/daemon/restart" ]; thenrm -rf /home/nginx/daemon/restart/home/nginx/a.sh restartfisleep 5 done

總結

以上是生活随笔為你收集整理的Shell - 通过hook文件后门实现应用的自动启停的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。