#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Server-side Hashcat report page. """ from html import escape from reports.hashcat import ( get_database_statistics, get_export_statistics, ) # ============================================================ # Hashcat page # ============================================================ def render_hashcat_page( conn, context=None, message=None, import_result=None, ): from reports.template import ( page_begin, page_end, ) if context is None: from reports.template import ( ReportContext, ) context = ReportContext( mode="server" ) export_statistics = get_export_statistics( conn ) database_statistics = get_database_statistics( conn ) html = page_begin( "Hashcat", ( "Export WPA handshakes for Hashcat " "and import passwords returned by " "hashcat --show." ), "hashcat", context ) if message: message_type = escape( str( message.get( "type", "info" ) ) ) message_text = escape( str( message.get( "text", "" ) ) ) html += f"""
{message_text}
""" # ======================================================== # Export # ======================================================== html += """

Export

Export WPA handshake hashes from the database for Hashcat.

{exported_hashes}
Hashes to export
{wpa01}
WPA*01
{wpa02}
WPA*02

The generated file contains the original WPA*01 and WPA*02 handshake lines stored in the database.

Export all hashes
""".format( exported_hashes=export_statistics[ "exported_hashes" ], wpa01=export_statistics[ "wpa01" ], wpa02=export_statistics[ "wpa02" ], ) # ======================================================== # Import # ======================================================== html += """

Import Hashcat results

Требуемый файл: текстовый результат команды hashcat --show. Не загружайте напрямую файл Hashcat .potfile.

Как создать файл для импорта

После завершения подбора паролей Hashcat выполните hashcat --show с теми же параметрами Hashcat и сохраните текстовый результат в файл.

hashcat -m 22000 --show --potfile-path "ПУТЬ_К_ВАШЕМУ_wifi-gps-mapper.potfile" "ПУТЬ_К_ФАЙЛУ_wifi-gps-mapper-all-20260915-002541.hc22000" > wifi-gps-mapper-result.txt

Имя и расширение файла не имеют значения. Проверяется только его содержимое.

Ожидаемый формат

HASH:AP_BSSID:CLIENT_MAC:ESSID:PASSWORD

Каждая строка проверяется по историческим данным рукопожатий: HASH, BSSID точки доступа, MAC-адрес клиента и ESSID.

Если хотя бы одна строка имеет неверный формат, весь импорт отклоняется. Если для результата не найдено соответствующее рукопожатие, такая строка будет пропущена, а остальные результаты могут быть импортированы.

Уже существующие credentials и повторяющиеся результаты не создают новых записей. Они будут показаны отдельно в статистике импорта.

Файл не выбран
""" html += """ """ # ======================================================== # Import statistics # ======================================================== if import_result is not None: html += """

Import statistics

{total_lines}
Total lines
{valid_lines}
Valid lines
{invalid_lines}
Invalid lines
{matched_handshakes}
Matched handshakes
{missing_handshakes}
Missing handshakes
{new_credentials}
New credentials
{duplicate_credentials}
Duplicate credentials
{already_existing}
Already exists

Result

{result}

""".format( total_lines=import_result[ "total_lines" ], valid_lines=import_result[ "valid_lines" ], invalid_lines=import_result[ "invalid_lines" ], matched_handshakes=import_result[ "matched_handshakes" ], missing_handshakes=import_result[ "missing_handshakes" ], new_credentials=import_result[ "new_credentials" ], duplicate_credentials=import_result[ "duplicate_credentials" ], already_existing=import_result[ "already_existing" ], result=escape( str( import_result[ "result" ] ) ), ) errors = import_result[ "errors" ] if errors: html += """

Errors

""" for error in errors: html += """ """.format( line=error[ "line" ], reason=escape( str( error[ "reason" ] ) ), ) html += """
Line Reason
{line} {reason}
""" html += """
""" # ======================================================== # Database state # ======================================================== html += """

Database

{access_points}
Access points
{handshakes}
Handshakes
{unique_hashes}
Unique hashes
{credentials}
Handshake Cracked
{cracked_access_points}
Cracked access points
""".format( access_points=database_statistics[ "access_points" ], handshakes=database_statistics[ "handshakes" ], unique_hashes=database_statistics[ "unique_hashes" ], credentials=database_statistics[ "credentials" ], cracked_access_points=database_statistics[ "cracked_access_points" ], ) html += page_end() return html