http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=1836 [º¹»ç]
¾È³çÇϼ¼¿ä.
ftz ·¹º§ 1À» Ŭ¸®¾î Çغ¸½Å ºÐÀº
find -perm -4000 ¿¡¼ -ÀÇ Àǹ̿¡´ëÇؼ ±Ã±ÝÇغ¸¼ÌÀ» °Ì´Ï´Ù.
¿À´ÃÀº ÀÌ°Å¿¡ ´ëÇؼ °øºÎÇغ¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.^^:
ÀÏ´Ü °£´ÜÇÏ°Ô ÆÄÀÏÆ۹̼ÇÀ» º¸°Ú½À´Ï´Ù.
ls -al À» Çϸé
drwxrwxrwx 5 guest guest 1413120 7¢¯ù 29 04:21 .
drwxr-xr-x 44 root root 4096 1¢¯ù 15 2009 ..
-rw------- 1 guest guest 1599 7¢¯ù 29 05:11 .bash_history
-rw-r--r-- 1 root root 224 12¢¯ù 1 2009 .bash_profile
-rw-r--r-x 1 root root 151 12¢¯ù 1 2009 .bashrc
drwxrwxr-x 2 guest guest 4096 7¢¯ù 29 03:34 .pwn3
-rw------- 1 guest guest 12288 7¢¯ù 29 04:17 .test.c.swp
-rw------- 1 guest guest 2993 7¢¯ù 29 03:49 .viminfo
-rwxrwxr-x 1 guest guest 11755 7¢¯ù 29 03:49 1
-rw-rw-r-- 1 guest guest 126 7¢¯ù 29 03:49 1.c
drwxrwxr-x 2 guest guest 4096 7¢¯ù 29 03:47 aa
drwxrwxr-x 2 guest guest 4096 7¢¯ù 29 04:56 test
ÀÌ·¸°Ô ³ª¿À´Â µ¥ ¸Ç¾ÕºÎºÐÀÌ Æ۹̼ÇÀÔ´Ï´Ù.
Æ۹̼Ç(±ÇÇÑ)À» »ç¿ëÇÏ´Â ÀÌÀ¯´Â, ¿¹¸¦ µé¾î¼ ³»°¡ °í»ýÇؼ ¸¸µç ÆÄÀÏ, ´Ù¸¥ »ç¶÷ÀÌ ¿Í¼, Áö¿ì¸é ±âºÐ´õ·´°ÚÁÒ?(ÀϹݻç¿ëÀÚ)
¶Ç´Â, Ä£±¸°£¿¡ Àб⸸ ÇÒ ¼ö ÀÖ°Ô °øÀ¯ÇÒ ÆÄÀÏÀε¥ ¾î¶»ÇÏÁÒ?(±×·ì) ³»°¡ Ȥ½Ã¶óµµ ³»ÆÄÀÏÀ» À߸ø°Çµå¸±±îºÁ °ÆÁ¤µÇÁÒ?(¼ÒÀ¯ÀÚ)
¸Ç¾Õ±ÛÀÚ¿¡ d´Â µð·ºÅ丮Áï Æú´õ°í, -´Â ÀϹÝÆÄÀÏÀÔ´Ï´Ù. ±×¹Û¿¡ ½Éº¼¸¯¸µÅ© µîµîÀÖ½À´Ï´Ù.
±× ´ÙÀ½ºÎºÐÀÎ 9ÀÚ°¡ ±ÇÇÑÀ» ³ªÅ¸³»´Â µ¥,
d/rwx/rwx/rwx ¿©±â¼ d´Â µð·ºÅ丮¸¦ ³ªÅ¸³½´Ù°íÇßÁÒ?
d´ÙÀ½¿¡ óÀ½À¸·Î ³ª¿À´Â rwx´Â ¼ÒÀ¯ÀÚ¿¡´ëÇؼ, ±×´ÙÀ½Àº ±×·ì¿¡´ëÇؼ, ¸¶Áö¸·Àº ±×¿Ü¿¡ ÀϹÝÀ¯Àú¿¡´ëÇؼ ÀÔ´Ï´Ù. (r´Â read Áï Àбâ, w´Â write Áï ¾²±â, x´Â execute Áï ½ÇÇàÀÔ´Ï´Ù.)
¼ÒÀ¯ÀÚ, ±×·ì , ÀϹÝÀ¯Àú(¼ÒÀ¯ÀÚµµ ±×·ìµµ¾Æ´Ñ »ç¶÷)¿¡ ´ëÇؼ °¢°¢ µû·Î ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
ÆÄÀÏÆ۹̼ǿ¡´ëÇؼ´Â °£´ÜÇÏ°Ô ´Ù·ç°Ú½À´Ï´Ù.
³×À̹ö¿¡¼ Æ۹̼ÇÀ» °Ë»öÇϸé, ±×¸²À¸·Î ÀÚ¼¼È÷ ¼³¸íÇÑ ºí·Î±× ¸¹ÀÌ ³ª¿À´Ï,
Çѹø º¸°í¿À¼¼¿ä.^^;
¸ÕÀú find ¸Þ´º¾óÀ» ºÁ¾ß°ÚÁÒ?
telnetÀ¸·Î ftz.hackerschool.org ¸¦ Á¢¼ÓÇØÁÖ¼¼¿ä.
guest·Î ·Î±×ÀÎÇØÁÖ¼¼¿ä.
man find¸¦ ÀÔ·ÂÇØÁֽøé
¿µ¾î·Î ¾î¼±¸Àú¼±¸ ³ª¿À´Âµ¥, permºÎºÐÀÌ ³ª¿Ã ¶§±îÁö enter¸¦ ´·¯ÁÝ´Ï´Ù.~
-perm mode
File's permission bits are exactly mode (octal or
symbolic). Symbolic modes use mode 0 as a point of
departure.
-perm -mode
All of the permission bits mode are set for the
file.
-perm +mode
Any of the permission bits mode are set for the
file.
-perm mode ´Â ±×³É Á¤È®È÷ °°Àº Æ۹̼ÇÀ» °¡Áø ÆÄÀÏã´Â °Å´Ï±î ¹«½ÃÇØÁÖ°í,
-mode ¿Í + mode ¸¦ º¾´Ï´Ù.
-perm -mode : ÆÛ¹Ì¼Ç ºñÆ® ¸ðµåÁß¿¡ ¸ðµç °ÍÀÌ ÆÄÀÏ¿¡ ´ëÇÏ¿© ¼³Á¤µÈ °Í
-perm +mode : ÆÛ¹Ì¼Ç ºñÆ® ¸ðµåÁß¿¡ Çϳª¶óµµ ÆÄÀÏ¿¡ ´ëÇÏ¿© ¼³Á¤µÈ °Í
Á¤µµ µÇ°Ú³×¿ä. ÀÌÇÏ ¹ß¹ø¿ªÀ̾ú½À´Ï´Ù.
¹º¼Ò¸®ÀÎÁö ¸ð¸£°ÚÁÒ?
Á÷Á¢ Çغ¾½Ã´Ù. Âü°í·Î touch ´Â ÆÄÀÏ»ý¼º, chmod´Â ±ÇÇѺ¯°æÇÏ´Â ¸í·É¾îÀÔ´Ï´Ù.
touch 1
touch 2
touch 3
.....
touch 7
±îÁö ÀÔ·ÂÇÕ´Ï´Ù.
±×´ÙÀ½¿¡
chmod 100 1
chmod 200 2
...
chmod 700 7
±îÁö ÀÔ·ÂÇÕ´Ï´Ù.
ls -l À» ÀÔ·ÂÇßÀ» ¶§
---x------ 1 guest guest 0 7¢¯ù 29 04:33 1
--w------- 1 guest guest 0 7¢¯ù 29 04:33 2
--wx------ 1 guest guest 0 7¢¯ù 29 04:33 3
-r-------- 1 guest guest 0 7¢¯ù 29 04:33 4
-r-x------ 1 guest guest 0 7¢¯ù 29 04:33 5
-rw------- 1 guest guest 0 7¢¯ù 29 04:33 6
-rwx------ 1 guest guest 0 7¢¯ù 29 04:33 7
ÀÌ·¸°Ô ³ª¿É´Ï´Ù.
±×·³ ÀÌÁ¦ ½ÇÇèÀ» Çغ¼±î¿ä?
-find -perm -300À» ÀÔ·ÂÇØÁÖ¼¼¿ä.
-find -perm +300À» ÀÔ·ÂÇØÁÖ¼¼¿ä.
[guest@ftz test]$ find -perm +300
.
./1
./2
./3
./5
./6
./7
[guest@ftz test]$ find -perm -300
.
./3
./7
[guest@ftz test]$
§! ÀÌ·± °á°ú°¡ ³ª¿É´Ï´Ù.
---x------ 1 guest guest 0 7¢¯ù 29 04:33 1
--w------- 1 guest guest 0 7¢¯ù 29 04:33 2
--wx------ 1 guest guest 0 7¢¯ù 29 04:33 3
-r-------- 1 guest guest 0 7¢¯ù 29 04:33 4
-r-x------ 1 guest guest 0 7¢¯ù 29 04:33 5
-rw------- 1 guest guest 0 7¢¯ù 29 04:33 6
-rwx------ 1 guest guest 0 7¢¯ù 29 04:33 7
À̺κÐÀ» ´Ù½Ã ºÁÁÖ¼¼¿ä.
300Àº write ¿Í execute ±ÇÇÑÀ» ¼ÒÀ¯ÀÚ¿¡°Ô ÁØ°ÅÁÒ?
ÆÄÀÏ 1Àº ¼ÒÀ¯ÀÚ¿¡°Ô execute ±ÇÇÑÀÌ ÀÖ°í, find -perm +300¿¡¼ °Ë»öµÇ¾ú½À´Ï´Ù.
ÆÄÀÏ 2´Â ¼ÒÀ¯ÀÚ¿¡°Ô write ±ÇÇÑÀÌ ÀÖ°í, find -perm +300¿¡¼ °Ë»öµÇ¾ú½À´Ï´Ù.
ÆÄÀÏ 3Àº ¼ÒÀ¯ÀÚ¿¡°Ô write ¿Í execute ±ÇÇÑÀÌ ÀÖ°í, find -perm +300°ú find -perm -300¿¡¼ °Ë»öµÇ¾ú½À´Ï´Ù.
ÆÄÀÏ 4´Â ¼ÒÀ¯ÀÚ¿¡°Ô read ±ÇÇÑÀÌ ÀÖ°í, ¾îµð¼µµ °Ë»öµÇÁö¾Ê¾Ò½À´Ï´Ù....
ÀÌ°É·Î ¹«¾ùÀ» ¾Ë ¼ö ÀÖÀ»±î¿ä?
ÆÄÀÏ 3°ú 7ÀÇ °øÅëÁ¡Àº ¹«¾ùÀϱî¿ä?
ÆÄÀÏ7Àº ¼ÒÀ¯ÀÚ¿¡°Ô rwx ±ÇÇÑÀ» Áá°í,
ÆÄÀÏ 3Àº ¼ÒÀ¯ÀÚ¿¡°Ô wx ±ÇÇÑÀ» Áá½À´Ï´Ù.
¿ì¸®°¡ °Ë»öÇÑ 300Àº ¼ÒÀ¯ÀÚ¿¡°Ô wx±ÇÇÑÀÌÁÒ?
ÀÌÂë µÇ¸é ¾Æ@!
find -perm +mode´Â mode¿¡ÀÖ´Â ±ÇÇÑÁß¿¡¼ Çϳª¸¸ÀÌ¶óµµ ¸¸Á·Çϸé,
Ãâ·ÂÇØÁÖ°í
find -perm -mode´Â mode¿¡ÀÖ´Â ±ÇÇÑÁß¿¡¼ ¸ðµÎ¸¦ ¸¸Á·ÇؾßÁö,
Ãâ·ÂÇØÁشٴ °É ¾Ë ¼ö ÀÖ°ÚÁÒ?
¸¶Áö¸·À¸·Î ¹®Á¦ !
a¶ó´Â ÆÄÀÏÀÌ Àִµ¥ Æ۹̼ÇÀº 321ÀÔ´Ï´Ù.
find -perm -311 À» Çϸé a¶ó´Â ÆÄÀÏÀ» ãÀ»±î¿ä? ¸øãÀ»±î¿ä?
ÁÖÀÇ»çÇ× : Ȥ½Ã ¹®Á¦°¡ »ý±â°Å³ª ÀÌ»óÇÏ´Ù ½ÍÀº ºÎºÐÀÌ ÀÖÀ¸¸é, ²À µ¡±Û³²°ÜÁÖ¼¼¿ä!
+¿Í -ÀÇ Â÷ÀÌ¿¡ ´ëÇؼ ±Ã±ÝÇؼ Á¤¸®ÇÑ ¹®¼À̱⶧¹®¿¡
Á¤È®ÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. ²À ÁöÀûÇØÁÖ¼¼¿ä! |
Hit : 25551 Date : 2011/08/04 04:42
|