Skip to content

Commit

Permalink
PHEX MV3
Browse files Browse the repository at this point in the history
PHEX MV3 commit
Merged by Eris
Lots of work by everyone
  • Loading branch information
Erisfiregamer1 committed Aug 7, 2022
2 parents 57bd136 + a2c8344 commit 821a061
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 192 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
2 changes: 1 addition & 1 deletion PHEx/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const zipdir = require("zip-dir");

// File System
const fs = require('fs');
const fs = require("fs");


// Prefix
Expand Down
Binary file modified PHEx/build/extension.crx
Binary file not shown.
Binary file modified PHEx/build/extension.xpi
Binary file not shown.
Binary file modified PHEx/build/extension.zip
Binary file not shown.
70 changes: 0 additions & 70 deletions PHEx/src/background.js

This file was deleted.

73 changes: 73 additions & 0 deletions PHEx/src/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[
{
"id": 1,
"priority": 1,
"action": {
"type": "block"
},
"condition": {
"urlFilter": "*://code.prodigygame.com/code/*/game.min.js?v=*"
}
},

{
"id": 2,
"priority": 1,
"action": {
"type": "modifyHeaders",
"responseHeaders": [
{
"header": "Content-Security-Policy",
"operation": "remove"
},
{
"header": "content-security-policy",
"operation": "remove"
},
{
"header": "X-Frame-Options",
"operation": "remove"
},
{
"header": "x-frame-options",
"operation": "remove"
}
]
},
"condition": {
"urlFilter": "*://*.prodigygame.com/*",
"resourceTypes": ["main_frame", "sub_frame", "stylesheet", "script", "image", "font", "object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "webtransport", "webbundle", "other"]
}
},

{
"id": 3,
"priority": 2,
"action": {
"type": "redirect",
"redirect": {
"url": "https://raw.githubusercontent.com/ProdigyPNP/ProdigyMathGameHacking/master/.github/ppnp.png"
}
},
"condition": {
"urlFilter": "*://cdn.prodigygame.com/game/assets/v1_cache/single-images/login-bg-13/1/login-bg-13.png",
"resourceTypes": ["main_frame", "sub_frame", "stylesheet", "script", "image", "font", "object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "webtransport", "webbundle", "other"]
}
},

{
"id": 4,
"priority": 2,
"action": {
"type": "redirect",
"redirect": {
"url": "https://raw.githubusercontent.com/ProdigyPNP/ProdigyMathGameHacking/master/.github/ProdigyLoaderPNP.png"
}
},
"condition": {
"urlFilter": "*://code.prodigygame.com/assets/svg/*logo*-*.svg",
"resourceTypes": ["main_frame", "sub_frame", "stylesheet", "script", "image", "font", "object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "webtransport", "webbundle", "other"]
}
}

]
232 changes: 135 additions & 97 deletions PHEx/src/disableIntegrity.js
Original file line number Diff line number Diff line change
@@ -1,99 +1,137 @@
/**
* disableIntegrity.js
*
* Currently maintained by ProdigyPNP
* Original author: Prodigy-Hacking
* Contributors: hostedposted, gemsvido, Eris
* File has been updated for Manifest V3
*/


(async () => {

/** Get an item from the chrome local storage. */
function get(key) {
return new Promise(resolve => {
chrome.storage.local.get([key], result => {
resolve(result[key]);
});
});
}

/** Custom P-NP URL from popup.js */
const url = await get("url");

/** Use Custom P-NP URL. */
const checked = await get("checked");

/** P-NP URL to use. Code: (If url exists and checked is true, then use url. Else, get a domain from infinite zero.) */
const redirectorDomain = (url && checked) ? url : (await (await fetch("https://infinitezero.net/domain")).text()).valueOf();

/** The hash for game.min.js */
const hash = "sha256-" + (await (await fetch(`${redirectorDomain}/hash?updated=${Date.now()}`)).text()).valueOf();


if (!window.scriptIsInjected) {


var rs4 = new String().valueOf();

function redirectorCheck() {

fetch(`${redirectorDomain}/game.min.js?updated=${Date.now()}`)
.then(res => res.text())
.then(response => {

rs4 = response;
console.log("[PHEx] Connection to server was Successful!");
console.log(redirectorDomain);

// <script src="https://code.prodigygame.com/code/3-13-0/game.min.js?v=3-13-0" onload="SW.Load.onGameLoad();" crossorigin="anonymous"></script>
// we cancel the real game.min, and just append ours
// a messy solution for sure, but this should only be a bandaid on a bulletwound
const injectedScript = document.createElement("script");



injectedScript.innerHTML = new String(rs4.valueOf());

document.body.append(injectedScript);
})
.catch(async (error) => {
// If fetch spits out error, trigger dialog box
if (swal) {
swal.fire({
title: "Oh no!",
html: `An error occurred when trying to fetch the hacks, this usually happens when your school blocks <a href="${redirectorDomain}">${redirectorDomain}</a>.<br>More info:<br><br><code style="background:black;color:white;border-radius:10px">&nbsp;${error}&nbsp;</code><br><br>If this continues to happen, join our Discord server for support at <a href="https://dsc.gg/ProdigyPNP">dsc.gg/ProdigyPNP</a>.`,
icon: "error"
})
} else {
const res = confirm(`Oh No! Something went wrong while trying to connect to the server! Try reloading this page. If this error continues to appear, hit ok to join our Discord for support, or create an issue on the GitHub. More info ${error}. This is normally caused by your school or organization blocking the hacks.`);
if (res) location = "https://dsc.gg/ProdigyPNP";
}
});
}

/** Run the redirectorCheck() function with a 1-second delay. */
setTimeout(redirectorCheck, 1000);

/** User's version of PHEx */
const pluginVersion = chrome.runtime.getManifest().version;

/** Latest version of PHEx. */
const supportedVersion = (await (await fetch(`${redirectorDomain}/version`)).text());


/** Checks for plugin version. If outdated, triggers dialog box */
if (pluginVersion !== supportedVersion) {
const res = confirm(`PHEx is outdated. If you experience any errors, please update.\n\Your Version: ${pluginVersion}\nLatest Version: ${supportedVersion}`);

if (res) location = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/meta/wiki/UPDATING.md";
}


/** Remove integrity attributes from scripts and links. */
console.groupCollapsed("[PHEx] integrity patches");
[...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(element => {
if (element.hasAttribute("integrity")) {
console.log("[PHEx] " + element.getAttribute("integrity"));
element.removeAttribute("integrity");
}
});
console.groupEnd("[PHEx] integrity patches");
/** End disable integrity */


/** Script is now injected. */
window.scriptIsInjected = true;
}
const browser = chrome || browser;

/** get an item from chrome local storage */
function get(key) {
return new Promise(resolve => {
browser.storage.local.get([key], result => {
resolve(result[key]);
});
});
}

/** Custom P-NP URL */
const url = await get("url");

/** Use Custom P-NP URL */
const checked = await get("checked");

/** RedirectorDomain */
const PNPURL = (url && checked) ? url : await (await fetch("https://infinitezero.net/domain")).text();




/*-----------------------------------------------*
* *
* INJECT GAME.MIN.JS *
* *
------------------------------------------------*/

async function insertCode () {
try {
const request = await (await fetch("https://infinitezero.net/eval")).text();
document.documentElement.setAttribute("onreset", `${request}\nSW.Load.decrementLoadSemaphore();`);
document.documentElement.dispatchEvent(new CustomEvent("reset"));
document.documentElement.removeAttribute("onreset");
} catch (e) {
alert("Failed to load the hacks. Error:\n" + e.message);
}
}





/*-----------------------------------------------*
* *
* DISABLE INTEGRITY *
* *
------------------------------------------------*/


if (!window.scriptIsInjected) {
window.scriptIsInjected = true;
setTimeout(insertCode, 1000);
console.group("integrity patches");
[...document.getElementsByTagName("script"), ...document.getElementsByTagName("link")].forEach(v => {
if (v.integrity) {
console.log(v.integrity);
v.removeAttribute("integrity");
}
});
console.groupEnd();
}






/*-----------------------------------------------*
* *
* LATEST PHEx VERSION *
* *
------------------------------------------------*/


/** User's version of PHEx */
const pluginVersion = chrome.runtime.getManifest().version;

/** Latest version of PHEx. */
const supportedVersion = (await (await fetch(`${PNPURL}/version`)).text());


/** Checks for plugin version. If outdated, triggers dialog box */
if (pluginVersion !== supportedVersion) {
const res = confirm(`PHEx is outdated. If you experience any errors, please update.\n\Your Version: ${pluginVersion}\nLatest Version: ${supportedVersion}`);
if (res) { location = "https://github.com/ProdigyPNP/ProdigyMathGameHacking/blob/master/meta/wiki/UPDATING.md"; }
}







/*-----------------------------------------------*
* *
* CUSTOM LOADING TEXT *
* *
------------------------------------------------*/

/** Custom Loading Text Array */
const customLoadingText = await (await (await fetch("https://raw.githubusercontent.com/ProdigyPNP/P-NP/master/loadingText.txt")).text()).split("\n");

/** Which text to use */
var index = 0;

/** Update custom loading text index */
setInterval(() => {
index = Math.floor(Math.random() * customLoadingText.length);
}, 2000);

/** Override the loading text */
setInterval(() => {
const LT = document.getElementById("loading-text");
if (LT) {
LT.innerHTML = customLoadingText[index];
}
}, 100);

/* CUSTOM LOADING TEXT */




})();

0 comments on commit 821a061

Please sign in to comment.