Created
January 9, 2023 16:25
-
-
Save princefishthrower/67e5977033b9e1daf3dedc06e053c5dd to your computer and use it in GitHub Desktop.
A 50 line script illustrating the ease of botnets to exploit spam on sites like substack.
This file contains 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
# Best run with "scrapy runspider asshats.py --nolog" in your terminal | |
import time | |
import scrapy | |
from selenium import webdriver | |
# Variables needed - or, throw this garbage in a loop to produce ultimate ass-hattery | |
url = "https://somesubstackurl.substack.com/" | |
email = "someemail@gmail.com" | |
class MyAsshatSpider(scrapy.Spider): | |
name = "asshat" | |
start_urls = [url] | |
def __init__(self): | |
self.driver = webdriver.Firefox() | |
def parse(self, response): | |
self.driver.get(response.url) | |
time.sleep(1) | |
# type email into input box | |
self.driver.find_element("xpath", '//div[@class="sideBySideWrap"]/input[@type="email"]').send_keys(email) | |
time.sleep(2) | |
# Click submit button | |
self.driver.find_element("xpath", '//button[@type="submit"]').click() | |
# Wait for next page | |
time.sleep(2) | |
# Click no pledge option | |
self.driver.find_element("xpath", '//div[text()="No pledge"]/preceding-sibling::input').click() | |
time.sleep(2) | |
# Click subscribe button | |
self.driver.find_element("xpath", '//button[@type="button"]').click() | |
# Wait for next page | |
time.sleep(2) | |
# Click maybe later button | |
self.driver.find_element("xpath", '//button[@type="button"]').click() | |
# Wait at bit for aesthetic purposes | |
time.sleep(2) | |
# Close the browser | |
self.drive.close() | |
print("Done! Subscription to site " + url + " with email " + email + " has been added.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment