[webhacking.kr] old-16

asdf·어제

web

목록 보기
8/10
post-thumbnail

업로드중..
시작 화면은 * 3개가 있습니다. 일단 뭔지 모르겠으니 html 코드를 살펴보겠습니다.

<html><head>
<title>Challenge 16</title>
</head><body bgcolor="black" onload="kk(1,1)" onkeypress="mv(event.keyCode)">
<font color="silver" id="c"></font>
<font color="yellow" size="100" style="position:relative" id="star">*</font>
<script> 
document.body.innerHTML+="<font color=yellow id=aa style=position:relative;left:0;top:0>*</font>";
function mv(cd){
  kk(star.style.left-50,star.style.top-50);
  if(cd==100) star.style.left=parseInt(star.style.left+0,10)+50+"px";
  if(cd==97) star.style.left=parseInt(star.style.left+0,10)-50+"px";
  if(cd==119) star.style.top=parseInt(star.style.top+0,10)-50+"px";
  if(cd==115) star.style.top=parseInt(star.style.top+0,10)+50+"px";
  if(cd==124) location.href=String.fromCharCode(cd)+".php"; // do it!
}
function kk(x,y){
  rndc=Math.floor(Math.random()*9000000);
  document.body.innerHTML+="<font color=#"+rndc+" id=aa style=position:relative;left:"+x+";top:"+y+" onmouseover=this.innerHTML=''>*</font>";
}
</script><font color="yellow" id="aa" style="position:relative;left:0;top:0">*</font>


<font color="#8471771" id="aa" style="position:relative;left:1;top:1" onmouseover="this.innerHTML=''">*</font></body></html>

가장 중요한 script 부분을 살펴보겠습니다. mv(cd)라는 함수를 살펴보면 cd==124부분에 do it! 이라는 주석이 달려있습니다. 즉, mv 함수를 실행할 때 124라는 값을 매개변수로 전달하는 것이 최종 목표라고 볼 수 있습니다.

아래의 kk 함수는 무언가의 위치를 재조정하는 함수인 것 같습니다.

mv 함수가 어디에서 실행되는지 보면 <body bgcolor="black"> 에서 실행됨을 알 수 있습니다. body에서 키 입력(onkeypress)이 실행될 때 입력 값이 mv의 인자로 들어가서 실행되게 됩니다.

저희가 넣어야 할 값은 124고 아스키 코드로 124는 | 이기 때문에 화면에서 |를 입력하면 문제를 해결할 수 있습니다.

profile
Rainy Waltz(a_hisa)

0개의 댓글