forked from LinusHenze/WebKit-RegEx-Exploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.js
executable file
·40 lines (35 loc) · 1 KB
/
logging.js
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
var ws_log = new WebSocket(`ws://${location.hostname}:5000/ws_log`);
var html_logging_ready = new Promise(function(resolve, reject) {
var body = document.getElementsByTagName("body")[0];
window.addEventListener("load", function() {
resolve();
}, false);
});
var logging_ready = new Promise(function(resolve, reject) {
ws_log.onopen = function() {
ws_log.send("Connection opened!");
resolve();
}
ws_log.onerror = function(err) {
reject(err);
};
});
print = function(msg) {
msg = "" + msg;
try {
ws_log.send(msg);
} catch (e) {}
msg = msg.replace("Wasm Memory", "Object");
msg = msg.replace("Wasm Internal Memory", "Internal Object");
document.body.innerHTML += msg + '<br>';
}
var putcharBuffer = "";
putchar = function (str) {
if (str[0] == "\n") {
print(putcharBuffer);
putcharBuffer = "";
} else {
putcharBuffer += str;
}
}
ready = Promise.all([ready, html_logging_ready, logging_ready]);