Created
February 13, 2025 17:09
-
-
Save devkabir/bca5ecddfef4bc8443f5f9efb43ce3fc to your computer and use it in GitHub Desktop.
This script will open the webpage, fill in the comment form, and submit spam comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function generate_random_ip() { | |
| return mt_rand(1, 255) . '.' . | |
| mt_rand(0, 255) . '.' . | |
| mt_rand(0, 255) . '.' . | |
| mt_rand(1, 255); | |
| } | |
| function generate_random_ipv6() { | |
| $ipv6 = []; | |
| for ($i = 0; $i < 8; $i++) { | |
| $ipv6[] = dechex(mt_rand(0, 65535)); // Generate random hex blocks | |
| } | |
| return implode(':', $ipv6); | |
| } | |
| $_SERVER['REMOTE_ADDR'] = generate_random_ip(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "dependencies": { | |
| "@faker-js/faker": "^9.5.0", | |
| "puppeteer": "^24.2.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const puppeteer = require('puppeteer'); | |
| const { faker } = require('@faker-js/faker'); | |
| const URL = 'https://<domain>/2025/02/13/post-1/'; | |
| async function submitSpamComment(i) { | |
| const browser = await puppeteer.launch({ headless: true }); // Set headless: false to see the browser | |
| const page = await browser.newPage(); | |
| try { | |
| console.log(`Submitting comment ${i + 1}...`); | |
| await page.goto(URL, { waitUntil: 'networkidle2' }); | |
| // Fill in the comment form | |
| await page.type('#comment', `Get cheap products now! Visit ${faker.internet.url()} for amazing deals!`); | |
| await page.type('#author', faker.internet.username()); | |
| await page.type('#email', faker.internet.email()); | |
| await page.type('#url', faker.internet.url()); | |
| // Submit the form | |
| await page.click('#submit'); | |
| console.log(`Comment ${i + 1} submitted!`); | |
| } catch (error) { | |
| console.error(`Error in comment ${i + 1}:`, error); | |
| } finally { | |
| await browser.close(); | |
| } | |
| } | |
| // Run the bot 6 times | |
| (async () => { | |
| console.log("Starting spam bot..."); | |
| const spamCount = 6; | |
| for (let i = 0; i < spamCount; i++) { | |
| await submitSpamComment(i); | |
| } | |
| console.log("Spam comment submission complete."); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment