commit eb45c7ab140eb1623ce96fdba951ecf0a15d4bfa Author: wangdong0 <673035202@qq.com> Date: Sat Jul 26 03:48:37 2025 +0800 first commit diff --git a/Readme.assets/image-20250726025746343.png b/Readme.assets/image-20250726025746343.png new file mode 100644 index 0000000..d11e266 Binary files /dev/null and b/Readme.assets/image-20250726025746343.png differ diff --git a/Readme.assets/image-20250726030119641.png b/Readme.assets/image-20250726030119641.png new file mode 100644 index 0000000..9809f24 Binary files /dev/null and b/Readme.assets/image-20250726030119641.png differ diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..f811827 --- /dev/null +++ b/Readme.md @@ -0,0 +1,92 @@ +# wpa_hashcat + + + +wpa_hashcat是基于hashcat与hcxtools封装,专用于解析WPA握手包的跑包工具。使用该工具您可以在linux环境下快速调用hashcat对捕获的WPA握手包进行暴力破解,以满足一些简单的跑包需求。 + + + +~~~ + .:::::::::::::.......::::::::::::::. + .::::::::::--::--*####+-:::--::::::::::. + ..::::::::::-#@@@@@@@@@@@@@@*-:::::::::::. + ..::::::::::.:%@@@@@@@@@@@@+.:::::::::::.. + ..:::::::::::.=@@@@@@@@@@@@:::::::::::::.. + ...::::::::::::@%*#@@@%#*@#.:::::::::::... + .....:::::::::.:*%#%@@%%%+.::::::::::..... + ...........::::..:-#@@+-:.:::::........... + ................:. #@@= ::................ + .................:@@@*.................. + ................ -@@@@.................. + ............... *@@@@- ............... + .............@@@@@# ............ + ...... *@@@@@@- ...... + . =@@@@@@@%. + .+@@@@@@@@@%- + :%@@@@@@@@@@@@# + %@@@@@@@@@@@@@@= + %@@@@@@@@@@@@@@+ + .::::::::::::::. + ...:......... ..........::.. + __ __ __ + _ __ ___ ___ _ / / ___ _ ___ / / ____ ___ _ / /_ + | |/|/ // _ \/ _ `/ / _ \/ _ `/ (_-< / _ \/ __// _ `// __/ + |__,__// .__/\_,_/ ____ /_//_/\_,_/ /___//_//_/\__/ \_,_/ \__/ + /_/ /___/ +————————————————————————————————————————————————————————————————— + 基于hashcat、hcxtools (by 小网洞) +————————————————————————————————————————————————————————————————— + +~~~ + + + +## 使用方法 + +~~~ +# 安装依赖 +apt install hashcat hcxdumptool python3 xxd zip p7zip-full +# 导入项目并运行 +git clone https://github.com/wangdong0/wpa_hashcat.git +cd wpa-hashcat +# 方式一 +bash wpa_hashcat.sh +# 方式二 +bash wpa_hashcat.sh <你的握手包路径> +~~~ + +> **【支持握手包格式】** +> +> *.cap ✅ | *.pcap ✅ | *.pcapng ✅ | *.hccapx ✅ | *.hc22000 ✅ + +![image-20250726030119641](Readme.assets/image-20250726030119641.png) + +![image-20250726025746343](Readme.assets/image-20250726025746343.png) + +**hashcat.rc**文件为运行hashcat的参数配置文件,设置了两个字段分别用于输出文件配置和优化参数配置,可根据需要进行修改。 + +- `HASHCAT_OUTPUT`:破解成功的密码输出文件(默认保存到wpa_hashcat_crack.txt中)。 + +- `HASHCAT_OPTS`:运行时使用的优化参数(默认不设置)。 + + + + + +## 预设说明 + +使用wpa_hashcat时您可以自选字典进行跑包,同时内置5种预设(主要针对国人的WiFi密码设置习惯)。 + +| 预设 | 版本 | 作者 | 密码量 | 说明 | 推荐度 | +| --------------- | ---- | -------- | --------- | -------------------------------------------- | ------------- | +| 常用弱密 | 1.0 | HULUGANG | ≈2500万 | 顺序字符、姓名、日期、谐音、数字字母组合等 | ⭐️⭐️⭐️⭐️⭐️(推荐) | +| 8位纯数字 | 1.0 | 小网洞 | 1亿 | 8位纯数字 | ⭐️⭐️⭐️⭐️⭐️(推荐) | +| 地区手机号 | 1.0 | 随风无限 | 20万~2亿 | 11位中国大陆移动、电信、联通手机号(2024年) | ⭐️⭐️⭐️⭐️⭐️(推荐) | +| 8位数字字母规律 | 1.0 | 小网洞 | ≈673亿 | 字母+数字、数字+字母、数字字母混合 | ⭐️⭐️ | +| 运营商光猫规律 | 1.0 | 随风无限 | ≈1万2千亿 | ChinaNet/CMCC/CU光猫默认密码规律 | ⭐️⭐️ | + + + +## 免责声明 + +本项目仅用于无线安全审计,使用时请注意遵守相关法律法规。 \ No newline at end of file diff --git a/auto_extract.sh b/auto_extract.sh new file mode 100644 index 0000000..4599570 --- /dev/null +++ b/auto_extract.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +# 自动解压函数 +auto_extract() { + local file="$1" + local target_dir="${file%.*}" # 解压到与压缩包同名的目录 + + # 检查文件是否存在 + if [[ ! -f "$file" ]]; then + echo "错误: 文件 '$file' 不存在" + return 1 + fi + + # 创建目标目录 + mkdir -p "$target_dir" || { + echo "错误: 无法创建目录 '$target_dir'" + return 1 + } + + # 根据文件后缀选择解压方式 + case "$file" in + *.7z|*.7Z) + if command -v 7z &>/dev/null; then + 7z x "$file" -o"$target_dir" -y >/dev/null + elif command -v 7za &>/dev/null; then + 7za x "$file" -o"$target_dir" -y >/dev/null + else + echo "错误: 需要安装p7zip工具(7z或7za命令)" + return 1 + fi + ;; + *.zip|*.ZIP) + if command -v unzip &>/dev/null; then + unzip -q -o "$file" -d "$target_dir" + else + echo "错误: 需要安装unzip工具" + return 1 + fi + ;; + *.rar|*.RAR) + if command -v unrar &>/dev/null; then + unrar x -y "$file" "$target_dir" >/dev/null + elif command -v rar &>/dev/null; then + rar x -y "$file" "$target_dir" >/dev/null + else + echo "错误: 需要安装unrar或rar工具" + return 1 + fi + ;; + *.tar.gz|*.tgz) + tar -xzf "$file" -C "$target_dir" --overwrite + ;; + *.tar.bz2) + tar -xjf "$file" -C "$target_dir" --overwrite + ;; + *.tar.xz) + tar -xJf "$file" -C "$target_dir" --overwrite + ;; + *) + echo "错误: 不支持的压缩格式 '$file'" + return 1 + ;; + esac + + if [[ $? -eq 0 ]]; then + echo "解压成功: $file → $target_dir" + else + echo "解压失败: $file" + return 1 + fi +} + +# 批量解压当前目录下所有支持的压缩文件 +batch_extract() { + local formats=("*.7z" "*.zip" "*.rar" "*.tar.gz" "*.tgz" "*.tar.bz2" "*.tar.xz") + local extracted=0 + + for format in "${formats[@]}"; do + for file in $format; do + [[ -f "$file" ]] || continue + auto_extract "$file" && ((extracted++)) + done + done + + if (( extracted == 0 )); then + echo "未找到可解压的文件" + fi +} + +# 使用示例: +# 解压单个文件: auto_extract "archive.7z" +# 解压当前目录所有文件: batch_extract + +export -f auto_extract \ No newline at end of file diff --git a/dict/ct&cm&cu.zip b/dict/ct&cm&cu.zip new file mode 100644 index 0000000..512d9b6 Binary files /dev/null and b/dict/ct&cm&cu.zip differ diff --git a/dict/easy_dict.7z b/dict/easy_dict.7z new file mode 100644 index 0000000..6b64eba Binary files /dev/null and b/dict/easy_dict.7z differ diff --git a/dict/letter&num(8).zip b/dict/letter&num(8).zip new file mode 100644 index 0000000..0035a8a Binary files /dev/null and b/dict/letter&num(8).zip differ diff --git a/dict/phone_number.zip b/dict/phone_number.zip new file mode 100644 index 0000000..86b8777 Binary files /dev/null and b/dict/phone_number.zip differ diff --git a/file_selector.sh b/file_selector.sh new file mode 100644 index 0000000..335c135 --- /dev/null +++ b/file_selector.sh @@ -0,0 +1,323 @@ +#!/bin/bash + +file_selector() { + # 保存原始终端状态 + local OLD_TERM + OLD_TERM=$(stty -g 2>/dev/null) + + # 保存当前进程ID(用于本地化信号处理) + local TOP_PID=$$ + + # 清理函数 - 完全恢复原始状态 + cleanup() { + # 恢复主屏幕缓冲区 + echo -en "\033[?1049l" >&2 + + # 恢复光标 + tput cnorm >&2 + + # 重置文本样式 + tput sgr0 >&2 + + # 恢复终端设置(仅在OLD_TERM有值时) + if [[ -n "$OLD_TERM" ]]; then + stty "$OLD_TERM" >&2 + fi + } + + normalize_path() { + local path="$1" + # 替换任意数量连续斜杠为单斜杠 + path=$(echo "$path" | sed 's|//\+|/|g') + # 特殊处理根目录的异常形式 + [[ "$path" == "//" ]] && path="/" + echo "$path" + } + + # 信号捕获 + trap 'cleanup; exit 1' EXIT INT TERM + + # 设置起始目录(支持可选参数) + local start_dir="${1:-$(pwd)}" + local restrict_mode=0 + local custom_prompt + local file_exts=() + + # 修复参数解析逻辑 + if [[ "$2" == "-r" || "$2" == "--restrict" ]]; then + restrict_mode=1 + custom_prompt="${3:-请选择一个文件:}" + if [[ -n "${4:-}" ]]; then + IFS=',' read -ra file_exts <<< "${4// /}" # 移除空格并分割 + fi + else + # 当没有使用-r选项时,第二个参数是提示 + custom_prompt="${2:-请选择一个文件:}" + if [[ -n "${3:-}" ]]; then + IFS=',' read -ra file_exts <<< "${3// /}" # 移除空格并分割 + fi + fi + + local current_dir="$start_dir" + current_dir=$(normalize_path "$current_dir") + local dir_stack=("$current_dir") + local selected=0 current_page=0 selected_file="" + + # 定义颜色(局部变量) + local COLOR_NORMAL=$(tput sgr0) + local COLOR_HIGHLIGHT=$(tput rev) + local COLOR_TITLE=$(tput setaf 14) + local COLOR_SELECTION=$(tput setaf 2) + local COLOR_DIR=$(tput setaf 6) + local COLOR_BACK=$(tput setaf 3) + local COLOR_PAGE=$(tput setaf 5) + + # 启用备用屏幕缓冲区 + echo -en "\033[?1049h" >&2 + + # 隐藏光标 + tput civis >&2 + + # 获取目录内容 + get_directory_contents() { + local dir="$1" + local contents=() + + # 添加上级目录选项 + [[ "$dir" != "/" && ( "$restrict_mode" -eq 0 || "$current_dir" != "$start_dir" ) ]] && contents+=("..") + + # 获取目录(始终显示) + while IFS= read -r -d $'\0' item; do + [[ -d "$item" ]] && contents+=("${item#$dir/}/") + done < <(find "$dir" -mindepth 1 -maxdepth 1 -type d -print0 2>/dev/null) + + # 获取文件(支持多种后缀过滤) + if (( ${#file_exts[@]} > 0 )); then + # 修复:构建正确的find查询条件 + local find_args=() + for ext in "${file_exts[@]}"; do + # 移除可能的空格 + ext="${ext// /}" + [[ -n "$ext" ]] && find_args+=(-name "*.${ext}" -o) + done + + # 移除最后一个多余的 -o + if (( ${#find_args[@]} > 0 )); then + unset 'find_args[${#find_args[@]}-1]' + + # 执行带后缀过滤的查询 + while IFS= read -r -d $'\0' item; do + contents+=("${item#$dir/}") + done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f \( "${find_args[@]}" \) -print0 2>/dev/null) + fi + else + # 无后缀过滤时获取所有文件 + while IFS= read -r -d $'\0' item; do + [[ -f "$item" ]] && contents+=("${item#$dir/}") + done < <(find "$dir" -mindepth 1 -maxdepth 1 -type f -print0 2>/dev/null) + fi + + echo "${contents[@]}" + } + + # 显示菜单(输出到 STDERR) + show_menu() { + local terminal_rows=$(tput lines) + local terminal_cols=$(tput cols) + ((items_per_page = terminal_rows - 6)) + + tput clear >&2 + tput cup 0 0 >&2 + + # 显示标题 + if [[ "$restrict_mode" -eq 0 ]]; then + echo -e "${COLOR_TITLE}当前目录: $current_dir" >&2 + else + if [ "$current_dir" == "$start_dir" ]; then + echo -e "${COLOR_TITLE}当前目录 (锁定): $current_dir" >&2 + else + echo -e "${COLOR_TITLE}当前目录: $current_dir" >&2 + fi + fi + echo -e "${custom_prompt}${COLOR_NORMAL}" >&2 + echo >&2 + + # 获取内容 + local MENU_OPTIONS=($(get_directory_contents "$current_dir")) + local num_options=${#MENU_OPTIONS[@]} + ((total_pages = (num_options + items_per_page - 1) / items_per_page)) + ((start_index = current_page * items_per_page)) + ((end_index = start_index + items_per_page)) + ((end_index > num_options)) && end_index=$num_options + + # 显示选项 + for ((i = start_index; i < end_index; i++)); do + local item="${MENU_OPTIONS[$i]}" + local display_item="$item" + local display_index=$((i - start_index)) + + if [[ "$item" == ".." ]]; then + display_item="${COLOR_BACK}[返回上级]${COLOR_NORMAL}" + elif [[ "$item" == */ ]]; then + display_item="${COLOR_DIR}[目录] ${item%/}${COLOR_NORMAL}" + fi + + if [[ $display_index -eq $selected ]]; then + echo -e "${COLOR_HIGHLIGHT}${COLOR_SELECTION}➔ $display_item${COLOR_NORMAL}" >&2 + else + echo -e " $display_item" >&2 + fi + done + + # 显示页码 + tput cup $((terminal_rows - 2)) 0 >&2 + if ((total_pages > 1)); then + echo -e "${COLOR_PAGE}页码: $((current_page + 1))/$total_pages" >&2 + echo -en "↑/↓ 导航 ←/→ 翻页 Enter 确认 B 返回上级 Q 退出${COLOR_NORMAL}" >&2 + else + echo -en "${COLOR_PAGE}↑/↓ 导航 Enter 确认 B 返回上级 Q 退出${COLOR_NORMAL}" >&2 + fi + tput ed >&2 + } + + # 主循环 + show_menu + local key + while true; do + # 读取单个键 + IFS= read -rsn1 key + + # 处理方向键 + if [[ "$key" == $'\x1B' ]]; then + # 读取额外的2个字节(方向键) + read -rsn2 -t 0.01 key + case "$key" in + '[A') # 上箭头 + if (( selected > 0 )); then + ((selected--)) + elif (( current_page > 0 )); then + ((current_page--)) + # 计算上一页的项目数 + local prev_items=$(( (terminal_rows - 6) )) + ((selected = prev_items - 1)) + fi + show_menu + ;; + '[B') # 下箭头 + local terminal_rows=$(tput lines) + ((items_per_page = terminal_rows - 6)) + local MENU_OPTIONS=($(get_directory_contents "$current_dir")) + local num_options=${#MENU_OPTIONS[@]} + ((items_on_page = items_per_page)) + (( items_on_page > num_options - current_page * items_per_page )) && \ + items_on_page=$(( num_options - current_page * items_per_page )) + + if (( selected < items_on_page - 1 )); then + ((selected++)) + elif (( current_page < total_pages - 1 )); then + ((current_page++)) + selected=0 + fi + show_menu + ;; + '[D') # 左箭头 + if (( current_page > 0 )); then + ((current_page--)) + selected=0 + show_menu + fi + ;; + '[C') # 右箭头 + local terminal_rows=$(tput lines) + ((items_per_page = terminal_rows - 6)) + local MENU_OPTIONS=($(get_directory_contents "$current_dir")) + local num_options=${#MENU_OPTIONS[@]} + ((total_pages = (num_options + items_per_page - 1) / items_per_page)) + + if (( current_page < total_pages - 1 )); then + ((current_page++)) + selected=0 + show_menu + fi + ;; + esac + else + # 处理普通键 + case "$key" in + '') # 回车 + local terminal_rows=$(tput lines) + ((items_per_page = terminal_rows - 6)) + local MENU_OPTIONS=($(get_directory_contents "$current_dir")) + local num_options=${#MENU_OPTIONS[@]} + ((global_index = current_page * items_per_page + selected)) + + if (( global_index < num_options )); then + local selected_item="${MENU_OPTIONS[$global_index]}" + + if [[ "$selected_item" == ".." ]]; then + if [[ "$restrict_mode" -eq 1 ]] && [ "$current_dir" == "$start_dir" ]; then + continue + fi + [[ "$current_dir" != "/" ]] && current_dir=$(dirname "$current_dir") + [[ "$current_dir" == "//" ]] && current_dir="/" + current_dir=$(normalize_path "$current_dir") + dir_stack+=("$current_dir") + current_page=0 + selected=0 + show_menu + elif [[ "$selected_item" == */ ]]; then + local new_dir=$(normalize_path "$current_dir/${selected_item%/}") + dir_stack+=("$new_dir") + current_dir="$new_dir" + current_page=0 + selected=0 + show_menu + else + selected_file=$(normalize_path "${current_dir%/}/$selected_item") + break + fi + fi + ;; + [bB]) # 返回上级 + if [[ "$restrict_mode" -eq 1 ]] && [ "$current_dir" == "$start_dir" ]; then + continue + fi + [[ "$current_dir" != "/" ]] && current_dir=$(dirname "$current_dir") + current_dir=$(normalize_path "$current_dir") + dir_stack+=("$current_dir") + current_page=0 + selected=0 + show_menu + ;; + [qQ]) # 退出 + selected_file="" + break + ;; + esac + fi + done + + cleanup + echo "$selected_file" # 输出结果到 STDOUT + [[ -n "$selected_file" ]] && return 0 || return 1 +} + +# 使用示例 +# source ./file_selector.sh +# echo "==== 文件选择器演示 ====" +# echo "当前目录内容:" +# ls -l +# +# selected_path=$(file_selector "$HOME" -r "请选择文本文件:" "txt") +# +# if [[ -n "$selected_path" ]]; then +# echo "您选择了: $selected_path" +# echo "文件内容:" +# head -n 5 "$selected_path" 2>/dev/null || echo "(目录内容无法显示)" +# else +# echo "未选择文件" +# fi +# +# echo "==== 脚本继续执行 ====" + +export -f file_selector \ No newline at end of file diff --git a/hashcat.rc b/hashcat.rc new file mode 100644 index 0000000..c4d2815 --- /dev/null +++ b/hashcat.rc @@ -0,0 +1,4 @@ +# hashcat 输出参数配置 +HASHCAT_OUTPUT="-o wpa_hashcat_crack.txt" +# hashcat 优化参数配置 +# HASHCAT_OPTS="--kernel-accel=16 --kernel-loops=512 --optimized-kernel-enable --hwmon-disable -O --force" diff --git a/hccapx_to_hc22000.py b/hccapx_to_hc22000.py new file mode 100644 index 0000000..6c5e853 --- /dev/null +++ b/hccapx_to_hc22000.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import os +import sys +import struct +import argparse +from datetime import datetime + +def hccapx_to_hc22000(input_file, output_file=None, verbose=False): + """ + 将 hccapx 文件转换为 hc22000 格式 + :param input_file: 输入的 .hccapx 文件路径 + :param output_file: 输出的 .hc22000 文件路径(可选) + :param verbose: 是否显示详细处理信息 + :return: 转换后的文件路径 + """ + # 检查输入文件是否存在 + if not os.path.isfile(input_file): + print(f"错误:输入文件 '{input_file}' 不存在!") + sys.exit(1) + + if verbose: + print(f"开始处理: {input_file}") + print(f"目标格式: hc22000") + + # 读取文件内容 + with open(input_file, "rb") as f: + data = f.read() + + # 验证文件签名 (HCPX) + signature = struct.unpack("4s", data[0:4])[0] + if signature != b"HCPX": + print(f"错误:无效的 hccapx 文件签名,应为 'HCPX',实际为 {signature}") + sys.exit(1) + + # 解析文件结构 + version = struct.unpack("I", data[4:8])[0] + message_pair = struct.unpack("B", data[8:9])[0] + essid_len = struct.unpack("B", data[9:10])[0] + essid = struct.unpack(f"{essid_len}s", data[10:10+essid_len])[0] + keyver = struct.unpack("B", data[42:43])[0] + keymic = struct.unpack("16s", data[43:59])[0] + mac_ap = struct.unpack("6s", data[59:65])[0] + nonce_ap = struct.unpack("32s", data[65:97])[0] + mac_sta = struct.unpack("6s", data[97:103])[0] + nonce_sta = struct.unpack("32s", data[103:135])[0] + eapol_len = struct.unpack("H", data[135:137])[0] + eapol = struct.unpack(f"{eapol_len}s", data[137:137+eapol_len])[0] + + # 构建 hc22000 格式字符串 + protocol = "WPA" + pmkid_mic = keymic.hex() + type_val = "02" + mac_ap_hex = mac_ap.hex() + mac_client_hex = mac_sta.hex() + essid_hex = essid.hex() + nonce_ap_hex = nonce_ap.hex() + eapol_hex = eapol.hex() + message_pair_hex = f"{message_pair:02x}" + + hc22000_str = ( + f"{protocol}*{type_val}*{pmkid_mic}*{mac_ap_hex}*{mac_client_hex}" + f"*{essid_hex}*{nonce_ap_hex}*{eapol_hex}*{message_pair_hex}" + ) + + # 处理输出文件名 + if not output_file: + base_name = os.path.splitext(os.path.basename(input_file))[0] + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + output_file = f"{base_name}_{timestamp}.hc22000" + elif not output_file.endswith('.hc22000'): + output_file += '.hc22000' + + # 写入转换结果 + with open(output_file, "w") as f: + f.write(hc22000_str) + + if verbose: + print(f"转换成功!输出文件: {output_file}") + print(f"ESSID: {essid.decode('utf-8', 'ignore')}") + print(f"AP MAC: {':'.join(f'{b:02x}' for b in mac_ap)}") + + return output_file + +if __name__ == "__main__": + # 参数解析器配置 [2,5,6](@ref) + parser = argparse.ArgumentParser( + description="将 hccapx 文件转换为 Hashcat hc22000 格式", + epilog="示例: python3 hccapx_to_hc22000.py capture.hccapx --output result.hc22000 -v" + ) + parser.add_argument("input", help="输入的 .hccapx 文件路径") + parser.add_argument("-o", "--output", help="输出的 .hc22000 文件路径(可选)") + parser.add_argument("-v", "--verbose", action="store_true", help="显示详细处理信息") + args = parser.parse_args() + + # 执行转换 + hccapx_to_hc22000( + input_file=args.input, + output_file=args.output, + verbose=args.verbose + ) \ No newline at end of file diff --git a/interactive_menu.sh b/interactive_menu.sh new file mode 100644 index 0000000..d897444 --- /dev/null +++ b/interactive_menu.sh @@ -0,0 +1,388 @@ +#!/bin/bash + +# 交互式菜单函数(关键修复) +interactive_menu() { + trap 'cleanup' EXIT + local -n options_ref=$1 + local title=${2:-"请选择一个选项:"} + local selected=0 + local num_options=${#options_ref[@]} + + # 初始化终端 + local OLD_TERM=$(stty -g) + stty -echo -icanon time 0 min 0 + tput smcup >/dev/tty + tput civis >/dev/tty + clear >/dev/tty + + # 颜色定义 + local COLOR_NORMAL=$(tput sgr0) + local COLOR_HIGHLIGHT=$(tput rev) + local COLOR_TITLE=$(tput setaf 4) + local COLOR_SELECTION=$(tput setaf 2) + + # 显示菜单(修复污染源) + show_menu() { + tput cup 0 0 >/dev/tty + printf "${COLOR_TITLE}%s${COLOR_NORMAL}\n\n" "$title" >/dev/tty + + for ((i=0; i/dev/tty + else + printf " %s\n" "${options_ref[$i]}" | expand -t4 >/dev/tty + fi + done + tput ed >/dev/tty + } + + # 事件处理 + local buffer="" + local return_index=-1 + + while true; do + show_menu + read -rsn1 input + buffer+="$input" + + case "$buffer" in + $'\x1B[A') # 上箭头 + ((selected = (selected - 1 + num_options) % num_options)) + buffer="" + ;; + $'\x1B[B') # 下箭头 + ((selected = (selected + 1) % num_options)) + buffer="" + ;; + "") # 回车 + return_index=$selected + break + ;; + [qQ]) # 退出 + break + ;; + *) + [[ ! "$buffer" =~ ^$'\x1B' ]] && buffer="" + ;; + esac + done + + # 清理终端 + cleanup() { + tput sgr0 2>/dev/null >/dev/tty + stty "$OLD_TERM" 2>/dev/null + tput cnorm >/dev/tty + tput rmcup >/dev/tty + } + cleanup + + # 关键修复:确保纯净数字输出 + if (( return_index >= 0 )); then + printf "%d" "$return_index" # 使用printf避免换行符[4](@ref) + return 0 + else + return 1 + fi +} + +# # ============== 调用示例 ============== # +# source ./interactive_menu.sh +# menu_items=("查看CPU信息" "检查磁盘空间" "监控网络状态" "返回上级菜单") +# +# # 捕获纯净数字索引 +# choice_index=$(interactive_menu menu_items "系统管理主菜单") +# interactive_menu_exit=$? +# +# # 安全获取选项(避免空值) +# if [[ -n "$choice_index" ]] && [[ "$choice_index" =~ ^[0-9]+$ ]]; then +# selected_item="${menu_items[$choice_index]}" +# else +# selected_item="无效选择" +# fi +# +# case $interactive_menu_exit in +# 0) echo "用户选择: $selected_item (索引: $choice_index)" ;; +# 1) echo "用户取消选择" ;; +# esac + +export -f interactive_menu + + + + + + + + +interactive_menu_csv() { + trap 'cleanup' EXIT + local csv_data="$1" + local select_tip=${2:-"请选择一个选项:"} + local selected=0 + local return_index=-1 + + # 解析CSV数据 + IFS=$'\n' read -d '' -r -a lines <<< "$csv_data" + local header="${lines[0]}" + local -a options=("${lines[@]:1}") + local num_options=${#options[@]} + + # 字符宽度映射表 - 针对常见中文字符优化 + declare -A char_width_map + + # 计算字符串的显示宽度(考虑全角字符) + str_display_width() { + local str="$1" + local width=0 + local char full_char hex_bytes codepoint + + # 按字符遍历字符串 + while IFS= read -r -n1 char; do + [[ -z "$char" ]] && continue # 跳过空字符 + + # 读取完整UTF-8字符 + full_char="$char" + local first_byte=$(printf "%d" "'$char") + + # 1字节字符(ASCII) + if (( first_byte < 128 )); then + ((width++)) + continue + fi + + # 多字节字符处理 + if (( first_byte >= 194 && first_byte <= 223 )); then # 2字节 + read -r -n1 char; full_char+="$char" + elif (( first_byte >= 224 && first_byte <= 239 )); then # 3字节 + read -r -n1 char; full_char+="$char" + read -r -n1 char; full_char+="$char" + elif (( first_byte >= 240 && first_byte <= 244 )); then # 4字节 + read -r -n1 char; full_char+="$char" + read -r -n1 char; full_char+="$char" + read -r -n1 char; full_char+="$char" + fi + + # 获取UTF-8字节的十六进制表示 + hex_bytes=$(echo -n "$full_char" | xxd -p) + + # 转换UTF-8到Unicode码点 + case ${#hex_bytes} in + 4) # 2字节 + codepoint=$(((0x${hex_bytes:0:2} & 0x1F) << 6 | (0x${hex_bytes:2:2} & 0x3F))) ;; + 6) # 3字节 + codepoint=$(((0x${hex_bytes:0:2} & 0x0F) << 12 | (0x${hex_bytes:2:2} & 0x3F) << 6 | (0x${hex_bytes:4:2} & 0x3F))) ;; + 8) # 4字节 + codepoint=$(((0x${hex_bytes:0:2} & 0x07) << 18 | (0x${hex_bytes:2:2} & 0x3F) << 12 | (0x${hex_bytes:4:2} & 0x3F) << 6 | (0x${hex_bytes:6:2} & 0x3F))) ;; + *) # 其他情况 + codepoint=0 ;; + esac + + # 判断宽字符(添加韩文字母范围 U+3130–U+318F) + if (( codepoint >= 0x4E00 && codepoint <= 0x9FFF || codepoint >= 0x3400 && codepoint <= 0x4DBF || codepoint >= 0x3040 && codepoint <= 0x309F || codepoint >= 0x30A0 && codepoint <= 0x30FF || codepoint >= 0x3130 && codepoint <= 0x318F || codepoint >= 0xAC00 && codepoint <= 0xD7AF || codepoint >= 0xFF00 && codepoint <= 0xFFEF || codepoint >= 0x3000 && codepoint <= 0x303F )); then + ((width += 2)) + else + ((width++)) + fi + done <<< "$str" + + echo "$width" + } + + # 确定每列的最大宽度 + local -a max_widths + IFS=',' read -r -a headers <<< "$header" + for ((i=0; i<${#headers[@]}; i++)); do + max_widths[$i]=$(str_display_width "${headers[$i]}") + done + + # 计算每列的最大宽度(包括选项) + for line in "${options[@]}"; do + IFS=',' read -r -a fields <<< "$line" + for ((i=0; i<${#fields[@]}; i++)); do + local width=$(str_display_width "${fields[$i]}") + if (( width > max_widths[i] )); then + max_widths[$i]=$width + fi + done + done + + # 列间隔设置 + local MIN_SPACING=3 + local MAX_SPACING=5 + local num_columns=${#max_widths[@]} + + # 计算总内容宽度 + local total_content_width=0 + for width in "${max_widths[@]}"; do + ((total_content_width += width)) + done + + # 获取终端宽度 + local term_width=$(tput cols) + local available_space=$((term_width - total_content_width)) + + # 计算最佳间隔 + if (( num_columns > 1 )); then + local ideal_spacing=$((available_space / (num_columns - 1))) + if (( ideal_spacing < MIN_SPACING )); then + spacing=$MIN_SPACING + elif (( ideal_spacing > MAX_SPACING )); then + spacing=$MAX_SPACING + else + spacing=$ideal_spacing + fi + else + spacing=$MIN_SPACING + fi + + # 格式化行数据 + format_row() { + local -a fields=("$@") + local formatted="" + + for ((i=0; i<${#fields[@]}; i++)); do + local field="${fields[$i]}" + local field_width=$(str_display_width "$field") + local padding=$((max_widths[i] - field_width)) + + formatted+="${field}" + + # 添加填充空格 + for ((j=0; j/dev/tty + tput civis >/dev/tty + clear >/dev/tty + + # 颜色定义 + local COLOR_NORMAL=$(tput sgr0) + local COLOR_HIGHLIGHT=$(tput rev) + local COLOR_select_tip=$(tput setaf 4) # 蓝色标题 + local COLOR_HEADER=$(tput setaf 6) # 青色表头 + local COLOR_SELECTION=$(tput setaf 2) # 绿色选中项 + local COLOR_PROMPT=$(tput setaf 3) # 黄色提示 + + # 高亮整行(包括间隔) + highlight_line() { + local line="$1" + local highlighted="${COLOR_HIGHLIGHT}${COLOR_SELECTION}➔ ${line}${COLOR_NORMAL}" + echo "$highlighted" + } + + # 显示菜单 + show_menu() { + tput cup 0 0 >/dev/tty + + # 显示表头 + printf " ${COLOR_HEADER}%s${COLOR_NORMAL}\n\n" "$formatted_header" >/dev/tty + + # 显示选项 + for ((i=0; i/dev/tty + else + printf " %s\n" "${formatted_options[$i]}" >/dev/tty + fi + done + + # 计算提示信息应该显示的位置 + local prompt_row=$((num_options + 3)) + tput cup $prompt_row 0 >/dev/tty + tput el >/dev/tty + printf "${COLOR_PROMPT}%s${COLOR_NORMAL}\n" "$select_tip" >/dev/tty + printf "${COLOR_PROMPT}↑↓: 选择 Enter: 确认 Q: 退出${COLOR_NORMAL}\n" >/dev/tty + + # 清除屏幕剩余部分 + tput ed >/dev/tty + } + + # 事件处理 + local buffer="" + + while true; do + show_menu + read -rsn1 input + buffer+="$input" + + case "$buffer" in + $'\x1B[A') # 上箭头 + ((selected = (selected - 1 + num_options) % num_options)) + buffer="" + ;; + $'\x1B[B') # 下箭头 + ((selected = (selected + 1) % num_options)) + buffer="" + ;; + "") # 回车 + return_index=$selected + break + ;; + [qQ]) # 退出 + break + ;; + *) + [[ ! "$buffer" =~ ^$'\x1B' ]] && buffer="" + ;; + esac + done + + # 清理终端 + cleanup() { + tput sgr0 2>/dev/null >/dev/tty + stty "$OLD_TERM" 2>/dev/null + tput cnorm >/dev/tty + tput rmcup >/dev/tty + } + cleanup + + # 返回选择结果 + if (( return_index >= 0 )); then + printf "%d" "$return_index" + return 0 + else + return 1 + fi +} + +# # ============== 调用示例 ============== # +# source ./interactive_menu_csv.sh +# csv="SSID名称,MAC地址,加密类型,握手信息 +# 好日子-WiFi-5G,11:22:33:AA:BB:CC,WPA2,2 handshake +# 303-4g,22:55:44:22:EE:DD,WPA2,1 handshake +# 303,55:66:77:88:99:AA,WPA2,1 handshake" +# +# selected=$(interactive_menu_csv "$csv" "请选择一个WiFi网络:") +# if [ $? -eq 0 ]; then +# echo "你选择了选项 $selected" +# else +# echo "已取消选择" +# fi + +export -f interactive_menu_csv \ No newline at end of file diff --git a/wpa_hashcat.sh b/wpa_hashcat.sh new file mode 100644 index 0000000..306c7b7 --- /dev/null +++ b/wpa_hashcat.sh @@ -0,0 +1,1024 @@ +#!/bin/bash + +# 获取脚本的绝对路径 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/file_selector.sh" +source "$SCRIPT_DIR/interactive_menu.sh" +source "$SCRIPT_DIR/auto_extract.sh" +source "$SCRIPT_DIR/hashcat.rc" + + +function get_info_from_hc22000() { + local hc22000_file=${1} + local hash_info=$(hcxhashtool -i "$hc22000_file" --info=stdout 2>/dev/null | iconv -c -t UTF-8) + + if [ "$hash_info" == "no hashes loaded" ]; then + return 1 + fi + echo "$hash_info" | awk -F': ' ' + # 定义函数:格式化MAC地址为 XX:XX:XX:XX:XX:XX + function format_mac(mac) { + # 转换为大写 + mac = toupper(mac) + # 插入冒号:每两个字符后添加一个冒号 + result = substr(mac, 1, 2) + for (i = 3; i <= length(mac); i += 2) { + result = result ":" substr(mac, i, 2) + } + return result + } + + BEGIN { + ssid = ""; mac_ap = ""; key_version = ""; in_group = 0 + has_mic = 0; has_pmkid = 0 + } + /^[[:space:]]*$/ { + if (in_group && ssid != "" && mac_ap != "" && key_version != "") { + print ssid "," mac_ap "," key_version "," has_mic "," has_pmkid + ssid = ""; mac_ap = ""; key_version = "" + has_mic = 0; has_pmkid = 0 + } + in_group = 0 + } + /^SSID\.{0,}:/ { + ssid = $2 + in_group = 1 + } + /^MAC_AP\.{0,}:/ { + # 提取MAC地址部分(冒号后第一个空格前的内容) + mac_part = $2 + # 移除括号及其内容 + sub(/[[:space:]]*\(.*/, "", mac_part) + # 格式化MAC地址 + mac_ap = format_mac(mac_part) + } + /^KEY VERSION\.{0,}:/ { + key_version = $2 + } + /^MIC\.{0,}:/ { + has_mic = 1 + } + /^PMKID\.{0,}:/ { + has_pmkid = 1 + } + END { + if (ssid != "" && mac_ap != "" && key_version != "") { + print ssid "," mac_ap "," key_version "," has_mic "," has_pmkid + } + } + ' | awk -F',' ' + BEGIN { + FS = "," # 字段分隔符为逗号 + idx = 0 + } + + # 处理每一行数据,按MAC地址分组累加,并记录顺序 + { + mac = $2 + if (!seen[mac]) { # 首次出现的MAC地址 + order[idx++] = mac + seen[mac] = 1 + } + ssid[mac] = $1 + key_version[mac] = $3 + mic_sum[mac] += $4 + 0 # 转换为数字 + pmkid_sum[mac] += $5 + 0 # 转换为数字 + } + + # 按原始顺序输出结果 + END { + print "SSID名称,MAC地址,加密类型,握手信息" + for (i = 0; i < idx; i++) { + mac = order[i] + # 构建汇总字符串 + result = "" + if (mic_sum[mac] > 0) { + result = mic_sum[mac] " handshake" + } + if (pmkid_sum[mac] > 0) { + if (result != "") { + result = result " & " + } + result = result pmkid_sum[mac] " pmkid" + } + # 输出合并后的行 + print ssid[mac] "," mac "," key_version[mac] "," result + } + } + ' +} + +convert_hc22000_file=/tmp/wpa_hashcat_temp.hc22000 + +function cap_to_hc22000() { + + local cap_file=${1} + local hc22000_file=${2} + + case "${cap_file}" in + *.cap|*.pcap|*.pcapng) + local hcxpcapngtool_output=$(hcxpcapngtool "${cap_file}" -o "${hc22000_file}" 2>&1) + if [ ! -f "$hc22000_file" ]; then + if echo "$hcxpcapngtool_output" | grep -q "Information: no hashes written to hash files"; then + echo "[!] 报文中未包含足够的WPA/WPA2握手信息!" + if echo "$hcxpcapngtool_output" | grep -q "(PMK not recoverable)";then + echo "[i] 检测到WPA3的握手信息(注意:WPA3无法通过hash计算破解,若攻击目标为WPA3网络,这是不可取的)。" + fi + elif echo "$hcxpcapngtool_output" | grep -q "unsupported dump file format"; then + echo "[!] 不支持的文件格式,请确保文件没有损坏。" + else + echo "[!] 未知错误,报文转换hc22000格式失败!" + fi + read -p "输入回车键退出..." + exit 1 + fi + ;; + *.hccapx) + "$SCRIPT_DIR/hccapx_to_hc22000.py" "${cap_file}" -o "${hc22000_file}" >/dev/null 2>&1 + if [ ! -f "$hc22000_file" ]; then + echo "[!] 报文转换hc22000格式失败,请确保文件没有损坏!" + read -p "输入回车键退出..." + exit 1 + fi + ;; + *.hc22000) + get_info_from_hc22000 "${cap_file}" >/dev/null 2>&1 + if [ $? != 0 ]; then + echo "[!] 未读取到可用的哈希信息,请确保文件没有损坏!" + read -p "输入回车键退出..." + exit 1 + fi + cp "${cap_file}" "${hc22000_file}" + ;; + *) + echo "[!] 不支持的握手包文件格式!(目前支持格式 .cap .pcap .pcapng .hccapx .hc22000)" >&2 + read -p "输入回车键退出..." + exit 1 + ;; + esac + + +} + +function exitWhenFileAbsent() { + local file + local error_text + + while [[ $# -gt 0 ]]; do + case "$1" in + -f) + if [ -n "$2" ]; then + case "$2" in + -[a-z]) ;; + *) file="$2"; shift ;; + esac + fi + ;; + -t) + if [ -n "$2" ]; then + case "$2" in + -[a-z]) ;; + *) error_text="$2"; shift ;; + esac + fi + ;; + esac + shift + done + error_text=${error_text:-"[!] 文件为空或不存在!"} + + if [ -n "$file" ]; then + if [ -f "$file" ] || [ "$(ls -A "$file" 2>/dev/null | wc -l)" -gt 0 ]; then + return 0 + fi + fi + echo "${error_text}" + read -p "输入回车键退出..." + exit 1 +} + + +function format_crack_options() { + local input="$1" + local output="" + local IFS=$'\n' + local line_num=0 + + input=$(echo "$input" | grep -v '^$') + for line in $input; do + + # 分割字段 + IFS=',' read -r col1 col2 col3 col4 col5 col6 <<< "$line" + + # 处理第一列:添加序号 + processed_col1="($line_num) $col1" + ((line_num++)) + + # 处理第四列:添加方括号 + if [[ -n "$col4" ]]; then + processed_col4="[${col4}]" + else + processed_col4="" + fi + + # 处理第六列:添加星号 + stars="" + recommend="" + if [[ -n "$col6" && "$col6" -gt 0 ]]; then + # 生成星号 + for ((i=1; i<=col6; i++)); do + stars+="⭐️" + done + + # 检查是否需要添加推荐 + if [[ "$col6" -ge 5 ]]; then + recommend="(推荐)" + fi + fi + processed_col6="${stars}${recommend}" + + # 拼接结果 + output+="${processed_col1},${col2},${col3},${processed_col4},${col5},${processed_col6}\n" + done + + # 输出结果(去除末尾的换行符) + echo -e "${output%\\n}" +} + + +function calculate_password_count_of_mask() { + + # 定义标准组合字符集及其长度 + declare -A charsets=( + ["l"]=26 # ?l: 小写字母 + ["u"]=26 # ?u: 大写字母 + ["d"]=10 # ?d: 数字 + ["h"]=16 # ?h: 十六进制小写 + ["H"]=16 # ?H: 十六进制大写 + ["s"]=33 # ?s: 特殊字符(包括空格) + ["a"]=95 # ?a: 所有可打印字符 + ["b"]=256 # ?b: 二进制字节 + ) + + # 计算自定义组合的大小(正确处理特殊字符) + calculate_size() { + local str="$1" + local len=${#str} + local i=0 + local size=0 + + while ((i < len)); do + char="${str:$i:1}" + + if [[ "$char" == "?" ]]; then + # 处理占位符 + if ((i+1 < len)); then + next_char="${str:$((i+1)):1}" + if [[ -n "${charsets[$next_char]}" ]]; then + size=$((size + ${charsets[$next_char]})) + i=$((i+2)) + continue + fi + fi + fi + + # 普通字符计数 + size=$((size + 1)) + i=$((i+1)) + done + + echo "$size" + } + + calculate_mask_of_hcmask() { + input=${1} + #input='?l?d?u,?l?d,?l?d*!$@_,?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d' + # 安全分割输入字符串(避免特殊字符被解释) + parts=() + current="" + len=${#input} + for ((i=0; i&2 + done + + # 解析模式字符串并构建表达式 + expr="1" + i=0 + len=${#pattern} + + while ((i < len)); do + char="${pattern:$i:1}" + + if [[ "$char" == "?" ]]; then + if ((i+1 < len)); then + next_char="${pattern:$((i+1)):1}" + + # 处理自定义组合引用(?1, ?2 等) + if [[ "$next_char" =~ [0-9] ]]; then + index=$((next_char)) + if ((index >= 1 && index <= ${#custom_sizes[@]})); then + value=${custom_sizes[$((index-1))]} + expr="$expr * $value" + #echo "处理 ?$next_char = $value" >&2 + i=$((i+2)) + continue + fi + # 处理预定义占位符 + elif [[ -n "${charsets[$next_char]}" ]]; then + value=${charsets[$next_char]} + expr="$expr * $value" + #echo "处理 ?$next_char = $value" >&2 + i=$((i+2)) + continue + fi + fi + fi + + # 处理普通字符(大小为1) + expr="$expr * 1" + #echo "处理 '$char' = 1" >&2 + i=$((i+1)) + done + + # 计算最终结果 + #echo "最终表达式: $expr" >&2 + result=$(echo "$expr" | bc) + echo "$result" + } + + + calculate_mask_of_string() { + # 输入字符串 + input_str="$1" + #$input_str="-1 ?l?u ?1?l?l?l?l?l19?d?d" + + # 分割输入字符串为数组 + IFS=' ' read -ra parts <<< "$input_str" + + # 存储自定义组合的字典 + declare -A custom_dict + pattern="" + i=0 + + # 解析自定义组合和模式字符串 + while [ $i -lt ${#parts[@]} ]; do + part="${parts[$i]}" + if [[ "$part" == -* ]]; then + # 提取自定义组合ID(去掉'-') + custom_id="${part:1}" + ((i++)) + if [ $i -ge ${#parts[@]} ]; then + #echo "Error: Missing definition for custom set $custom_id" + return 1 + fi + def_str="${parts[$i]}" + total_size=0 + + # 解析定义字符串 + j=0 + while [ $j -lt ${#def_str} ]; do + if [ "${def_str:$j:1}" = "?" ]; then + # 处理占位符 + ((j++)) + if [ $j -lt ${#def_str} ]; then + char="${def_str:$j:1}" + if [[ "$char" =~ [0-9a-zA-Z] ]]; then + # 预定义占位符 + if [ -n "${charsets[$char]}" ]; then + total_size=$((total_size + ${charsets[$char]})) + fi + ((j++)) + else + # 无效占位符,视为固定字符'?' + total_size=$((total_size + 1)) + ((j++)) + fi + else + # '?' 在末尾,视为固定字符 + total_size=$((total_size + 1)) + fi + else + # 处理固定字符 + total_size=$((total_size + 1)) + ((j++)) + fi + done + + # 存储自定义组合大小 + custom_dict[$custom_id]=$total_size + else + # 第一个非自定义组合标识的部分作为模式字符串 + pattern="$part" + break + fi + ((i++)) + done + + if [ -z "$pattern" ]; then + #echo "Error: Pattern string not found" + return 1 + fi + + # 计算模式字符串的组合总数 + total_combinations=1 + j=0 + while [ $j -lt ${#pattern} ]; do + if [ "${pattern:$j:1}" = "?" ]; then + # 处理占位符 + ((j++)) + if [ $j -lt ${#pattern} ]; then + char="${pattern:$j:1}" + if [[ "$char" =~ [0-9] ]]; then + # 自定义占位符 + if [ -n "${custom_dict[$char]}" ]; then + size=${custom_dict[$char]} + else + size=0 + fi + else + # 预定义占位符 + if [ -n "${charsets[$char]}" ]; then + size=${charsets[$char]} + else + size=0 + fi + fi + total_combinations=$((total_combinations * size)) + ((j++)) + else + # '?' 在末尾,视为固定字符(大小为1) + ((j++)) + fi + else + # 处理固定字符(大小为1) + ((j++)) + fi + done + + echo "$total_combinations" + } + + + local mask=$1 + local password_count + + if [[ $mask == *.hcmask ]]; then + if [ -f "$mask" ]; then + password_count=0 + local count + while read -r line; do + count=$(calculate_mask_of_hcmask "$line") + if [[ -n $count ]]; then + password_count=$((password_count+count)) + fi + done < <(sed -e '/^$/d' -e '/^#/d' -e 's/\\,//g' -e 's/??//g' "$mask") + fi + else + password_count=$(calculate_mask_of_string "$mask") + fi + echo $password_count +} + + +#确保密码大于等于8 +#function run_hashcat_wpa() { +# +#} + + + + + + + + + +####################主程序###################### + +version=0.10 +echo "" +echo -e "\033[1m __ __ __ \033[0m" +echo -e "\033[1m _ __ ___ ___ _ / / ___ _ ___ / / ____ ___ _ / /_ \033[0m" +echo -e '\033[1m | |/|/ // _ \/ _ `/ / _ \/ _ `/(_-< / _ \/ __// _ `// __/ \033[0m' +echo -e "\033[32m\033[1m |__,__// .__/\_,_/ ____ /_//_/\_,_//___//_//_/\__/ \_,_/ \__/ \033[0m" +echo -e "\033[32m\033[1m /_/ /___/ \033[0m" +echo "" +sleep 0.1 +echo -e "—————————————————————————————————————————————————————————————————" +sleep 0.1 +echo -e " \033[36m\033[1mwpa_hashcat v${version}\033[0m (by \033[33m小网洞\033[0m) 基于hashcat,hcxtools " +sleep 0.1 +echo -e "—————————————————————————————————————————————————————————————————" +sleep 0.1 +#echo -e " wpa_hashcat v0.10 (by 小网洞) 基于hashcat,hcxtools " +echo "" +echo "[+] 脚本启动!" + +###0.检查依赖### +#hashcat,hcxtools,python,xxd,7z,zip + + + +###1.选择握手包文件### + +zenity_enable=true + +if [ -n "${1}" ]; then + cap_file=${1} + exitWhenFileAbsent -f "${cap_file}" -t "[!] 文件${cap_file}不存在!" +else + echo "[+] 等待用户选择握手包文件..." + sleep 0.2 + if $zenity_enable; then + # 使用zenity弹出文件选择器 + cap_file=$(zenity --file-selection \ + --title="请选择握手包文件" \ + --file-filter="握手包文件 (*.cap *.pcap *.pcapng *.hccapx *.hc22000)|*.cap *.pcap *.pcapng *.hccapx *.hc22000" \ + --file-filter="所有文件 (*)|*" \ + 2>/dev/null) + + if [ $? != 0 ]; then + zenity_enable=false + echo "[i] 对话框未能启动 (当前可能为非图形化环境)。" + cap_file=$(file_selector "$pwd" "请选择握手包文件 (cap,pcap,pcapng,hccapx,hc22000):" "cap,pcap,pcapng,hccapx,hc22000") + fi + else + cap_file=$(file_selector "$pwd" "请选择握手包文件 (cap,pcap,pcapng,hccapx,hc22000):" "cap,pcap,pcapng,hccapx,hc22000") + fi + + exitWhenFileAbsent -f "${cap_file}" -t "[!] 未选择任何文件,脚本退出。" + + echo "[+] 已选择握手包文件: ${cap_file}" +fi + + +rm "$convert_hc22000_file" >/dev/null 2>&1 +cap_to_hc22000 "${cap_file}" "${convert_hc22000_file}" +hash_info=$(get_info_from_hc22000 "${convert_hc22000_file}") +if [ -n "$hash_info" ]; then + if [[ $(echo "$hash_info" | wc -l) -gt 2 ]]; then + selected_wifi=$(interactive_menu_csv "$hash_info" "请选择一个需要破解的WiFi网络 (取消则破解所有):") + if [ $? -eq 0 ]; then + ((selected_wifi++)) + selected_wifi_info=$(echo "$hash_info" | sed '1d' | sed -n "${selected_wifi}p") + selected_wifi_essid=$(echo $selected_wifi_info | awk -F, '{print $1}') + selected_wifi_bssid=$(echo $selected_wifi_info | awk -F, '{print $2}') + echo "[+] 已选择目标 ${selected_wifi_essid} (${selected_wifi_bssid})" + selected_wifi_bssid=$(echo $selected_wifi_bssid | tr '[:upper:]' '[:lower:]' | sed 's/://g') + hash=$(cat "${convert_hc22000_file}" | grep $selected_wifi_bssid | head -n 1) + else + echo "[+] 未选择,默认破解所有哈希。" + hash=$convert_hc22000_file + fi + else + hash=$convert_hc22000_file + fi +else + echo "[!] 未知错误,未读取到可用的哈希信息!" + read -p "输入回车键退出..." + exit 1 +fi + + + +###2.选择破解选项### + +crack_title="破解方式,版本,作者,密码量,说明,推荐度" +crack_default_options="自定义字典,,,,," +crack_custom_options=" +常用弱密,1.0,HULUGANG,≈2500万,顺序字符、姓名、日期、谐音、数字字母组合等,5 +8位纯数字,1.0,小网洞,1亿,8位纯数字,5 +地区手机号,1.0,随风无限,20万~2亿,11位中国大陆移动、电信、联通手机号(2024年),5 +8位数字字母规律,1.0,小网洞,≈673亿,字母+数字、数字+字母、数字字母混合,2 +运营商光猫规律,1.0,随风无限,≈1万2千亿,ChinaNet/CMCC/CU光猫默认密码规律,2 +" + +#字母姓名日期组合,1.0,小网洞,,单字母/拼音/姓名及缩写+年月日/规律数字符号组合,4 +#字母+手机号,1.0,小网洞,104万-104亿,手机号(11位)前加26个字母含大小写,1 +#已知姓+手机号,1.0,小网洞,40万~4亿,手机号(11位)前/前后加姓名拼音,1 +#已知姓名缩写+手机号,1.0,小网洞,20万~2亿,手机号(11位)前加姓名缩写,1 +#电信光猫规律,1.0,小网洞,,电信ChinaNet-XXXX光猫默认密码规律,1 +#移动光猫规律,1.0,小网洞,,移动CMCC-XXXX光猫默认密码规律,1 +#联通光猫规律,1.0,小网洞,,联通CU_XXXX光猫默认密码规律,1 + + +crack_options="${crack_default_options}${crack_custom_options}" +crack_options_csv=$(echo "$crack_title" | cat - <(format_crack_options "$crack_options")) + + +crack_choice_index=$(interactive_menu_csv "$crack_options_csv" "请选择破解选项:") +if [ -z "$crack_choice_index" ]; then + echo "[!] 未选择破解方式,脚本退出。" + read -p "输入回车键退出..." + exit 1 +fi + +IFS=$'\n' read -d '' -r -a crack_options_array </dev/null) + else + dict_file=$(file_selector "$pwd" "请选择字典文件(txt,dict,dic):" "txt,dict,dic") + fi + exitWhenFileAbsent -f "${dict_file}" -t "[!] 未选择任何文件,脚本退出。" + echo "[+] 执行${crack_selected_option}跑包..." + key_cout=$(cat "$dict_file" | grep -v '^$' | wc -l) + echo -e "[i] 密码量${key_cout}。" + hashcat -m 22000 -a 0 $hash "${dict_file}" $optimization_parameter $output_parameter + ;; + 1) #常用弱密 + dict_file="$default_dict_path/easy_dict/easy_dict.txt" + if [ ! -f "${dict_file}" ]; then + dict_archive_file="$default_dict_path/easy_dict.7z" + exitWhenFileAbsent -f "${dict_archive_file}" -t "[!] 字典文件${dict_archive_file}不存在!" + echo "[i] 正在解压字典文件..." + auto_extract "$dict_archive_file" >/dev/null 2>&1 + exitWhenFileAbsent -f "${dict_file}" -t "[!] 字典文件${dict_archive_file}解压失败!" + fi + echo "[+] 执行${crack_selected_option}跑包..." + key_cout=$(cat "$dict_file" | grep -v '^$' | wc -l) + echo -e "[i] 密码量${key_cout}。" + hashcat -m 22000 -a 0 $hash "${dict_file}" $optimization_parameter $output_parameter + ;; + 2) #8位纯数字 + echo "[+] 执行${crack_selected_option}跑包..." + mask=?d?d?d?d?d?d?d?d + key_cout=$(calculate_password_count_of_mask "$mask") + echo -e "[i] 密码量${key_cout}。" + hashcat -m 22000 -a 3 $hash $mask $optimization_parameter $output_parameter + ;; + 3) #地区手机号 + dict_path="$default_dict_path/phone_number" + if ! [ "$(ls -A "$dict_path" 2>/dev/null | wc -l)" -gt 0 ]; then + dict_archive_file="$default_dict_path/phone_number.zip" + exitWhenFileAbsent -f "${dict_archive_file}" -t "[!] 字典文件${dict_archive_file}不存在!" + echo "[i] 正在解压字典文件..." + auto_extract "$dict_archive_file" >/dev/null 2>&1 + exitWhenFileAbsent -f "${dict_path}" -t "[!] 字典文件${dict_archive_file}解压失败!" + fi + dict_file=$(file_selector "$dict_path" -r "请根据所在地区选择:") + exitWhenFileAbsent -f "${dict_file}" -t "[!] 未选择任何文件,脚本退出。" + echo -e "[+] 执行\033[36m${area}\033[0m${crack_selected_option}跑包..." + area=$(basename "$dict_file" ".txt") + mask=?d?d?d?d + key_cout=$(($(cat "$dict_file" | grep -v '^$' | wc -l) * $(calculate_password_count_of_mask "$mask"))) + echo -e "[i] 密码量${key_cout}。" + hashcat -m 22000 -a 6 $hash "${dict_file}" $mask $optimization_parameter $output_parameter + ;; + 4) #8位字母数字规律 + mask_file="$default_dict_path/letter&num(8)/letter&num(8).hcmask" + if [ ! -f "$mask_file" ]; then + mask_archive_file="$default_dict_path/letter&num(8).zip" + exitWhenFileAbsent -f "${mask_archive_file}" -t "[!] 掩码文件${mask_archive_file}不存在!" + echo "[i] 正在解压掩码文件..." + auto_extract "$mask_archive_file" >/dev/null 2>&1 + exitWhenFileAbsent -f "${mask_file}" -t "[!] 字典文件${mask_archive_file}解压失败!" + fi + echo "[+] 执行${crack_selected_option}跑包..." + key_cout=$(calculate_password_count_of_mask "$mask_file") + echo -e "[i] 密码量${key_cout}。" + hashcat -m 22000 -a 3 $hash $mask_file $optimization_parameter $output_parameter + ;; + 5) #运营商光猫规律 + dict_file1="$default_dict_path/ct&cm&cu/first4.txt" + dict_file2="$default_dict_path/ct&cm&cu/last4.txt" + if [ ! -f "${dict_file1}" ] || [ ! -f "${dict_file2}" ]; then + dict_archive_file="$default_dict_path/ct&cm&cu.zip" + exitWhenFileAbsent -f "${dict_archive_file}" -t "[!] 字典文件${dict_archive_file}不存在!" + echo "[i] 正在解压字典文件..." + auto_extract "$dict_archive_file" >/dev/null 2>&1 + exitWhenFileAbsent -f "${dict_file1}" -t "[!] 字典文件${dict_archive_file}解压失败!" + exitWhenFileAbsent -f "${dict_file2}" -t "[!] 字典文件${dict_archive_file}解压失败!" + fi + echo "[+] 执行${crack_selected_option}跑包..." + key_cout1=$(cat "$dict_file1" | grep -v '^$' | wc -l) + key_cout2=$(cat "$dict_file2" | grep -v '^$' | wc -l) + echo -e "[i] 密码量$(echo "$key_cout1 * $key_cout2" | bc)。" + hashcat -m 22000 -a 1 $hash "${dict_file1}" "${dict_file2}" $optimization_parameter $output_parameter + ;; + #6) #姓名日期规律 + # dict_path="$default_dict_path/name&date" + # if ! [ "$(ls -A "$dict_path" 2>/dev/null | wc -l)" -gt 0 ]; then + # dict_archive_file="$default_dict_path/name&date.zip" + # exitWhenFileAbsent -f "${dict_archive_file}" -t "[!] 字典文件${dict_archive_file}不存在!" + # echo "[i] 正在解压字典文件..." + # auto_extract "$dict_archive_file" >/dev/null 2>&1 + # exitWhenFileAbsent -f "${dict_file}" -t "[!] 字典文件${dict_archive_file}解压失败!" + # fi + # echo "[+] 执行${crack_selected_option}跑包..." + # #常见单词/字符组合(含首字母大写和全大写) + 年/日月 [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/char(4).txt" "${dict_path}/yyyy_1960-2030(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/char(4).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j "!A u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/word(4).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/char(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/char(4).txt" -k "!A u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/word(4).txt" -k "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/char(4).txt" "${dict_path}/mmdd(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/char(4).txt" "${dict_path}/mmdd(4).txt" -j "!A u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/word(4).txt" "${dict_path}/mmdd(4).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/char(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/char(4).txt" -k "!A u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/word(4).txt" -k "T0" $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 常见数字组合 [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j "T0" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j "u" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -k "T0" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -k "u" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j ">5" -k "_3" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j ">5 T0" -k "_3" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j ">5 u" -k "_3" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -k ">5" -j "_3" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -k ">5 T0" -j "_3" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/common-num(3+).txt" "${dict_path}/name(4+).txt" -k ">5 u" -j "_3" $optimization_parameter + # #1-3字母(含首字母大写和全大写) + 常见数字组合 [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k ">7" --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k "_6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k "_5" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/common-num(3+).txt" $mask -j ">7" --increment $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/common-num(3+).txt" $mask -j "_6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/common-num(3+).txt" $mask -j "_5" $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k ">6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k "_5" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/common-num(3+).txt" $mask -j ">6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/common-num(3+).txt" $mask -j "_5" $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 年 [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j "u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/name(4+).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/name(4+).txt" -k "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyy_1960-2030(4).txt" "${dict_path}/name(4+).txt" -k "u" $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 日月 [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j "u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/name(4+).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/name(4+).txt" -k "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/mmdd(4).txt" "${dict_path}/name(4+).txt" -k "u" $optimization_parameter + # #姓/姓名名(含首字母大写和全大写) + 8位年月日(yyyymmdd) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" -j "u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" -k "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" -k "u" $optimization_parameter + # #1-3位字母(含首字母大写和全大写) + 8位年月日(yyyymmdd) [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymmdd_1960-2030(8).txt" --increment $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" $mask --increment $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymmdd_1960-2030(8).txt" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" $mask --increment --increment-min 2 $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 6位年月日(yymmdd) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" -k "x26" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" -j "T0" -k "x26" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymmdd_1960-2030(8).txt" -j "u" -k "x26" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" -j "x26" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" -k "T0" -j "x26" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" "${dict_path}/name(4+).txt" -k "u" -j "x26" $optimization_parameter + # #2-3位字母(含首字母大写) + 6位年月日(yymmdd) [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymmdd_1960-2030(8).txt" --increment --increment-min 2 -k "x26" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" $mask --increment --increment-min 2 -j "x26" $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymmdd_1960-2030(8).txt" --increment --increment-min 2 -k "x26" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" $mask --increment --increment-min 2 -j "x26" $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 6-7位年月日(yyyymd)(日月去0) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" -j "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" -j "u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" -k "T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" -k "u" $optimization_parameter + # #1-3位字母(含首字母大写和全大写) + 6-7位年月日(yyyymd)(日月去0) [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymd_1960-2030(6-7).txt" -k "_6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymd_1960-2030(6-7).txt" -k "_7" --increment $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" $mask -j "_6" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" $mask -j "_7" --increment $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymd_1960-2030(6-7).txt" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" $mask --increment --increment-min 2 $optimization_parameter + # #姓/姓名(含首字母大写和全大写) + 4-5位年月日(yymd)(日月去0) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" -j "T0" -k "O02" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyymd_1960-2030(6-7).txt" -j "u" -k "O02" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" -k "T0" -j "O02" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" "${dict_path}/name(4+).txt" -k "u" -j "O02" $optimization_parameter + # #3位字母(含首字母大写和全大写) + 5位年月日(yymd)(日月去0) [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymd_1960-2030(6-7).txt" -k "_7 O02" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" $mask -j "_7 O02" $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/yyyymd_1960-2030(6-7).txt" -k "_7 O02" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyymd_1960-2030(6-7).txt" $mask -j "_7 O02" $optimization_parameter + # #1字母(含大写) + 6/8位年月日(yyyymmdd/yymmdd) + 1字母(含大写) + # hashcat -m 22000 -a 0 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" -r "${dict_path}/Prefix-Suffix-a-zA-z.rule" $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/yyyymmdd_1960-2030(8).txt" -j "x26" -r "${dict_path}/Prefix-Suffix-a-zA-z.rule" $optimization_parameter + # #2-3位字母(含首字母大写和全大写) + 6位121212/123123/112233格式数字(ababab/abcabc) [含反组合] + # mask="-1 ?l?u ?1?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/00-99.txt" -k "p2" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/000-999.txt" -k "p1" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/000-999.txt" -k "q" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 "${dict_path}/00-99.txt" $hash $mask -j "p2" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 "${dict_path}/000-999.txt" $hash $mask -j "p1" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 "${dict_path}/000-999.txt" $hash $mask -j "q" --increment --increment-min 2 $optimization_parameter + # mask="?u?u?u" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/00-99.txt" -k "p2" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/000-999.txt" -k "p1" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/000-999.txt" -k "q" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/00-99.txt" $mask -j "p2" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/000-999.txt" $mask -j "p1" --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/000-999.txt" $mask -j "q" --increment --increment-min 2 $optimization_parameter + # #拼音(含首字母大写和全大写) + 6位121212格式数字(ababab) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/00-99.txt" -k "p2" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/00-99.txt" -k "p2" -j ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/00-99.txt" -k "p2" -j ">4 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/00-99.txt" "${dict_path}/pinyin(2+).txt" -j "p2" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/00-99.txt" "${dict_path}/pinyin(2+).txt" -j "p2" -k ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/00-99.txt" "${dict_path}/pinyin(2+).txt" -j "p2" -k ">4 u" $optimization_parameter + # #拼音(含首字母大写和全大写) + 6位123123/112233格式数字(abcabc) [含反组合] + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "p1" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "p1" -j ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "p1" -j ">4 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "q" -j ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "q" -j ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/000-999.txt" -k "q" -j ">4 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "p1" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "p1" -k ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "p1" -k ">4 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "q" -k ">4" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "q" -k ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/000-999.txt" "${dict_path}/pinyin(2+).txt" -j "q" -k ">4 u" $optimization_parameter + # #拼音(含首字母大写和全大写)/年份 + .com + # mask=.com + # hashcat -m 22000 -a 6 $hash "${dict_path}/pinyin(2+).txt" $mask -j ">4" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/pinyin(2+).txt" $mask -j ">4 T0" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/pinyin(2+).txt" $mask -j ">4 u" $optimization_parameter + # hashcat -m 22000 -a 6 $hash "${dict_path}/yyyy_1960-2030(4).txt" $mask $optimization_parameter + # #拼音(含首字母大写) + 6位邮编 + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/zipcode(6).txt" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/zipcode(6).txt" -j "T0" $optimization_parameter + # #纯姓名拼音(含首字母大写和全大写) + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j ">8" $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j ">8 T0" $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j ">8 u" $optimization_parameter + # #姓/姓名拼音(含首字母大写和全大写) + 符号(.@!#*?+-) + # #mask='-1 '\''.@!#*??+-'\'' ?1' + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -j ">7" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -j ">7 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -j ">7 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p1" -j ">6" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p1" -j ">6 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p1" -j ">6 u" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p2" -j ">5" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p2" -j ">5 T0" $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-special-char(1).txt" -k "p2" -j ">5 u" $optimization_parameter + # #mask=''\''!@#'\''' + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '>5 $! $@ $#' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '>5 T0 $! $@ $#' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '>5 u $! $@ $#' $optimization_parameter + # #拼音(含首字母大写和全大写)/2-3字母 + 年份/月日/常见数字组合 + 符号(.@) + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -k '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -k '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -k '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -k '$@@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -k '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -k '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -k '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -k '$@@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -k '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -k '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -k '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -k '$@@' $optimization_parameter + # mask="?l?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 $.' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 $..' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 $@' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 $@@' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 $.' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 $..' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 $@' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 $@@' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_3 $..' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_3 $@@' --increment $optimization_parameter + # #拼音(含首字母大写和全大写)//2-3字母 + 符号(.@!#*?+) + 年份/月日/常见数字组合 + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/common-num(3+).txt" -j '$@@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/yyyy_1960-2030(4).txt" -j '$@@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j '$.' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j '$..' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j '$@' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/name(4+).txt" "${dict_path}/mmdd(4).txt" -j '$@@' $optimization_parameter + # mask="?l?l?l" + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 ^.' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 ^..' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '>5 ^@' --increment --increment-min 2 $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 ^.' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 ^..' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_4 ^@' --increment $optimization_parameter + # hashcat -m 22000 -a 7 $hash $mask "${dict_path}/common-num(3+).txt" -k '_3 ^..' --increment $optimization_parameter + # #拼音(首字母大写) + 拼音(首字母大写) + . + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j 'T0' -k 'T0 $.' $optimization_parameter + # #拼音(含首字母大写) + & + 拼音(含首字母大写) + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '$&' -k '>5' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>3 $&' -k '_4' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>4 $&' -k '_3' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>5 $&' -k '_2' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '$& T0' -k '>5 T0' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>3 $& T0' -k '_4 T0' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>4 $& T0' -k '_3 T0' $optimization_parameter + # hashcat -m 22000 -a 1 $hash "${dict_path}/pinyin(2+).txt" "${dict_path}/pinyin(2+).txt" -j '>5 $& T0' -k '_2 T0' $optimization_parameter + # #姓/姓名拼音 + .@ + 姓/姓名拼音(如lihua@lihua) + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_4 $. d D9' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_5 $. d D11' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_6 $. d D13' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_4 $@ d D9' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_5 $@ d D11' $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/name(4+).txt" -j '_6 $@ d D13' $optimization_parameter + # #拼音(含全大写)穿插数字(如x1i2n3g4、m1i9n9g8) + # hashcat -m 22000 -a 0 $hash "${dict_path}/pinyin(2+).txt" -r "${dict_path}/Interval-Insert-4Num.rule" -j ">4 <5" $optimization_parameter + # hashcat -m 22000 -a 0 $hash "${dict_path}/pinyin(2+).txt" -r "${dict_path}/Interval-Insert-4Num.rule" -j ">4 <5 u" $optimization_parameter + # #符号(.@!#*?+) + 拼音(含首字母大写和全大写)/2-3字母 + 年份/月日/常见数字组合 + # #概率较小,暂不编写 + # + # #符号(.@!#*?+) + 年份/月日/常见数字组合 + 拼音(含首字母大写和全大写)/2-3字母 + # #概率较小,暂不编写 + # + # #年份/月日/常见数字组合 + 拼音(含首字母大写和全大写)/2-3字母 + 符号(.@!#*?+) + # #概率较小,暂不编写 + # + # #年份/月日/常见数字组合 + 符号(.@!#*?+) + 拼音(含首字母大写和全大写)/2-3字母 + # #概率较小,暂不编写 + # + # #6位年月日(yymmdd) + 符号(.@!#*?+) + 拼音(含首字母大写和全大写)/2-3字母 + # #概率较小,暂不编写 + # + # #符号(.@!#*?+) + 2-3字母 + 年份/月日/常见数字组合 + 符号(.@!#*?+) + # #概率较小,暂不编写 + # + # #年份/月日/常见数字组合 + 拼音(含首字母大写和全大写)/2-3字母 + 年份/月日/常见数字组合 + # #概率较小,暂不编写 + # + # #拼音(含首字母大写和全大写)/2-3字母 + 符号(.@!#*?+) + 年份/月日/常见数字组合 + 符号(.@!#*?+) + # #概率较小,暂不编写 + # #概率较小,暂不编写 + # + # #拼音 + 年份/月日/常见数字组合 + 拼音 + # #概率较小,暂不编写 + # + # #拼音(含首字母大写) + ./@ + 拼音(含首字母大写) + ./@ ( + 拼音(含首字母大写) ( + ./@)) + # #概率较小,暂不编写 + # + # ;; +esac +read -p "输入回车键退出..." \ No newline at end of file