macOS GateKeeper Helper 使用教程

macOS GateKeeper Helper 使用教程

macOS-GateKeeper-HelperSimple macOS GateKeeper script.项目地址:https://gitcode.com/gh_mirrors/ma/macOS-GateKeeper-Helper

1. 项目的目录结构及介绍

macOS GateKeeper Helper 项目的目录结构相对简单,主要包含以下文件和文件夹:

macOS-GateKeeper-Helper/
├── gitignore
├── GateKeeper_Helper_command
├── LICENSE
├── README.md
└── screenshot.png
  • gitignore: 用于指定 Git 版本控制系统忽略的文件和文件夹。
  • GateKeeper_Helper_command: 项目的启动脚本,用于执行各种 GateKeeper 相关的操作。
  • LICENSE: 项目的许可证文件,本项目采用 MIT 许可证。
  • README.md: 项目的说明文档,包含项目的基本介绍、使用方法和注意事项。
  • screenshot.png: 项目的截图文件,展示项目运行时的界面。

2. 项目的启动文件介绍

项目的启动文件是 GateKeeper_Helper_command,这是一个可执行的 Shell 脚本。以下是该脚本的主要功能和结构:

#!/bin/zsh

# 项目的基本信息
GITHUB_URL="https://github.com/wynioux/macOS-GateKeeper-Helper"
RELEASE_VERSION="v1.2.2"
ROOT_PASSWORD=0

# 颜色设置
Color_Off='\033[0m' # 重置颜色
Black='\033[0;30m' # 黑色
Red='\033[0;31m' # 红色
Green='\033[0;32m' # 绿色
Yellow='\033[0;33m' # 黄色
Blue='\033[0;34m' # 蓝色
Purple='\033[0;35m' # 紫色
Cyan='\033[0;36m' # 青色
White='\033[0;37m' # 白色

# 加粗颜色
BBlack='\033[1;30m' # 加粗黑色
BRed='\033[1;31m' # 加粗红色
BGreen='\033[1;32m' # 加粗绿色
BYellow='\033[1;33m' # 加粗黄色
BBlue='\033[1;34m' # 加粗蓝色
BPurple='\033[1;35m' # 加粗紫色
BCyan='\033[1;36m' # 加粗青色
BWhite='\033[1;37m' # 加粗白色

# 显示 GateKeeper 状态
showGateKeeperStatus() {
    echo "${Green}You choose to show GateKeeper status${Color_Off}"
    askPassword
    sudo spctl --status
    continueMessage
}

# 启用 GateKeeper
enableGateKeeper() {
    echo "${Green}You chose to enable GateKeeper. Good for you!${Color_Off}"
    askPassword
    sudo spctl --master-enable
    echo "${Red}GateKeeper enabled${Color_Off}"
    continueMessage
}

# 禁用 GateKeeper
disableGateKeeper() {
    echo "${Green}You chose to disable GateKeeper${Color_Off}"
    echo -e "${Red}>> Danger${Color_Off}"
    echo -e "Disabling GateKeeper is a very bad idea and creates"
    echo -e "a major security hole in macOS\n"
    askPassword
    sudo spctl --master-disable
    echo "${Red}GateKeeper disabled${Color_Off}"
    continueMessage
}

# 从 GateKeeper 隔离区移除应用
removeAppFromGateKeeperQuarantine() {
    echo "${Green}You chose to remove an app from GateKeeper quarantine${Color_Off}"
    askPassword
    sudo xattr -d com.apple.quarantine /path/to/app
    echo "${Red}App removed from quarantine${Color_Off}"
    continueMessage
}

# 询问密码
askPassword() {
    case $ROOT_PASSWORD in
        0) echo "${Cyan}Please provide your password to proceed or press ^C to quit${Color_Off}"
           ROOT_PASSWORD=1
           ;;
    esac
}

# 继续提示信息
continueMessage() {
    echo "\nPress any key to

macOS-GateKeeper-HelperSimple macOS GateKeeper script.项目地址:https://gitcode.com/gh_mirrors/ma/macOS-GateKeeper-Helper

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凌霆贝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值