-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecompilerV2.html
More file actions
75 lines (75 loc) · 2.13 KB
/
Copy pathdecompilerV2.html
File metadata and controls
75 lines (75 loc) · 2.13 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
<head>
<title>decompiler V2</title>
<meta name="viewport"content="width=device-width,initial-scale=1">
<style>
#actual,#display{
font-family:monospace;
word-wrap:break-word;
width:100%;
font-size:15px;
top:0;
left:0;
position:fixed;
}
#actual{
resize:none;
height:80%;
color:rgba(0,0,0,0);
caret-color:black;
opacity:.2;
}
#display{
margin-top:2px;
margin-left:2px;
z-index:-1;
font-weight:900;
}
button{
position:fixed;
top:80%;
}
.str{
color:brown;
}
.num{
color:red;
}
.keywords{
color:blue;
}
.bool{
color:purple;
}
</style>
</head>
<body>
<textarea id=actual>alert("Hello world")</textarea>
<div id=display></div>
<button onclick="try{eval(display.innerText)}catch(e){console.log(e.stack)}">Run</button>
<script>
setInterval(()=>{
Element.prototype.remove=_=>alert("we can't allow you");
document.write=_=>alert("we can't allow you");
debugger;
});
//prevents access to internal functions from the terminal
(function(loop,delay,log,$){
let keywords=/(arguments|break|case|continue|debugger|default|delete|do|enum|eval|export|extends|finally|implements|import|in|instanceof|interface|new|package|private|protected|public|static|super|switch|throw|typeof|void|while|with|yield|var|let|this|const|function|await|async|for|return|if|else|try|catch)(?!"(?:(?:[^"]*"){2})*[^"]*)/g;
let bool=/(NaN|true|false|null)(?!"(?:(?:[^"]*"){2})*[^"]*)/g;
loop(()=>{
$("display").innerHTML=
$("actual").value
.replaceAll(/\n/g,"<br/>")//newline
.replaceAll(/"([^"]*)"/g,'<span class=str>"$1"</span>')
.replaceAll(/'([^']*)'/g,"<span class=str>'$1'</span>")
.replaceAll(/\d+/g,m=>`<span class=num>${m}</span>`)
.replaceAll(keywords,"<span class=keywords>$1</span>")
.replaceAll(bool,"<span class=bool>$1</span>");
$("display").style.fontSize=window.getComputedStyle($("actual")).getPropertyValue("font-size");
})
})(setInterval,setTimeout,console.log,n=>document.getElementById(n))
</script>
</body>
</html>