아빠는 내게 프로그래밍에서 랜덤 값을 어떻게 사용하는지 알려주었다.
random.c file looks like the image above.
random.c 파일을 열어보면 위 이미지와 같다.
If the Key ^ random == 0xdeadbeef condition is true, read the flag file. This condition is logically equivalent to key == 0xdeadbeef ^ random.
key ^ random == 0xdeadbeef 조건이 참이면 flag파일을 읽는다. 이는 논리적으로 key == 0xdeadbeef ^ random과 같다.
However, since a seed value is not given to the rand() function, it generates a fixed value instead of a random value. You can check with the debugger which value goes into the random variable.
그런데 rand() 함수에 seed 값을 주지 않았으므로, 랜덤값이 아니라 고정된 값을 생성한다. 어떤 값이 random 변수로 들어가는지 디버거로 확인할 수 있다.
To check the return value of rand(), you can open the values after the rand() function. To open the eax, you can check it by setting break at *main+18.
rand()의 리턴값을 확인하려면 rand()함수 이후의 값들을 열어보면 되는데, eax를 열어보려면 *main+18 위치에 break를 설정하면 확인할 수 있다.
The value of eax is 1804289383.
eax 값은 1804289383 이다.
With python, simple logical operations are possible.
python 을 실행하면 간단히 논리 연산을 할 수 있다.
You can see the decimal number 3039230856. You can pass this value with pipeline to the random program to see the correct answer.
10진수 3039230856을 확인할 수 있다. 이 값을 random 프로그램에 파이프라인으로 넘겨주면 정답을 확인할 수 있다.