白嫖 worker 自建短链服务 Url-Shorten-Worker API 不公开服务
源码:
https://github.com/crazypeace/Url-Shorten-Worker
搭建方法:
https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html
API 不公开服务的修改思路:
gh-pages 分支下
index.html
<input type="text" class="form-password" value="__PASSWORD__" readonly="true" id="passwordText">
main.js
body: JSON.stringify({ url: document.querySelector("#text").value, customShortURL: document.querySelector("#customShortURL").value, password: document.querySelector("#passwordText").value })
准备放到 worker 的脚本
在返回
let index= await fetch("https://crazypeace.github.io/Url-Shorten-Worker/"+config.theme+"/index.html")index=await index.text()index=index.replace(/__PASSWORD__/gm, password_value)return new Response(index, {headers: {"content-type": "text/html;charset=UTF-8",},})
获取
let req_password=req["password"]
增加验证密钥的处理, 如果
if (req_password != password_value) {return new Response(`{"status":500,"key":": Error: Invalid password."}`, {headers: response_header,})}
整个系统运行逻辑为:
worker
当用户点击按钮提交
worker
整个系统的安全性
整个系统的源码和逻辑都可以公开给攻击者。如果攻击者不能拿到
评论
发表评论