๋ฐ์ํ
๐์ ์ ์๋์ ๋ ์ฝ๋๋ฅผ ์ฝ๊ณ , "Welcome Hackers :)"๊ฐ ์ถ๋ ฅ๋๋ ์ ๋ ฅ๊ฐ์ ์ฐพ์๋ณด์ธ์.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int sz = 0x30; // sz์ 16์ง์ 0x30์ ํ ๋นํ๋ค. ์ญ์ง์๋ก 48์ด๋ค.
char *buf = (char *)malloc(sizeof(char) * sz);
// sz ํฌ๊ธฐ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋์ ํ ๋น ํ๋ค.
puts("Hello World!"); // hello world ๋ฅผ ์ถ๋ ฅํ๋ค. puts๋ ์ถ๋ ฅํ๊ณ ์๋ ์ค๋ฐ๊ฟ ํ๋ค.
printf("Education + Hack = ?\n");
fgets(buf, sz, stdin); //๋ฌธ์์ด์ ์ฝ์ด buf์ ์ ์ฅํ๋ค. ์ต๋ sz-1 ๊ฐ ๋ฌธ์๋ฅผ ์ฝ๋๋ค.
if (!strncmp(buf, "DreamHack", 9)) //buf์ dream... ๋ฌธ์์ด์ ์ฒ์ 9์๋ฆฌ ๋น๊ต
printf("Welcome Hackers :)\n");
else
printf("No No :/\n");
return 0;
}
#!/usr/bin/python3
quiz = [116, 66, 85, 81, 93, 120, 81, 83, 91]
for i in range(len(quiz)):
quiz[i] ^= 0x30 # xor ์ฐ์ฐ ์ํ
quiz = ''.join([chr(_) for _ in quiz]) #์ซ์๋ฅผ ๋ฌธ์๋ก ๋ณํํ๊ณ ์ฐ๊ฒฐํด์ ๋ฌธ์์ด๋ก ๋ง๋ ๋ค.
answer = input() #๋ฌธ์์ด ์
๋ ฅ ๋ฐ์
if answer == quiz:
print("Welcome Hackers :)")
else:
print("No No :/")
๋
๋ฐ์ํ
'hacking > pwnable' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํธ์ถ ๊ท์ฝ] cdecl (0) | 2025.03.02 |
---|---|
[Assembly] c์ธ์ด ์ฝ๋๋ฅผ ์ด์ ๋ธ๋ฆฌ์ด๋ก ๋ณํํ์ฌ ํ์ผ์ ์ ์ฅ (0) | 2025.03.02 |
[Dream hack] Logical Bug: Type Error (0) | 2025.03.02 |
[๊ฐ๋ ์ ๋ฆฌ] plt์ got (0) | 2024.11.15 |
[Dream hack] Background: RELRO-2 (0) | 2024.11.15 |