{"id":15558582,"url":"https://github.com/guedou/r2m2","last_synced_at":"2025-10-07T08:31:19.172Z","repository":{"id":93000859,"uuid":"67708831","full_name":"guedou/r2m2","owner":"guedou","description":"radare2 + miasm2 = ♥","archived":false,"fork":false,"pushed_at":"2020-01-22T16:39:13.000Z","size":74,"stargazers_count":102,"open_issues_count":4,"forks_count":11,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-02T04:34:31.322Z","etag":null,"topics":["miasm2","radare2","radare2-plugin","reverse-engineering"],"latest_commit_sha":null,"homepage":"","language":"Python","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/guedou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.txt","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-08T14:10:27.000Z","updated_at":"2025-01-13T08:22:17.000Z","dependencies_parsed_at":"2023-05-26T21:15:49.142Z","dependency_job_id":null,"html_url":"https://github.com/guedou/r2m2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/guedou/r2m2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedou%2Fr2m2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedou%2Fr2m2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedou%2Fr2m2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedou%2Fr2m2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guedou","download_url":"https://codeload.github.com/guedou/r2m2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guedou%2Fr2m2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278743090,"owners_count":26037968,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"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":["miasm2","radare2","radare2-plugin","reverse-engineering"],"created_at":"2024-10-02T15:39:15.813Z","updated_at":"2025-10-07T08:31:18.833Z","avatar_url":"https://github.com/guedou.png","language":"Python","funding_links":[],"categories":["Tools"],"sub_categories":["Conferences"],"readme":"# r2m2 - use miasm2 as a radare2 plugin\n\n[![Build Status](https://travis-ci.org/guedou/r2m2.svg?branch=master)](https://travis-ci.org/guedou/r2m2)\n[![GitHub tag](https://img.shields.io/github/tag/guedou/r2m2.svg)](https://github.com/guedou/r2m2/releases)\n[![Docker Automated buil](https://img.shields.io/docker/automated/guedou/r2m2.svg)](https://hub.docker.com/r/guedou/r2m2/)\n[![Twitter Follow](https://img.shields.io/twitter/follow/guedou.svg?style=social)](https://twitter.com/intent/follow?screen_name=guedou)\n\nr2m2 is a [radare2](https://github.com/radare/radare2) plugin that aims at easing reversing new architectures by leveraging radare2 and [miasm2](https://github.com/cea-sec/miasm) features. Its goal is to be as architecture independent as possible.\n\nIt bridges the radare2 and miasm2 communities: radare2 being the graphical interface of miasm2, and miasm2 simplifying the implementation of new architectures.\n\nCurrently, r2m2 is able to assemble, disassemble, split blocs, using miasm2,  and convert internal miasm2 expressions to radare2 ESIL.\n\nInterested? Watch the video, or check the [presentation and design slides](https://guedou.github.io/).\n[![asciicast](https://asciinema.org/a/3x0i1ejw5x9s0ep9aghhm848c.png)](https://asciinema.org/a/3x0i1ejw5x9s0ep9aghhm848c)\n\n\n## Demos\n\nr2m2 provides a single radare2 plugin, that can be enabled using the `-a` option, used in most radare2 commands. The `R2M2_ARCH` environment variable is used to select the architecture that will be used.\n\n### Assemble and disassemble MIPS32 using rasm2\n\n```\nr2m2$ export R2M2_ARCH=mips32l; rasm2 -a r2m2 'addiu a0, a1, 2' |rasm2 -a r2m2 -d -\nADDIU      A0, A1, 0x2\n```\n\n### Disassemble random MSP430 instructions in r2\n\n```\nr2m2$ R2M2_ARCH=msp430 r2 -a r2m2 -qc 'woR; pd 5' -\n            0x00000000      07fa           and.w      R10, R7\n            0x00000002      47ad           dadd.b     R13, R7\n            0x00000004      f05e0778       add.b      @R14+, 0x7807(PC)\n            0x00000008      f46d81ed       addc.b     @R13+, 0xED81(R4)\n            0x0000000c      3fdc           bis.w      @R12+, R15\n```\n\n### Assemble MIPS32 using rasm2 and display the call graph using r2\n\n```\nr2m2$ R2M2_ARCH=mips32b rasm2 -a r2m2 'j 0x4; nop' -B \u003e j_nop.bin\n\nr2m2$ R2M2_ARCH=mips32b r2 -a r2m2 -qc 'pd 2' j_nop.bin\n        ,=\u003c 0x00000000      0c000001       JAL        0x4\n        `-\u003e 0x00000004      00000000       NOP\n```\n\n\n## Testing r2m2\n\n[Docker](https://www.docker.com/) is the recommended solution to use r2m2. Each pull requests are tested with Travis. Upon success, a Docker image is built on [Docker Hub](https://hub.docker.com) and can easily be pulled as follows:\n\n```\nr2m2$ docker pull guedou/r2m2\n\nr2m2$ docker run --rm -it -e 'R2M2_ARCH=mips32l' guedou/r2m2 rasm2 -a r2m2 \"addiu a0, a1, 2\"\n0200a424\n```\n\n## Building r2m2\n\n### Docker\n\nThe `Dockerfile` takes care of everything, and builds r2m2.  The following command lines show how to build the Docker image, run a temporary container, and test r2m2:\n\n```\nr2m2$ docker build -t guedou/r2m2 .\n\nr2m2$ docker run --rm -it -e 'R2M2_ARCH=mips32l' guedou/r2m2 bash\nroot@11da1889a490:/home/r2m2# rasm2 -L |grep r2m2\nadAe  32         r2m2        LGPL3   miasm2 backend\nroot@11da1889a490:/home/r2m2# rasm2 -a r2m2 \"addiu a0, a1, 2\"\n0200a424\n\nr2m2$ docker run --rm -it -e 'R2M2_ARCH=x86_64' guedou/r2m2\n -- One does not simply write documentation.\n[0x00000000]\u003e o /bin/ls\n4\n[0x0000487f]\u003e e anal.arch=r2m2\n[0x0000487f]\u003e e asm.emu=true\n[0x0000487f]\u003e pd 10\n            ;-- entry0:\n            0x0000487f      31ed           xor ebp, ebp                ; zf=0x1  ; nf=0x0 \n            0x00004881      4989d1         mov r9, rdx                 ; r9=0x0 \n            0x00004884      5e             pop rsi                     ; rsp=0x8  ; rsi=0x0 \n            0x00004885      4889e2         mov rdx, rsp                ; rdx=0x8 \n            0x00004888      4883e4f0       and rsp, 0xfffffffffffffff0 ; zf=0x1  ; nf=0x0 \n            0x0000488c      50             push rax                    ; rsp=0x10 \n            0x0000488d      54             push rsp                    ; rsp=0x18 \n            0x0000488e      49c7c0301d41.  mov r8, 0x411d30            ; r8=0x411d30 -\u003e 0xffffff00\n            0x00004895      48c7c1c01c41.  mov rcx, 0x411cc0           ; rcx=0x411cc0 -\u003e 0xffffff00\n            0x0000489c      48c7c7c02840.  mov rdi, 0x4028c0           ; rdi=0x4028c0 -\u003e 0xffffff00\n```\n\n### Linux \u0026 OS X\n\n**Note:** automatic builds are performed on Ubuntu, Arch Linux, and Mac OS X.  Other distributions might not work due to libraries incompatibilities.\n\nThe following software must be installed:\n\n1. radare2 (\u003e= 2.9.0)\n\n2. miasm2\n\n3. CFFI Python module (\u003e= 1.6)\n\n4. jinja2 Python module (\u003e= 1.6)\n\nr2m2 can be built as follows:\n```\nr2m2$ make all install\n[..]\nmkdir -p [..]\n```\n\nYou can type the following command to check that everything went fine:\n```\nr2m2$ rasm2 -L |grep r2m2\nadAe  32         r2m2        LGPL3   miasm2 backend\n```\n\n\n## Compilation warnings\n\nIf you get the following error, the CFFI Python module version is not \u003e= 1.6.  You need to upgrade it, for example using PIP in a virtualenv.\n```\nAttributeError: 'FFI' object has no attribute 'set_source'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguedou%2Fr2m2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguedou%2Fr2m2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguedou%2Fr2m2/lists"}