diff --git a/r2revng/Dockerfile b/r2revng/Dockerfile new file mode 100644 index 000000000..336b4d0a6 --- /dev/null +++ b/r2revng/Dockerfile @@ -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 diff --git a/r2revng/Makefile b/r2revng/Makefile new file mode 100644 index 000000000..f2a76372a --- /dev/null +++ b/r2revng/Makefile @@ -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 diff --git a/r2revng/README.md b/r2revng/README.md new file mode 100644 index 000000000..62b40a43e --- /dev/null +++ b/r2revng/README.md @@ -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 +``` diff --git a/r2revng/demo.c b/r2revng/demo.c new file mode 100644 index 000000000..f81ea90a9 --- /dev/null +++ b/r2revng/demo.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf ("Hello World\n"); + return 0; +} diff --git a/r2revng/revng.sh b/r2revng/revng.sh new file mode 100755 index 000000000..cf9f77b13 --- /dev/null +++ b/r2revng/revng.sh @@ -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