Natas Level 7 → Level 8
Username: natas8
URL: http://natas8.natas.labs.overthewire.org
8단계 비밀번호는 이 글을 참고하세요.
앞 문제보다 좀 더 꼬아서 만든 문제이다.
소스코드를 보자.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <? $encodedSecret = "3d3d516343746d4d6d6c315669563362"; function encodeSecret($secret) { return bin2hex(strrev(base64_encode($secret))); } if(array_key_exists("submit", $_POST)) { if(encodeSecret($_POST['secret']) == $encodedSecret) { print "Access granted. The password for natas9 is <censored>"; } else { print "Wrong secret"; } } ?> | cs |
좀 더 색감있게 표현해봤다. color scripter는 아주 좋은 도구!
시크릿을 base64로 인코딩하고 strrev 함수로 문자열을 뒤집은 다음, 바이너리를 hex코드로 바꾼 것이 $encodedSecret이다.
http://www.tutorialspoint.com/execute_php_online.php 에서 나는 이 함수를 거꾸로 사용할 것이다.
1 2 3 4 5 6 7 8 9 | <?php $encodedSecret = "3d3d516343746d4d6d6c315669563362"; function encodeSecret($encodedSecret) { return base64_decode(strrev(hex2bin($encodedSecret))); } echo encodeSecret($encodedSecret); ?> | cs |
이런 식으로 말이다..
echo로 나온 문자열을 입력했다.
natas9 : W0mMhUcRRnG8dcghE4qvk3JA9lGt8nDl
'워게임 > NATAS-overthewire.org' 카테고리의 다른 글
[워게임 Natas] 레벨 10 문제 풀이 (0) | 2016.06.14 |
---|---|
[워게임 Natas] 레벨 9 문제 풀이 (0) | 2016.06.14 |
[워게임 Natas] 레벨 7 문제 풀이 (0) | 2016.06.13 |
[워게임 Natas] 레벨 6 문제 풀이 (0) | 2016.06.13 |
[워게임 Natas] 레벨 5 문제 풀이 (0) | 2016.06.13 |