728x90
http://natas24.natas.labs.overthewire.org/index.php
natas24/OsRmXFguozKpTZZ5X14zNO43379LZveg로 로그인
전 단계와 마찬가지로 패스워드를 입력하는 창이 있다.
소스코드를 살펴보았다.
<html>
<head>
<!-- This stuff in the header has nothing to do with the level -->
<link rel="stylesheet" type="text/css" href="http://natas.labs.overthewire.org/css/level.css">
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/jquery-ui.css" />
<link rel="stylesheet" href="http://natas.labs.overthewire.org/css/wechall.css" />
<script src="http://natas.labs.overthewire.org/js/jquery-1.9.1.js"></script>
<script src="http://natas.labs.overthewire.org/js/jquery-ui.js"></script>
<script src="http://natas.labs.overthewire.org/js/wechall-data.js"></script><script src="http://natas.labs.overthewire.org/js/wechall.js"></script>
<script>var wechallinfo = { "level": "natas24", "pass": "<censored>" };</script></head>
<body>
<h1>natas24</h1>
<div id="content">
Password:
<form name="input" method="get">
<input type="text" name="passwd" size=20>
<input type="submit" value="Login">
</form>
<?php
if(array_key_exists("passwd",$_REQUEST)){
if(!strcmp($_REQUEST["passwd"],"<censored>")){
echo "<br>The credentials for the next level are:<br>";
echo "<pre>Username: natas25 Password: <censored></pre>";
}
else{
echo "<br>Wrong!<br>";
}
}
// morla / 10111
?>
<div id="viewsource"><a href="index-source.html">View sourcecode</a></div>
</div>
</body>
</html>
strcmp 함수를 이용해 문자열을 비교하고 있다.
!strcmp이 참이 되려면 0이 되도록 해야 한다.
strcmp 함수는 원래 비교하는 문자열이 서로 같아야 0을 반환하지만, 배열과 비교하게 되면 무조건 0을 반환한다.
따라서 다음과 같이 입력해주었다.
Warning과 함께 natas25의 패스워드가 출력된다.
Password: GHF6X7YwACaYYssHVY05cFq83hRktl4c
728x90
'WEB > Natas' 카테고리의 다른 글
[Natas] Level 25 → Level 26 (0) | 2021.08.29 |
---|---|
[Natas] Level 24 → Level 25 (0) | 2021.08.12 |
[Natas] Level 22 → Level 23 (0) | 2021.07.27 |
[Natas] Level 21 → Level 22 (0) | 2021.07.21 |
[Natas] Level 20 → Level 21 (0) | 2021.07.08 |