{"id":15060511,"url":"https://github.com/postmodern/ffi-udis86","last_synced_at":"2026-02-12T11:08:23.154Z","repository":{"id":574212,"uuid":"206308","full_name":"postmodern/ffi-udis86","owner":"postmodern","description":"Ruby FFI bindings for udis86","archived":false,"fork":false,"pushed_at":"2021-12-20T23:33:31.000Z","size":154,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-22T21:17:47.420Z","etag":null,"topics":["asm","assembly","disassembler","ffi-bindings","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postmodern.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-05-21T00:12:08.000Z","updated_at":"2021-12-20T23:33:34.000Z","dependencies_parsed_at":"2022-07-08T02:05:07.005Z","dependency_job_id":null,"html_url":"https://github.com/postmodern/ffi-udis86","commit_stats":null,"previous_names":["sophsec/ffi-udis86"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fffi-udis86","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fffi-udis86/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fffi-udis86/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fffi-udis86/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postmodern","download_url":"https://codeload.github.com/postmodern/ffi-udis86/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166927,"owners_count":21058480,"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":["asm","assembly","disassembler","ffi-bindings","ruby"],"created_at":"2024-09-24T22:59:42.359Z","updated_at":"2026-02-12T11:08:18.134Z","avatar_url":"https://github.com/postmodern.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ffi-udis86\n\n* [Source](https://github.com/postmodern/ffi-udis86/)\n* [Issue](https://github.com/postmodern/ffi-udis86/)\n* [Documentation](https://rubydoc.info/gems/ffi-udis86/)\n\n## Description\n\n{FFI::UDis86} provides Ruby FFI bindings for the [udis86] library, a x86 and\nx86-64 disassembler.\n\n## Features\n\n* Supports x86 and x86-64 instructions.\n* Supports 16 and 32 disassembly modes.\n* Supports Intel and ATT syntax output.\n* Supports disassembling files and arbitrary input.\n* Supports using input buffers.\n* Supports using input callbacks.\n* Supports fully disassembling instructions and operands.\n\n## Examples\n\nCreate a new disassembler:\n\n```ruby\ninclude FFI::UDis86\n    \nud = UD.create(:syntax =\u003e :att, :mode =\u003e 64)\n```\n\nSet the input buffer:\n\n```ruby\nud.input_buffer = \"\\x90\\x90\\xc3\"\n```\n\nAdd an input callback:\n\n```ruby\nud.input_callback { |ud| ops.shift || -1 }\n```\n\nRead from a file:\n\n```ruby\nUD.open(path) do |ud|\n  ...\nend\n```\n\nDisassemble and print instructions:\n\n```ruby\nud.disas do |insn|\n  puts insn\nend\n```\n\nDisassemble and print information about the instruction and operands:\n\n```ruby\nasm = \"\\x75\\x62\\x48\\x83\\xc4\\x20\\x5b\\xc3\\x48\\x8d\\x0d\\x23\\x0c\\x01\\x00\\x49\\x89\\xf0\"\n\nud = FFI::UDis86::UD.create(\n  :buffer =\u003e asm,\n  :mode =\u003e 64,\n  :vendor =\u003e :amd,\n  :syntax =\u003e :att\n)\n\nud.disas do |insn|\n  puts insn\n  puts \"  * Offset: #{insn.insn_offset}\"\n  puts \"  * Length: #{insn.insn_length}\"\n  puts \"  * Mnemonic: #{insn.mnemonic}\"\n\n  operands = insn.operands.reverse.map do |operand|\n    if operand.is_mem?\n      ptr = [operand.base]\n      ptr \u003c\u003c operand.index if operand.index\n      ptr \u003c\u003c operand.scale if operand.scale\n\n      \"Memory Access (#{ptr.join(',')})\"\n    elsif operand.is_imm?\n      'Immediate Data'\n    elsif operand.is_jmp_imm?\n      'Relative Offset'\n    elsif operand.is_const?\n      'Constant'\n    elsif operand.is_reg?\n      \"Register (#{operand.reg})\"\n    end\n  end\n\n  puts '  * Operands: ' + operands.join(' -\u003e ')\nend\n```\n\n## Requirements\n\n* [Ruby](https://www.ruby-lang.org/) \u003e= 2.0.0 or\n  [JRruby](https://jruby.org) \u003e= 1.6\n* [udis86] \u003e= 1.7.2\n* [ffi](https://github.com/ffi/ffi#readme) ~\u003e 1.0\n\n## Install\n\n```shell\n$ sudo gem install ffi-udis86\n```\n\n## Crystal\n\n[udis86.cr] is a [Crystal][crystal-lang] port of this library.\n\n[udis86.cr]: https://github.com/postmodern/udis86.cr#readme\n[crystal-lang]: https://www.crystal-lang.org/\n\n## License\n\nSee {file:LICENSE.txt} for license information.\n\n[udis86]: https://github.com/vmt/udis86#readme\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fffi-udis86","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostmodern%2Fffi-udis86","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fffi-udis86/lists"}