import time
from http import HTTPStatus
from ..exploit import GlpiExploit
from glpwnme.exploits.logger import Log
from bs4 import BeautifulSoup
from glpwnme.exploits.utils import GlpiUtils

class CVE_2023_41320(GlpiExploit):
    """
    This CVE abuse something...

    @author <author_name>
    @cvss <score_cvss>
    @name <exploit_name>
    """
    min_version = "<min_version>" # Default: 0 (min_version will be checked with <=)
    max_version = "<max_version>" # Default: inf (max_version will be checked with < strictly)
    min_php_version = "<min_version>" # Default: 0
    max_php_version = "<max_version>" # Default: inf
    _impacts = "<impacts_of_exploits>" # What are the impacts of this exploits shortly ?
    _privilege = "<Unauthenticated|User|Hotliner|Observer|Technician|Supervisor|Admin|SuperAdmin>" # Default: Unauthenticated
    _is_check_opsec_safe = False # Whether or not the check is opsec safe, Default: True
    require_api = False # Whether or not the exploit require the api to be enabled, default: False
    require_inventory = False # Whether or not the exploit require the inventory to be enabled, default: False

    def infos(self):
        """
        Infos that will be displayed to the user when using --infos argument

        :return: The infos about this exploit (rich formatted)
        :rtype: str
        """
        infos = "[u]Description:[/u]\n"
        infos += "\n[u]Usage:[/u]\n"
        infos += "\nExploit is [green b]Safe[/]" # or Unsafe ?
        return infos

    def check(self):
        """
        Check if the target is vulnerable

        This method is optionnal, if it is not implemented, glpwnme
        will only checks if the version matches

        :return: True if the target is vulnerable, False otherwise
        :rtype: bool
        """
        raise NotImplementedError

    def clean(self):
        """
        Optional method that will clean the traces,
        can take any arguments as the run method
        """
        raise NotImplementedError

    def run(self):
        """
        Run the exploit on the target
        You can add any argument on this function
        """
        raise NotImplementedError
