From be91ff8272031981b9ebb306006a5b43f8a7e94a Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Sat, 8 Nov 2025 11:47:14 +0800 Subject: [PATCH] feat: create update_obfs_password.sh add --- bin/update_obfs_password.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bin/update_obfs_password.sh diff --git a/bin/update_obfs_password.sh b/bin/update_obfs_password.sh new file mode 100644 index 0000000..e68db3e --- /dev/null +++ b/bin/update_obfs_password.sh @@ -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 \ No newline at end of file