|
|
import time |
|
|
import gradio as gr |
|
|
import threading |
|
|
from selenium import webdriver |
|
|
from selenium.webdriver.chrome.options import Options |
|
|
from selenium.webdriver.common.by import By |
|
|
from selenium.webdriver.support.wait import WebDriverWait |
|
|
from selenium.webdriver.support import expected_conditions as EC |
|
|
from selenium.webdriver.common.keys import Keys |
|
|
import secrets |
|
|
from gradio_client import Client, file |
|
|
|
|
|
import os |
|
|
total_dm_done = 0 |
|
|
def in_dm_code(driver, server_link): |
|
|
time.sleep(1) |
|
|
text_box = driver.find_element(By.CSS_SELECTOR,"[role='textbox']") |
|
|
text_box.send_keys("Joining w8") |
|
|
time.sleep(1) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
time.sleep(3) |
|
|
text_box = driver.find_element(By.CSS_SELECTOR,"[role='textbox']") |
|
|
|
|
|
try: |
|
|
join_btn = WebDriverWait(driver, 3).until( |
|
|
EC.presence_of_element_located((By.XPATH, "//button/div[contains(text(), 'Join')]")) |
|
|
) |
|
|
except: |
|
|
current_channel_url = driver.current_url |
|
|
current_channel = current_channel_url[current_channel_url.find("@me/"):].replace("@me/", "") |
|
|
|
|
|
with open('pending.txt') as file: |
|
|
contents = file.read() |
|
|
search_word = current_channel |
|
|
if str(search_word) +"2" in contents: |
|
|
print('Already pending..Sending last message') |
|
|
text_box.send_keys("Now don't message me again understood") |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
global total_dm_done |
|
|
total_dm_done-=1 |
|
|
return True |
|
|
elif str(search_word) +"1" in contents: |
|
|
current_channel = str(current_channel) + "2" |
|
|
print('Already pending..Giving last chance') |
|
|
text_box.send_keys("bro send join link??") |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
file = open("pending.txt", "a") |
|
|
file.write(f"{current_channel} \n") |
|
|
file.close() |
|
|
return False |
|
|
|
|
|
else: |
|
|
current_channel = str(current_channel) + "1" |
|
|
print("New channel working on it") |
|
|
file = open("pending.txt", "a") |
|
|
file.write(f"{current_channel} \n") |
|
|
file.close() |
|
|
text_box.send_keys("Send join link asap") |
|
|
time.sleep(1) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
return False |
|
|
driver.execute_script("""function getElementsByXPath(xpath, parent) |
|
|
{ |
|
|
let results = []; |
|
|
let query = document.evaluate(xpath, parent || document, |
|
|
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); |
|
|
for (let i = 0, length = query.snapshotLength; i < length; ++i) { |
|
|
results.push(query.snapshotItem(i)); |
|
|
} |
|
|
return results; |
|
|
} |
|
|
|
|
|
var div_list = getElementsByXPath("//button/div[contains(text(), 'Join')]") |
|
|
var div_array = [...div_list]; // converts NodeList to Array |
|
|
div_array.forEach(div => { |
|
|
|
|
|
div.innerHTML = "Joined"; |
|
|
|
|
|
}); """) |
|
|
time.sleep(1) |
|
|
driver.save_screenshot("./screenshot.png") |
|
|
time.sleep(0.5) |
|
|
|
|
|
|
|
|
|
|
|
input_element = driver.find_element(By.CSS_SELECTOR, "[class='file-input']") |
|
|
|
|
|
|
|
|
input_element.send_keys(os.getcwd()+'/screenshot.png') |
|
|
time.sleep(2) |
|
|
text_box.send_keys("see") |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
|
|
|
time.sleep(2) |
|
|
|
|
|
|
|
|
text_box.send_keys("done") |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(server_link) |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
time.sleep(0.5) |
|
|
text_box.send_keys("Now you join") |
|
|
time.sleep(1.5) |
|
|
text_box.send_keys(Keys.ENTER) |
|
|
time.sleep(1) |
|
|
return True |
|
|
|
|
|
def j4j_msg_req(invites, server_link): |
|
|
global total_dm_done |
|
|
global stop_thread |
|
|
options = Options() |
|
|
options.add_experimental_option("excludeSwitches", ["enable-logging"]) |
|
|
|
|
|
|
|
|
|
|
|
options.add_argument("--no-sandbox") |
|
|
options.add_argument("--headless=new") |
|
|
options.add_argument('--disable-gpu') |
|
|
options.add_argument("--disable-dev-shm-usage") |
|
|
|
|
|
options.add_argument('user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/68.0.3440.84 Safari/537.36') |
|
|
|
|
|
driver = webdriver.Chrome(options=options) |
|
|
|
|
|
driver.get("https://discord.com/login") |
|
|
time.sleep(5) |
|
|
driver.execute_script("""function login(token) { |
|
|
setInterval(() => { |
|
|
document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = `"${token}"` |
|
|
}, 50); |
|
|
|
|
|
} |
|
|
|
|
|
login('ODUyOTM4OTg1ODM5Nzg4MDYz.GQjdRR.tyJTkt_WnKNKoimmQEguWYTSoEGYQd9TKaWl-8');""") |
|
|
time.sleep(5) |
|
|
driver.get("https://discord.com/channels/@me/") |
|
|
time.sleep(5) |
|
|
setting_check = WebDriverWait(driver, 30).until( |
|
|
EC.presence_of_element_located((By.CSS_SELECTOR, "[aria-label='User Settings']")) |
|
|
) |
|
|
|
|
|
print("logged in succesfully") |
|
|
|
|
|
|
|
|
time.sleep(2) |
|
|
while(True): |
|
|
if stop_thread: |
|
|
driver.quit() |
|
|
client = Client("hashir672/hashirdis672seleneem") |
|
|
|
|
|
result = client.predict( |
|
|
anything="stop", |
|
|
|
|
|
) |
|
|
print(result) |
|
|
print("Stopped j4j spam server too") |
|
|
break |
|
|
time.sleep(2) |
|
|
|
|
|
try: |
|
|
msg_req = WebDriverWait(driver, 1).until( |
|
|
EC.presence_of_element_located((By.XPATH, "//*[contains(text(), 'Message Requests')]")) |
|
|
) |
|
|
msg_req.click() |
|
|
time.sleep(1) |
|
|
|
|
|
try: |
|
|
accept_dm = driver.find_element(By.XPATH,"//*[contains(text(), 'Accept DM')]/../../preceding-sibling::div[1]") |
|
|
except: |
|
|
driver.find_element(By.XPATH,"//*[contains(text(), 'Spam')]").click() |
|
|
time.sleep(1) |
|
|
driver.find_element(By.XPATH,"//*[contains(text(), 'Accept DM')]").click() |
|
|
time.sleep(3) |
|
|
|
|
|
try: |
|
|
accept_dm.click() |
|
|
except: |
|
|
pass |
|
|
except Exception as e: |
|
|
driver.find_element(By.XPATH, "//div[contains(text(), 'Friends')]").click() |
|
|
|
|
|
dm = driver.find_element(By.XPATH,"//*[@aria-label='Servers']/preceding-sibling::div[2]") |
|
|
if("tutorial" in str(dm.get_attribute("class"))): |
|
|
|
|
|
print("No dm found") |
|
|
continue |
|
|
else: |
|
|
print("dm found") |
|
|
dm.click() |
|
|
time.sleep(2) |
|
|
text_box = driver.find_element(By.CSS_SELECTOR,"[role='textbox']") |
|
|
text_box.click() |
|
|
time.sleep(1) |
|
|
current_channel_url = driver.current_url |
|
|
current_channel = current_channel_url[current_channel_url.find("@me/"):].replace("@me/", "") |
|
|
with open('channels.txt') as file: |
|
|
contents = file.read() |
|
|
search_word = current_channel |
|
|
if search_word in contents: |
|
|
print('channel already done') |
|
|
driver.find_element(By.XPATH, "//div[contains(text(), 'Friends')]").click() |
|
|
continue |
|
|
else: |
|
|
print("New channel working on it") |
|
|
|
|
|
dm_done = in_dm_code(driver ,server_link) |
|
|
|
|
|
current_channel_url = driver.current_url |
|
|
current_channel = current_channel_url[current_channel_url.find("@me/"):].replace("@me/", "") |
|
|
print(current_channel) |
|
|
if dm_done: |
|
|
total_dm_done+=1 |
|
|
file = open("channels.txt", "a") |
|
|
file.write(f"{current_channel} \n") |
|
|
file.close() |
|
|
time.sleep(0.5) |
|
|
if total_dm_done==int(invites): |
|
|
driver.quit() |
|
|
client = Client("hashir672/hashirdis672seleneem") |
|
|
|
|
|
result = client.predict( |
|
|
anything="stop", |
|
|
|
|
|
) |
|
|
print(result) |
|
|
print("Stopped j4j spam server too") |
|
|
break |
|
|
driver.find_element(By.XPATH, "//div[contains(text(), 'Friends')]").click() |
|
|
|
|
|
print(f"Program ended with aproximately {total_dm_done} Joins") |
|
|
total_dm_done = 0 |
|
|
|
|
|
|
|
|
|
|
|
if stop_thread: |
|
|
return None |
|
|
|
|
|
|
|
|
def j4j_spam_start(something): |
|
|
|
|
|
client = Client("hashir672/hashirdis672seleneem") |
|
|
|
|
|
result = client.predict( |
|
|
anything="start", |
|
|
|
|
|
) |
|
|
print(result) |
|
|
print("j4j spam started too") |
|
|
return None |
|
|
|
|
|
|
|
|
stop_thread = False |
|
|
|
|
|
|
|
|
def output(anything, invites, server_link): |
|
|
global stop_thread |
|
|
stop_thread = False |
|
|
if "stop" in anything.lower(): |
|
|
|
|
|
stop_thread = True |
|
|
return 201 |
|
|
else: |
|
|
t2 = threading.Thread(target=j4j_spam_start, args=(0,)) |
|
|
t2.start() |
|
|
t1 = threading.Thread(target=j4j_msg_req, args=(invites,server_link)) |
|
|
|
|
|
t1.start() |
|
|
return 200 |
|
|
|
|
|
|
|
|
iface = gr.Interface( |
|
|
fn=output, |
|
|
inputs=[gr.Textbox(label="Enter start or stop"),gr.Textbox(label="Enter number of invites"),gr.Textbox(label="Enter server link")], |
|
|
outputs=gr.Number(), |
|
|
title="Enter start or stop", |
|
|
description="Start or stop j4j message request Bot", |
|
|
) |
|
|
|
|
|
iface.launch() |