forked from TrungNguyen1909/ggctf20-teleport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
50 lines (46 loc) · 2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: monospace;
}
</style>
</head>
<body>
<script src="chall/bindings/mojo_bindings.js"></script>
<script src="chall/bindings/content/common/pwn.mojom.js"></script>
<script src="chall/bindings/services/network/public/mojom/url_loader_factory.mojom.js"></script>
<script src="/pwn.js"></script>
<script>
function loadServiceWorkerAndStart(){
if (navigator.serviceWorker.controller) {
main();
} else {
navigator.serviceWorker.register('/service_worker.js', { scope: './' }).then(function (reg) {
main();
}).catch(function (error) {
console.log('registration failed with ' + error.message);
fetch("/failed", {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
credentials: 'same-origin', // include, *same-origin, omit
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow', // manual, *follow, error
referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
body: JSON.stringify({ 'error': error.message }) // body data type must match "Content-Type" header
});
});
}
}
if (navigator.serviceWorker) {
loadServiceWorkerAndStart();
} else {
console.log('no service worker');
}
</script>
</body>
</html>