Fixed account.dat generation

This commit is contained in:
Jonathan Barrow 2021-12-13 08:12:42 -05:00
parent 498ac2e79a
commit 9618dbf1c7
3 changed files with 40 additions and 9 deletions

16
package-lock.json generated
View File

@ -20,7 +20,8 @@
"gray-matter": "^4.0.3",
"marked": "^3.0.4",
"morgan": "^1.10.0",
"trello": "^0.11.0"
"trello": "^0.11.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"eslint": "^7.32.0"
@ -2372,6 +2373,14 @@
"node": ">= 0.4.0"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@ -4244,6 +4253,11 @@
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",

View File

@ -29,7 +29,8 @@
"gray-matter": "^4.0.3",
"marked": "^3.0.4",
"morgan": "^1.10.0",
"trello": "^0.11.0"
"trello": "^0.11.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"eslint": "^7.32.0"

View File

@ -1,6 +1,7 @@
const { Router } = require('express');
const crypto = require('crypto');
const DiscordOauth2 = require('discord-oauth2');
const { v4: uuidv4 } = require('uuid');
const AdmZip = require('adm-zip');
const util = require('../util');
const config = require('../../config.json');
@ -400,11 +401,27 @@ router.get('/online-files', async (request, response) => {
let decryptedPasswordHash = decipher.update(Buffer.from(request.cookies.ph, 'hex'));
decryptedPasswordHash = Buffer.concat([decryptedPasswordHash, decipher.final()]);
const miiNameBuffer = Buffer.alloc(0x16);
const miiName = Buffer.from(account.mii.name, 'utf16le').swap16();
miiName.copy(miiNameBuffer);
let accountDat = 'AccountInstance_00000000\n';
accountDat += `AccountPasswordCache=${decryptedPasswordHash.toString('hex')}\n`;
accountDat += 'IsPasswordCacheEnabled=1\n';
accountDat += 'PersistentId=80000001\n';
accountDat += 'TransferableIdBase=0\n';
accountDat += `Uuid=${uuidv4().replace(/-/g, '')}\n`;
accountDat += `MiiData=${Buffer.from(account.mii.data, 'base64').toString('hex')}\n`;
accountDat += `MiiName=${miiNameBuffer.toString('hex')}\n`;
accountDat += `AccountId=${account.username}\n`;
accountDat += 'PersistentId=80000001';
accountDat += 'BirthYear=0\n';
accountDat += 'BirthMonth=0\n';
accountDat += 'BirthDay=0\n';
accountDat += 'Gender=0\n';
accountDat += `EmailAddress=${account.email.address}\n`;
accountDat += 'Country=0\n';
accountDat += 'SimpleAddressId=0\n';
accountDat += `PrincipalId=${account.pid.toString(16)}\n`;
accountDat += 'IsPasswordCacheEnabled=1\n';
accountDat += `AccountPasswordCache=${decryptedPasswordHash.toString('hex')}`;
const onlineFiles = new AdmZip();
@ -412,10 +429,9 @@ router.get('/online-files', async (request, response) => {
onlineFiles.addFile('otp.bin', Buffer.alloc(0x400)); // nulled OTP
onlineFiles.addFile('seeprom.bin', Buffer.alloc(0x200)); // nulled SEEPROM
response.writeHead(200, {
'Content-Disposition': 'attachment; filename="Online Files.zip"',
'Content-Type': 'application/zip',
});
response.status(200);
response.set('Content-Disposition', 'attachment; filename="Online Files.zip');
response.set('Content-Type', 'application/zip');
response.end(onlineFiles.toBuffer());
});