UAC插件开发教程:从零开始创建自定义取证artifact

发布时间:2026/6/19 7:34:52

UAC插件开发教程:从零开始创建自定义取证artifact UAC插件开发教程从零开始创建自定义取证artifact【免费下载链接】uacUAC is a Live Response collection script for Incident Response that makes use of native binaries and tools to automate the collection of AIX, Android, ESXi, FreeBSD, Linux, macOS, NetBSD, NetScaler, OpenBSD and Solaris systems artifacts.项目地址: https://gitcode.com/gh_mirrors/ua/uacUAC是一款强大的事件响应实时收集脚本支持AIX、Linux、macOS等多种操作系统的取证数据采集。本教程将带您从零开始创建自定义取证artifact插件扩展UAC的采集能力满足特定场景下的取证需求。一、了解UAC artifact插件结构UAC使用YAML格式定义取证artifact每个插件都是一个独立的YAML文件存放在项目的artifacts目录下。典型的artifact插件包含版本信息、描述、支持的操作系统、采集器类型和具体采集规则。例如系统默认的shell历史记录采集插件artifacts/files/shell/history.yaml结构如下version: 4.0 artifacts: - description: Collect shell history files. supported_os: [all] collector: file path: /%user_home% name_pattern: [.*_history, .*history, .cosh_history, .dash_history, .esh_history, .lesshst, .nash_history, .sash_history, .scsh_history, .xonsh_history, .zhistory, *.historynew, fish_history] max_depth: 4二、创建自定义artifact的准备工作1. 环境准备首先克隆UAC项目到本地开发环境git clone https://gitcode.com/gh_mirrors/ua/uac cd uac2. 确定采集需求在创建自定义artifact前需要明确要采集的文件/目录路径支持的操作系统all/linux/macos/windows等采集器类型file/command/bodyfile等过滤规则文件名模式/大小限制/修改时间等三、编写自定义artifact插件1. 创建YAML文件在artifacts目录下创建新的插件目录和文件建议按照功能分类存放。例如创建一个收集SSH配置文件的插件mkdir -p artifacts/files/ssh touch artifacts/files/ssh/config.yaml2. 基本配置结构编辑config.yaml文件添加以下基本结构version: 4.0 artifacts: - description: Collect SSH configuration files and known hosts supported_os: [linux, macos] collector: file path: /%user_home%/.ssh name_pattern: [config, known_hosts, id_rsa.pub, id_dsa.pub] max_depth: 1 include_directory: false3. 关键配置项说明version: 插件版本号当前推荐使用4.0description: 插件功能描述清晰说明采集内容supported_os: 支持的操作系统列表可选值包括all/linux/macos/freebsd等collector: 采集器类型常用类型file: 文件采集器用于收集指定路径的文件command: 命令采集器用于执行系统命令并收集输出bodyfile: 文件元数据采集器收集文件系统元信息path: 采集根路径支持%user_home%等变量name_pattern: 文件名匹配模式支持通配符和正则表达式max_depth: 递归采集的最大深度include_directory: 是否包含目录本身四、高级配置选项1. 命令型采集器示例如果需要通过执行命令采集数据可以使用command类型采集器version: 4.0 artifacts: - description: Collect installed package list using dpkg supported_os: [linux] collector: command command: dpkg -l output_file: dpkg_list.txt timeout: 302. 条件采集配置添加conditions节点实现条件化采集version: 4.0 artifacts: - description: Collect macOS specific logs supported_os: [macos] collector: file path: /private/var/log name_pattern: [system.log, install.log] conditions: - os_version: 10.15 action: include五、测试自定义artifact1. 使用UAC测试模式通过-t参数测试单个artifact./uac -t artifacts/files/ssh/config.yaml2. 检查输出结果测试完成后查看生成的采集报告cat output/uac_report.log六、插件发布与贡献1. 遵循编码规范确保插件符合UAC项目规范使用清晰的描述性名称添加详细的注释测试所有支持的操作系统遵循YAML语法规范2. 提交贡献将您的自定义artifact提交到UAC项目Fork项目仓库创建特性分支feature/your-artifact-name提交代码并创建Pull Request等待项目维护者审核七、常用参考资源官方artifact库项目artifacts目录下提供了大量官方插件示例如artifacts/system/suid.yamlSUID文件采集、artifacts/files/logs/var_log.yaml系统日志采集等核心库函数lib/validate_artifact.sh提供了artifact验证功能配置文件config/uac.conf包含系统级配置参数通过本教程您已经掌握了UAC自定义artifact的开发方法。无论是收集特定应用数据、系统配置还是自定义命令输出都可以通过创建相应的YAML插件实现。开始动手创建您的第一个artifact为事件响应取证工作添砖加瓦吧【免费下载链接】uacUAC is a Live Response collection script for Incident Response that makes use of native binaries and tools to automate the collection of AIX, Android, ESXi, FreeBSD, Linux, macOS, NetBSD, NetScaler, OpenBSD and Solaris systems artifacts.项目地址: https://gitcode.com/gh_mirrors/ua/uac创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

相关新闻