DaxxSec/SecVF

GitHub: DaxxSec/SecVF

基于 Apple Virtualization Framework 的 macOS 原生安全虚拟化框架,为恶意软件分析、网络取证和 AI 沙箱提供硬件级隔离的一站式虚拟化环境。

Stars: 2 | Forks: 0

[![macOS](https://img.shields.io/badge/macOS_14+-000000?style=for-the-badge&logo=apple&logoColor=white)](https://www.apple.com/macos/) [![Swift](https://img.shields.io/badge/Swift_5.9-F05138?style=for-the-badge&logo=swift&logoColor=white)](https://swift.org) [![Apple Silicon](https://img.shields.io/badge/Apple_Silicon-000000?style=for-the-badge&logo=apple&logoColor=white)](https://www.apple.com/newsroom/2020/11/apple-unleashes-m1/) [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e?style=for-the-badge)](LICENSE.txt) [![Tag](https://img.shields.io/github/v/tag/DaxxSec/SecVF?style=for-the-badge&color=6366f1&label=version)](https://github.com/DaxxSec/SecVF/tags) [![Stars](https://img.shields.io/github/stars/DaxxSec/SecVF?style=for-the-badge&color=eab308)](https://github.com/DaxxSec/SecVF/stargazers)

## ⚡ 功能介绍
### 🔬 恶意软件分析 在具有完整网络可见性的隔离 VM 中引爆样本。捕获每一个数据包,记录每一个连接。通过 Apple Virtualization Framework 实现硬件强制隔离——无法逃逸到宿主机。 ### 🌐 网络取证 具备实时数据包捕获的 L2/L3 软件交换机。支持 Wireshark 风格的显示过滤器、实时协议分析和 PCAP 导出。Kali 路由器 VM 位于你的恶意软件和互联网之间。
### 🤖 AI 沙箱 用于 AI agent 执行的临时 macOS 客户机 VM。具备 APFS CoW 会话克隆(约 0ms)、VirtioFS 工作区共享、vsock IPC 桥接、DTrace/ESF 遥测功能——一键启动、运行、销毁。 ### 🛡️ 应急响应 具有严重性级别(INFO → EMERGENCY)的安全审计日志记录。实时文件系统监控、进程遥测、ISO 校验和验证。完整的审计轨迹位于 `~/.avf/logs/`。
## 🖥️ 屏幕截图
| VM 库 | 数据包分析 | |:---:|:---:| | *带有实时数据包日志面板的多 VM 管理* | *Wireshark 风格的深度数据包检测* |
## 🚀 快速开始 ### 前置条件 | 需求 | 版本 | 备注 | |---|---|---| | macOS | **14.0+ Sonoma** | Virtualization framework 功能所必需 | | Xcode | **15.0+** | 用于从源代码构建 | | Apple Silicon | **M1+** | macOS 客户机 VM 所必需;Intel 芯片可用于 Linux VM | | tshark | **可选** | 启用数据包捕获:`brew install wireshark` | ### 安装 ``` git clone https://github.com/DaxxSec/SecVF.git cd SecVF open SecVF.xcodeproj # Build & Run: ⌘R ``` ### 可选:用于数据包捕获的 tshark ``` brew install wireshark ``` ## 🔧 功能特性 ### 虚拟机管理 ``` ┌─────────────────────────────────────────────────────┐ │ VM Library [+ New VM] │ │ ───────────────────────────────────────────────── │ │ ● Kali-Router Running Virtual Net 192MB │ │ ● Ubuntu-Sandbox Running Virtual Net 512MB │ │ ○ Windows-11 Stopped NAT - │ │ ○ macOS-14-AI Stopped NAT - │ └─────────────────────────────────────────────────────┘ ``` - 🐧 **8 种 Linux 发行版** — Kali、Ubuntu、Debian、Fedora、Arch 等 - 🍎 **macOS 客户机 VM** — 通过 Apple CDN 进行完整的 IPSW 安装(仅限 Apple Silicon) - 🔄 **多窗口会话** — 每个 VM 拥有独立的窗口 - 💾 **ISO 缓存管理器** — 经过 SHA256 验证的下载,无需重复下载 ### 网络栈 ``` [ Malware VM ] ──┐ [ Analysis VM ] ─┤──▶ [ Virtual Switch ] ──▶ [ Kali Router ] ──▶ Internet [ AI Sandbox ] ──┘ (L2/L3) (traffic tap) │ [ PacketCapture ] [ tshark/PCAP ] ``` | 模式 | 应用场景 | |---|---| | 🌍 **NAT** | 通过宿主机进行标准互联网访问 | | 🔒 **虚拟网络** | 隔离的 VM 到 VM 通信,无宿主机网络 | | 🕵️ **路由器 VM** | Kali 作为网关——完整的流量拦截 | | 🎭 **FakeNet** | DNS/HTTP 蜜罐——捕获恶意软件 C2 通信 | ### 数据包分析 | 功能 | 详情 | |---|---| | 🔴 **实时捕获** | 通过实时数据包流进行启动/停止/清空操作 | | 🔍 **显示过滤器** | Wireshark 风格:`tcp`、`ip.addr == 10.0.100.1`、`dns` | | 📊 **协议统计** | 实时分析:TCP/UDP/DNS/ARP/ICMP/HTTP | | 🔬 **数据包解码** | 逐层解析:Ethernet → IP → TCP/UDP → 应用层 | | 💾 **PCAP 导出** | 保存捕获内容以供 Wireshark 或离线分析 | | 📟 **Hex 转储** | 带有 ASCII 表示的原始字节 | ### 实时监控 | 窗口 | 快捷键 | 查看内容 | |---|---|---| | 🔐 安全日志 | `⌘⇧1` | 文件系统事件、进程活动、严重性警报 | | 🌐 网络日志 | `⌘⇧2` | 虚拟交换机流量、连接日志 | | 📦 数据包分析 | `⌘⇧P` | 深度数据包检测 | | 📈 交换机统计 | `⌘⇧3` | 转发速率、MAC 表、丢弃的数据包 | | ✅ ISO 缓存审计 | `⌘⇧4` | 下载历史记录、校验和验证日志 | ## 🏗️ 架构 ``` SecVF/ ├── 🧠 Core │ ├── AppDelegate.swift # App lifecycle, VM window management │ ├── VMManager.swift # VM CRUD, bundle management │ └── VMConfiguration.swift # Codable VM settings model │ ├── 🌐 Network Stack │ ├── VirtualNetworkSwitch.swift # L2/L3 software switch, MAC learning │ ├── PacketCaptureManager.swift # tshark integration, Combine publishers │ └── PacketAnalysisWindowController.swift # Wireshark-style UI │ ├── 🖥️ UI │ └── VMLibraryWindowController.swift # Main window (~2600 LOC) │ ├── 🤖 AI Sandbox │ └── AISandboxMacVMConfiguration.swift # macOS guest VM + vsock IPC │ ├── 🔒 Security │ ├── VMSecurityMonitor.swift # Real-time security event logging │ └── SecVFError.swift # Typed errors, audit trail │ ├── 📦 Supporting │ ├── ISOCacheManager.swift # ISO download + SHA256 verification │ ├── MacOSVMInstaller.swift # IPSW download from Apple CDN │ └── ScriptsUSBManager.swift # Guest VM script delivery │ └── 📜 Scripts ├── kali-router-setup.sh # Kali as NAT router + traffic tap ├── kali-fakenet-setup.sh # FakeNet DNS/HTTP honeypot └── provision-macos-vm.sh # AI Sandbox macOS guest provisioning ``` ## 🦠 恶意软件分析工作流 ``` # 1. 设置你的分析环境 # 创建 Kali Router VM → 在其中运行 kali-router-setup.sh # 2. 创建你的恶意软件沙箱 VM # 新建 VM → Linux/Windows → Virtual Network 模式 # 3. 开始监控 # ⌘⇧P → Start Capture # 4. 引爆 # 在沙箱 VM 中执行恶意软件样本 # 5. 分析 # 在 packet 面板中观察实时流量 # 导出 PCAP 以进行更深入的 Wireshark 分析 # 检查 Security Logs (⌘⇧1) 以了解文件系统活动 ``` ## 🤖 AI 沙箱工作流 用于安全执行 AI agent 的临时 macOS VM: ``` Build once: AISandboxMacVMInstaller.downloadAndInstall() └─▶ IPSW download → macOS install → provision └─▶ ai-sandbox-base-v1.bundle (~/.avf/AISandbox/) Each session: AISandboxVMSession.cloneBase() # APFS CoW, ~0ms AISandboxVMSession.boot() AISandboxVMSession.run("your command") # vsock:2222 AISandboxVMSession.destroy() # wipe session bundle ``` **隔离保证:** 硬件 VM 边界 · 非 admin 的 agent 用户 · 仅限工作区写入权限 · DTrace + ESF 遥测 ## ⌨️ 键盘快捷键 | 操作 | 快捷键 | |---|---| | 新建 VM | `⌘N` | | 启动 VM | `⌘S` | | 停止 VM | `⌘.` | | 数据包分析 | `⌘⇧P` | | 安全日志 | `⌘⇧1` | | 网络日志 | `⌘⇧2` | | 交换机统计 | `⌘⇧3` | | ISO 缓存审计 | `⌘⇧4` | ## 🛠️ 技术栈
[![Swift](https://img.shields.io/badge/Swift-F05138?style=flat-square&logo=swift&logoColor=white)](https://swift.org) [![Apple Virtualization](https://img.shields.io/badge/Virtualization_Framework-000000?style=flat-square&logo=apple&logoColor=white)](https://developer.apple.com/documentation/virtualization) [![AppKit](https://img.shields.io/badge/AppKit-1D6FA5?style=flat-square&logo=apple&logoColor=white)](https://developer.apple.com/documentation/appkit) [![Combine](https://img.shields.io/badge/Combine-F05138?style=flat-square&logo=swift&logoColor=white)](https://developer.apple.com/documentation/combine) [![tshark](https://img.shields.io/badge/tshark-1679A7?style=flat-square&logo=wireshark&logoColor=white)](https://www.wireshark.org/docs/man-pages/tshark.html)
- **Apple Virtualization Framework** — 硬件强制的 VM 隔离(macOS 14+) - **Swift Concurrency** — 使用 `async/await`、`@MainActor` 和 Combine 实现响应式数据包更新 - **tshark** — 通过 FIFO 管道进行数据包捕获,JSON 输出解析 - **VirtioFS** — 高性能的宿主机↔客户机文件共享 - **vsock** — 低延迟的宿主机↔VM IPC(AI 沙箱命令通道) ## 🔐 安全模型 - **硬件隔离** — 采用 Apple Virtualization Framework,而非容器 - **默认无共享文件夹** — VM 与宿主机文件系统之间存在物理隔离 - **IPSW 验证** — 仅从 `*.cdn-apple.com` 下载,要求 TLS 1.2+,并进行扩展名检查 - **ISO 验证** — 从官方发行版镜像源获取 SHA256 校验和 - **URL 域名白名单** — 对所有网络下载采用硬编码的允许列表 - **严重性级别警报** — INFO / WARNING / CRITICAL / EMERGENCY 事件 - **审计轨迹** — `~/.avf/logs/security-*.log`、`error-audit.log` ## 📄 许可证 MIT — 详情请见 [LICENSE.txt](LICENSE.txt)
**由 [DaxxSec](https://github.com/DaxxSec) 构建** [![GitHub](https://img.shields.io/badge/GitHub-DaxxSec-181717?style=for-the-badge&logo=github)](https://github.com/DaxxSec) *如果 SecVF 在调查中为您节省了时间,请给它一个 ⭐*
标签:AI沙箱, APFS克隆, Apple Silicon, Apple Virtualization框架, Burp Suite 替代, DAST, DTrace, L2/L3软路由, M1/M2/M3, macOS开发, macOS虚拟化, MIT开源协议, PCAP导出, Swift, VirtioFS, vsock通信, 威胁情报, 子域名枚举, 库, 应急响应, 底层分析, 开发者工具, 恶意软件分析, 搜索语句(dork), 流量捕获, 系统安全, 网络安全, 网络拓扑, 网络隔离, 虚拟化安全, 虚拟机监控, 隐私保护