Skip to content

Commit

Permalink
Enable debugger capabilities for r2-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Mar 12, 2017
1 parent f1ccd64 commit 7b31601
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions man/r2-docker.1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
.Op Fl s
.Op Fl u
.Op Fl l
.Op Fl r
.Op Fl d
.Ar file
.Sh DESCRIPTION
radare2 is a commandline hexadecimal editor, and this tool allows you to create a contained version inside a Docker image to open your files safely.
Expand All @@ -16,10 +18,14 @@ The options are:
.Bl -tag -width Fl
.It Fl s
open shell inside the docker image (user r2, pass r2)
.It Fl d
debug program (only for linux-x86-32/64)
.It Fl u
update or create the docker image with r2 inside
.It Fl l
List all docker images with radare2
.It Fl r
Remove the radare2 docker image
.Sh SEE ALSO
.Pp
.Xr radare2(1)
Expand Down
17 changes: 14 additions & 3 deletions sys/r2-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@ fi
showHelp() {
echo "Usage: r2-docker [-u] [file] [...]"
echo " -u update/build the radare2 docker image"
echo " -d debug program (linux-x86-32/64)"
echo " -l list radare2 docker images"
echo " -s enter the shell"
echo " -r remove radare2 docker image"
exit 1
}

ALLOW_DEBUG="--security-opt seccomp:unconfined"
#ALLOW_DEBUG="--privileged"

case "$1" in
-r)
docker rmi radare2
;;
-d)
R2FLAGS=-d $0 $2
;;
-u)
docker build -t radare2 .
;;
-l)
docker images | grep radare2
;;
shell|sh|-s)
docker run -ti radare2 || echo "run r2-docker -u to update the docker image"
docker run ${ALLOW_DEBUG} -v $PWD/dockervol:/mnt -ti radare2 || echo "run r2-docker -u to update the docker image"
;;
-h|'')
showHelp
Expand All @@ -38,10 +49,10 @@ shell|sh|-s)
rm -rf dockervol
mkdir -p dockervol
cp -f "$1" "dockervol/$F"
docker run -v $PWD/dockervol:/mnt -p 9090:9090 -ti radare2 r2 /mnt/$F
docker run ${ALLOW_DEBUG} -v $PWD/dockervol:/mnt -p 9090:9090 -ti radare2 r2 ${R2FLAGS} /mnt/$F
rm -rf dockervol
else
docker run -v $PWD/dockervol:/mnt -p 9090:9090 -ti radare2 r2 $1
docker run ${ALLOW_DEBUG} -v $PWD/dockervol:/mnt -p 9090:9090 -ti radare2 r2 ${R2FLAGS} $1
fi
;;
esac
Expand Down
1 change: 0 additions & 1 deletion sys/shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ fileslist=(
./sys/user.sh
./sys/valabind.sh
./sys/vala.sh
./sys/whereis.sh
)

FMT=gcc
Expand Down

0 comments on commit 7b31601

Please sign in to comment.