![]() |
is it possible to generate passwords using python - Printable Version +- hashcat Forum (https://hashcat.net/forum) +-- Forum: Support (https://hashcat.net/forum/forum-3.html) +--- Forum: hashcat (https://hashcat.net/forum/forum-45.html) +--- Thread: is it possible to generate passwords using python (/thread-12486.html) |
is it possible to generate passwords using python - bretget - 01-26-2025 I tried generating passwords in python, and after generating them, they will be selected in hashcat and so on in a circle. but nothing worked out for me, experts, tell me what to do, what to fix. There is a code below import os import subprocess # Функция для установки переменной среды OpenCL def set_opencl_environment(): # Укажите путь к библиотеке OpenCL на вашей системе # Пример пути для Windows (замените на актуальный путь) os.environ['OPENCL_ICD_VENDORS'] = r'C:\Windows\System32\OpenCL.dll' # Путь к OpenCL на Windows # Если у вас другая операционная система, путь будет отличаться # Функция для запуска hashcat с использованием только CPU или указанной платформы OpenCL def run_hashcat(hc22000_file, mask): # Установим переменную среды для OpenCL set_opencl_environment() # Указываем путь к hashcat hashcat_dir = r"B:\maraduer\hashcat-6.2.6" # Путь к папке, где находится hashcat # Добавляем путь к hashcat в системную переменную PATH os.environ["PATH"] += os.pathsep + hashcat_dir # Формируем команду для запуска hashcat command = [ "hashcat", "-D", "1", # Принудительно используем только CPU (если GPU не настроено) "-m", "22000", # Режим WPA2 hc22000_file, # Путь к файлу .hc22000 mask # Маска пароля ] try: # Запуск hashcat result = subprocess.run(command, capture_output=True, text=True) print(result.stdout) # Печать вывода print(result.stderr) # Печать ошибок (если есть) except Exception as e: print(f"[ERROR] Ошибка при запуске hashcat: {e}") # Генерация паролей и запуск подбора def generate_passwords_and_crack(hc22000_file): """ Генерация паролей с помощью mask attack и подбора пароля. :param hc22000_file: Путь к файлу .hc22000 """ # Пример маски: 6 строчных букв и цифры mask = "?l?l?l?l?l?l?d?d" # Маска для 6 символов (буквы и цифры) # Запуск функции подбора пароля run_hashcat(hc22000_file, mask) # Пример использования if __name__ == "__main__": hc22000_file = input("Введите путь к файлу .hc22000: ").strip() # Путь к .hc22000 файлу generate_passwords_and_crack(hc22000_file) RE: is it possible to generate passwords using python - Snoopy - 01-27-2025 Why so complicated? Just use a simple batchfile with variables, put variables at the beginning of your file where you can easily change them, don't forget to add option --status to update the status window regulary this way you can just use relative paths like ..\hashcat.exe, no need for adding or changing environment but never the less, i think the problem lies in your result, i dont think subprocess.run "returns" values, was looking through some old python files and i used subprocess.check_output to grab the output from a process EDIT: okay was missing capture output So the question is what output do you receive? subprocess.run will only return output after the whole process finishes, so you will have to wait quite some time depending on your hashspeed |