feat: create update_obfs_password.sh add

This commit is contained in:
Olia Lisa 2025-11-08 11:47:14 +08:00
parent b0c322e595
commit be91ff8272

View File

@ -0,0 +1,25 @@
#!/bin/bash
# 更新密码的函数
update_obfs_password() {
local script_dir="$(dirname "$(realpath "$0")")"
local config_file="$script_dir/../config.json"
# 加载工具脚本
source "$script_dir/utils/jq_util.sh"
source "$script_dir/utils/base.sh"
# 检查jq是否安装
check_jq
# 生成一个长度为16的随机密码
local new_password=$(gen_password 16)
# 使用jq_util.sh中的modify_json_file函数修改config.json文件中的auth.password字段
modify_json_file "$config_file" 'obfs.salamander.password' "$new_password"
echo "更新混淆密码成功"
}
# 调用函数
update_obfs_password