Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripped Down ExtHang3r #77

Merged
merged 9 commits into from
Feb 5, 2025
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ <h1>ExtHang3r</h1>
selectElement.appendChild(option);
document.getElementById("hangButton").style.display = "none";
document.getElementById("iframeCountSlider").style.display = "none";
document.getElementById("labelForIframeSlider").style.display = "none";
try{document.getElementById("labelForIframeSlider").style.display = "none";}catch(err){}
document.getElementById("iframeCountValue").style.display = "none";
}
}
Expand Down Expand Up @@ -309,10 +309,10 @@ <h1>ExtHang3r</h1>
document.getElementById("killButton").style.display = "inline-block";
document.getElementById("hangButton").style.display = "none";
document.getElementById("iframeSelect").style.display = "none";
document.getElementById("labelForIframeSelect").style.display = "none";
try{document.getElementById("labelForIframeSelect").style.display = "none";}catch(err){}
document.getElementById("iframeCountSlider").style.display = "none";
document.getElementById("iframeCountValue").style.display = "none";
document.getElementById("labelForIframeSlider").style.display = "none";
try{document.getElementById("labelForIframeSlider").style.display = "none";}catch(err){}
document.getElementById("killButton").setAttribute("data-url", selectedSrc);
}, 10000);
}, 5000);
Expand All @@ -328,4 +328,4 @@ <h1>ExtHang3r</h1>
}
</script>
</body>
</html>
</html>
36 changes: 36 additions & 0 deletions strip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// ? This is a node.js script for stripping down the index.html to be more minimal and harder to tell what its goal is just by looking at someones screen.

// Import some built-in node.js packages for dealing with files.
const fs = require('fs')
const path = require('path')

// Get the base index.html content's so we can strip it down.
let html = fs.readFileSync(path.resolve("./index.html")).toString()

// All that good ol' regex/string matching magic using some home grown regex and strings.
html = html
// Replace the title and favicon with nothing, could probably be changed later to appear like google classroom
.replace(/<title>[\s\S]*?<\/title>/, "<title>.</title>")
.replace(/<link rel="shortcut icon" type="image\/png" href=".*?">/, "")

.replace(/<h.>.*?<\/h.>/g, "") // Remove headers
.replace(/<img.*?>/g, "") // Remove img elements
.replace(/<p>[\s\S]*?<\/p>/g, "") // Remove paragraph elements
.replace(/<label[\s\S]*?>[\s\S]*?<\/label>/g, "") // Remove label elements
.replace(">Hang Extension!</button>", ">Start!</button>") // Changes wording of kill extension button to be less obvious to someone just glancing at a user's screen.
.replace(">Kill Extension!</button>", ">Finish!</button>") // Changes wording of kill extension button to be less obvious to someone just glancing at a user's screen.
.replace("<footer>", "<footer><a href='https://github.com/Blobby-Boi/'>Link to Creator</a>") // Add back link to Blobby Boi's Github

// Only leave capital letters inside the extension names
.replace(/(?<=").*?(?=": "chrome-extension:\/\/)/gi, (matchedText)=>{
return matchedText.replace(/[a-z]/g, "")
})

// Make some element text contents give away what the page does less.
.replace(/ extension.? (?!\=)/gi, " ")
.replace(/kill/gi, "stop")
.replace(/hanged/gi, "paused")
.replace(/hang/gi, "pause");

// Write the now stripped down HTML to a new file.
fs.writeFileSync(path.resolve("./stripped.html"), html)
Loading