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
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from collections import deque
import time
import random
import argparse
CHANGELOG= "Version 0.3: ahora es mas facil hacer pruebas"
TARGETLIST = ['"🛵 Bro’s"', '"AniHentaiKawaii (。・ω・。)ノ♡"', '"Chivahermanos ⚪🔴🔵"']
MESSAGES = ["Shi", "Perro eda", "Ando loco", "Alguien anda de malas 😂", "Auauauauaua", "Yeeeehaaaaa", "Que loco dios",
"Tons que", "Amos?", "Duraz0"]
CHIVAHERMANOS = MESSAGES + ["Putas chivas", "Vete alv Lucho auauauaua", "Callate amargo"]
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"-t",
"--test",
action='store_true',
)
parser.add_argument(
"-f",
"--firstrun",
action='store_true'
)
return parser.parse_args()
def get_target_list(args):
if args.test:
target_list = ['"Dorian Echeverria"']
else:
target_list = TARGETLIST
return target_list
def find_target(target):
contact=driver.find_element(By.XPATH, "//span[@title='+target+']")
contact.click()
txtbox = driver.find_element(By.XPATH, '/html/body/div[1]/div/div/div[4]/div/footer/div[1]/div/span[2]/div/div[2]/div[1]/div/div[1]')
time.sleep(1)
txtbox.click()
return txtbox
def chose_message(target):
message_list = []
if '"Chivahermanos ⚪🔴🔵"' == target:
message_list=CHIVAHERMANOS
else:
message_list=MESSAGES
message_to_send=random.choice(message_list)
while message_to_send in used:
message_to_send=random.choice(message_list)
print(message_to_send)
return message_to_send
if __name__ == '__main__':
args = get_args()
ffoptions = Options()
ffoptions.add_argument("-profile")
ffoptions.add_argument("/Users/dorian/Library/Application Support/Firefox/Profiles/odod94nn.default")
driver = webdriver.Firefox(options=ffoptions)
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 100)
time.sleep(30)
used = deque(["", "", ""])
target_list = get_target_list(args)
if args.firstrun:
message_box = find_target('"🛵 Bro’s"')
message_box.send_keys(CHANGELOG + Keys.ENTER)
while True:
for target in target_list:
message_box = find_target(target)
message_to_send = chose_message(target)
message_box.send_keys(Keys.BACKSPACE)
[message_box.send_keys(c) for c in message_to_send]
message_box.send_keys(Keys.ENTER)
used.append(message_to_send)
if len(used) > 3:
used.popleft()
if args.test:
time_to_sleep=5
else:
time_to_sleep=random.randrange(18000, 86400)
message_box = find_target('"Dorian Echeverria"')
sleep_message="Cayendome {} horas".format(time_to_sleep/60/60)
message_box.send_keys(sleep_message + Keys.ENTER)
time.sleep(time_to_sleep)
driver.quit()