{"id":15287440,"url":"https://github.com/ronin-rb/ronin-code-asm","last_synced_at":"2025-04-06T22:10:34.323Z","repository":{"id":795704,"uuid":"494595","full_name":"ronin-rb/ronin-code-asm","owner":"ronin-rb","description":"A Ruby DSL for crafting assmebly programs and shellcode.","archived":false,"fork":false,"pushed_at":"2024-08-04T20:45:52.000Z","size":535,"stargazers_count":49,"open_issues_count":8,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-29T14:22:26.533Z","etag":null,"topics":["asm","assembly","dsl","infosec","ronin-rb","ruby","shellcode","yasm"],"latest_commit_sha":null,"homepage":"https://ronin-rb.dev","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ronin-rb.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"COPYING.txt","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},"funding":{"open_collective":"ronin-rb","patreon":"roninrb"}},"created_at":"2010-01-30T02:23:30.000Z","updated_at":"2024-09-25T08:35:19.000Z","dependencies_parsed_at":"2023-11-23T22:32:37.102Z","dependency_job_id":"ebe75118-b501-43f0-a093-33190a6a8a8a","html_url":"https://github.com/ronin-rb/ronin-code-asm","commit_stats":{"total_commits":529,"total_committers":1,"mean_commits":529.0,"dds":0.0,"last_synced_commit":"f7d1f281e4f2b0a019c7c1ee3889c90225fa896d"},"previous_names":["ronin-ruby/ronin-asm"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin-rb%2Fronin-code-asm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin-rb%2Fronin-code-asm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin-rb%2Fronin-code-asm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin-rb%2Fronin-code-asm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronin-rb","download_url":"https://codeload.github.com/ronin-rb/ronin-code-asm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208492,"owners_count":20901570,"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","dsl","infosec","ronin-rb","ruby","shellcode","yasm"],"created_at":"2024-09-30T15:28:10.437Z","updated_at":"2025-04-06T22:10:34.304Z","avatar_url":"https://github.com/ronin-rb.png","language":"Ruby","readme":"# ronin-code-asm\n\n[![CI](https://github.com/ronin-rb/ronin-code-asm/actions/workflows/ruby.yml/badge.svg)](https://github.com/ronin-rb/ronin-asm/actions/workflows/ruby.yml)\n[![Code Climate](https://codeclimate.com/github/ronin-rb/ronin-code-asm.svg)](https://codeclimate.com/github/ronin-rb/ronin-asm)\n[![Gem Version](https://badge.fury.io/rb/ronin-code-asm.svg)](https://badge.fury.io/rb/ronin-code-asm)\n\n* [Source](https://github.com/ronin-rb/ronin-code-asm)\n* [Issues](https://github.com/ronin-rb/ronin-code-asm/issues)\n* [Documentation](https://ronin-rb.dev/docs/ronin-code-asm/frames)\n* [Discord](https://discord.gg/6WAb3PsVX9) |\n  [Mastodon](https://infosec.exchange/@ronin_rb)\n\n## Description\n\n{Ronin::Code::ASM} is a Ruby DSL for crafting Assembly programs and Shellcode.\n\n## Features\n\n* Provides a Ruby DSL for writing Assembly programs.\n  * Supports X86 and AMD64 instruction sets.\n  * Supports ATT and Intel syntax.\n* Uses [yasm] to assemble the programs.\n* Supports assembling Shellcode.\n* Has 95% documentation coverage.\n* Has 99% test coverage.\n\n## Examples\n\nCreate a program:\n\n```ruby\nasm = Ronin::Code::ASM.new do\n  push ebx\n  mov  eax, 0xc0ffee\n  pop  ebx\n  hlt\nend\n\nputs asm.to_asm\n# BITS 32\n# section .text\n# _start:\n#\tpush\tebx\n#\tmov\teax,\tWORD 0xc0ffee\n#\tpop\tebx\n#\thlt\n\nputs asm.to_asm(:att)\n# .code32\n# .text\n# _start:\n#\tpushl\t%ebx\n#\tmovl\t$0xc0ffee,      %eax\n#\tpopl\t%ebx\n#\thlt\n```\n\nCreate shellcode:\n\n```ruby\nshellcode = Ronin::Code::ASM::Shellcode.new(arch: :x86) do\n  xor   eax,  eax\n  push  eax\n  push  0x68732f2f\n  push  0x6e69622f\n  mov   ebx,  esp\n  push  eax\n  push  ebx\n  mov   ecx,  esp\n  xor   edx,  edx\n  mov   al,   0xb\n  int   0x80\nend\n\nshellcode.assemble\n# =\u003e \"1\\xC0Ph//shh/bin\\x89\\xDCPS\\x89\\xCC1\\xD2\\xB0\\v\\xCD\\x80\"\n```\n\n### Immediate Operands\n\nImmediate operands can be Integers or `nil`:\n\n```ruby\nmov eax, 0xff\nmov ebx, nil\n```\n\nThe size of the operand can also be specified explicitly:\n\n```ruby\npush byte(0xff)\npush word(0xffff)\npush dword(0xffffffff)\npush qword(0xffffffffffffffff)\n```\n\n### Memory Operands\n\nMemory operands can be expressed as arithmetic on registers:\n\n```ruby\nmov ebx, esp+8\nmov ebx, esp-8\nmov ebx, esp+esi\nmov ebx, esp+(esi*4)\n```\n\n### Labels\n\nLabels can be expressed with blocks:\n\n```ruby\n_loop do\n  inc eax\n  cmp eax, 10\n  jl :_loop\nend\n```\n\n### Syscalls\n\nIf the `:os` option is specified, then syscall numbers can be looked up via the\n`syscalls` Hash:\n\n```ruby\nRonin::Code::ASM.new(os: 'Linux') do\n  # ...\n  mov al, syscalls[:execve]\n  int 0x80\nend\n```\n\n## Requirements\n\n* [Ruby] \u003e= 3.0.0\n* [yasm] \u003e= 0.6.0\n* [ruby-yasm] ~\u003e 0.3\n\n## Install\n\n### Ubuntu\n\n```shell\nsudo apt install -y yasm\ngem install ronin-code-asm\n```\n\n### Fedora\n\n```shell\nsudo dnf install -y yasm\ngem install ronin-code-asm\n```\n\n### OpenSUSE\n\n```shell\nsudo zypper -n in -l yasm\ngem install ronin-code-asm\n```\n\n### Arch\n\n```shell\nsudo pacman -Sy yasm\ngem install ronin-code-asm\n```\n\n### macOS\n\n```shell\nbrew install yasm\ngem install ronin-code-asm\n```\n\n### FreeBSD\n\n```shell\nsudo pkg install -y yasm\ngem install ronin-code-asm\n```\n\n### Gemfile\n\n```ruby\ngem 'ronin-code-asm', '~\u003e 1.0'\n```\n\n### gemspec\n\n```ruby\ngem.add_dependency 'ronin-code-asm', '~\u003e 1.0'\n```\n\n## Development\n\n1. [Fork It!](https://github.com/ronin-rb/ronin-code-asm/fork)\n2. Clone It!\n3. `cd ronin-code-asm/`\n4. `bundle install`\n5. `git checkout -b my_feature`\n6. Code It!\n7. `bundle exec rake spec`\n8. `git push origin my_feature`\n\n## License\n\nronin-code-asm - A Ruby DSL for crafting Assembly programs and shellcode.\n\nCopyright (c) 2007-2025 Hal Brodigan (postmodern.mod3 at gmail.com)\n\nronin-code-asm is free software: you can redistribute it and/or modify\nit under the terms of the GNU Lesser General Public License as published\nby the Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nronin-code-asm is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License\nalong with ronin-code-asm.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n\n[Ruby]: https://www.ruby-lang.org\n[yasm]: https://yasm.tortall.net/\n[ruby-yasm]: https://github.com/postmodern/ruby-yasm#readme\n","funding_links":["https://opencollective.com/ronin-rb","https://patreon.com/roninrb"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronin-rb%2Fronin-code-asm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronin-rb%2Fronin-code-asm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronin-rb%2Fronin-code-asm/lists"}