首页
开源项目
搜索 TinyTools
Docker-OSX容器中运行MacOS
51.0k
在线演示
Github仓库
Gitee仓库
# Docker-OSX  在 Docker 中以接近原生的性能运行 Mac OS X!X11 转发!iMessage 安全研究!iPhone USB 正常工作!macOS 运行在 Docker 容器中! 使用 Linux 和 Windows 在 macOS 上进行安全研究! ## 快速入门 Docker-OSX 视频设置教程也可在此处观看:https://www.youtube.com/watch?v=wLezYl77Ll8 **Windows 用户:**[点击此处查看以下说明](#id-like-to-run-docker-osx-on-windows)!  ### Catalina (10.15) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e SHORTNAME=catalina \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` ### Big Sur (11) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e SHORTNAME=big-sur \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` ### Monterey (12) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e GENERATE_UNIQUE=true \ -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \ -e SHORTNAME=monterey \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` ### Ventura (13) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e GENERATE_UNIQUE=true \ -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \ -e SHORTNAME=ventura \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` ### Sonoma (14) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e GENERATE_UNIQUE=true \ -e CPU='Haswell-noTSX' \ -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \ -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \ -e SHORTNAME=sonoma \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` ### Sequoia (15) ```bash docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e GENERATE_UNIQUE=true \ -e CPU='Haswell-noTSX' \ -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \ -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \ -e SHORTNAME=sequoia \ sickcodes/docker-osx:latest # docker build -t docker-osx . ``` # 共享目录、共享文件、共享文件夹、挂载文件夹 最简单、最安全的方法是 `sshfs` ```bash # on Linux/Windows mkdir ~/mnt/osx sshfs user@localhost: -p 50922 ~/mnt/osx # wait a few seconds, and ~/mnt/osx will have full rootfs mounted over ssh, and in userspace # automated: sshpass -p
sshfs user@localhost:/ -p 50922 ~/mnt/osx ``` ## 功能 - 使用 [usbfluxd](https://github.com/corellium/usbfluxd) 在 Linux 上使用 iPhone OSX KVM! - 在 Linux 上使用 macOS Monterey VM! - 文件夹共享 - - USB 直通(也支持热插拔) - 启用 SSH(`localhost:50922`) - 如果使用 ./vnc 版本,则启用 VNC(`localhost:8888`) - 通过 [序列号生成器!](https://github.com/sickcodes/osx-serial-generator) 进行 iMessage 安全研究 - 已启用 X11 转发 - 在 QEMU + KVM 上运行 - 支持 Big Sur、自定义镜像、Xvfb 无头模式 - 您可以使用 `docker commit` 克隆您的容器 ### 要求 - 最低安装需要 20GB+++ 磁盘空间(如果使用 Xcode,则需要 50GB) - BIOS 设置中应启用虚拟化 - 支持 x86_64 kvm 的主机 - `:auto` 至少需要 50GB 空间(一半用于基础镜像,一半用于运行时镜像) ### 待办事项 - 安全研究人员文档 - GPU 加速 - 支持虚拟管理器 ## 初始设置 在执行任何其他操作之前,您需要在 BIOS 中启用硬件虚拟化。具体操作取决于您的具体机器(和 BIOS),但应该很简单。 然后,您需要在主机上安装 QEMU 和其他一些依赖项: ```bash # ARCH sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf # UBUNTU DEBIAN sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools # CENTOS RHEL FEDORA sudo yum install libvirt qemu-kvm ``` Then, enable libvirt and load the KVM kernel module: ```bash sudo systemctl enable --now libvirtd sudo systemctl enable --now virtlogd echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs sudo modprobe kvm ``` ### 我想在 Windows 上运行 Docker-OSX 使用 WSL2(Windows 11 + Windows Subsystem for Linux)可以在 Windows 上运行 Docker-OSX。 您必须安装 Windows 11 版本 22000+(21H2 或更高版本)。 首先,在您的计算机上安装 WSL,方法是在管理员权限的 PowerShell 中运行此命令。更多信息,请访问[此处](https://docs.microsoft.com/en-us/windows/wsl/install)。 这将默认安装 Ubuntu。 ``` wsl --install ``` 您可以使用 PowerShell 中的“wsl -l -v”来确认 WSL2 已启用。要查看其他可用的发行版,请使用“wsl -l -o”。 如果您之前安装了 WSL1,请升级到 WSL 2。请查看[此链接,了解如何从 WSL1 升级到 WSL2](https://docs.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2)。 安装 WSL 后,转到“C:/Users/
/.wslconfig”,并在文件末尾添加“nestedVirtualization=true”(如果该文件不存在,请创建)。有关“.wslconfig”文件的更多信息,请查看[此链接](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#wslconfig)。请确保您在文件资源管理器选项中已选中“显示隐藏文件”和“显示文件扩展名”。结果应该是这样的: ``` [wsl2] nestedVirtualization=true ``` 进入你的 WSL 发行版(在 powershell 中运行 `wsl`),并使用 `kvm-ok` 命令检查 KVM 是否已启用。输出应如下所示: ``` INFO: /dev/kvm exists KVM acceleration can be used ``` 如果尚未安装,请使用命令“sudo apt -y install bridge-utils cpu-checker libvirt-clients libvirt-daemon qemu qemu-kvm”进行安装。 现在,如果尚未安装 [Docker for Windows](https://docs.docker.com/desktop/windows/install/),请下载并安装。 安装完成后,进入“设置”并勾选以下两个框: ``` 常规 -> “使用基于 WSL2 的引擎”; 资源 -> WSL 集成 -> “启用与我的默认 WSL 发行版的集成” ``` 确保已安装“x11-apps”。如果尚未安装,请使用命令“sudo apt install x11-apps -y”进行安装。 最后,有三种获取视频输出的方法: - WSLg:这是最简单易用的选项。可能会出现一些问题,例如键盘无法完全穿透或在桌面上看到第二个鼠标 - [WSLg 上的问题](https://github.com/microsoft/wslg/issues/376) - 但建议使用此选项。 要使用 WSLg 内置的 X-11 服务器,请将 docker run 命令中的这两行更改为将 Docker-OSX 指向 WSLg。 ``` -e "DISPLAY=${DISPLAY:-:0.0}" \ -v /mnt/wslg/.X11-unix:/tmp/.X11-unix \ ``` 或者尝试: ``` -e "DISPLAY=${DISPLAY:-:0}" \ -v /mnt/wslg/.X11-unix:/tmp/.X11-unix \ ``` 对于 Windows 上的 Ubuntu 20.x,请参阅 [https://github.com/sickcodes/Docker-OSX/discussions/458](https://github.com/sickcodes/Docker-OSX/discussions/458) - VNC:请参阅 [VNC 部分](#building-a-headless-container-which-allows-insecure-vnc-on-localhost-for-local-use-only) 了解更多信息。您也可以为 qemu 添加 -vnc 参数。通过 VNC 客户端连接到您的 Mac 虚拟机。[此处提供操作方法](https://wiki.archlinux.org/title/QEMU#VNC) - 桌面环境:这将为您提供完整的 Linux 桌面体验,但会占用更多计算机资源。此处提供示例指南,但还有其他指南可以帮助您设置桌面环境。[DE 示例](https://www.makeuseof.com/tag/linux-desktop-windows-subsystem/)
tabler/tabler is licensed under the
MIT License
A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
Permissions
Commercial use
Modification
Distribution
Private use
Limitations
Liability
Warranty
Conditions
License and copyright notice