Skip to content

Commit

Permalink
Initial work to support revng decompiler for r2, for now just a docke…
Browse files Browse the repository at this point in the history
…r image
  • Loading branch information
radare committed Mar 29, 2024
1 parent 6c21ca2 commit ccc7d46
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
18 changes: 18 additions & 0 deletions r2revng/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:22.04

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Update and install basic utilities (optional)
RUN apt-get update && apt-get install -y \
curl \
git \
xz-utils \
&& rm -rf /var/lib/apt/lists/*

# Your command here
RUN curl -L -s https://rev.ng/downloads/revng-distributable/master/install.sh | bash

COPY revng.sh /

ENTRYPOINT /revng.sh
11 changes: 11 additions & 0 deletions r2revng/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
all:
docker build --platform linux/amd64 -t revng:0.1 .

demo: all
gcc -o demo demo.c
docker run --rm --platform linux/amd64 -i revng:0.1 /revng.sh < demo

shell:
docker run --platform linux/amd64 -it revng:0.1 /usr/bin/bash

.PHONY: demo run all
9 changes: 9 additions & 0 deletions r2revng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# r2revng

This directory contains the scripts to run revng from Docker

## Usage

```bash
docker run --rm --platform linux/amd64 -i revng:0.1 /revng.sh < compiled.bin > decompiled.c
```
6 changes: 6 additions & 0 deletions r2revng/demo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdio.h>

int main() {
printf ("Hello World\n");
return 0;
}
5 changes: 5 additions & 0 deletions r2revng/revng.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
export BASH=/usr/bin/bash
cat > a.out
. /revng/environment
revng artifact --analyze --progress decompile-to-single-file $@ a.out | revng ptml --color

0 comments on commit ccc7d46

Please sign in to comment.