Webhacking.kr old-10
Challenge
Move the target link to the goal position.
将目标链接移动到终点位置。
1 | https://webhacking.kr/challenge/code-1/ |
Analysis
hackme 元素的 onclick 处理器每次把
style.left 增加 1px;当结果恰好为 1600px
时,脚本才把 href 设置为 ?go=1600px:
1 | this.style.left = parseInt(this.style.left, 10) + 1 + "px"; |
直接访问 ?go=1600px 会触发
no hack,因为服务端还需要这次真实的 click
流程。把元素放到终点前 1px,再触发一次
click,可以同时满足位置和链接生成条件。
Solution
在题目页面的浏览器开发者工具 Console 中运行完整脚本:
1 | (function moveTargetToGoal() { |