Compare commits

..

1 Commits

Author SHA1 Message Date
Sandro Soria
7513a1202d
Merge f0321e1f6d into 03dac9ed6d 2024-10-26 16:48:08 +00:00
12 changed files with 172 additions and 90 deletions

View File

@ -126,6 +126,42 @@ Builds for macOS may not work on Windows/Linux and vice-versa.
---
### Athena's Shield
The Extra File Verification System
Athenas Shield prevents the use of unapproved mods in HeliosLauncher by verifying the integrity of each mod from the distribution, blocking unauthorized changes, and ensuring a secure, reliable gaming experience.
**How to active this ?**
```console
> npm run athshield
```
```
Would you like to activate Athena's Shield? (yes/no): yes
Would you like to activate debug mode? (yes/no): yes
Would you like to hide or block the menu? (hide/block): block
Athena's Shield activated. Menu blocked.
```
You can choose whether Athena's Shield hides the mod category or blocks interaction with the drop-in mod.
```console
▄▄▄ ▄▄▄█████▓ ██░ ██ ▓█████ ███▄ █ ▄▄▄ ██████ ██████ ██░ ██ ██▓▓█████ ██▓ ▓█████▄
▒████▄ ▓ ██▒ ▓▒▓██░ ██▒▓█ ▀ ██ ▀█ █ ▒████▄ ▒██ ▒ ▒██ ▒ ▓██░ ██▒▓██▒▓█ ▀ ▓██▒ ▒██▀ ██▌
▒██ ▀█▄ ▒ ▓██░ ▒░▒██▀▀██░▒███ ▓██ ▀█ ██▒▒██ ▀█▄ ░ ▓██▄ ░ ▓██▄ ▒██▀▀██░▒██▒▒███ ▒██░ ░██ █▌
░██▄▄▄▄██░ ▓██▓ ░ ░▓█ ░██ ▒▓█ ▄ ▓██▒ ▐▌██▒░██▄▄▄▄██ ▒ ██▒ ▒ ██▒░▓█ ░██ ░██░▒▓█ ▄ ▒██░ ░▓█▄ ▌
▓█ ▓██▒ ▒██▒ ░ ░▓█▒░██▓░▒████▒▒██░ ▓██░ ▓█ ▓██▒▒██████▒▒ ▒██████▒▒░▓█▒░██▓░██░░▒████▒░██████▒░▒████▓
▒▒ ▓▒█░ ▒ ░░ ▒ ░░▒░▒░░ ▒░ ░░ ▒░ ▒ ▒ ▒▒ ▓▒█░▒ ▒▓▒ ▒ ░ ▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒░▓ ░░ ▒░ ░░ ▒░▓ ░ ▒▒▓ ▒
▒ ▒▒ ░ ░ ▒ ░▒░ ░ ░ ░ ░░ ░░ ░ ▒░ ▒ ▒▒ ░░ ░▒ ░ ░ ░ ░▒ ░ ░ ▒ ░▒░ ░ ▒ ░ ░ ░ ░░ ░ ▒ ░ ░ ▒ ▒
░ ▒ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
```
---
### Visual Studio Code
All development of the launcher should be done using [Visual Studio Code][vscode].

View File

