김민주

Flying Chars 본문

SWUFORCE/[공통] 드림핵 스터디

Flying Chars

7alswn 2023. 11. 28. 22:54

문제는 다음과 같다.

 

주어진 사이트에 접속한 화면이다.

<html>
<head>
  <title>Web</title>
</head>
<body>
  <div id="box">
  </div>

  <style type="text/css">
    body{
      display: flex;
      width: 100vw;
      height:100vh;
      padding: 0px;

    }
    #box{
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      width: 90%;
      height:100%;
    }
  </style>

  <script type="text/javascript">
    const img_files = ["/static/images/10.png", "/static/images/17.png", "/static/images/13.png", "/static/images/7.png","/static/images/16.png", "/static/images/8.png", "/static/images/14.png", "/static/images/2.png", "/static/images/9.png", "/static/images/5.png", "/static/images/11.png", "/static/images/6.png", "/static/images/12.png", "/static/images/3.png", "/static/images/0.png", "/static/images/19.png", "/static/images/4.png", "/static/images/15.png", "/static/images/18.png", "/static/images/1.png"];
    var imgs = [];
    for (var i = 0; i < img_files.length; i++){
      imgs[i] = document.createElement('img');
      imgs[i].src = img_files[i]; 
      imgs[i].style.display = 'block';
      imgs[i].style.width = '10px';
      imgs[i].style.height = '10px';
      document.getElementById('box').appendChild(imgs[i]);
    }

    const max_pos = self.innerWidth;
    function anim(elem, pos, dis){
      function move() {
        pos += dis;
        if (pos > max_pos) {
          pos = 0;
        }
        elem.style.transform = `translateX(${pos}px)`;
        requestAnimationFrame(move);
      }
      move();
    }

    for(var i = 0; i < 20; i++){
      anim(imgs[i], 0, Math.random()*60+20);
    }
  </script>
</body>
</html>

문제에서 주어진 소스코드의 스크립트 부분이다.

for문에 랜덤으로 문자열 위치를 이동시키는 코드가 있어보인다.

 

for(var i = 0; i < 20; i++){
      anim(imgs[i], 0, 1);
}

해당 반복문을 위와 같이 수정해주고 페이지를 확인해 보겠다.

 

이런 식으로 배열된 것을 볼 수 있다.

flag: DH{Too_H4rd_to_sEe_th3_Ch4rs_x.x}

문제 풀이 성공

'SWUFORCE > [공통] 드림핵 스터디' 카테고리의 다른 글

ex-reg-ex  (1) 2023.11.28
[web] web-misconf-1  (0) 2023.11.21
[web] session  (0) 2023.11.21
[pwnable] ssp_001  (0) 2023.11.13
[pwnable] ssp_000  (1) 2023.11.13