File size: 1,500 Bytes
68e3d6c
 
eae300a
 
 
 
 
68e3d6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

'''
import os
session_token = os.environ.get('SessionToken')
conversation_id = os.environ.get('conversation_id')
from revChatGPT.ChatGPT import Chatbot
chatbot = Chatbot({"session_token": session_token}) # You can start a custom conversation
'''

import undetected_chromedriver.v2 as uc
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By


def get_element_or_none(driver, xpath, wait=None):
    try:
        if wait is None:
            return driver.find_element(By.XPATH, xpath)
        else:
            return WebDriverWait(driver, wait).until(
                EC.presence_of_element_located((By.XPATH, xpath)))
    except:
        return None


def run():
    print("Welcome to game of Tom and Jerry. Here Cloudflare is the cat, Jerry is the Programmer. Our Goal as a good Jerry is to trick Cloudflare.")

    options = uc.ChromeOptions()
    options.arguments.extend(
        ["--no-sandbox", "--disable-setuid-sandbox"])
    print("Creating Driver...")
    driver = uc.Chrome(
        options=options
    )
    print("Created Driver...")

    driver.get('https://nowsecure.nl')

    element = get_element_or_none(driver, "/html/body/div[2]/div/main/h1", 20)
    if element is not None:
        print("We defeated Cloudflare, 🎉🥳 :)")
    else:
        print("Cloudflare defeated us :(, No woory we will try again. ")
    driver.quit()


if __name__ == "__main__":
    run()