Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

x

Webhacking.kr 16 keyCode 본문

공부/웹

Webhacking.kr 16 keyCode

minkmink 2017. 1. 30. 14:20

<html>
<head>
<title>Challenge 16</title>
<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.posLeft-50,star.style.posTop-50);
if(cd==100) star.style.posLeft=star.style.posLeft+50;
if(cd==97) star.style.posLeft=star.style.posLeft-50;
if(cd==119) star.style.posTop=star.style.posTop-50;
if(cd==115) star.style.posTop=star.style.posTop+50;
if(cd==124) location.href=String.fromCharCode(cd);
}



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>
</body>
</html>




location.href : relative URL을 사용할 수 있다

event.keyCode 는 ASCII code에 기반한다.

cd ==124인 문자는 |이므로 |를 입력하면 location.href가 relative URL을 인식하여 http://webhacking.kr/challenge/javascript/| 로 이동한다

















'공부 > ' 카테고리의 다른 글

Javascript  (0) 2017.01.29
webhacking.kr 26 url encoding  (0) 2017.01.28
Webhacking.kr 24 쿠키값 변조  (0) 2017.01.28
HTML  (0) 2017.01.27
XSS (Cross site scripting)  (0) 2017.01.27
Comments