B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-30 Monday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 193 article 2003-08-08 15:25:02
NickName   Ç®ºñ´©
Subject   Á¦·Îº¸µå pl4 ÀÏ°ýÆÐÄ¡ ½ºÅ©¸³Æ®
#!/bin/bash

# ÆÐÄ¡ÇÒ ÆÄÀÏ À§Ä¡ ÁöÁ¤
patchfile="/script/zboard/lib.php"
# »óÈ£
name="ºñ´©³Ý"
frommail="master at byus.net"

# lib.php ÆÄÀÏ ÃßÃâ
for i in $(find /home*/ -name lib.php|sed -e 's/^.*\ .*$//g'); do

if [ -f  $i ] ; then

        # lib.php ÆÄÀÏÀÇ size È®ÀÎ
        size=$(ls -al $i|awk '{print $5}')

        # lib.php ÆÄÀÏÀÇ ¼ÒÀ¯±Ç ÃßÃâ
        user=$(ls -al $i|awk -F/ '{print $3}')
        group=$user

        # lib.php ÆÄÀÏÀÇ À§Ä¡ ÃßÃâ
        dir=$(echo $i|sed -e 's/\/lib.php//g')
        echo $i
        echo $dir

        # lib.php °¡ Á¦·Îº¸µå Æú´õ³» ÆÄÀÏÀÎÁö È®ÀÎ
        if [ -f $dir/zboard.php ]; then
                # lib.php °¡ pl3 ¿øº»ÀÇ ÆÄÀÏ »çÀÌÁî¿Í µ¿ÀÏÇÑÁö È®ÀÎ.
                if (( $size == 32789 )) ; then
                        # lib.php °èÁ¤ ¿øº» ¹é¾÷ lib.php.pl3backup
                        cp -a $i $dir/lib.php.pl3backup
                        # ÆÐÄ¡ ÆÄÀÏ º¹»ç
                        cp -a $patchfile $dir
                        # ¼ÒÀ¯±Ç ¼öÁ¤
                        chown $user.$group $i
                        echo ">>> ÆÐÄ¡°¡ ¿Ï·áµÇ¾ú½À´Ï´Ù"
                        patchok="yes"
                elif (( $size == 33997 )) ; then
                        # ¼ÒÀ¯±Ç ¼öÁ¤
                        chown $user.$group $i
                        echo ">>> ÀÌ¹Ì ÆÐÄ¡°¡ µÇ¾î ÀÖ½À´Ï´Ù"
                        patchok="yes"
                else
                        echo ">>> lib.php size error . ÆÐÄ¡°¡ Ãë¼Ò µÇ¾ú½À´Ï´Ù."
                        patchok="no"
                        # ÆÐÄ¡ ¹ÌÁøÇà À¯Àú ¸®½ºÆ® ÀÛ¼º
                        echo $user      $size   $i >> /root/nopatched
                fi
                # ÆÐÄ¡ °á°ú ÆÄÀÏ Á¶È¸
                echo "-------------------------------------------------------"
                ls -al $i
                echo "-------------------------------------------------------"
                echo
                        # ¸ÞÀÏ ¼Û½ÅºÎ
                        if [ $patchok="yes" ] ; then
                                patchmessage="ȸ¿ø´ÔÀÇ °èÁ¤³» lib.php ÆÄÀÏÀÌ Á¤»ó ÆÐÄ¡ µÇ¾ú½À´Ï´Ù."
                        elif [ $patchok="no" ] ; then
                                patchmessage="ȸ¿ø´ÔÀÇ °èÁ¤³» lib.php ÆÄÀÏÀÌ ÆÐÄ¡ µÇÁö ¾Ê¾Ò½À´Ï´Ù."
                        fi

                        if [ -f /root/userinfo ] ;then
                        mail1=$(cat /root/userinfo |grep "^$user\>" |awk '{print $2}')
                        fi

                        mail2=$user

cat > /tmp/mailsource << EOF
From: $frommail
To: $mail1
To: $mail2
Subject: [$name] Á¦·Îº¸µå ÆÐÄ¡ °ü·Ã °øÁö ¸ÞÀÏ
MIME-Version: 1.0
Content-Type: text/plain; charset="EUC-KR"
Content-Transfer-Encoding: 8bit

Á¦·Îº¸µå ÆÐÄ¡ °ü·Ã -------------

Á¦·Îº¸µå¿¡¼­ ½Å±Ô Á¦·Îº¸µå ÆÐÄ¡ pl4 °¡ ¹ßÇ¥ µÇ¾ú½À´Ï´Ù.

º¸¾È °ü·Ã Áß¿ä ¹ö±×·Î ÀÎÇÏ¿©, ¼­¹ö³»¿¡¼­ ÆÐÄ¡°¡ °¡´ÉÇÑ °æ¿ì ÆÐÄ¡
ÁøÇàÀÌ ÀÌ·ç¾î Á³½À´Ï´Ù.

>>>> ȸ¿ø´ÔÀÇ °èÁ¤ ÆÐÄ¡ °á°ú ----------------------
-> $patchmessage
-------------------------------------------------

ÇØ´ç°ú °ü·ÃÇÏ¿©, ¼­¹ö³» Á¦·Îº¸µå¸¦ ÀÌ¿ëÇϽô ȸ¿øºÐµéÀÇ ¼Ò½º°¡
ÀϺΠ¼öÁ¤µÇ¾úÀ¸¸ç, ´ÙÀ½°ú °°ÀÌ ÀÛ¾÷ÀÌ ÀÌ·ç¾î Á³½À´Ï´Ù.

------ ÆÐÄ¡ ³»¿ª ------

1) Á¦·Îº¸µå Æú´õ³»¿¡ lib.php ÆÄÀÏÀÇ ÆÐÄ¡

2) ±âÁ¸ ÆÄÀÏÀº lib.php.pl3backup À¸·Î ¹é¾÷µÊ
   - ÆÐÄ¡ Á¾°áÈÄ ¹®Á¦°¡ ¾øÀ» °æ¿ì »èÁ¦ÇØ ÁÖ½Ã¸é µË´Ï´Ù.

3) Á¦·Îº¸µå ±âº» ¼Ò½º lib.php °¡ ÀÓÀÇ º¯°æµÇ¾î ¿î¿µµÈ »çÀÌÆ®ÀÇ
   °æ¿ì ÆÐÄ¡°¡ µÇÁö ¾Ê¾Ò½À´Ï´Ù.
   - Á÷Á¢ http://nzeo.com ¿¡ ¹æ¹®ÈÄ ÆÐÄ¡ÆÄÀÏÀ» ´Ù¿î ¹Þ¾Æ, ÆÐÄ¡ÇØ
     ÁÖ½Ã¸é µË´Ï´Ù.

EOF
chmod 700 /tmp/mailsource
sendmail -t < /tmp/mailsource
#rm -rf /tmp/mailsource



        fi
fi
done
Regist Addr [ 61.97.224.130 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®