Skip to content

Instantly share code, notes, and snippets.

@deshwalmahesh
Created September 12, 2023 04:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deshwalmahesh/664de344967e019a78471acc687ce047 to your computer and use it in GitHub Desktop.
Save deshwalmahesh/664de344967e019a78471acc687ce047 to your computer and use it in GitHub Desktop.
Tired of people spamming you on WhatsApp? Don't block them from now on. Just Run this code and you Spam them. What's good? If it's a person, they'll be similarly annoyed and if they're a company, their WhatsApp API will go higher because they' are who they are and will reply via their bot :)
# pip install selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
class SpamBack:
def __init__(self):
self.driver = webdriver.Firefox()
self.driver.maximize_window()
self.driver.get("https://web.whatsapp.com")
def setup_armoury(self, spammer:str):
"""
USE this function very carefully as it selects the first message and can ping unknown people
"""
raise NotImplementedError("Do not Use this for now. It's unstable. Manually select the chat window")
while True:
try:
search_bar = self.driver.find_element(By.XPATH,"/html/body/div[1]/div/div/div[4]/div/div[1]/div/div/div[2]/div/div[1]/p")
ActionChains(self.driver).move_to_element(search_bar).click(search_bar).send_keys(str(spammer)).perform()
self.driver.find_element(By.XPATH,"/html/body/div[1]/div/div/div[4]/div/div[2]/div[1]/div/div/div[1]/div/div/div").click()
return True
except NoSuchElementException as e:
print("No Search Bar Found. Retrying in 5 seconds. Authenticate by then")
time.sleep(5)
def fire_and_forget(self, rounds = 100, personal_message = "You'll stop spamming me now? "*125):
"""
Authenticate and Open the chat window of someone who's spamming you constantly and call this function.
"""
try:
self.driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div[5]/div/footer/div[1]/div/span[2]/div/div[2]/div[1]/div[2]/div[1]/p")
except NoSuchElementException as e:
raise ValueError("Authenticate first and then open the chat window of the business who is spamming you")
chat_box = self.driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div[5]/div/footer/div[1]/div/span[2]/div/div[2]/div[1]/div[2]/div[1]/p")
ActionChains(self.driver).move_to_element(chat_box).click(chat_box).send_keys(personal_message).perform()
action = ActionChains(self.driver)
action.key_down(Keys.CONTROL).send_keys('A').key_down(Keys.CONTROL).send_keys('C').key_up(Keys.CONTROL).perform()
for _ in range(rounds):
action.key_down(Keys.CONTROL).send_keys('V').key_up(Keys.CONTROL).perform()
time.sleep(0.2)
self.driver.find_element(By.XPATH, "/html/body/div[1]/div/div/div[5]/div/footer/div[1]/div/span[2]/div/div[2]/div[2]/button").click()
time.sleep(0.2)
SB = SpamBack() # init the class -> It'll open a browser. Authenticate and click on the contact that's spamming you
SB.fire_and_forget(100, "Will you stop spaming me now? "*10) # Run this code and let then have a taste of their own medicine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment