├── .gitignore ├── docker ├── meta │ ├── gui │ │ └── icon.png │ └── snap.yaml ├── command.sh ├── sbom │ ├── r2ai.spdx.json.in │ ├── r2dec.spdx.json.in │ ├── r2book.spdx.json.in │ ├── radare2-snap.spdx.json.in │ ├── r2yara.spdx.json.in │ ├── r2frida.spdx.json.in │ ├── r2ghidra.spdx.json.in │ └── radare2.spdx.json.in └── Dockerfile ├── .github ├── dependabot.yml ├── scripts │ └── update-versions.sh └── workflows │ ├── publish-readme.yml │ ├── sbom.yaml │ ├── update.yaml │ └── publish.yaml ├── config ├── amd64.mk ├── arm64.mk ├── armhf.mk ├── s390x.mk ├── riscv64.mk ├── ppc64el.mk └── i386.mk ├── versions.mk ├── README.md ├── metadata.mk ├── Makefile └── README-containers.md /.gitignore: -------------------------------------------------------------------------------- 1 | digests 2 | docker-images 3 | snaps 4 | -------------------------------------------------------------------------------- /docker/meta/gui/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/radareorg/radare2-snap/main/docker/meta/gui/icon.png -------------------------------------------------------------------------------- /docker/command.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | COMMAND="$(basename "$0")" 4 | exec /snap/radare2/current/bin/"${COMMAND#radare2.}" "$@" 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | -------------------------------------------------------------------------------- /config/amd64.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/amd64 5 | MULTIARCH=x86_64-linux-gnu 6 | FRIDA_ARCH=x86_64 7 | -------------------------------------------------------------------------------- /config/arm64.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/arm64 5 | MULTIARCH=aarch64-linux-gnu 6 | FRIDA_ARCH=arm64 7 | -------------------------------------------------------------------------------- /config/armhf.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/arm/v7 5 | MULTIARCH=arm-linux-gnueabihf 6 | FRIDA_ARCH=armhf 7 | -------------------------------------------------------------------------------- /config/s390x.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/s390x 5 | MULTIARCH=s390x-linux-gnu 6 | # Frida disabled 7 | FRIDA_ARCH= 8 | -------------------------------------------------------------------------------- /config/riscv64.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/riscv64 5 | MULTIARCH=riscv64-linux-gnu 6 | # Frida disabled 7 | FRIDA_ARCH= 8 | -------------------------------------------------------------------------------- /config/ppc64el.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:24.04 2 | BASE_SNAP=core24 3 | 4 | TARGETPLATFORM=linux/ppc64le 5 | MULTIARCH=powerpc64le-linux-gnu 6 | # Frida disabled 7 | FRIDA_ARCH= 8 | -------------------------------------------------------------------------------- /versions.mk: -------------------------------------------------------------------------------- 1 | R2_VERSION=6.0.7 2 | R2GHIDRA_VERSION=6.0.7 3 | R2FRIDA_VERSION=6.0.6 4 | R2DEC_VERSION=6.0.7 5 | YARA_VERSION=4.5.5 6 | R2YARA_VERSION=1.4.4 7 | R2AI_VERSION=1.2.6 8 | R2BOOK_VERSION=6.0.0 9 | -------------------------------------------------------------------------------- /config/i386.mk: -------------------------------------------------------------------------------- 1 | BASE_IMAGE=docker.io/library/ubuntu:18.04 2 | BASE_SNAP=core18 3 | MESON_VERSION=0.61.5 4 | PYTHON_VERSION=3.8 5 | 6 | TARGETPLATFORM=linux/386 7 | MULTIARCH=i386-linux-gnu 8 | FRIDA_ARCH=x86 9 | -------------------------------------------------------------------------------- /.github/scripts/update-versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ae 4 | 5 | cd "$(dirname "$0")/../.." 6 | 7 | getLatestReleaseTag() { 8 | echo "Checking latest release version for $1..." > /dev/stderr 9 | V=$(gh release view --repo "$1" --json tagName --template '{{.tagName}}') 10 | if [ -n "$2" ]; then V="${V#$2}"; fi 11 | if [ -n "$3" ]; then V="${V%$3}"; fi 12 | echo "$V" 13 | } 14 | 15 | cat << EOF > versions.mk 16 | R2_VERSION=$(getLatestReleaseTag radareorg/radare2) 17 | R2GHIDRA_VERSION=$(getLatestReleaseTag radareorg/r2ghidra) 18 | R2FRIDA_VERSION=$(getLatestReleaseTag nowsecure/r2frida) 19 | R2DEC_VERSION=$(getLatestReleaseTag wargio/r2dec-js) 20 | YARA_VERSION=$(getLatestReleaseTag VirusTotal/yara v) 21 | R2YARA_VERSION=$(getLatestReleaseTag radareorg/r2yara) 22 | R2AI_VERSION=$(getLatestReleaseTag radareorg/r2ai) 23 | R2BOOK_VERSION=$(getLatestReleaseTag radareorg/radare2-book) 24 | EOF 25 | -------------------------------------------------------------------------------- /.github/workflows/publish-readme.yml: -------------------------------------------------------------------------------- 1 | name: Push README to Docker Hub 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | paths: 8 | - 'README-containers.md' 9 | - '.github/workflows/publish-readme.yml' 10 | 11 | jobs: 12 | push-readme: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v6 17 | with: 18 | ref: main 19 | 20 | - name: Push README to DockerHub 21 | uses: christian-korneck/update-container-description-action@v1 22 | env: 23 | DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} 24 | DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} 25 | with: 26 | destination_container_repo: ${{ vars.DOCKERHUB_REPO }} 27 | provider: dockerhub 28 | short_description: 'UNIX-like reverse engineering framework and command-line toolset' 29 | readme_file: 'README-containers.md' 30 | -------------------------------------------------------------------------------- /docker/sbom/r2ai.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-09-07T14:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2ai", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-r2ai" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2ai-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-r2ai", 17 | "name": "r2ai", 18 | "versionInfo": "${R2AI_VERSION}", 19 | "downloadLocation": "https://github.com/radareorg/r2ai/archive/refs/tags/${R2AI_VERSION}.tar.gz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "MIT", 22 | "supplier": "Organization: radareorg", 23 | "primaryPackagePurpose": "LIBRARY", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/radareorg/r2ai@${R2AI_VERSION}" 29 | } 30 | ] 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /docker/sbom/r2dec.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-03-07T14:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2dec", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.wargio-r2dec-js" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2dec-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.wargio-r2dec-js", 17 | "name": "r2dec", 18 | "versionInfo": "${R2DEC_VERSION}", 19 | "downloadLocation": "https://github.com/wargio/r2dec-js/archive/refs/tags/${R2DEC_VERSION}.tar.gz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "MIT AND BSD-3-Clause", 22 | "supplier": "Person: Giovanni Dante Grazioli", 23 | "primaryPackagePurpose": "LIBRARY", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/wargio/r2dec-js@${R2DEC_VERSION}" 29 | } 30 | ] 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /docker/sbom/r2book.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-08-08T23:49:52Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2book", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-r2book" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2book-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-r2book", 17 | "name": "r2book", 18 | "versionInfo": "${R2BOOK_VERSION}", 19 | "downloadLocation": "https://github.com/radareorg/radare2-book/releases/download/${R2BOOK_VERSION}/r2book.info.gz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "CC-BY-SA-4.0", 22 | "supplier": "Organization: radare org", 23 | "primaryPackagePurpose": "FILE", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/radareorg/radare2-book@${R2BOOK_VERSION}" 29 | } 30 | ] 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /.github/workflows/sbom.yaml: -------------------------------------------------------------------------------- 1 | name: SBOM manual upload 2 | on: 3 | workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab 4 | inputs: 5 | platform: 6 | description: Docker platform 7 | required: true 8 | default: linux/amd64 9 | type: choice 10 | options: 11 | - linux/amd64 12 | - linux/arm64 13 | - linux/arm/v7 14 | - linux/386 15 | - linux/ppc64le 16 | - linux/riscv64 17 | - linux/s390x 18 | 19 | jobs: 20 | sbom: 21 | runs-on: ubuntu-latest 22 | permissions: 23 | id-token: write 24 | contents: write 25 | steps: 26 | - name: Install Syft 27 | uses: anchore/sbom-action/download-syft@v0 28 | 29 | - name: Generate SBOM with Syft from latest AMD64 image 30 | run: syft scan registry:${{ vars.DOCKERHUB_REPO }}:latest --platform ${{ inputs.platform }} --select-catalogers "+sbom-cataloger" --output spdx-json=docker.spdx.json 31 | 32 | - name: Upload SBOM artifact 33 | uses: actions/upload-artifact@v4 34 | with: 35 | name: docker-sbom 36 | path: docker.spdx.json 37 | 38 | - name: Upload SBOM to GitHub dependency submission API 39 | uses: advanced-security/spdx-dependency-submission-action@v0.1.1 40 | -------------------------------------------------------------------------------- /docker/sbom/radare2-snap.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-03-07T14:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "radare2-snap", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-radare2-snap" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/radare2-snap-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-radare2-snap", 17 | "name": "radare2-snap", 18 | "versionInfo": "${R2_VERSION}+${R2_SNAP_COMMIT}", 19 | "downloadLocation": "git+https://github.com/radareorg/radare2-snap#${R2_SNAP_COMMIT}", 20 | "filesAnalyzed": false, 21 | "supplier": "Organization: radare org", 22 | "primaryPackagePurpose": "INSTALL", 23 | "externalRefs": [ 24 | { 25 | "referenceCategory": "PACKAGE-MANAGER", 26 | "referenceType": "purl", 27 | "referenceLocator": "pkg:github/radareorg/radare2-snap@${R2_SNAP_COMMIT}" 28 | }, 29 | { 30 | "referenceCategory": "PACKAGE-MANAGER", 31 | "referenceType": "url", 32 | "referenceLocator": "snap://radare2" 33 | } 34 | ] 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /docker/meta/snap.yaml: -------------------------------------------------------------------------------- 1 | name: radare2 2 | version: 0.0.0 3 | summary: UNIX-like reverse engineering framework and command-line toolset 4 | description: | 5 | Radare2 (also known as r2) is a complete framework for reverse-engineering 6 | and analyzing binaries; composed of a set of small utilities that can be used 7 | together or independently from the command line. Built around a disassembler 8 | for computer software which generates assembly language source code from 9 | machine-executable code, it supports a variety of executable formats for 10 | different processors and operating systems. Apart from the static analysis 11 | feature it also supports debugging and emulation. The architecture of the 12 | framework is modular and allows to use existing or create new plugins for new 13 | file formats, architectures, analysis features. 14 | license: LGPL-3.0-only 15 | architectures: [] 16 | base: core 17 | apps: {} 18 | confinement: classic 19 | grade: stable 20 | environment: 21 | R2_PREFIX: $SNAP 22 | SLEIGHHOME: $SNAP/lib/radare2/last/r2ghidra_sleigh 23 | PKG_CONFIG_PATH: $SNAP/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} 24 | LD_LIBRARY_PATH: ${SNAP_LIBRARY_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}:$SNAP/lib 25 | PATH: $SNAP/bin:$PATH 26 | links: 27 | contact: 28 | - https://github.com/radareorg/radare2#community 29 | issues: 30 | - https://github.com/radareorg/radare2/issues 31 | - https://github.com/radareorg/r2ghidra/issues 32 | - https://github.com/nowsecure/r2frida/issues 33 | - https://github.com/wargio/r2dec-js/issues 34 | - https://github.com/radareorg/r2yara/issues 35 | - https://github.com/radareorg/r2ai/issues 36 | - https://github.com/radareorg/radare2-snap/issues 37 | source-code: 38 | - https://github.com/radareorg/radare2-snap 39 | website: 40 | - https://www.radare.org/ 41 | -------------------------------------------------------------------------------- /.github/workflows/update.yaml: -------------------------------------------------------------------------------- 1 | name: Check for updates 2 | on: 3 | schedule: # for scheduling to work this file must be in the default branch 4 | - cron: "30 */6 * * *" # run every 6 hours 5 | workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab 6 | 7 | jobs: 8 | update-versions: 9 | runs-on: ubuntu-latest 10 | 11 | permissions: 12 | # Give the default GITHUB_TOKEN write permission to commit and push the 13 | # added or changed files to the repository. 14 | contents: write 15 | 16 | outputs: 17 | changes_detected: ${{ steps.commit.outputs.changes_detected }} 18 | 19 | steps: 20 | # Perform the checkout of the main branch 21 | - name: Checkout 22 | uses: actions/checkout@v6 23 | with: 24 | ref: main 25 | 26 | # Perform the actual version check 27 | - name: Check for new versions for all parts 28 | run: .github/scripts/update-versions.sh 29 | env: 30 | GH_TOKEN: ${{ github.token }} 31 | 32 | # Commit changed file back to the repository 33 | - name: Commit changes 34 | id: commit 35 | uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1 36 | with: 37 | commit_message: Automatic update versions 38 | #commit_user_name: 'github-actions[bot]' 39 | #commit_user_email: '41898282+github-actions[bot]@users.noreply.github.com' 40 | commit_author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' 41 | 42 | build: 43 | if: needs.update-versions.outputs.changes_detected == 'true' 44 | needs: 45 | - update-versions 46 | uses: ./.github/workflows/publish.yaml 47 | secrets: inherit 48 | permissions: 49 | contents: write # needed to allow upload SBOM to GitHub dependency submission API 50 | id-token: write # needed for signing the images with GitHub OIDC Token 51 | -------------------------------------------------------------------------------- /docker/sbom/r2yara.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-05-02T15:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2yara", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-r2yara" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2yara-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-r2yara", 17 | "name": "r2yara", 18 | "versionInfo": "${R2YARA_VERSION}", 19 | "downloadLocation": "https://github.com/radareorg/r2yara/archive/refs/tags/${R2YARA_VERSION}.tar.gz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "LGPL-3.0-only", 22 | "supplier": "Organization: radare org", 23 | "primaryPackagePurpose": "LIBRARY", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/radareorg/r2yara@${R2YARA_VERSION}" 29 | } 30 | ] 31 | }, 32 | { 33 | "SPDXID": "SPDXRef-com.github.virustotal-yara", 34 | "name": "yara", 35 | "versionInfo": "${YARA_VERSION}", 36 | "downloadLocation": "https://github.com/VirusTotal/yara/archive/refs/tags/v${YARA_VERSION}.tar.gz", 37 | "filesAnalyzed": false, 38 | "licenseDeclared": "BSD-3-Clause", 39 | "supplier": "Organization: VirusTotal", 40 | "primaryPackagePurpose": "LIBRARY", 41 | "externalRefs": [ 42 | { 43 | "referenceCategory": "PACKAGE-MANAGER", 44 | "referenceType": "purl", 45 | "referenceLocator": "pkg:github/VirusTotal/yara@${YARA_VERSION}" 46 | }, 47 | { 48 | "referenceCategory" : "SECURITY", 49 | "referenceLocator" : "cpe:2.3:a:virustotal:yara:${YARA_VERSION}:*:*:*:*:*:*:*", 50 | "referenceType" : "cpe23Type" 51 | } 52 | ] 53 | } 54 | ], 55 | "relationships": [ 56 | { 57 | "relationshipType": "DEPENDENCY_OF", 58 | "spdxElementId": "SPDXRef-com.github.virustotal-yara", 59 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-r2yara" 60 | } 61 | ] 62 | } -------------------------------------------------------------------------------- /docker/sbom/r2frida.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-03-07T14:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2frida", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.nowsecure-r2frida" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2frida-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.nowsecure-r2frida", 17 | "name": "r2frida", 18 | "versionInfo": "${R2FRIDA_VERSION}", 19 | "downloadLocation": "https://github.com/nowsecure/r2frida/archive/refs/tags/${R2FRIDA_VERSION}.tar.gz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "MIT", 22 | "supplier": "Organization: NowSecure", 23 | "primaryPackagePurpose": "LIBRARY", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "OTHER", 27 | "referenceType": "url", 28 | "referenceLocator": "https://github.com/nowsecure/r2frida/releases/download/${R2FRIDA_VERSION}/_agent.js", 29 | "comment": "Release r2frida prebuild _agent.js" 30 | }, 31 | { 32 | "referenceCategory": "PACKAGE-MANAGER", 33 | "referenceType": "purl", 34 | "referenceLocator": "pkg:github/nowsecure/r2frida@${R2FRIDA_VERSION}" 35 | } 36 | ] 37 | }, 38 | { 39 | "SPDXID": "SPDXRef-com.github.frida-frida-frida-core-devkit", 40 | "name": "frida-core-devkit", 41 | "downloadLocation": "https://github.com/frida/frida/releases", 42 | "primaryPackagePurpose": "LIBRARY", 43 | "filesAnalyzed": false, 44 | "licenseDeclared": "GPL-2.0-or-later WITH WxWindows-exception-3.1", 45 | "supplier": "Organization: Frida", 46 | "externalRefs": [ 47 | { 48 | "referenceCategory": "PACKAGE-MANAGER", 49 | "referenceType": "purl", 50 | "referenceLocator": "pkg:github/frida/frida" 51 | } 52 | ] 53 | } 54 | ], 55 | "relationships": [ 56 | { 57 | "relationshipType": "BUILD_DEPENDENCY_OF", 58 | "spdxElementId": "SPDXRef-com.github.frida-frida-frida-core-devkit", 59 | "relatedSpdxElement": "SPDXRef-com.github.nowsecure-r2frida" 60 | } 61 | ] 62 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Radare2 snap and docker repository 2 | 3 | [![snap: radare2](https://snapcraft.io/radare2/badge.svg "snap latest stable version")](https://snapcraft.io/radare2) 4 | [![docker: radare/radare2](https://img.shields.io/docker/pulls/radare/radare2?logo=docker&logoColor=white&label=radare%2Fradare2 "docker pulls")](https://hub.docker.com/r/radare/radare2) 5 | 6 | This repository contains the recipie to build the snap version of radare2 using docker as well to build a standalone docker image with the same build. 7 | 8 | The resulting build includes the following projects: 9 | 10 | * [radare2](https://github.com/radareorg/radare2) 11 | * [r2ghidra](https://github.com/radareorg/r2ghidra) 12 | * [r2frida](https://github.com/nowsecure/r2frida) (only in supported platforms) 13 | * [r2dec](https://github.com/wargio/r2dec-js) 14 | * [r2yara](https://github.com/radareorg/r2yara) 15 | * [r2ai](https://github.com/radareorg/r2ai) 16 | * [r2book](https://github.com/radareorg/radare2-book) (as `info` file) 17 | 18 | ## Install the snap 19 | 20 | [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/radare2) 21 | 22 | Radare requires snap classic confinement, to install run: 23 | 24 | ```sh 25 | sudo snap install radare2 --classic 26 | ``` 27 | 28 | Once installed all radare commands are available as: 29 | `radare2.` (ex: `radare2.rasm2`). 30 | 31 | To allow using radare commands without this prefix, it can be solved by using shell aliases. So as an example could be something like this: 32 | 33 | ```sh 34 | alias r2='radare2.r2' 35 | alias r2agent='radare2.r2agent' 36 | alias r2frida-compile='radare2.r2frida-compile' 37 | alias r2p='radare2.r2p' 38 | alias r2pm='radare2.r2pm' 39 | alias r2r='radare2.r2r' 40 | alias rabin2='radare2.rabin2' 41 | alias radiff2='radare2.radiff2' 42 | alias rafind2='radare2.rafind2' 43 | alias ragg2='radare2.ragg2' 44 | alias rahash2='radare2.rahash2' 45 | alias rarun2='radare2.rarun2' 46 | alias rasign2='radare2.rasign2' 47 | alias rasm2='radare2.rasm2' 48 | alias ravc2='radare2.ravc2' 49 | alias rax2='radare2.rax2' 50 | alias sleighc='radare2.sleighc' 51 | alias yara='radare2.yara' 52 | alias yarac='radare2.yarac' 53 | ``` 54 | 55 | ## The docker image 56 | 57 | As explained, with the same snap build a [docker image](https://hub.docker.com/r/radare/radare2) is generated. 58 | 59 | For documentation on how to use this docker image you can refer to [containers section](README-containers.md) in this respository. 60 | -------------------------------------------------------------------------------- /docker/sbom/r2ghidra.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-03-07T14:00:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "r2ghidra", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-r2ghidra" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/r2ghidra-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-r2ghidra", 17 | "name": "r2ghidra", 18 | "versionInfo": "${R2GHIDRA_VERSION}", 19 | "downloadLocation": "https://github.com/radareorg/r2ghidra/releases/download/${R2GHIDRA_VERSION}/r2ghidra-${R2GHIDRA_VERSION}.tar.xz", 20 | "filesAnalyzed": false, 21 | "licenseDeclared": "LGPL-3.0-only", 22 | "supplier": "Organization: radare org", 23 | "primaryPackagePurpose": "LIBRARY", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/radareorg/r2ghidra@${R2GHIDRA_VERSION}" 29 | } 30 | ] 31 | }, 32 | { 33 | "SPDXID": "SPDXRef-com.github.radareorg-ghidra-native", 34 | "name": "ghidra-native", 35 | "downloadLocation": "git+https://github.com/radareorg/ghidra-native", 36 | "filesAnalyzed": false, 37 | "licenseDeclared": "Apache-2.0", 38 | "supplier": "Organization: radare org", 39 | "primaryPackagePurpose": "SOURCE", 40 | "externalRefs": [ 41 | { 42 | "referenceCategory": "PACKAGE-MANAGER", 43 | "referenceType": "purl", 44 | "referenceLocator": "pkg:github/radareorg/ghidra-native" 45 | } 46 | ] 47 | }, 48 | { 49 | "SPDXID": "SPDXRef-com.github.zeux-pugixml", 50 | "name": "pugixml", 51 | "versionInfo": "1.11", 52 | "downloadLocation": "git+https://github.com/zeux/pugixml", 53 | "filesAnalyzed": false, 54 | "licenseDeclared": "BSD-3-Clause", 55 | "supplier": "Person: Arseny Kapoulkine", 56 | "primaryPackagePurpose": "SOURCE", 57 | "externalRefs": [ 58 | { 59 | "referenceCategory": "PACKAGE-MANAGER", 60 | "referenceType": "purl", 61 | "referenceLocator": "pkg:github/zeux/pugixml" 62 | }, 63 | { 64 | "referenceCategory" : "SECURITY", 65 | "referenceLocator" : "cpe:2.3:a:pugixml_project:pugixml:1.11:*:*:*:*:*:*:*", 66 | "referenceType" : "cpe23Type" 67 | } 68 | ] 69 | } 70 | ], 71 | "relationships": [ 72 | { 73 | "relationshipType": "BUILD_DEPENDENCY_OF", 74 | "spdxElementId": "SPDXRef-com.github.radareorg-ghidra-native", 75 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-r2ghidra" 76 | }, 77 | { 78 | "relationshipType": "BUILD_DEPENDENCY_OF", 79 | "spdxElementId": "SPDXRef-com.github.zeux-pugixml", 80 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-r2ghidra" 81 | } 82 | ] 83 | } -------------------------------------------------------------------------------- /metadata.mk: -------------------------------------------------------------------------------- 1 | DOCKER_TITLE=radare2 2 | DOCKER_DESCRIPTION=UNIX-like reverse engineering framework and command-line toolset 3 | DOCKER_VENDOR=radareorg 4 | DOCKER_LICENSES=LGPL-3.0-only 5 | DOCKER_HOMEPAGE_URL=https://www.radare.org/ 6 | DOCKER_DOCUMENTATION_URL=https://github.com/radareorg/radare2-snap/blob/main/README-containers.md 7 | DOCKER_SOURCE_URL=https://github.com/radareorg/radare2-snap 8 | 9 | # Docker labels included inside docker image config 10 | DOCKER_LABELS= \ 11 | --label org.opencontainers.image.title="$(DOCKER_TITLE)" \ 12 | --label org.opencontainers.image.description="$(DOCKER_DESCRIPTION)" \ 13 | --label org.opencontainers.image.ref.name="$(REGISTRY_IMAGE)" \ 14 | --label org.opencontainers.image.version="$(R2_VERSION)" \ 15 | --label org.opencontainers.image.vendor="$(DOCKER_VENDOR)" \ 16 | --label org.opencontainers.image.licenses="$(DOCKER_LICENSES)" \ 17 | --label org.opencontainers.image.url="$(DOCKER_HOMEPAGE_URL)" \ 18 | --label org.opencontainers.image.documentation="$(DOCKER_DOCUMENTATION_URL)" \ 19 | --label org.opencontainers.image.source="$(DOCKER_SOURCE_URL)" \ 20 | --label org.opencontainers.image.revision="$(R2_SNAP_COMMIT)" \ 21 | --label org.opencontainers.image.base.name="$(BASE_IMAGE)" 22 | 23 | # Docker annotations for the repository manifest for the platform image 24 | DOCKER_ANNOTATIONS_MANIFEST= \ 25 | --annotation manifest:org.opencontainers.image.title="$(DOCKER_TITLE)" \ 26 | --annotation manifest:org.opencontainers.image.description="$(DOCKER_DESCRIPTION)" \ 27 | --annotation manifest:org.opencontainers.image.ref.name="$(REGISTRY_IMAGE)" \ 28 | --annotation manifest:org.opencontainers.image.version="$(R2_VERSION)" \ 29 | --annotation manifest:org.opencontainers.image.vendor="$(DOCKER_VENDOR)" \ 30 | --annotation manifest:org.opencontainers.image.licenses="$(DOCKER_LICENSES)" \ 31 | --annotation manifest:org.opencontainers.image.url="$(DOCKER_HOMEPAGE_URL)" \ 32 | --annotation manifest:org.opencontainers.image.documentation="$(DOCKER_DOCUMENTATION_URL)" \ 33 | --annotation manifest:org.opencontainers.image.source="$(DOCKER_SOURCE_URL)" \ 34 | --annotation manifest:org.opencontainers.image.revision="$(R2_SNAP_COMMIT)" \ 35 | --annotation manifest:org.opencontainers.image.base.name="$(BASE_IMAGE)" 36 | 37 | # Docker annotations for the repository index referencing all platforms for a specific tag 38 | # Note: Do not include ".image.base.*" since it is different for each platform 39 | DOCKER_ANNOTATIONS_INDEX= \ 40 | --annotation index:org.opencontainers.image.title="$(DOCKER_TITLE)" \ 41 | --annotation index:org.opencontainers.image.description="$(DOCKER_DESCRIPTION)" \ 42 | --annotation index:org.opencontainers.image.ref.name="$(REGISTRY_IMAGE)" \ 43 | --annotation index:org.opencontainers.image.version="$(R2_VERSION)" \ 44 | --annotation index:org.opencontainers.image.vendor="$(DOCKER_VENDOR)" \ 45 | --annotation index:org.opencontainers.image.licenses="$(DOCKER_LICENSES)" \ 46 | --annotation index:org.opencontainers.image.url="$(DOCKER_HOMEPAGE_URL)" \ 47 | --annotation index:org.opencontainers.image.documentation="$(DOCKER_DOCUMENTATION_URL)" \ 48 | --annotation index:org.opencontainers.image.source="$(DOCKER_SOURCE_URL)" \ 49 | --annotation index:org.opencontainers.image.revision="$(R2_SNAP_COMMIT)" 50 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | REGISTRY_IMAGE?=localhost/radare2 2 | DOCKER_TAG?=latest 3 | DOCKER_IMAGE?=$(REGISTRY_IMAGE):$(DOCKER_TAG) 4 | 5 | R2_SNAP_COMMIT:=$(shell git rev-parse --short HEAD) 6 | DEB_BUILD_ARCH?=$(shell type -p dpkg-architecture > /dev/null && dpkg-architecture -qDEB_BUILD_ARCH || uname -m | sed -e 's,i[0-9]86,i386,g' -e 's,x86_64,amd64,g' -e 's,armv.*,armhf,g' -e 's,aarch64,arm64,g' -e 's,ppc.+64le,ppc64el,g') 7 | SNAP_ARCH?=$(DEB_BUILD_ARCH) 8 | #ARCH_CONFIGS=$(wildcard config/*.mk) 9 | COSIGN_ARGS?= 10 | 11 | include versions.mk config/$(SNAP_ARCH).mk metadata.mk 12 | MESON_VERSION?=0.64.1 13 | PYTHON_VERSION?=3 14 | DOCKER_BUILD_ARGS+= \ 15 | --build-arg BASE_IMAGE=$(BASE_IMAGE) \ 16 | --build-arg BASE_SNAP=$(BASE_SNAP) \ 17 | --build-arg SNAP_ARCH=$(SNAP_ARCH) \ 18 | --build-arg MULTIARCH=$(MULTIARCH) \ 19 | --build-arg FRIDA_ARCH=$(FRIDA_ARCH) \ 20 | --build-arg MESON_VERSION=$(MESON_VERSION) \ 21 | --build-arg PYTHON_VERSION=$(PYTHON_VERSION) \ 22 | --build-arg R2_SNAP_COMMIT=$(R2_SNAP_COMMIT) \ 23 | --build-arg R2_VERSION=$(R2_VERSION) \ 24 | --build-arg R2GHIDRA_VERSION=$(R2GHIDRA_VERSION) \ 25 | --build-arg R2FRIDA_VERSION=$(R2FRIDA_VERSION) \ 26 | --build-arg R2DEC_VERSION=$(R2DEC_VERSION) \ 27 | --build-arg YARA_VERSION=$(YARA_VERSION) \ 28 | --build-arg R2YARA_VERSION=$(R2YARA_VERSION) \ 29 | --build-arg R2AI_VERSION=$(R2AI_VERSION) \ 30 | --build-arg R2BOOK_VERSION=$(R2BOOK_VERSION) 31 | 32 | .PHONY: all snap docker update clean \ 33 | buildx snap-buildx docker-buildx docker-buildx-tarball \ 34 | docker-buildx-push docker-push-multiarch 35 | 36 | # Build both for local arch for testing 37 | all: snap docker 38 | 39 | # Build both crossplatform locally for testing 40 | buildx: snap-buildx docker-buildx 41 | 42 | # Build docker for local arch for testing 43 | snap: 44 | docker build $(DOCKER_BUILD_ARGS) \ 45 | --target snap \ 46 | --output "type=local,dest=snaps" \ 47 | docker 48 | 49 | # Build docker for local arch for testing 50 | docker: 51 | docker build $(DOCKER_BUILD_ARGS) $(DOCKER_LABELS) \ 52 | --target docker \ 53 | --tag "$(DOCKER_IMAGE)" \ 54 | docker 55 | 56 | # Build crossplatform snap 57 | snap-buildx: 58 | docker buildx build $(DOCKER_BUILD_ARGS) \ 59 | --platform "$(TARGETPLATFORM)" \ 60 | --target snap \ 61 | --output "type=local,dest=snaps" \ 62 | docker 63 | 64 | # Build crossplatform docker locally for testing 65 | docker-buildx: 66 | docker buildx build $(DOCKER_BUILD_ARGS) $(DOCKER_LABELS) \ 67 | --target docker \ 68 | --platform "$(TARGETPLATFORM)" \ 69 | --output "type=docker" \ 70 | --tag "$(DOCKER_IMAGE)" \ 71 | docker 72 | 73 | # Build crossplatform docker as tarball 74 | docker-buildx-tarball: 75 | mkdir -p docker-images 76 | docker buildx build $(DOCKER_BUILD_ARGS) $(DOCKER_LABELS) $(DOCKER_ANNOTATIONS_MANIFEST) $(DOCKER_ANNOTATIONS_INDEX) \ 77 | --target docker \ 78 | --platform "$(TARGETPLATFORM)" \ 79 | --attest type=provenance,mode=max \ 80 | --output "type=oci,dest=docker-images/radare2-docker-$(SNAP_ARCH).tar" \ 81 | --tag "$(DOCKER_IMAGE)" \ 82 | docker 83 | 84 | # Build and push a single platform image 85 | docker-buildx-push: 86 | mkdir -p digests 87 | docker buildx build $(DOCKER_BUILD_ARGS) $(DOCKER_LABELS) $(DOCKER_ANNOTATIONS_MANIFEST) \ 88 | --target docker \ 89 | --platform "$(TARGETPLATFORM)" \ 90 | --iidfile "digests/$(SNAP_ARCH).iidfile" \ 91 | --attest type=provenance,mode=max \ 92 | --output "type=image,name=$(REGISTRY_IMAGE),push-by-digest=true,name-canonical=true,push=true" \ 93 | docker 94 | 95 | # digests/%.iidfile: 96 | # make docker-buildx-push SNAP_ARCH=$(notdir $(basename $@)) REGISTRY_IMAGE=$(REGISTRY_IMAGE) 97 | 98 | # digests: $(addprefix digests/,$(addsuffix .iidfile,$(notdir $(basename $(ARCH_CONFIGS))))) 99 | 100 | # Publish image with all iddfile hashes generated by docker-buildx-push 101 | docker-push-multiarch: digests 102 | docker buildx imagetools create $(DOCKER_ANNOTATIONS_INDEX) \ 103 | --tag "$(REGISTRY_IMAGE):$(DOCKER_TAG)" \ 104 | --tag "$(REGISTRY_IMAGE):$(R2_VERSION)" \ 105 | $(shell awk '{print "$(REGISTRY_IMAGE)@"$$0}' digests/*.iidfile) 106 | 107 | # GitHub Actions scripts 108 | update: 109 | .github/scripts/update-versions.sh 110 | -git status 111 | 112 | # Clean 113 | clean: 114 | rm -fR snaps digests 115 | -------------------------------------------------------------------------------- /docker/sbom/radare2.spdx.json.in: -------------------------------------------------------------------------------- 1 | { 2 | "SPDXID": "SPDXRef-DOCUMENT", 3 | "spdxVersion": "SPDX-2.3", 4 | "creationInfo": { 5 | "created": "2024-08-08T23:43:00Z", 6 | "creators": [ "Organization: radare org" ] 7 | }, 8 | "name": "radare2", 9 | "dataLicense": "CC0-1.0", 10 | "documentDescribes": [ 11 | "SPDXRef-com.github.radareorg-radare2" 12 | ], 13 | "documentNamespace": "https://github.com/radareorg/radare2-snap/sbom/radare2-${R2_SNAP_COMMIT}", 14 | "packages": [ 15 | { 16 | "SPDXID": "SPDXRef-com.github.radareorg-radare2", 17 | "name": "radare2", 18 | "versionInfo": "${R2_VERSION}", 19 | "downloadLocation": "https://github.com/radareorg/radare2/releases/download/${R2_VERSION}/radare2-${R2_VERSION}.tar.xz", 20 | "filesAnalyzed": false, 21 | "licenseComments": "Mostly under LGPLv3 but each plugin can have different licenses (see r2 -L, rasm2 -L, ...)", 22 | "supplier": "Organization: radare org", 23 | "primaryPackagePurpose": "APPLICATION", 24 | "externalRefs": [ 25 | { 26 | "referenceCategory": "PACKAGE-MANAGER", 27 | "referenceType": "purl", 28 | "referenceLocator": "pkg:github/radareorg/radare2@${R2_VERSION}" 29 | }, 30 | { 31 | "referenceCategory" : "SECURITY", 32 | "referenceLocator" : "cpe:2.3:a:radare:radare2:${R2_VERSION}:*:*:*:*:*:*:*", 33 | "referenceType" : "cpe23Type" 34 | } 35 | ] 36 | }, 37 | { 38 | "SPDXID": "SPDXRef-com.github.capstone-engine-capstone", 39 | "name": "capstone", 40 | "versionInfo": "5.0.2", 41 | "downloadLocation": "git+https://github.com/capstone-engine/capstone", 42 | "filesAnalyzed": false, 43 | "licenseDeclared": "BSD-3-Clause", 44 | "supplier": "Organization: Capstone Engine", 45 | "primaryPackagePurpose": "SOURCE", 46 | "externalRefs": [ 47 | { 48 | "referenceCategory": "PACKAGE-MANAGER", 49 | "referenceType": "purl", 50 | "referenceLocator": "pkg:github/capstone-engine/capstone" 51 | }, 52 | { 53 | "referenceCategory" : "SECURITY", 54 | "referenceLocator" : "cpe:2.3:a:capstone-engine:capstone:5.0.2:*:*:*:*:*:*:*", 55 | "referenceType" : "cpe23Type" 56 | } 57 | ] 58 | }, 59 | { 60 | "SPDXID": "SPDXRef-com.github.radareorg-vector35-arch-arm64", 61 | "name": "binaryninja-arch-arm64", 62 | "downloadLocation": "git+https://github.com/radareorg/vector35-arch-arm64", 63 | "filesAnalyzed": false, 64 | "licenseDeclared": "Apache-2.0", 65 | "supplier": "Organization: radare org", 66 | "primaryPackagePurpose": "SOURCE", 67 | "externalRefs": [ 68 | { 69 | "referenceCategory": "PACKAGE-MANAGER", 70 | "referenceType": "purl", 71 | "referenceLocator": "pkg:github/radareorg/vector35-arch-arm64" 72 | }, 73 | { 74 | "referenceCategory": "OTHER", 75 | "referenceType": "purl", 76 | "referenceLocator": "pkg:github/Vector35/binaryninja-api" 77 | } 78 | ] 79 | }, 80 | { 81 | "SPDXID": "SPDXRef-com.github.radareorg-vector35-arch-armv7", 82 | "name": "binaryninja-arch-armv7", 83 | "downloadLocation": "git+https://github.com/radareorg/vector35-arch-armv7", 84 | "filesAnalyzed": false, 85 | "licenseDeclared": "Apache-2.0", 86 | "supplier": "Organization: radare org", 87 | "primaryPackagePurpose": "SOURCE", 88 | "externalRefs": [ 89 | { 90 | "referenceCategory": "PACKAGE-MANAGER", 91 | "referenceType": "purl", 92 | "referenceLocator": "pkg:github/radareorg/vector35-arch-armv7" 93 | }, 94 | { 95 | "referenceCategory": "OTHER", 96 | "referenceType": "purl", 97 | "referenceLocator": "pkg:github/Vector35/binaryninja-api" 98 | } 99 | ] 100 | } 101 | ], 102 | "relationships": [ 103 | { 104 | "relationshipType": "BUILD_DEPENDENCY_OF", 105 | "spdxElementId": "SPDXRef-com.github.capstone-engine-capstone", 106 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-radare2" 107 | }, 108 | { 109 | "relationshipType": "BUILD_DEPENDENCY_OF", 110 | "spdxElementId": "SPDXRef-com.github.radareorg-vector35-arch-arm64", 111 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-radare2" 112 | }, 113 | { 114 | "relationshipType": "BUILD_DEPENDENCY_OF", 115 | "spdxElementId": "SPDXRef-com.github.radareorg-vector35-arch-armv7", 116 | "relatedSpdxElement": "SPDXRef-com.github.radareorg-radare2" 117 | } 118 | ] 119 | } -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Build and publish 2 | on: 3 | workflow_call: # called on version update detected 4 | workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab 5 | push: 6 | branches: 7 | - 'main' 8 | paths: 9 | - 'config/**' 10 | - 'docker/**' 11 | - 'versions.mk' 12 | 13 | concurrency: 14 | group: "publish" 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | build: 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | arch: 23 | - amd64 24 | - i386 25 | - ppc64el 26 | - riscv64 27 | - s390x 28 | runner: [ubuntu-24.04] 29 | include: 30 | - arch: arm64 31 | runner: ubuntu-24.04-arm 32 | - arch: armhf 33 | runner: ubuntu-24.04-arm 34 | runs-on: ${{ matrix.runner }} 35 | steps: 36 | # Perform the checkout of the main branch 37 | - name: Checkout 38 | uses: actions/checkout@v6 39 | with: 40 | ref: main 41 | 42 | - name: Set up QEMU 43 | uses: docker/setup-qemu-action@v3 44 | 45 | - name: Set up Docker Buildx 46 | uses: docker/setup-buildx-action@v3 47 | 48 | - name: Build snap 49 | run: make snap-buildx SNAP_ARCH=${{ matrix.arch }} 50 | 51 | - name: Upload artifact 52 | uses: actions/upload-artifact@v4 53 | with: 54 | name: snap-${{ matrix.arch }} 55 | path: snaps/radare2_*.snap 56 | if-no-files-found: error 57 | retention-days: 1 58 | compression-level: 0 59 | 60 | - name: Login to Docker Hub 61 | uses: docker/login-action@v3 62 | with: 63 | username: ${{ secrets.DOCKERHUB_USERNAME }} 64 | password: ${{ secrets.DOCKERHUB_TOKEN }} 65 | 66 | - name: Build and push docker image 67 | run: make docker-buildx-push REGISTRY_IMAGE=${{ vars.DOCKERHUB_REPO }} SNAP_ARCH=${{ matrix.arch }} 68 | 69 | - name: Upload docker digest 70 | uses: actions/upload-artifact@v4 71 | with: 72 | name: docker-digest-${{ matrix.arch }} 73 | path: digests/* 74 | if-no-files-found: error 75 | retention-days: 1 76 | 77 | - name: Lookup for snap file 78 | id: snap 79 | run: echo "file=$(find snaps -name \*.snap)" >> $GITHUB_OUTPUT 80 | 81 | - name: Publish snap 82 | uses: snapcore/action-publish@v1 83 | env: 84 | SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} 85 | with: 86 | snap: ${{ steps.snap.outputs.file }} 87 | release: stable 88 | 89 | merge: 90 | runs-on: ubuntu-24.04 91 | permissions: 92 | contents: read 93 | id-token: write # needed for signing the images with GitHub OIDC Token 94 | needs: 95 | - build 96 | steps: 97 | # Perform the checkout of the main branch 98 | - name: Checkout 99 | uses: actions/checkout@v6 100 | with: 101 | ref: main 102 | 103 | - name: Download digests 104 | uses: actions/download-artifact@v5 105 | with: 106 | path: digests 107 | pattern: docker-digest-* 108 | merge-multiple: true 109 | 110 | - name: Install Cosign 111 | uses: sigstore/cosign-installer@v3.9.2 112 | 113 | - name: Set up Docker Buildx 114 | uses: docker/setup-buildx-action@v3 115 | 116 | - name: Login to Docker Hub 117 | uses: docker/login-action@v3 118 | with: 119 | username: ${{ secrets.DOCKERHUB_USERNAME }} 120 | password: ${{ secrets.DOCKERHUB_TOKEN }} 121 | 122 | - name: Create manifest list and push 123 | run: make docker-push-multiarch REGISTRY_IMAGE=${{ vars.DOCKERHUB_REPO }} DOCKER_TAG=latest 124 | 125 | - name: Sign the images with GitHub OIDC Token 126 | env: 127 | COSIGN_EXPERIMENTAL: '1' 128 | run: cosign sign --yes --recursive --registry-referrers-mode=oci-1-1 ${{ vars.DOCKERHUB_REPO }}:latest 129 | 130 | sbom: 131 | runs-on: ubuntu-latest 132 | continue-on-error: true 133 | permissions: 134 | id-token: write 135 | contents: write 136 | needs: 137 | - build 138 | steps: 139 | - name: Install Syft 140 | uses: anchore/sbom-action/download-syft@v0 141 | 142 | - name: Download digests 143 | uses: actions/download-artifact@v5 144 | with: 145 | name: docker-digest-amd64 146 | 147 | - name: Generate SBOM with Syft 148 | run: syft scan registry:${{ vars.DOCKERHUB_REPO }}@$(cat amd64.iidfile) --select-catalogers "+sbom-cataloger" --output spdx-json=docker.spdx.json 149 | 150 | - name: Upload SBOM artifact 151 | uses: actions/upload-artifact@v4 152 | with: 153 | name: docker-sbom 154 | path: docker.spdx.json 155 | 156 | - name: Upload SBOM to GitHub dependency submission API 157 | uses: advanced-security/spdx-dependency-submission-action@v0.1.1 158 | -------------------------------------------------------------------------------- /README-containers.md: -------------------------------------------------------------------------------- 1 | # radare2 docker image 2 | 3 | Radare2 (also known as r2) is a complete framework for reverse-engineering 4 | and analyzing binaries; composed of a set of small utilities that can be used 5 | together or independently from the command line. Built around a disassembler 6 | for computer software which generates assembly language source code from 7 | machine-executable code, it supports a variety of executable formats for 8 | different processors and operating systems. Apart from the static analysis 9 | feature it also supports debugging and emulation. The architecture of the 10 | framework is modular and allows to use existing or create new plugins for new 11 | file formats, architectures, analysis features. 12 | 13 | ## Official stable version 14 | 15 | This registry image is for the stable version is based on **Ubuntu** and the [radare2 snap](https://snapcraft.io/radare2) build. 16 | The Dockerfile used to build it can be found in [this dedicated repository](https://github.com/radareorg/radare2-snap). 17 | Any issue found in this packaging can be opened [there](https://github.com/radareorg/radare2-snap/issues). 18 | 19 | The resulting build includes the following projects: 20 | 21 | * [radare2](https://github.com/radareorg/radare2) 22 | * [r2ghidra](https://github.com/radareorg/r2ghidra) 23 | * [r2frida](https://github.com/nowsecure/r2frida) (only in supported platforms) 24 | * [r2dec](https://github.com/wargio/r2dec-js) 25 | * [r2yara](https://github.com/radareorg/r2yara) 26 | * [r2ai](https://github.com/radareorg/r2ai) 27 | * [r2pipe](https://pypi.org/project/r2pipe/) (for Python) 28 | * [r2book](https://github.com/radareorg/radare2-book) (as info page) 29 | 30 | ### Run 31 | 32 | To use this docker image you can use either: 33 | 34 | ```sh 35 | docker run -ti radare/radare2 36 | podman run -ti docker.io/radare/radare2 37 | nerdctl run -ti radare/radare2 38 | ``` 39 | 40 | To use the docker image as one shot so it removes everything inside the container on exit just add `--rm` as follows: 41 | 42 | ```sh 43 | docker run --rm -ti radare/radare2 44 | ``` 45 | 46 | Another example to use for debugging inside the docker: 47 | 48 | ```sh 49 | docker run --tty --interactive --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined radare/radare2 50 | ``` 51 | 52 | Also there is the option to open the [r2book](https://book.rada.re/) inside the container: 53 | 54 | ```sh 55 | info r2book 56 | ``` 57 | 58 | ### Verify 59 | 60 | The image can be verified that has been generated by GitHub Actions by runing the following command: 61 | 62 | ```sh 63 | cosign verify docker.io/radare/radare2 --experimental-oci11=true --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity-regexp='https://github\.com/radareorg/radare2-snap/.*@refs/heads/main' 64 | ``` 65 | 66 | ## GIT version (r2docker) 67 | 68 | Alternatively there is a version with radare2 GIT aimed to be build locally. 69 | 70 | This will build an image using **Debian** with radare2 from git with latest changes. 71 | The Dockerfile to build can be found inside the `dist/docker` directory in the [radare2](https://github.com/radareorg/radare2) source tree. 72 | 73 | ### Build from GIT 74 | 75 | To build this other image run the following lines: 76 | 77 | ```sh 78 | git clone https://github.com/radareorg/radare2.git 79 | cd radare2 80 | make -C dist/docker 81 | ``` 82 | 83 | This will build an image with the following plugins: 84 | 85 | * [r2ghidra](https://github.com/radareorg/r2ghidra) 86 | * [r2frida](https://github.com/nowsecure/r2frida) 87 | * [r2dec](https://github.com/wargio/r2dec-js) 88 | 89 | It is possible to specify more packages using the `R2PM` make variable: 90 | 91 | ```sh 92 | make -C dist/docker R2PM=radius2 93 | ``` 94 | 95 | Also, you can select the architecture (amd64 / arm64) to compile the image by using the `ARCH` make variable. 96 | 97 | ## Run a container as r2web server 98 | 99 | By default both images are intended to be used in a interactive terminal. 100 | 101 | But both can also be launched directly to use the radare2 web UI. 102 | 103 | The do so it can be launched using the following command: 104 | 105 | ```sh 106 | docker run -p 9090:9090 radare/radare2 r2 -c '=h' - 107 | ``` 108 | 109 | Or the following docker-compose structure: 110 | 111 | ```yaml 112 | version: "3.8" 113 | services: 114 | radare2: 115 | image: radare/radare2 116 | command: r2 -c '=h' - 117 | network_mode: bridge 118 | ports: 119 | - "9090:9090" 120 | ``` 121 | 122 | Or if debugging functionality is required: 123 | 124 | ```yaml 125 | version: "3.8" 126 | services: 127 | radare2: 128 | image: radare/radare2 129 | command: r2 -c '=h' - 130 | network_mode: bridge 131 | ports: 132 | - "9090:9090" 133 | privileged: true 134 | cap_add: 135 | - SYS_PTRACE 136 | security_opt: 137 | - "seccomp=unconfined" 138 | - "apparmor=unconfined" 139 | ``` 140 | 141 | ## Links 142 | 143 | You can read more about the project in the following links: 144 | 145 | * 146 | * 147 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | ARG ALPINE_VERSION=3.22 3 | 4 | ## Native build cross platform 5 | FROM "${BASE_IMAGE}" AS native-builder 6 | 7 | ARG BASE_SNAP 8 | ARG MESON_VERSION 9 | ARG PYTHON_VERSION 10 | RUN apt-get update && \ 11 | apt-get install -y --no-install-recommends \ 12 | ca-certificates \ 13 | curl \ 14 | g++ \ 15 | gcc \ 16 | git \ 17 | libc-dev \ 18 | zlib1g-dev \ 19 | make \ 20 | patch \ 21 | pkg-config \ 22 | xz-utils \ 23 | "python${PYTHON_VERSION}" \ 24 | "python${PYTHON_VERSION}-venv" \ 25 | python3-pip \ 26 | ninja-build \ 27 | autoconf \ 28 | automake \ 29 | bison \ 30 | flex \ 31 | libtool \ 32 | libssl-dev \ 33 | && \ 34 | rm -rf /var/lib/apt/lists/* && \ 35 | ln -s "/usr/bin/python${PYTHON_VERSION}" /usr/local/bin/python3 && \ 36 | python3 -m venv /opt/meson && /opt/meson/bin/pip3 install "meson~=${MESON_VERSION}" && \ 37 | mkdir -p "/snap/${BASE_SNAP}" && \ 38 | ln -s "/" "/snap/${BASE_SNAP}/current" 39 | 40 | WORKDIR /usr/src 41 | ENV PREFIX="/snap/radare2/current" \ 42 | PATH="/snap/radare2/current/bin:$PATH:/opt/meson/bin" \ 43 | LD_LIBRARY_PATH="/snap/radare2/current/lib" \ 44 | PKG_CONFIG_PATH="/snap/radare2/current/lib/pkgconfig" \ 45 | CFLAGS="-O3" 46 | 47 | # Build radare2 48 | ARG R2_VERSION 49 | RUN curl -L "https://github.com/radareorg/radare2/releases/download/${R2_VERSION}/radare2-${R2_VERSION}.tar.xz" | tar -xJ && \ 50 | cd "radare2-${R2_VERSION}" && \ 51 | ./configure --prefix="$PREFIX" --with-checks-level=0 && \ 52 | make && make install 53 | 54 | # Build r2ghidra 55 | ARG R2GHIDRA_VERSION 56 | RUN curl -L "https://github.com/radareorg/r2ghidra/releases/download/${R2GHIDRA_VERSION}/r2ghidra-${R2GHIDRA_VERSION}.tar.xz" | tar -xJ && \ 57 | cd "r2ghidra-${R2GHIDRA_VERSION}" && \ 58 | ./configure --prefix="$PREFIX" --with-checks-level=0 && \ 59 | make && make install 60 | 61 | # Build r2frida (optional) 62 | ARG R2FRIDA_VERSION 63 | ARG FRIDA_ARCH 64 | RUN if [ -n "$FRIDA_ARCH" ]; then \ 65 | curl -L "https://github.com/nowsecure/r2frida/archive/refs/tags/${R2FRIDA_VERSION}.tar.gz" | tar -xz && \ 66 | cd "r2frida-${R2FRIDA_VERSION}" && \ 67 | ./configure --prefix="$PREFIX" --with-checks-level=0 && \ 68 | make frida_arch="$FRIDA_ARCH" R2FRIDA_PRECOMPILED_AGENT=1 \ 69 | R2FRIDA_PRECOMPILED_AGENT_URL="https://github.com/nowsecure/r2frida/releases/download/${R2FRIDA_VERSION}/_agent.js" && \ 70 | make install frida_arch="$FRIDA_ARCH"; \ 71 | fi 72 | 73 | # Build r2dec 74 | ARG R2DEC_VERSION 75 | RUN curl -L "https://github.com/wargio/r2dec-js/archive/refs/tags/${R2DEC_VERSION}.tar.gz" | tar -xz && \ 76 | cd "r2dec-js-${R2DEC_VERSION}" && \ 77 | meson setup --prefix "$PREFIX" build && \ 78 | ninja -C build install 79 | 80 | # Build r2yara 81 | ## Compile yara dependency 82 | ARG YARA_VERSION 83 | RUN curl -L "https://github.com/VirusTotal/yara/archive/refs/tags/v${YARA_VERSION}.tar.gz" | tar -xz && \ 84 | cd "yara-${YARA_VERSION}" && \ 85 | ./bootstrap.sh && \ 86 | ./configure --prefix="$PREFIX" && \ 87 | make && make install 88 | ## Compile r2yara plugin 89 | ARG R2YARA_VERSION 90 | RUN curl -L "https://github.com/radareorg/r2yara/archive/refs/tags/${R2YARA_VERSION}.tar.gz" | tar -xz && \ 91 | cd "r2yara-${R2YARA_VERSION}" && \ 92 | ./configure --prefix="$PREFIX" --with-checks-level=0 && \ 93 | make && make install 94 | 95 | # Add r2ai 96 | ARG R2AI_VERSION 97 | RUN curl -L "https://github.com/radareorg/r2ai/archive/refs/tags/${R2AI_VERSION}.tar.gz" | tar -xz && \ 98 | cd "r2ai-${R2AI_VERSION}" && \ 99 | make -C src && make -C src install && \ 100 | make -C decai install 101 | 102 | # Add r2book 103 | ARG R2BOOK_VERSION 104 | RUN mkdir -p "$PREFIX/share/info" && \ 105 | curl -Lo "$PREFIX/share/info/r2book.info.gz" "https://github.com/radareorg/radare2-book/releases/download/${R2BOOK_VERSION}/r2book.info.gz" 106 | 107 | ## Final build: patch elfs and generate metadata 108 | FROM --platform=$BUILDPLATFORM "alpine:${ALPINE_VERSION}" AS builder 109 | 110 | RUN apk add --no-cache yq-go gettext-envsubst patchelf 111 | 112 | ENV PREFIX="/snap/radare2/current" 113 | COPY --from=native-builder /snap /snap 114 | 115 | # patchelf 116 | # An alternative to use patchelf is to build with 117 | # LDFLAGS="-Wl,-rpath='\$\$ORIGIN/../lib' -Wl,-dynamic-linker=${DYNAMIC_LINKER}" 118 | ARG R2_VERSION 119 | ARG BASE_SNAP 120 | ARG MULTIARCH 121 | RUN BASE_PATH="/snap/$BASE_SNAP/current" LIBRARY_PATH="$BASE_PATH/lib/$MULTIARCH" DYNAMIC_LINKER=$(patchelf --print-interpreter "$PREFIX/bin/radare2") && \ 122 | find "$PREFIX/bin" -maxdepth 1 -type f '!' -name "clang-format-radare2" -exec patchelf --set-interpreter "${BASE_PATH}${DYNAMIC_LINKER}" --force-rpath --set-rpath "\$ORIGIN/../lib:$LIBRARY_PATH" \{\} \+ && \ 123 | find "$PREFIX/lib" -maxdepth 1 -name \*.so\* -type f -exec patchelf --force-rpath --set-rpath "\$ORIGIN:$LIBRARY_PATH" \{\} \+ && \ 124 | find "$PREFIX/lib/radare2/$R2_VERSION" -maxdepth 1 -name \*.so\* -type f -exec patchelf --force-rpath --set-rpath "\$ORIGIN/../..:$LIBRARY_PATH" \{\} \+ 125 | 126 | # Generate SBOM files 127 | ARG FRIDA_ARCH 128 | ARG R2_SNAP_COMMIT 129 | ARG R2DEC_VERSION 130 | ARG R2FRIDA_VERSION 131 | ARG R2GHIDRA_VERSION 132 | ARG R2YARA_VERSION 133 | ARG YARA_VERSION 134 | ARG R2AI_VERSION 135 | ARG R2BOOK_VERSION 136 | COPY sbom /usr/src/sbom 137 | RUN set -e; \ 138 | OUT_DIR="$PREFIX/share/sbom"; mkdir -p "$OUT_DIR"; cd "/usr/src/sbom"; \ 139 | for IN_SPDX in *.spdx.*.in; do PKG_SPDX="${IN_SPDX%.spdx.*}"; \ 140 | [ "$PKG_SPDX" = "r2frida" -a -z "$FRIDA_ARCH" ] && continue; \ 141 | OUT_SPDX="${OUT_DIR}/${IN_SPDX%.in}"; \ 142 | echo "Generate SBOM from ${IN_SPDX} to ${OUT_SPDX}..."; \ 143 | envsubst < "$IN_SPDX" > "$OUT_SPDX"; \ 144 | done 145 | 146 | # Create snap metadata and docker alias 147 | COPY meta "$PREFIX/meta" 148 | COPY "command.sh" /snap/bin/radare2 149 | ARG SNAP_ARCH 150 | RUN set -ex; \ 151 | yq eval -i ".version=\"$R2_VERSION\" | .base=\"$BASE_SNAP\" | .architectures=[\"$SNAP_ARCH\"]" "$PREFIX/meta/snap.yaml"; \ 152 | for f in "$PREFIX/bin/"* ; do c=$(basename "$f"); \ 153 | yq eval -i ".apps[\"$c\"].command=\"bin/$c\"" "$PREFIX/meta/snap.yaml"; \ 154 | [ "$c" != "radare2" ] && ln -s "radare2" "/snap/bin/radare2.$c"; \ 155 | done 156 | 157 | ## Build snap file 158 | FROM --platform=$BUILDPLATFORM "alpine:${ALPINE_VERSION}" AS snapbuilder 159 | 160 | RUN apk add --no-cache squashfs-tools 161 | COPY --from=builder /snap/radare2/current /snap/radare2/current 162 | 163 | ARG R2_VERSION 164 | ARG SNAP_ARCH 165 | RUN mksquashfs /snap/radare2/current "/root/radare2_${R2_VERSION}_${SNAP_ARCH}.snap" -comp lzo -all-root -no-xattrs -no-fragments 166 | 167 | ## Export snap file 168 | FROM --platform=$BUILDPLATFORM scratch AS snap 169 | 170 | COPY --from=snapbuilder /root/*.snap / 171 | 172 | ## Docker final image 173 | FROM "${BASE_IMAGE}" AS docker 174 | 175 | # Create non-root user 176 | RUN apt-get update && \ 177 | apt-get install -y --no-install-recommends \ 178 | sudo \ 179 | info \ 180 | openssl \ 181 | python3-pip \ 182 | python3-setuptools \ 183 | && \ 184 | rm -rf /var/lib/apt/lists/* && \ 185 | mkdir -p /var/snap/radare2/current /var/snap/radare2/common && \ 186 | useradd -m r2 && \ 187 | echo "r2 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/r2 && \ 188 | rm -vf /usr/lib/python*/EXTERNALLY-MANAGED && \ 189 | pip3 install --no-cache-dir r2pipe 190 | 191 | # Copy uncompressed snap files 192 | ARG SNAP_ARCH 193 | COPY --from=builder /snap /snap 194 | 195 | # Initialise base user 196 | ARG R2_VERSION 197 | USER r2 198 | WORKDIR /home/r2 199 | ENV HOME="/home/r2" \ 200 | PATH="/home/r2/.local/share/radare2/prefix/bin:/snap/radare2/current/bin:/snap/bin:${PATH}" \ 201 | LD_LIBRARY_PATH="/home/r2/.local/share/radare2/prefix/lib:/snap/radare2/current/lib" \ 202 | PKG_CONFIG_PATH="/home/r2/.local/share/radare2/prefix/lib/pkgconfig:/snap/radare2/current/lib/pkgconfig" \ 203 | INFOPATH="/snap/radare2/current/share/info:" \ 204 | R2_PREFIX="/snap/radare2/current" \ 205 | SNAP="/snap/radare2/current" \ 206 | SNAP_NAME="radare2" \ 207 | SNAP_INSTANCE_NAME="radare2" \ 208 | SNAP_VERSION="${R2_VERSION}" \ 209 | SNAP_ARCH="${SNAP_ARCH}" \ 210 | SNAP_REAL_HOME="/home/r2" \ 211 | SNAP_USER_DATA="/home/r2/snap/radare2/current" \ 212 | SNAP_USER_COMMON="/home/r2/snap/radare2/common" \ 213 | SNAP_DATA="/var/snap/radare2/current" \ 214 | SNAP_COMMON="/var/snap/radare2/common" 215 | --------------------------------------------------------------------------------