http://www.hackerschool.org/HS_Boards/zboard.php?id=QNA_linux&no=4454 [º¹»ç]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
char password[8];
int generate_otp (void)
{
int fd = open ("/dev/urandom", O_RDONLY);
int readed;
readed = read (fd, (void *)password, 8);
close (fd);
return readed;
}
int main (int argc, char *argv[])
{
char user_password[8];
int readed = 0;
if (generate_otp () != 8) {
printf ("Something is wrong! Contact to administrator.\n");
exit (0);
}
printf ("Enter password (8 bytes) : \n");
if (read (0, user_password, 8) != 8) {
printf ("Please enter 8 bytes.\n");
exit (0);
}
if (!strncmp (password, user_password, 8))
system ("/bin/cat flag");
else
printf ("Wrong password !!!\n");
return 0;
}
ÇÁ·Î±×·¥À» µû·Î ÀÛ¼ºÇؼ ½ÇÇà½ÃÄѾ߰ÚÁÒ? |
Hit : 3117 Date : 2017/03/30 08:48
|