Created
May 21, 2024 15:28
-
-
Save PowerX-NOT/2488b7eb76802ffb0c5d5f00d0d1e25f to your computer and use it in GitHub Desktop.
spam your friends :)
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
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.common.exceptions import TimeoutException, NoSuchElementException | |
# Initialize the WebDriver | |
driver = webdriver.Firefox() | |
# Open WhatsApp Web | |
driver.get('https://web.whatsapp.com') | |
# Wait for user to scan the QR code | |
input("Press Enter after scanning the QR code") | |
def whatsapp_spam(): | |
while True: | |
name = input("Enter the name of the person or group you want to spam: ") | |
try: | |
# Search for the contact or group | |
search_box = WebDriverWait(driver, 10).until( | |
EC.presence_of_element_located((By.XPATH, '//div[@contenteditable="true"][@data-tab="3"]')) | |
) | |
search_box.click() | |
search_box.send_keys(name) | |
# Wait for the search results to load | |
time.sleep(8) | |
# Select the contact or group | |
user = WebDriverWait(driver, 10).until( | |
EC.presence_of_element_located((By.XPATH, f'//span[@title="{name}"]')) | |
) | |
user.click() | |
# Wait for the message box to be clickable | |
msg_box = WebDriverWait(driver, 10).until( | |
EC.element_to_be_clickable((By.XPATH, '//div[@contenteditable="true"][@data-tab="10"]')) | |
) | |
# Ask the user for the message and the number of times to send it | |
user_msg = input("Enter the message you want to send: ") | |
count = int(input("Enter the number of times you want to send the message: ")) | |
# Loop to send the message repeatedly | |
for _ in range(count): | |
msg_box.send_keys(user_msg) | |
msg_box.send_keys(Keys.RETURN) | |
except TimeoutException: | |
print("An element could not be found within the given time.") | |
except NoSuchElementException: | |
print("An element could not be found on the page.") | |
# Ask if the user wants to continue spamming | |
if input("Do you want to continue spamming? (y/n): ").lower() != 'y': | |
break | |
driver.quit() | |
print("Spamming completed") | |
whatsapp_spam() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment