{"id":13721628,"url":"https://github.com/neil-wu/SwiftDump","last_synced_at":"2025-05-07T14:30:37.375Z","repository":{"id":44434480,"uuid":"277268277","full_name":"neil-wu/SwiftDump","owner":"neil-wu","description":"SwiftDump is a command-line tool for retriving the Swift Object info from Mach-O file.","archived":false,"fork":false,"pushed_at":"2023-08-18T02:54:54.000Z","size":1334,"stargazers_count":416,"open_issues_count":6,"forks_count":59,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-19T00:10:31.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neil-wu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-07-05T09:18:30.000Z","updated_at":"2025-04-11T01:24:55.000Z","dependencies_parsed_at":"2022-09-17T06:51:23.574Z","dependency_job_id":"62948508-31f3-4b76-8f48-fd37fede837b","html_url":"https://github.com/neil-wu/SwiftDump","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-wu%2FSwiftDump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-wu%2FSwiftDump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-wu%2FSwiftDump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neil-wu%2FSwiftDump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neil-wu","download_url":"https://codeload.github.com/neil-wu/SwiftDump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252895472,"owners_count":21821167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-08-03T01:01:19.474Z","updated_at":"2025-05-07T14:30:36.316Z","avatar_url":"https://github.com/neil-wu.png","language":"Swift","funding_links":[],"categories":["Swift (22)","Tools","Swift"],"sub_categories":["Reverse Engineering Tools"],"readme":"\n#### SwiftDump\n\n##### [中文文档](./README_zh.md)\n\nSwiftDump is a command-line tool for retriving the Swift Object info from Mach-O file. Similar to [class-dump](https://github.com/nygard/class-dump/), but the difference is that SwiftDump focus on swift 5 objects. For Mach-O files mixed with Objective-C and swift, you can combine class-dump with SwiftDump.\n\nThere is alos a [Frida](https://www.frida.re/) version named [FridaSwiftDump](https://github.com/neil-wu/FridaSwiftDump/).\n\nYou can either use`SwiftDump` for a Mach-O file or `FridaSwiftDump` for a foreground running app.\n\nIf you are curious about the Mach-O format, check the image at the bottom of this article.\n\n![demo](./Doc/img_demo_result.jpg)\n\n#### Usage\n\n``` Text\nUSAGE: SwiftDump [--debug] [--arch \u003carch\u003e] \u003cfile\u003e [--version]\n\nARGUMENTS:\n  \u003cfile\u003e                  MachO File\n\nOPTIONS:\n  -d, --debug             Show debug log.\n  -a, --arch \u003carch\u003e       Choose architecture from a fat binary (only support x86_64/arm64).\n                          (default: arm64)\n  -v, --version           Version\n  -h, --help              Show help information.\n```\n\n* SwiftDump ./TestMachO \u003e result.txt\n* SwiftDump -a x86_64 ./TestMachO \u003e result.txt\n\n#### Features\n\n* Written entirely in swift, the project is tiny\n* Dump swift 5 struct/class/enum/protocol\n* Parse enum with payload case\n* Support inheritance and protocol\n* Since it is written in swift, the mangled names are demangled by swift's runtime function, such as `swift_getTypeByMangledNameInContext` and `swift_demangle_getDemangledName`. \n\nThanks to the runtime function, SwiftDump can demangle complex type, such as RxSwift variable. For example, \n`RxSwift.Queue\u003c(eventTime: Foundation.Date, event: RxSwift.Event\u003cA.RxSwift.ObserverType.Element\u003e)\u003e`\n\n#### TODO\n\n* Parse swift function address\n* More\n\n#### Compile\n\n1. Clone the repo\n2. Open SwiftDump.xcodeproj with Xcode\n3. Modify 'Signing \u0026 Capabilities' to use your own id\n4. Build \u0026 Run\n\nThe default Mach-O file path is `Demo/test`, you can change it in `Xcode - Product - Scheme - Edit Scheme - Arguments`\n\n(Tested on Xcode Version 11.5 (11E608c), MacOS 10.15.5)\n\n#### Credit\n\n* [Machismo](https://github.com/g-Off/Machismo) : Parsing of Mach-O binaries using swift.\n* [swift-argument-parser](https://github.com/apple/swift-argument-parser) : Straightforward, type-safe argument parsing for Swift.\n* [Swift metadata](https://knight.sc/reverse%20engineering/2019/07/17/swift-metadata.html) : High level description of all the Swift 5 sections that can show up in a Swift binary.\n\n\n#### License\n\nMIT\n\n\n#### Mach-O File Format\n\nThe following image shows how SwiftDump parse swift types from file `Demo/test`. You can open this file with [MachOView](https://github.com/gdbinit/MachOView).\n\n![demo](./Doc/macho.jpg)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneil-wu%2FSwiftDump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneil-wu%2FSwiftDump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneil-wu%2FSwiftDump/lists"}