diff --git a/index.js b/index.js index 03679e0..cc968f7 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /* - DVDFab Server Emulator v1.1.1 + DVDFab Server Emulator v1.1.2 */ // Libraries @@ -11,35 +11,34 @@ const mockttp = require('mockttp'); // Classes class Session { constructor() { - this.DOMAINS = ['hotmail.com', 'gmail.com', 'yahoo.com', 'outlook.com', 'protonmail.com', 'yandex.com']; - this.CHARACTERS = 'abcdefghijklmnopqrstuvwxyz0123456789.-'; - this.email = null; - this.machine_id = null; + this.emailDomains = ['hotmail.com', 'gmail.com', 'yahoo.com', 'outlook.com', 'protonmail.com', 'yandex.com']; + this.emailCharacters = 'abcdefghijklmnopqrstuvwxyz0123456789.-'; + this.currentEmail = null; + this.currentMachineId = null; this.usage = 0; - this.update(); + this.generateNewIdentity(); } generateRandomString(length) { - return Array(length).fill(null).map(() => this.CHARACTERS.charAt(Math.floor(Math.random() * this.CHARACTERS.length))).join(''); + return Array(length).fill(null).map(() => this.emailCharacters.charAt(Math.floor(Math.random() * this.emailCharacters.length))).join(''); } generateMacAddress() { - const bytes = Array.from({ length: 12 }, () => Math.floor(Math.random() * 256)); - const mac1 = bytes.slice(0, 6).map(b => b.toString(16).padStart(2, '0')).join('-'); - const mac2 = bytes.slice(6).map(b => b.toString(16).padStart(2, '0')).join('-'); - return `${mac1}:${mac2}`; + const macBytes = Array.from({ length: 12 }, () => Math.floor(Math.random() * 256)); + const firstMac = macBytes.slice(0, 6).map(_ => _.toString(16).padStart(2, '0')).join('-'); + const secondMac = macBytes.slice(6).map(_ => _.toString(16).padStart(2, '0')).join('-'); + return `${firstMac}:${secondMac}`; } - update() { - const length = Math.floor(Math.random() * 10) + 5; - this.email = `${this.generateRandomString(length)}@${this.DOMAINS[Math.floor(Math.random() * this.DOMAINS.length)]}`; - this.machine_id = this.generateMacAddress(); + generateNewIdentity() { + this.currentEmail = `${this.generateRandomString(Math.floor(Math.random() * 10) + 5)}@${this.emailDomains[Math.floor(Math.random() * this.emailDomains.length)]}`; + this.currentMachineId = this.generateMacAddress(); } patchBoundary(data) { if (this.usage === 3) { this.usage = 0; - this.update(); + this.generateNewIdentity(); } const macRegex = /^([0-9a-f]{2}-){5}[0-9a-f]{2}(:([0-9a-f]{2}-){5}[0-9a-f]{2})?/; @@ -49,9 +48,9 @@ class Session { for (const key in data) { const value = data[key]; if (macRegex.test(value)) { - data[key] = this.machine_id; + data[key] = this.currentMachineId; } else if (emailRegex.test(value)) { - data[key] = this.email; + data[key] = this.currentEmail; } else if (subscriptionRegex.test(value)) { data[key] = 'trial'; } @@ -183,15 +182,19 @@ ticket.push('TM:0'); console.log(' +=============================================================+'); console.log(' | DVDFab Server Emulator has started... |'); console.log(' | You may now use any DVDFab software. |'); - console.log(' | Press CTRL-C or close this window to stop the emulator. |'); + console.log(' | Press CTRL-C to stop the emulator. |'); console.log(' | You can safely ignore any errors. |'); console.log(' +=============================================================+'); - console.log(' | If you have any problems with your network after |'); - console.log(' | disconnecting from the local proxy, please run the |'); - console.log(' | \'stop.bat\' script. |'); - console.log(' +=============================================================+'); console.log(' | If you got this script from anywhere apart from |'); console.log(' | The CDM-Project, you likely have a malicious copy. |'); console.log(' +=============================================================+'); console.log(); + console.log(' !-------------------------------------------------------------!'); + console.log(' ! !!!!!!!!! READ THIS OR YOU WILL SUFFER, LITERALLY !!!!!!!!! !'); + console.log(' !-------------------------------------------------------------!'); + console.log(' ! ONCE YOU ARE READY, DO NOT JUST CLOSE THE EMULATOR! !'); + console.log(' ! Using CTRL-C will properly disconnect you from the proxy. !'); + console.log(' ! If you used the CLOSE BUTTON, run the \'stop.bat\' script. !'); + console.log(' !-------------------------------------------------------------!'); + console.log(); })();