Skip to content

Commit

Permalink
Merge pull request #2 from Miner49ur/css-test
Browse files Browse the repository at this point in the history
Css test
  • Loading branch information
Miner49ur authored Aug 30, 2024
2 parents 9ac9dc2 + 6d6acc7 commit fc69266
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 100 deletions.
48 changes: 0 additions & 48 deletions payloads/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,6 @@ <h1>No payloads are available</h1>
</ul>
</div>

<!-- <style>
body {
background-color: #1e2030;
color: white;
font-family: Arial, Helvetica, sans-serif;
overflow: hidden;
}
a {
color: #b7bdf8;
}
.main {
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
border: 3px solid white;
font-weight: bold;
padding: 5%;
border-radius: 10px;
text-align: center;
background-color: #24273a;
}
.button {
background-color: #a6da95;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
cursor: pointer;
border-radius: 5px;
}
ul {
text-align: center;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
}
</style> -->
</body>

</html>
128 changes: 76 additions & 52 deletions payloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ const managementTemplate = `
<div id="chrome_management_disable_ext">
<h1> chrome.management Disable Extensions </h1>
<p> Note that this only works on extensions installed by your administrator </p>
<ol class="extlist">
</ol><br/>
<input type="text" class="extnum" /><button disabled id="toggler">Toggle extension</button>
<p class ="description">this funny was granted by the members of silly goober money gang</p>
<p class ="description">we love casting fun times</p>
<br/>
<button id="current-extension">Disable injected extension</button>
<br/><br/>
<button id="current-extension">Disable currently running extension</button>
<ul class="extlist">
</ul>
<!-- <input type="text" class="extnum" /><button disabled id="toggler">Toggle extension</button>
<br/><br/> -->
</div>
<br/>
info: DO NOT SHARE, BETA
`; // TODO: Add CSS for this
`;
let savedExtList = [];
const slides = [];
let activeSlideIdx = 0;
Expand Down Expand Up @@ -286,6 +286,18 @@ class DefaultExtensionCapabilities extends ExtensionCapabilities {
class HostPermissions {
activate() {}
}
function createExtensionCard(name, id, enabled) {
const li = document.createElement('li');
li.className = 'extension-card';
li.innerHTML = `
<span class="extension-name">${name} (${id})</span>
<label class="toggle-switch">
<input type="checkbox" ${enabled ? 'checked' : ''}>
<span class="slider"></span>
</label>
`;
return li;
}
function updateExtensionStatus(extlist_element) {
return new Promise(function (resolve, reject) {
extlist_element.innerHTML = "";
Expand All @@ -297,21 +309,30 @@ function updateExtensionStatus(extlist_element) {
return;
}
ordlist.push(e);
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(itemElement);

let card = createExtensionCard(e.name, e.id, e.enabled)

card.querySelector('input').addEventListener('change', (event) => {
chrome.management.setEnabled(e.id, event.target.checked);
// setTimeout(function () {
// updateExtensionStatus(extlist_element);
// }, 200);
});
// 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);
resolve();
});
savedExtList = ordlist;
Expand All @@ -326,9 +347,12 @@ const fileManagerPrivateTemplate = `
</div>
`
const htmlStyle = `<style> body {font-family: Arial, sans-serif;background-color: #202124;color: #fff;margin: 0;padding: 20px;}#chrome_management_disable_ext {max-width: 800px;margin: 0 auto;}h1 {font-size: 24px;margin-bottom: 20px;}.description {margin-bottom: 20px;color: #9aa0a6;}.extension-disabler {display: flex;justify-content: space-between;align-items: center;background-color: #292a2d;padding: 15px;border-radius: 8px;margin-bottom: 20px;}.extlist {list-style-type: none;padding: 0;}.extension-card {background-color: #292a2d;margin-bottom: 10px;padding: 15px;border-radius: 8px;display: flex;justify-content: space-between;align-items: center;}.extension-name {font-weight: bold;}.toggle-switch {position: relative;display: inline-block;width: 60px;height: 34px;}.toggle-switch input {opacity: 0;width: 0;height: 0;}.slider {position: absolute;cursor: pointer;top: 0;left: 0;right: 0;bottom: 0;background-color: #ccc;transition: .4s;border-radius: 34px;}.slider:before {position: absolute;content: "";height: 26px;width: 26px;left: 4px;bottom: 4px;background-color: white;transition: .4s;border-radius: 50%;}input:checked + .slider {background-color: #2196F3;}input:checked + .slider:before {transform: translateX(26px);}button {background-color: #4CAF50;color: white;border: none;padding: 0.5rem 1rem;border-radius: 5px;cursor: pointer;transition: background-color 0.3s;}button:hover {background-color: #45a049;}button:disabled {background-color: #cccccc;cursor: not-allowed;}#current-extension {background-color: #f44336;font-family: Arial;font-size: medium;font-weight: bold;}#current-extension:hover {background-color: #da190b;} </style>`;

onload = async function x() {
let foundNothing = true;
document.open();
this.document.write(htmlStyle);
if (chrome.fileManagerPrivate) {
// alert(1);
chrome.fileManagerPrivate.openURL("data:text/html,<h1>Hello</h1>");
Expand All @@ -337,8 +361,8 @@ onload = async function x() {
};
}
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(
Expand All @@ -356,39 +380,39 @@ onload = async function x() {
}
};

container_extensions.querySelector("#toggler").onclick = async function dx(e) {
// open();
container_extensions.querySelector("#toggler").disabled = true;
// 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,
);
});
// 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;
// container_extensions.querySelector("#toggler").disabled = false;
// await updateExtensionStatus(extlist_element);
// };
// container_extensions.querySelector("#toggler").disabled = false;
}
const otherFeatures = window.chrome.runtime.getManifest();
const permissions = otherFeatures.permissions;

new DefaultExtensionCapabilities().activate();
document.close();
ExtensionCapabilities.setupSlides();
};
};

0 comments on commit fc69266

Please sign in to comment.