{"id":16714188,"url":"https://github.com/flier/rust-macho","last_synced_at":"2025-04-05T14:07:24.899Z","repository":{"id":37412657,"uuid":"55600369","full_name":"flier/rust-macho","owner":"flier","description":"Mach-O File Format Parser for Rust","archived":false,"fork":false,"pushed_at":"2024-08-09T13:34:06.000Z","size":784,"stargazers_count":92,"open_issues_count":6,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-13T20:49:40.830Z","etag":null,"topics":["mach-o"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/flier.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}},"created_at":"2016-04-06T11:30:59.000Z","updated_at":"2024-10-13T19:55:56.000Z","dependencies_parsed_at":"2024-10-26T00:29:21.310Z","dependency_job_id":null,"html_url":"https://github.com/flier/rust-macho","commit_stats":{"total_commits":186,"total_committers":12,"mean_commits":15.5,"dds":"0.24193548387096775","last_synced_commit":"4bf5fb1f2a0ab02dc09e7f51a95a46e780b1354c"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-macho","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-macho/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-macho/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Frust-macho/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flier","download_url":"https://codeload.github.com/flier/rust-macho/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345853,"owners_count":20924102,"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":["mach-o"],"created_at":"2024-10-12T20:49:48.965Z","updated_at":"2025-04-05T14:07:24.878Z","avatar_url":"https://github.com/flier.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rust-macho [![travis](https://travis-ci.org/flier/rust-macho.svg?branch=master)](https://travis-ci.org/flier/rust-macho) [![crate](https://img.shields.io/crates/v/mach_object.svg)](https://crates.io/crates/mach_object) [![docs](https://docs.rs/mach_object/badge.svg)](https://docs.rs/mach_object)\nMach-O File Format Parser for Rust\n\n## Usage\n\nTo use, add the following line to Cargo.toml under [dependencies]:\n\n```toml\nmach_object = \"0.1\"\n```\nor alternatively,\n```toml\nmach_object = { git = \"https://github.com/flier/rust-macho.git\" }\n```\n\n## Examples\n\nUse OFile::parse to read the mach-o file from a \u0026[u8] slice.\n\n```rust\nuse std::io::{Read, Cursor};\nuse std::fs::File;\nuse mach_object::{OFile, CPU_TYPE_X86_64, MachCommand, LoadCommand};\n\nlet mut f = File::open(\"test/helloworld\").unwrap();\nlet mut buf = Vec::new();\nlet size = f.read_to_end(\u0026mut buf).unwrap();\nlet mut cur = Cursor::new(\u0026buf[..size]);\nif let OFile::MachFile { ref header, ref commands } = OFile::parse(\u0026mut cur).unwrap() {\n    assert_eq!(header.cputype, CPU_TYPE_X86_64);\n    assert_eq!(header.ncmds as usize, commands.len());\n    for \u0026MachCommand(ref cmd, cmdsize) in commands {\n        if let \u0026LoadCommand::Segment64 { ref segname, ref sections, .. } = cmd {\n            println!(\"segment: {}\", segname);\n\n            for ref sect in sections {\n                println!(\"  section: {}\", sect.sectname);\n            }\n        }\n    }\n}\n```\n\nFor more detail, please check the unit tests and the [otool](examples/otool.rs) example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Frust-macho","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflier%2Frust-macho","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Frust-macho/lists"}