본문 바로가기
CTF, 워게임 문제 풀이/webhacking.kr

Webhacking.kr 16번 문제 풀이

by secumark 2022. 8. 26.
728x90

 

*이 있다.

 
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>";
}

 

안에 이런 스크립트가 있다.

mv 함수를 보니까 안에 cd라는 매개변수 값에 따라 위치가 바뀌는거 같다!

 

 

 

엥?

 

 

 

그냥 이렇게 하나씩 쳐보고 있었는데, mv(124)를 눌렀더니 문제가 해결됐다.

 

이렇게 풀어도 되지만.. 이 100, 97, 119, 115, 124 숫자를 아스키 코드로 바꿨을 때 d a w s |  (파이프)로 변환이 되어서 그냥 키보드에서 파이프를 입력해줘도 바로 문제가 풀리긴 한다.

 

728x90

댓글