-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
51 lines (51 loc) · 1.74 KB
/
main.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
41
42
43
44
45
46
47
48
49
50
51
(function() {
"use strict";
console.log("Loaded main");
(()=>{
const i = setInterval(()=>{
try{
vm.runtime.on("ANSWER",A=>window.ANSWER=A);
clearInterval(i);
}catch(e){}
},100);
})();
const spritefile = document.createElement("input");
spritefile.type = "file";
const jsfile = document.createElement("input");
jsfile.type = "file";
document.addEventListener("ScratchSploitMessage",e=>{
const req = e.detail;
switch(req.type) {
case "spoofUser":
vm.runtime.ioDevices.userData._username = req.value;
break;
case "injectSprite":
spritefile.onchange = function(e){
console.log(e.target,e.target.files)
const files = e.target.files;
Array.from(files).forEach(file=>{
const reader = new FileReader;
reader.onload = ()=>{
vm.addSprite(reader.result);
}
reader.readAsArrayBuffer(file);
});
}
spritefile.click();
break;
case "injectJS":
jsfile.onchange = function(e){
const files = e.target.files;
Array.from(files).forEach(file=>{
const reader = new FileReader;
reader.onload = ()=>{
eval(reader.result);
}
reader.readAsText(file);
});
}
jsfile.click();
break;
}
});
})();