Delete all posts
Page 1 of 1
Interinactive
VIP Member



Posts: 29343

PostPosted: Tue, 2nd Jul 2024 13:37    Post subject: Delete all posts
Since I've had multiple requests in the past couple of months via PM, and again today, here it is so nobody has to ask again:

Code:
async function editPostToEmpty(pid) {
    try {
        console.log(`Editing post ${pid}`);
        let response = await fetch("https://www.nfohump.com/forum/posting.php", {
            "headers": {
                "content-type": "application/x-www-form-urlencoded",
            },
            "body": `subject=&addbbcode20=%23444444&addbbcode22=12&helpbox=Quote+text%3A+%5Bquote%5Dtext%5B%2Fquote%5D++%28alt%2Bq%29&message=%E2%81%A2%E2%81%A2&mode=editpost&p=${pid}&post=Submit`,
            "method": "POST",
            "mode": "cors",
            "credentials": "include"
        });

        if (!response.ok) {
            throw new Error(`Failed to edit post ${pid}: ${response.statusText}`);
        }
        console.log(`Edited post ${pid} successfully`);
    } catch (error) {
        console.error(`Error editing post ${pid}:`, error);
    }
}

async function getPosts(author, page = 0) {
    try {
        console.log(`Fetching posts for ${author} on page ${page}`);
        let parser = new DOMParser();
        let html = await fetch(`https://www.nfohump.com/forum/search.php?mode=results&start=${page * 30}`, {
            "headers": {
                "content-type": "application/x-www-form-urlencoded",
            },
            "body": `search_keywords=&search_terms=all&search_author=${author}&search_forum=-1&search_time=0&search_fields=all&search_cat=-1&sort_by=0&sort_dir=DESC&show_results=posts&return_chars=0`,
            "method": "POST",
            "mode": "cors",
            "credentials": "include"
        }).then(res => res.text());
        let DOM = parser.parseFromString(html, "text/html");
        let posts = [...DOM.querySelectorAll("b+ b a")].map(e => +e.hash.substr(1));
        if (posts.length >= 30) {
            posts = posts.concat(await getPosts(author, ++page));
        }
        return posts;
    } catch (error) {
        console.error(`Error fetching posts for ${author} on page ${page}:`, error);
        return [];
    }
}

async function nuke() {
    try {
        console.log("Nuking...");
        let author = "[color=orange][b]Interinactive[/b][/color]";
        let posts = await getPosts(author);
        console.log(`Found ${posts.length} posts`, posts);
        for (let pid of posts) {
            await editPostToEmpty(pid);
            console.log(`Edited post ${pid}`);
        }
        console.log("Nuke successfully detonated");
    } catch (error) {
        console.error("Error during nuking process:", error);
    }
}

nuke();


Change Interinactive to your username and execute it in the console. It will edit posts to have no content

If you want to verify it works by deleting just the first 30 posts, use this:

 Spoiler:
 
Back to top
iconized




Posts: 4404
Location: Pays-Bas
PostPosted: Wed, 3rd Jul 2024 08:34    Post subject:


Last edited by iconized on Fri, 12th Jul 2024 11:40; edited 1 time in total
Back to top
tonizito




Posts: 51255
Location: Portugal, the shithole of Europe.
PostPosted: Wed, 3rd Jul 2024 09:34    Post subject:
But why? Someone's finally running for office or something? Laughing

EDIT: Not like this nolan, not like this Sad Crying or Very sad


boundle (thoughts on cracking AITD) wrote:
i guess thouth if without a legit key the installation was rolling back we are all fucking then
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Site Feedback
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group