Created
November 8, 2020 21:03
-
-
Save zmarffy/259fcd0b096c55cdcc525bd54615908c to your computer and use it in GitHub Desktop.
Join Jackbox games that are about to start. For confusing people around the world
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 random | |
from itertools import chain, product | |
from json.decoder import JSONDecodeError | |
from time import sleep | |
import requests | |
from selenium import webdriver | |
JACKBOX_URL = "https://ecast.jackboxgames.com/room/" | |
USERNAME = "A GHOST" | |
DELAY = 1 | |
def bruteforce(maxlength, minlength=1, charset="QWERTYUIOPASDFGHJKLZXCVBNM1234567890", shuffle_charset=False): | |
if shuffle_charset: | |
charset = ''.join(random.sample(charset, len(charset))) | |
return (''.join(candidate) for candidate in chain.from_iterable(product(charset, repeat=i) for i in range(minlength, maxlength + 1))) | |
def check_room(room_code): | |
try: | |
return requests.get(JACKBOX_URL + room_code).json() | |
except JSONDecodeError: | |
return {} | |
if __name__ == "__main__": | |
driver = webdriver.Chrome() | |
found = False | |
for room_code in bruteforce(4, minlength=4, shuffle_charset=False): | |
resp = check_room(room_code) | |
if resp.get("joinAs") == "player" and not resp["requiresPassword"]: | |
found = True | |
break | |
sleep(DELAY) | |
if found: | |
print("\aHit for room {} found. Attempting to join.".format(room_code)) | |
driver.get("https://jackbox.tv/") | |
driver.find_element_by_id("roomcode").send_keys(room_code) | |
driver.find_element_by_id("username").send_keys(USERNAME) | |
driver.find_element_by_id("button-join").click() | |
while True: | |
print("User is playing game...") | |
sleep(30) |
how to use
There are no arguments. You just run it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use