⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chkrootkit

📁 linux中经典的rootkit的检测工具 功能超强 可以查杀上百种rootkit
💻
📖 第 1 页 / 共 5 页
字号:
   ### HKRK   if [ -f ${ROOTDIR}etc/rc.d/init.d/network ]; then      if [ "${QUIET}" != "t" ];then printn "Searching for HKRK rootkit... "; fi      if ${egrep} "\.hk" ${ROOTDIR}etc/rc.d/init.d/network 2>/dev/null ; then        echo "Warning: /etc/rc.d/init.d/network INFECTED"      else         if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi      fi   fi   ### Suckit   if [ -f ${ROOTDIR}sbin/init ]; then      if [ "${QUIET}" != "t" ];then printn "Searching for Suckit rootkit... "; fi      if [ ${SYSTEM} != "HP-UX" ] && ( ${strings} ${ROOTDIR}sbin/init | ${egrep} HOME  || \	      cat ${ROOTDIR}/proc/1/maps | ${egrep} "init." ) >/dev/null 2>&1        then        echo "Warning: ${ROOTDIR}sbin/init INFECTED"      else         if [ -d ${ROOTDIR}/dev/.golf ]; then            echo "Warning: Suspect directory ${ROOTDIR}dev/.golf"	 else            if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi	 fi      fi   fi   ### Volc   if [ "${QUIET}" != "t" ];then printn "Searching for Volc rootkit... "; fi   if [ -f ${ROOTDIR}usr/bin/volc -o -f ${ROOTDIR}usr/lib/volc ] ; then      echo "Warning: Possible Volc rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### Gold2   if [ "${QUIET}" != "t" ];then printn "Searching for Gold2 rootkit... "; fi   if [ -f ${ROOTDIR}usr/bin/ishit ] ; then      echo "Warning: Possible Gold2 rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### TC2 Worm   if [ "${QUIET}" != "t" ]; then \      printn "Searching for TC2 Worm default files and dirs... "; fi   if [ -d ${ROOTDIR}usr/info/.tc2k -o -d ${ROOTDIR}usr/bin/util -o \        -f ${ROOTDIR}usr/sbin/initcheck  -o -f ${ROOTDIR}usr/sbin/ldb ]   then         echo "Possible TC2 Worm installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### ANONOYING Rootkit   if [ "${QUIET}" != "t" ]; then \      printn "Searching for Anonoying rootkit default files and dirs... "; fi   if [ -f ${ROOTDIR}usr/sbin/mech -o -f ${ROOTDIR}usr/sbin/kswapd ]; then         echo "Possible anonoying rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### ZK Rootkit   if [ "${QUIET}" != "t" ]; then \      printn "Searching for ZK rootkit default files and dirs... "; fi   if [ -f ${ROOTDIR}etc/sysconfig/console/load.zk ]; then         echo "Possible ZK rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### ShKit   if [ "${QUIET}" != "t" ]; then      printn "Searching for ShKit rootkit default files and dirs... "; fi   if [ -f ${ROOTDIR}lib/security/.config -o -f ${ROOTDIR}etc/ld.so.hash ]; then         echo "Possible ShKit rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### AjaKit   if [ "${QUIET}" != "t" ]; then      printn "Searching for AjaKit rootkit default files and dirs... "; fi      if [ -d ${ROOTDIR}lib/.ligh.gh -o -d ${ROOTDIR}dev/tux ]; then         echo "Possible AjaKit rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### zaRwT   if [ "${QUIET}" != "t" ]; then      printn "Searching for zaRwT rootkit default files and dirs... "; fi      if [ -f ${ROOTDIR}bin/imin -o -f ${ROOTDIR}bin/imout ]; then         echo "Possible zaRwT rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### Madalin rootkit   if [ "${QUIET}" != "t" ]; then      printn "Searching for Madalin rootkit default files... "; fi   D=${ROOTDIR}usr/include   if [ -f $D/icekey.h -o -f $D/iceconf.h -o -f $D/iceseed.h ]; then       echo "Possible Madalin rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### Fu rootkit   if [ "${QUIET}" != "t" ]; then      printn "Searching for Fu rootkit default files... "; fi   if [ -f ${ROOTDIR}sbin/xc -o -f ${ROOTDIR}bin/.lib -o \        -f ${ROOTDIR}usr/include/ivtype.h ]; then      echo "Possible Fu rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ### ESRK   if [ "${QUIET}" != "t" ]; then      printn "Searching for ESRK rootkit default files... "; fi   if [ -d "${ROOTDIR}usr/lib/tcl5.3" ]; then      echo "Possible ESRK rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ## rootedoor   if [ "${QUIET}" != "t" ]; then      printn "Searching for rootedoor... "; fi   found=0   for i in `$echo $PATH|tr -s ':' ' '`; do      if [ -f "${ROOTDIR}${i}/rootedoor" ]; then         echo "Possible rootedoor installed in ${ROOTDIR}${i}"	 found=1      fi   done   [ "${found}" = "0"  ] &&\   if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   ### ENYELKM   if [ "${QUIET}" != "t" ]; then      printn "Searching for ENYELKM rootkit default files... "; fi   if [ -d "${ROOTDIR}etc/.enyelkmOCULTAR.ko" ]; then      echo "Possible ENYELKM rootkit installed"   else      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi   ###   ### shell history anomalies   ###   if [ "${QUIET}" != "t" ]; then \      printn "Searching for anomalies in shell history files... "; fi   files=""   if [ ! -z "${SHELL}" -a ! -z "${HOME}" ]; then      files=`${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' -size 0`      [ ! -z "${files}" ] && \        echo "Warning: \`${files}' file size is zero"      files1=`${find} ${ROOTDIR}${HOME} ${findargs} -name '.*history' \( -links 2 -o -type l \)`      [ ! -z "${files1}" ] && \        echo "Warning: \`${files}' is linked to another file"   fi   if [ -z "${files}" -a -z "${files1}" ]; then      if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi   fi}####################################################################### util functions# our which(1)loc () {    ### usage: loc filename filename_to_return_if_nothing_was_found path    thing=$1    shift    dflt=$1    shift    for dir in $*; do            case "$thing" in            .)            if test -d $dir/$thing; then                    echo $dir                    exit 0            fi            ;;            *)            for thisthing in $dir/$thing; do                    :            done            if test -f $thisthing; then                    echo $thisthing                    exit 0            fi            ;;            esac    done    if [ "${ROOTDIR}" = "/" ]; then      echo ${dflt}    else      echo "${ROOTDIR}${dflt}"    fi    exit 1}getCMD() {   RUNNING=`${ps} ${ps_cmd} | ${egrep} "${L_REGEXP}${1}${R_REGEXP}" | \            ${egrep} -v grep | ${egrep} -v chkrootkit | _head -1 | \            ${awk} '{ print $5 }'`   for i in ${ROOTDIR}${RUNNING} ${ROOTDIR}usr/sbin/${1} `loc ${1} ${1} $pth`   do      CMD="${i}"      if [ -r "${i}" ]        then        return 0      fi   done   return 1}expertmode_output() {    echo "###"    echo "### Output of: $1"    echo "###"    eval $1 2>&1#    cat <<EOF#`$1 2>&1`#EOF    return 0}tnfs (){   ## Check if -fstype nfs works   findargs=""   if find /etc -maxdepth 0 >/dev/null 2>&1; then        find /etc ! -fstype nfs -maxdepth 0 >/dev/null 2>&1 && \           findargs="! -fstype nfs "   elif find /etc -prune > /dev/null 2>&1; then        find /etc ! -fstype nfs -prune > /dev/null 2>&1 && \           findargs="! -fstype nfs "   fi}####################################################################### trojan functionschk_chfn () {    STATUS=${NOT_INFECTED}    CMD=`loc chfn chfn $pth`    [ ${?} -ne 0 ] &&  return ${NOT_FOUND}    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    case "${SYSTEM}" in       Linux)          if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}" \             >/dev/null 2>&1          then             STATUS=${INFECTED}          fi;;       FreeBSD)          [ `echo $V | awk '{ if ( $1 >= 5.0) print 1; else print 0 }'` -eq 1 ] && n=1 || n=2          if [ `${strings} -a ${CMD} | \                ${egrep} -c "${GENERIC_ROOTKIT_LABEL}"` -ne $n ]          then             STATUS=${INFECTED}          fi;;    esac    return ${STATUS}}chk_chsh () {    STATUS=${NOT_INFECTED}    CMD=`loc chsh chsh $pth`    [ ${?} -ne 0 ] && return ${NOT_FOUND}    REDHAT_PAM_LABEL="*NOT*"    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    case "${SYSTEM}" in       Linux)          if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}" \          >/dev/null 2>&1             then             if ${strings} -a ${CMD} | ${egrep} "${REDHAT_PAM_LABEL}" \             >/dev/null 2>&1                then                :             else                STATUS=${INFECTED}             fi          fi;;       FreeBSD)          [ `echo $V | awk '{ if ($1 >= 5.0) print 1; else print 0}'` -eq 1 ] && n=1 || n=2          if [ `${strings} -a ${CMD} | ${egrep} -c "${GENERIC_ROOTKIT_LABEL}"` -ne $n ]             then             STATUS=${INFECTED}          fi;;    esac    return ${STATUS}}chk_login () {    STATUS=${NOT_INFECTED}    CMD=`loc login login $pth`    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    if [ "$SYSTEM" = "SunOS" ]; then      TROJED_L_L="porcao|/bin/xstat"      if ${strings} -a ${CMD} | ${egrep} "${TROJED_L_L}" >/dev/null 2>&1 ]; then          return ${INFECTED}       else          return ${NOT_TESTED}       fi    fi    GENERAL="^root$"    TROJED_L_L="vejeta|^xlogin|^@\(#\)klogin\.c|lets_log|sukasuka|/usr/lib/.ark?|SucKIT"    ret=`${strings} -a ${CMD} | ${egrep} -c "${GENERAL}"`    if [ ${ret} -gt 0 ]; then        case ${ret} in        1) [ "${SYSTEM}" = "OpenBSD" -a `echo $V | ${awk} '{ if ($1 < 2.7 ||$1 >= 3.0) print 1; else print 0}'` -eq 1 ] && \             STATUS=${NOT_INFECTED} || STATUS=${INFECTED};;        2) [ "${SYSTEM}" = "FreeBSD"  -o ${SYSTEM} = "NetBSD" -o ${SYSTEM} = \"OpenBSD" -a `echo ${V} | ${awk} '{ if ($1 >= 2.8) print 1; else print 0 }'` -eq 1 ] && STATUS=${NOT_INFECTED} || STATUS=${INFECTED};;        6|7) [ "${SYSTEM}" = "HP-UX" ] && STATUS=${NOT_INFECTED} || STATUS=${INFECTED};;        *) STATUS=${INFECTED};;        esac    fi    if ${strings} -a ${CMD} | ${egrep} "${TROJED_L_L}" 2>&1 >/dev/null       then        STATUS=${INFECTED}    fi    return ${STATUS}}chk_passwd () {    STATUS=${NOT_INFECTED}    CMD=`loc passwd passwd $pth`    if [ ! -x ${CMD} -a -x ${ROOTDIR}usr/bin/passwd ]; then       CMD="${ROOTDIR}usr/bin/passwd"    fi    if [ "${EXPERT}" = "t" ]; then       expertmode_output "${strings} -a ${CMD}"    fi    if [ "${SYSTEM}" = "OpenBSD" -o "${SYSTEM}" = "SunOS" -o "${SYSTEM}" \        = "HP-UX" ]    then       return ${NOT_TESTED}    fi    if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}|/lib/security" \    >/dev/null 2>&1    then       STATUS=${INFECTED}    fi    return ${STATUS}}chk_inetd () {    STATUS=${NOT_INFECTED}    getCMD 'inetd'    if [ ! -r ${CMD} -o ${CMD} = '/' ]    then       return ${NOT_TESTED}    fi    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}" \    >/dev/null 2>&1    then       STATUS=${INFECTED}    fi    return ${STATUS}}chk_syslogd () {    STATUS=${NOT_INFECTED}SYSLOG_I_L="/usr/lib/pt07|/dev/pty[pqrs]|/dev/hd[als][0-7]|/dev/ddtz1|/dev/ptyxx|/dev/tux|syslogs\.h"    CMD=`loc syslogd syslogd $pth`    if [ ! -r ${CMD} ]    then       return ${NOT_TESTED}    fi    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    if ${strings} -a ${CMD} | ${egrep} "${SYSLOG_I_L}" >/dev/null 2>&1    then       STATUS=${INFECTED}    fi    return ${STATUS}}chk_hdparm () {    STATUS=${NOT_INFECTED}    HDPARM_INFECTED_LABEL="/dev/ida"    CMD=`loc hdparm hdparm $pth`    if [ ! -r ${CMD} ]    then       return ${NOT_FOUND}    fi    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    if ${strings} -a ${CMD} | ${egrep} "${HDPARM_INFECTED_LABEL}" \       >/dev/null 2>&1    then       STATUS=${INFECTED}    fi    return ${STATUS}}chk_gpm () {    STATUS=${NOT_INFECTED}    GPM_INFECTED_LABEL="mingetty"    CMD=`loc gpm gpm $pth`    if [ ! -r ${CMD} ]    then       return ${NOT_FOUND}    fi    if [ "${EXPERT}" = "t" ]; then        expertmode_output "${strings} -a ${CMD}"        return 5    fi    if ${strings} -a ${CMD} | ${egrep} "${GPM_INFECTED_LABEL}" \       >/dev/null 2>&1    then       STATUS=${INFECTED}    fi    return ${STATUS}}chk_mingetty () {    STATUS=${NOT_INFECTED}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -