Nickeshpaudel.com.np https://nickeshpaudel.com.np Let's Optimize Wed, 24 Apr 2024 12:08:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 Content Protection in Online Education with Our Smart Screenshot Bot https://nickeshpaudel.com.np/content-protection-in-online-education-with-our-smart-screenshot-bot/ https://nickeshpaudel.com.np/content-protection-in-online-education-with-our-smart-screenshot-bot/#respond Wed, 24 Apr 2024 12:08:26 +0000 https://nickeshpaudel.com.np/?p=124 Content Protection in Online Education with Our Smart Screenshot Bot Read More »

]]>
We’re excited to unveil our latest innovation in the fight against content theft in online education: a smart screenshot bot that enhances content security like never before!

Our tool is brilliantly simple yet incredibly effective. Instead of relying on complex algorithms, it uses a straightforward method to monitor and protect our exclusive educational content. By automatically capturing screenshots of exam questions as they appear and storing them with a unique hash value derived from the question text, our bot ensures that each piece of content is securely archived.

When competitors attempt to upload new questions that might infringe on our materials, our bot instantly detects these attempts during routine checks. If a question doesn’t match our archive, it’s flagged, and a new screenshot is taken and stored. This not only helps in identifying potential copyright breaches but also in maintaining the integrity and exclusivity of our educational resources.

Stay tuned as we continue to refine our technology to ensure that our educational content remains protected and uniquely ours. With this innovative approach, we’re setting new standards in educational content security

Source Code

import pyautogui
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import hashlib
import os

def create_hash(text):
    return hashlib.md5(text.encode()).hexdigest()

def full_screen_screenshot(name, folder):
    file_path = os.path.join(folder, f"{name}.png")
    screenshot = pyautogui.screenshot()
    screenshot.save(file_path)

def get_question_text_with_js(driver):
    try:
        script = "return document.querySelector('YOUR_QUESTION_SELECTOR').textContent;"
        return driver.execute_script(script).strip()
    except Exception as e:
        print("Error in executing JavaScript:", e)
        return ""

screenshot_folder = "DEMO_PATH"
if not os.path.exists(screenshot_folder):
    os.makedirs(screenshot_folder)

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.maximize_window()

# Manual sign-in process
driver.get("DEMO_URL")
driver.execute_script("window.open('DEMO_SIGN_IN_URL');")
driver.switch_to.window(driver.window_handles[1])

# Wait for the user to complete the manual sign-in process
input("Please complete the sign-in process and press Enter when done...")

# Navigate to the exam URL
driver.execute_script("window.open('DEMO_EXAM_URL');")
driver.switch_to.window(driver.window_handles[2])

time.sleep(16)

start_exam_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_START_EXAM_SELECTOR")))
start_exam_button.click()

time.sleep(3)

retake_counter = 0
while retake_counter < 7:
    question_hashes = set()
    new_screenshots = False

    while True:
        try:
            current_question_text = get_question_text_with_js(driver)
            if current_question_text == "":
                print("No text found, waiting...")
                time.sleep(2)
                continue

            hash_value = create_hash(current_question_text)

            if hash_value not in question_hashes:
                question_hashes.add(hash_value)
                print(f"Question Text: {current_question_text}")

                if not os.path.exists(os.path.join(screenshot_folder, f"{hash_value}.png")):
                    full_screen_screenshot(hash_value, screenshot_folder)
                    new_screenshots = True

                    show_answer_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_SHOW_ANSWER_SELECTOR")))
                    show_answer_button.click()
                    time.sleep(3)
                    full_screen_screenshot(f"{hash_value}_answer", screenshot_folder)
                    close_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_CLOSE_ANSWER_SELECTOR")))
                    close_button.click()

            next_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_NEXT_QUESTION_SELECTOR")))
            next_button.click()
            time.sleep(2)

        except Exception as e:
            print("An error occurred:", e)
            break

        if "Finish" in driver.page_source:
            finish_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_FINISH_EXAM_SELECTOR")))
            finish_button.click()
            break

    time.sleep(7)

    if not new_screenshots:
        retake_counter += 1
    else:
        retake_counter = 0

    retake_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_RETAKE_SELECTOR")))
    retake_button.click()

    time.sleep(3)
    start_exam_button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "DEMO_START_EXAM_SELECTOR")))
    start_exam_button.click()

    time.sleep(8)

driver.quit()
]]>
https://nickeshpaudel.com.np/content-protection-in-online-education-with-our-smart-screenshot-bot/feed/ 0