Click me! Write-up

Ccr3t·2025년 9월 13일
0

Wargame

목록 보기
46/55

[Solved in under 4 minutes]

뭐 할 말 없다.
가보자

대충 이런 페이지인데 Click me! 에 마우스를 갖다대면 겁나게 도망다닌다 랜덤값으로 바로 코드 보자

<!DOCTYPE html>
<html lang="ko">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Click me!</title>
    <style>
      body {
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        margin: 0;
        background-color: #f0f0f0;
      }
      #escapeButton {
        padding: 15px 30px;
        font-size: 20px;
        background-color: #ff6347;
        color: white;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        position: absolute;
      }
    </style>
  </head>
  <body>
    <button id="escapeButton" tabindex="-1" onclick="alert('You Clicked Me!')">
      Click me!
    </button>

    <script>
      const escapeButton = document.getElementById("escapeButton");
      const ESCAPE_DISTANCE = 200;

      moveButtonRandomly();

      document.addEventListener("mousemove", (event) => {
        const mouseX = event.clientX;
        const mouseY = event.clientY;

        const buttonRect = escapeButton.getBoundingClientRect();

        const buttonCenterX = buttonRect.left + buttonRect.width / 2;
        const buttonCenterY = buttonRect.top + buttonRect.height / 2;

        const distance = Math.sqrt(
          Math.pow(mouseX - buttonCenterX, 2) +
            Math.pow(mouseY - buttonCenterY, 2)
        );

        if (distance < ESCAPE_DISTANCE) {
          moveButtonRandomly();
        }
      });

      function moveButtonRandomly() {
        const screenWidth = window.innerWidth;
        const screenHeight = window.innerHeight;

        const buttonWidth = escapeButton.clientWidth;
        const buttonHeight = escapeButton.clientHeight;

        const maxX = screenWidth - buttonWidth;
        const maxY = screenHeight - buttonHeight;

        const newX = Math.random() * maxX;
        const newY = Math.random() * maxY;

        escapeButton.style.left = `${newX}px`;
        escapeButton.style.top = `${newY}px`;
      }

      escapeButton.addEventListener("click", () => {
        window.location.href = "/fnxmtmznpdjakstp";
      });
    </script>
  </body>
</html>

코드 읽을 줄 몰라도 괜찮다.

이 녀석 그냥 함수명으로 moveButtonRandomly() 바로 박아놨다.

이 녀석에 들어 있는 코드를 그냥 클라이언트 측에서 날려버리자

moveButtonRandomly = () => {};

그냥 해당 Script를 비웠다.

이제 움직이지 않는다

클릭하면?

홈페이지 잘 넣으먄~~

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ 답 ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

DH{How_did_you_click_this_button?}

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

개발자도구를 아무렇지 않게 사용 할 수 있으면 누구나 쉽게 풀 수 있을거라고 생각한다!

DreamHack Click me! Write-up

이상 보고 끝!

profile
웹해킹을 잘 못 하지만 좋아 하려고 노력하는 한 젊은이.

0개의 댓글