@ -2,27 +2,32 @@ const fs = require('fs')
const readline = require('readline')
const path = require('path')
const configPath = path.join(__dirname, 'variables.json')
// Path to the configuration file
const configPath = path.join(__dirname, 'variables.athshield')
// Load the variables from the file
function loadConfig() {
const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString())
return JSON.parse(rawData.toString()) // Convert Buffer to string
}
// Save the variables to the file
function saveConfig(config) {
const data = JSON.stringify(config, null, 2)
fs.writeFileSync(configPath, data)
}
// Create the readline interface
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
// Function to ask questions to the user
function startCLI() {
const config = loadConfig()
rl.question('Would you like to activate extra file verification? (yes/no): ', (answer) => {
rl.question('Would you like to activate Athena\'s Shield? (yes/no): ', (answer) => {
if (answer.trim().startsWith('//')) {
console.log('This is a comment; the line is ignored.')
rl.close()
@ -30,10 +35,10 @@ function startCLI() {
}
if (answer.toLowerCase() === 'yes') {
config.extraFileVerifActivated = true
config.athenaShieldActivated = true
rl.question('Would you like to activate debug mode? (yes/no): ', (debugAnswer) => {
config.debug = debugAnswer.toLowerCase() === 'yes'
config.debug = debugAnswer.toLowerCase() === 'yes' // Set debug to true or false
rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => {
if (menuAnswer.trim().startsWith('//')) {
@ -43,27 +48,29 @@ function startCLI() {
}
if (menuAnswer.toLowerCase() === 'hide') {
config.menuVisibility = 'hidden'
console.log('Extra file verification activated. Menu hidden.')
config.menuVisibility = 'hidden' // Set to 'hidden'
console.log('Athena\'s Shield activated. Menu hidden.')
} else if (menuAnswer.toLowerCase() === 'block') {
config.menuVisibility = 'blocked'
console.log('Extra file verification activated. Menu blocked.')
config.menuVisibility = 'blocked' // Set to 'blocked'
console.log('Athena\'s Shield activated. Menu blocked.')
} else {
console.log('Invalid option for the menu.')
rl.close()
return
}
// Save the modified configuration
saveConfig(config)
rl.close()
})
})
} else if (answer.toLowerCase() === 'no') {
console.log('Extra file verification not activated. Closing the CLI.')
config.extraFileVerifActivated = false
config.menuVisibility = 'visible'
config.debug = false
console.log('Athena\'s Shield not activated. Closing the CLI.')
config.athenaShieldActivated = false
config.menuVisibility = 'visible' // Reset to default
config.debug = 'false'
// Save the modified configuration
saveConfig(config)
rl.close()
} else {
@ -73,4 +80,5 @@ function startCLI() {
})
}
// Launch the CLI
startCLI()

View File

@ -0,0 +1,37 @@
const fs = require('fs')
const path = require('path')
// Chemin vers le fichier de configuration
const configPath = path.join(__dirname, 'variables.athshield')
// Classe pour gérer Athena's Shield
class AthenaShield {
constructor() {
this.config = this.loadConfig()
}
// Charger les variables depuis le fichier
loadConfig() {
const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString())
}
// Récupérer le statut d'Athena's Shield
get status() {
return this.config.athenaShieldActivated
}
// Récupérer la visibilité du menu
get type() {
return this.config.menuVisibility
}
// Récupérer le mode debug
get debug() {
return this.config.debug
}
}
// Exporter une instance de la classe
const athenaShieldInstance = new AthenaShield()
module.exports = athenaShieldInstance

View File

@ -0,0 +1,5 @@
{
"athenaShieldActivated": false,
"menuVisibility": "visible",
"debug": "false"
}

View File

@ -1,30 +0,0 @@
const fs = require('fs')
const path = require('path')
const configPath = path.join(__dirname, 'variables.json')
class ExtraFileVerification {
constructor() {
this.config = this.loadConfig()
}
loadConfig() {
const rawData = fs.readFileSync(configPath)
return JSON.parse(rawData.toString())
}
get status() {
return this.config.extraFileVerifActivated
}
get type() {
return this.config.menuVisibility
}
get debug() {
return this.config.debug
}
}
const ExtraFileVerificationInstance = new ExtraFileVerification()
module.exports = ExtraFileVerificationInstance

View File

@ -1,6 +0,0 @@
{
"extraFileVerifActivated": false,
"menuVisibility": "visible",
"debug": false
}

View File

@ -437,6 +437,36 @@ async function downloadJava(effectiveJavaOptions, launchAfter = true) {
}
/**
* @Name dlAsync Function
* @returns {Promise<void>}
*
* @author Sandro642
* @Cheating Athena's Shield
*
* @Added whitelist for mods
* @Added support for the new HeliosLauncher version
*/
/**
* @Reviewed on 10.26.2024 expires on XX.XX.2025
* @Bugs discovereds: 0
* @Athena's Shield
* @Sandro642
*/
// ▄▄▄ ▄▄▄█████▓ ██░ ██ ▓█████ ███▄ █ ▄▄▄ ██████ ██████ ██░ ██ ██▓▓█████ ██▓ ▓█████▄
// ▒████▄ ▓ ██▒ ▓▒▓██░ ██▒▓█ ▀ ██ ▀█ █ ▒████▄ ▒██ ▒ ▒██ ▒ ▓██░ ██▒▓██▒▓█ ▀ ▓██▒ ▒██▀ ██▌
// ▒██ ▀█▄ ▒ ▓██░ ▒░▒██▀▀██░▒███ ▓██ ▀█ ██▒▒██ ▀█▄ ░ ▓██▄ ░ ▓██▄ ▒██▀▀██░▒██▒▒███ ▒██░ ░██ █▌
// ░██▄▄▄▄██░ ▓██▓ ░ ░▓█ ░██ ▒▓█ ▄ ▓██▒ ▐▌██▒░██▄▄▄▄██ ▒ ██▒ ▒ ██▒░▓█ ░██ ░██░▒▓█ ▄ ▒██░ ░▓█▄ ▌
// ▓█ ▓██▒ ▒██▒ ░ ░▓█▒░██▓░▒████▒▒██░ ▓██░ ▓█ ▓██▒▒██████▒▒ ▒██████▒▒░▓█▒░██▓░██░░▒████▒░██████▒░▒████▓
// ▒▒ ▓▒█░ ▒ ░░ ▒ ░░▒░▒░░ ▒░ ░░ ▒░ ▒ ▒ ▒▒ ▓▒█░▒ ▒▓▒ ▒ ░ ▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒░▓ ░░ ▒░ ░░ ▒░▓ ░ ▒▒▓ ▒
// ▒ ▒▒ ░ ░ ▒ ░▒░ ░ ░ ░ ░░ ░░ ░ ▒░ ▒ ▒▒ ░░ ░▒ ░ ░ ░ ░▒ ░ ░ ▒ ░▒░ ░ ▒ ░ ░ ░ ░░ ░ ▒ ░ ░ ▒ ▒
// ░ ▒ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░
// ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
// ░
// Keep reference to Minecraft Process
let proc
// Is DiscordRPC enabled
@ -457,7 +487,7 @@ async function dlAsync(login = true) {
// launching the game.
const loggerLaunchSuite = LoggerUtil.getLogger('LaunchSuite')
const loggerLanding = LoggerUtil.getLogger('dlAsync')
const loggerLanding = LoggerUtil.getLogger('Landing')
setLaunchDetails(Lang.queryJS('landing.dlAsync.loadingServerInfo'))
let distro
@ -482,8 +512,8 @@ async function dlAsync(login = true) {
// --------- Mod Verification Logic ---------
if (extraFileVerif.status) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.usingExtraFileVerif'))
if (athShield.status) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.usingAthShield'))
const modsDir = path.join(ConfigManager.getDataDirectory(), 'instances', serv.rawServer.id, 'mods')
@ -500,8 +530,8 @@ async function dlAsync(login = true) {
if (mdl.rawModule.name.endsWith('.jar')) {
const modPath = path.join(modsDir, mdl.rawModule.name)
const modIdentity = mdl.rawModule.identity || mdl.rawModule.artifact.MD5
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.distributionIdentityError', {
if (athShield.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.distributionIdentityError', {
'moduleName': mdl.rawModule.name,
'moduleIdentity': modIdentity
}))
@ -513,16 +543,17 @@ async function dlAsync(login = true) {
// Function to extract mod identity from the jar file
const extractModIdentity = (filePath) => {
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modIdentityExtraction', {'filePath': filePath}))
if (athShield.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.modIdentityExtraction', {'filePath': filePath}))
}
// Fall back to a hash if no identity is found
const fileBuffer = fs.readFileSync(filePath)
const hashSum = crypto.createHash('md5') // Use MD5 to match the distribution configuration
hashSum.update(fileBuffer)
const hash = hashSum.digest('hex')
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.identityNotFoundUsingHash', {
if (athShield.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.identityNotFoundUsingHash', {
'filePath': filePath,
'hash': hash
}))
@ -533,7 +564,7 @@ async function dlAsync(login = true) {
// Validate mods function
const validateMods = () => {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.startingModValidation'))
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.startingModValidation'))
const installedMods = fs.readdirSync(modsDir)
let valid = true
@ -542,17 +573,17 @@ async function dlAsync(login = true) {
// Skip validation for mods in the excluded list
if (EXCLUDED_MODS.includes(mod)) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modValidationBypassed', {'mod': mod}))
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.modValidationBypassed', {'mod': mod}))
continue
}
const expectedIdentity = distroMods[modPath]
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.validatingMod', {'mod': mod}))
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.validatingMod', {'mod': mod}))
if (expectedIdentity) {
const modIdentity = extractModIdentity(modPath)
if (extraFileVerif.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.expectedAndCalculatedIdentity', {
if (athShield.debug) {
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.expectedAndCalculatedIdentity', {
'expectedIdentity': expectedIdentity,
'mod': mod,
'modIdentity': modIdentity
@ -560,8 +591,8 @@ async function dlAsync(login = true) {
}
if (modIdentity !== expectedIdentity) {
if (extraFileVerif.debug) {
loggerLanding.error(Lang.queryJS('landing.dlAsync.extraFileVerif.modIdentityMismatchError', {
if (athShield.debug) {
loggerLanding.error(Lang.queryJS('landing.dlAsync.AthShield.modIdentityMismatchError', {
'mod': mod,
'expectedIdentity': expectedIdentity,
'modIdentity': modIdentity
@ -572,26 +603,26 @@ async function dlAsync(login = true) {
break
}
} else {
loggerLanding.warn(Lang.queryJS('landing.dlAsync.extraFileVerif.expectedIdentityNotFound', {'mod': mod}))
loggerLanding.warn(Lang.queryJS('landing.dlAsync.AthShield.expectedIdentityNotFound', {'mod': mod}))
valid = false
break
}
}
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.modValidationCompleted'))
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.modValidationCompleted'))
return valid
}
// Perform mod validation before proceeding
if (!validateMods()) {
const errorMessage = Lang.queryJS('landing.dlAsync.extraFileVerif.invalidModsDetectedMessage', {'folder': ConfigManager.getNameDataPath()})
const errorMessage = Lang.queryJS('landing.dlAsync.AthShield.invalidModsDetectedMessage', {'folder': ConfigManager.getNameDataPath()})
loggerLanding.error(errorMessage)
showLaunchFailure(errorMessage, null)
return
}
} else {
loggerLanding.info(Lang.queryJS('landing.dlAsync.extraFileVerif.notUsingExtraFileVerif'))
loggerLanding.info(Lang.queryJS('landing.dlAsync.AthShield.notUsingAthShield'))
}
// --------- End of Mod Verification Logic ---------
@ -650,7 +681,7 @@ async function dlAsync(login = true) {
return
}
} else {
loggerLaunchSuite.info(Lang.queryJS('landing.dlAsync.notUsingExtraFileVerif.downloadingFiles'))
loggerLaunchSuite.info(Lang.queryJS('landing.dlAsync.AthShield.downloadingFiles'))
}
// Remove download bar.

View File

@ -3,7 +3,7 @@ const os = require('os')
const semver = require('semver')
const DropinModUtil = require('./assets/js/dropinmodutil')
const extraFileVerif = require('./assets/extraverif/parserExtraverif')
const athShield = require('./assets/athshield/parserAthShield')
const { MSFT_OPCODE, MSFT_REPLY_TYPE, MSFT_ERROR } = require('./assets/js/ipcconstants')
const settingsState = {
@ -722,10 +722,10 @@ function manageModCategory() {
const modsButton = document.querySelector('button[rSc="settingsTabMods"]')
const dropInMods = document.getElementById('settingsDropinModsContainer')
if (extraFileVerif.type === 'hidden') {
if (athShield.type === 'hidden') {
// Hide the Mods navigation button
modsButton.style.display = 'none'
} else if (extraFileVerif.type === 'blocked') {
} else if (athShield.type === 'blocked') {
// Hide the drop-in mods elements
dropInMods.style.display = 'none'
}

View File

@ -215,7 +215,7 @@ gameExited = "Game process exited with code {code}."
gameErrorDuringLaunch = "Error during game launch {error}."
waintingLaunchingGame = "Waiting for game window..."
[js.landing.dlAsync.extraFileVerif]
[js.landing.dlAsync.AthShield]
distributionIdentityError = "Expected Identity from Distribution for {moduleName}: {moduleIdentity}."
modIdentityExtraction = "Extracting identity for mod at: {filePath}."
identityNotFoundUsingHash = "No identity found in manifest for {filePath}, using hash: {hash}"
@ -226,10 +226,10 @@ expectedAndCalculatedIdentity = "Expected Identity: {expectedIdentity}, Calculat
modIdentityMismatchError = "Mod identity mismatch! Mod: {mod}, Expected: {expectedIdentity}, Found: {modIdentity}"
expectedIdentityNotFound = "No expected identity found for mod: {mod}. Marking as invalid."
modValidationCompleted = "Mod validation completed."
invalidModsDetectedMessage = "Extra file verification has detected invalid mods. Please delete the {folder} folder and restart the launcher."
invalidModsDetectedMessage = "Athena's Shield has detected invalid mods. Please delete the {folder} folder and restart the launcher."
downloadingFiles = "No invalid files, skipping download."
usingExtraFileVerif = "Extra file verification activated, Resource usage..."
notUsingExtraFileVerif = "Extra file verification deactivated, Not using resources..."
usingAthShield = "Athena's Shield activated, Resource usage..."
notUsingAthShield = "Athena's Shield deactivated, Not using resources..."
[js.landing.news]
checking = "Checking for News"

View File

@ -1,16 +1,16 @@
**Documentation: ExtraFileVerification for HeliosLauncher**
**Documentation: Athena's Shield for HeliosLauncher**
### Introduction
HeliosLauncher is a game launcher for Minecraft developed by Daniel Scalzi, designed to provide a secure and optimized gaming experience. To maintain game integrity and prevent unauthorized or altered mods, I have implemented a new security system called ExtraFileVerification.
HeliosLauncher is a game launcher for Minecraft developed by Daniel Scalzi, designed to provide a secure and optimized gaming experience. To maintain game integrity and prevent unauthorized or altered mods, I have implemented a new security system called Athena's Shield.
### Purpose of ExtraFileVerification
The main purpose of ExtraFileVerification is to ensure that only authorized and verified mods are used with HeliosLauncher. This system checks the integrity of installed mods to prevent any modifications or additions of malicious or unapproved mods.
### Purpose of Athena's Shield
The main purpose of Athena's Shield is to ensure that only authorized and verified mods are used with HeliosLauncher. This system checks the integrity of installed mods to prevent any modifications or additions of malicious or unapproved mods.
### Key Features
**Installed Mod Validation:**
- Before launching the game, ExtraFileVerification verifies the mods present in the HeliosLauncher mods folder.
- Before launching the game, Athena's Shield verifies the mods present in the HeliosLauncher mods folder.
- Each mod is validated by comparing its name and hash (digital fingerprint) with expected data in the distribution.
- If a mod does not meet validation criteria, game launch is stopped, and an error message is displayed.
@ -21,7 +21,7 @@ The main purpose of ExtraFileVerification is to ensure that only authorized and
**Modification Management:**
- ExtraFileVerification also verifies changes to mods. For instance, if a mod is deleted, replaced, or renamed, it will be detected.
- Athena's Shield also verifies changes to mods. For instance, if a mod is deleted, replaced, or renamed, it will be detected.
- Hash verification ensures that mods have not been altered since their initial download.
**Error Messages and Instructions:**
@ -31,18 +31,18 @@ The main purpose of ExtraFileVerification is to ensure that only authorized and
### User Benefits
- **Enhanced Security:** By preventing unauthorized mods and verifying integrity, ExtraFileVerification protects users from malicious mods.
- **Enhanced Security:** By preventing unauthorized mods and verifying integrity, Athena's Shield protects users from malicious mods.
- **Reliable Gaming Experience:** Ensures that only tested and validated mods are used, guaranteeing a stable and trouble-free gaming experience.
- **Ease of Use:** Users are guided with clear messages and instructions to help resolve any potential conflicts, simplifying problem-solving.
### Conclusion
ExtraFileVerification is a significant step toward enhancing the security and integrity of HeliosLauncher. With this integration, I ensure that every Minecraft user enjoys a safe and reliable gaming experience, without compromising on quality or security.
Athena's Shield is a significant step toward enhancing the security and integrity of HeliosLauncher. With this integration, I ensure that every Minecraft user enjoys a safe and reliable gaming experience, without compromising on quality or security.
If you have any questions or need further clarification about ExtraFileVerification, feel free to contact me.
If you have any questions or need further clarification about Athena's Shield, feel free to contact me.
**The only way to bypass ExtraFileVerification would be through advanced cryptography knowledge, involving signature copying or hash modification.**
**The only way to bypass Athena's Shield would be through advanced cryptography knowledge, involving signature copying or hash modification.**
The creation and verification of ExtraFileVerification are currently complete, though additional improvements may be made in the future, as with any project.
The creation and verification of Athena's Shield are currently complete, though additional improvements may be made in the future, as with any project.
Respectfully,
**SORIA Sandro (Sandro642)**
**SORIA Sandro (Sandro642)**

Binary file not shown.

View File

@ -18,7 +18,7 @@
"dist:mac": "npm run dist -- -m",
"dist:linux": "npm run dist -- -l",
"lint": "eslint --config .eslintrc.json .",
"extraverif": "node app/assets/extraverif/extraverif.js"
"athshield": "node app/assets/athshield/athshield.js"
},
"engines": {
"node": "20.x.x"
@ -26,6 +26,7 @@
"dependencies": {
"@electron/remote": "^2.1.2",
"adm-zip": "^0.5.16",
"crypto": "^1.0.1",
"discord-rpc-patch": "^4.0.1",
"ejs": "^3.1.10",
"ejs-electron": "^3.0.0",