{"id":51118547,"url":"https://github.com/howmp/zigdonut","last_synced_at":"2026-06-25T00:00:44.035Z","repository":{"id":353470520,"uuid":"968466778","full_name":"howmp/zigdonut","owner":"howmp","description":"用zig实现精简版的donut,可将exe/dll/elf转换为shellcode","archived":false,"fork":false,"pushed_at":"2026-06-02T08:05:29.000Z","size":317,"stargazers_count":19,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-02T10:07:50.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/howmp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-18T06:10:57.000Z","updated_at":"2026-06-02T08:03:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/howmp/zigdonut","commit_stats":null,"previous_names":["howmp/zigdonut"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/howmp/zigdonut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howmp%2Fzigdonut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howmp%2Fzigdonut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howmp%2Fzigdonut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howmp%2Fzigdonut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/howmp","download_url":"https://codeload.github.com/howmp/zigdonut/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/howmp%2Fzigdonut/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34753781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-25T00:00:43.269Z","updated_at":"2026-06-25T00:00:43.989Z","avatar_url":"https://github.com/howmp.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zigdonut\n\n用zig实现精简版的donut，可将PE/ELF转换为shellcode\n\n## 特性\n\n### PE (Windows)\n\n1. 静态TLS的支持(比如rust的exe/dll)，目前只有IoM/c3/MemoryModulePP等支持部分操作系统\n2. 没有重定位表时，会尝试根据ImageBase申请内存\n3. 更彻底的擦除，除了擦除PE头之外，还擦除了导入表\n\n### ELF (Linux x86_64)\n\n1. 支持静态链接的PIE/ET_DYN ELF\n2. 完整的ELF loader：段映射、RELATIVE重定位、栈帧构建(auxv)\n3. Double fork脱离控制终端，后台执行，不产生僵尸进程\n4. 输出重定向到文件\n5. 切换工作目录到/tmp\n\n## 编译\n\n需要zig 0.11.0\n\n```bash\nzig build\n```\n\n产出文件在 `zig-out/bin/` 下：\n\n| 文件 | 说明 |\n|------|------|\n| `zigdonut` | 生成器，将PE/ELF转为shellcode |\n| `elfdebug` | ELF loader调试(独立可执行) |\n| `elfscloader` | ELF shellcode加载器(C语言) |\n| `pedebugXX.exe` | PE loader调试 |\n\n## 使用\n\n### ELF (Linux)\n\n生成shellcode：\n\n```bash\n./zigdonut busybox busybox.sc\n```\n\n加载运行shellcode：\n\n```bash\n./elfscloader busybox.sc output ps\n```\n\n- `busybox.sc` - 生成的shellcode文件\n- `output` - 重定向输出文件\n- `ps` - 要执行的命令及参数\n\n调试模式（直接加载ELF，不经过shellcode）：\n\n```bash\n./elfdebug ps\n```\n\n### PE (Windows)\n\n生成shellcode：\n\n```bash\nzigdonut.exe input.exe output.sc\n```\n\n擦除PE头：\n\n```bash\nzigdonut.exe -w input.exe output.sc\n```\n\n调试：\n\n```bash\n# 32位\nzigdonut.exe in32.exe instance32\npedebug32.exe\n\n# 64位\nzigdonut.exe in64.exe instance64\npedebug64.exe\n```\n\n\n## 实现说明\n\n\u003chttps://guage.cool/zig-3-donut.html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowmp%2Fzigdonut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhowmp%2Fzigdonut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhowmp%2Fzigdonut/lists"}