Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
grngxd committed Nov 24, 2024
1 parent 0ad0452 commit c1f211c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions injectors/desktop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ import * as core from '../core';
*/
const EXECUTABLE = await core.findDiscordExe();
const DEBUGGING_PORT = 4444;
const WEB_SERVER_PORT = 4443;

if (!EXECUTABLE) {
console.error('Discord executable not found.');
process.exit(1);
}

// Function to start the web server in a detached process
core.startProxy(WEB_SERVER_PORT);

// Extract process name for Windows
const processName = platform() === 'win32' ? path.basename(EXECUTABLE) : EXECUTABLE;

Expand Down Expand Up @@ -69,7 +73,7 @@ const injectCode = async () => {

console.log('WebSocket Address:', wsURL);

const ws: WebSocket = new WebSocket(wsURL);
const ws = new WebSocket(wsURL);
const code = fs.readFileSync('./out/veil.js', 'utf-8');

const timeout = setTimeout(() => {
Expand All @@ -92,17 +96,16 @@ const injectCode = async () => {
});

ws.on('message', (data) => {
if (data.method === 'Runtime.exceptionThrown') {
console.error('An exception was thrown while evaluating the payload:', data.params.exceptionDetails);
const message = JSON.parse(data.toString());
if (message.method === 'Runtime.exceptionThrown') {
console.error('An exception was thrown while evaluating the payload:', message.params.exceptionDetails);
process.exit(1);
}

if (data.method === 'Inspector.detached') {
if (message.method === 'Inspector.detached') {
console.error('The inspector was detached while evaluating the payload.');
process.exit(1);
}

process.exit(0);
});

ws.on('error', (error) => {
Expand All @@ -120,7 +123,6 @@ const injectCode = async () => {
// Initial launch of Discord
launchDiscord();

// Check and inject code at intervals
const i = setInterval(async () => {
try {
await injectCode();
Expand Down

0 comments on commit c1f211c

Please sign in to comment.