C0deH4cker / PwnableHarness

Manage building and deploying exploitation challenges with ease
MIT License
57 stars 4 forks source link

Add `DOCKER_GDBSERVER_PORT` option #24

Open C0deH4cker opened 1 year ago

C0deH4cker commented 1 year ago

It would be very useful during challenge development to run the challenge in the container and attach gdb to it. I think the best way to enable this is to allow opening a port to a listening instance of gdbserver.

The Build.mk variable could be called DOCKER_GDBSERVER_PORT. When this is set to a port number, it'll do one of two things (I still need to think about this):

  1. Override the container's entrypoint to run pwnable_server under gdbserver, which will listen on the given port.
  2. Override the command launched by pwnable_server upon receiving a connection to instead run it under gdbserver.

PwnableHarness will also need to add the port forwarding options. The gdbserver port should only ever be exposed on localhost.

C0deH4cker commented 4 weeks ago

Option 2 definitely makes more sense to me now.