Wargame/Suninatas

<Suninatas> 2번 문제

지우친구 웅이 2021. 10. 21. 11:46

Suninatas 2번 문제

<내가 푼 방법>

 

로그인 창만 띄워져 있다. 크롬의 개발자 도구(F12)를 통해 소스코드를 살펴보자.


<!DOCTYPE html>

<html>
<head>
    <title>Game 02</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="shortcut icon" href="/static/img/game.ico" />
</head>
<body>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <form method="post" name="web02">
        <table width="240" cellpadding="0" cellspacing="0" align="center">
            <tr height="30">
                <td colspan="2" bgcolor="cccccc" align="center"><b>LEVEL 2</b></td>
            </tr>
            <tr height="30">
                <td colspan="2" width="100%" class="table_top" align="right">
                    <input type="button" name="main_btn" value="main" style="width: 60" onclick="location.href = '/'">&nbsp<input type="button" name="main_btn" value="Back" style="width: 60" onclick="history.back()"></td>
            </tr>
            <tr height="30" class="table_main">
                <td width="90" align="center" bgcolor="cccccc"><font size="2"><b>ID</b></font></td>
                <td width="150" align="center" bgcolor="cccccc">
                    <input type="text" name="id" style="width: 140"></td>
            </tr>
            <tr height="30" class="table_main">
                <td width="90" align="center" bgcolor="cccccc"><font size="2"><b>PW</b></font></td>
                <td width="150" align="center" bgcolor="cccccc">
                    <input type="password" name="pw" style="width: 140"></td>
            </tr>
            <tr height="30">
                <td colspan="2" align="center" class="table_top">
                    <input type="button" value="Join" style="width: 60" onclick="chk_form()">
            </tr>
            <tr height="30" class="table_main">
                <td colspan="2" align="center" bgcolor="cccccc">Authkey : ?????</td>
            </tr>
        </table>
</body>
</html>
<script>
	function chk_form(){
		var id = document.web02.id.value ;
		var pw = document.web02.pw.value ;
		if ( id == pw )
		{
			alert("You can't join! Try again");
			document.web02.id.focus();
			document.web02.id.value = "";
			document.web02.pw.value = "";
		}
		else
		{
			document.web02.submit();
		}
	}
</script>
<!-- Hint : Join / id = pw -->
<!-- M@de by 2theT0P -->

script내용을 살펴보면

 

▶id와 pw가 같을 때

"You can't join! Try again"메시지를 띄우고,

id 입력 폼에 포커스 되고,

id와 pw값이 빈 문자열이 된다.

 

▶id와 pw가 다를 때

document.web02.submit()을 통해 id와 pw값을 서버에 전달한다.

 

소스코드 맨 아래에 id와 pw는 같다는 힌트가 있다.

id와 pw입력 폼에 같은 값을 주고,

console을 이용해 document.web02.submit()를 실행하면 인증 키 값을 얻을 수 있다.

 

이렇게 크롬의 개발자 도구(F12)의 console을 통해 명령어를 바로 실행시켜 볼 수도 있다.