C0deH4cker / PwnableHarness

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

Allow projects to set the version of Ubuntu needed to build a challenge #22

Open C0deH4cker opened 1 year ago

C0deH4cker commented 1 year ago

Some challenges, such as https://github.com/SunshineCTF/SunshineCTF-2022-Public/tree/master/Pwn/RII-MagicTheGatheRIIng, need to be built on a specific version of Ubuntu. There should be a properly supported mechanism for Build.mk files to set a necessary version of Ubuntu to build it with.

This gets complicated when there may be multiple projects that have different Ubuntu version requirements. For example, consider this workspace structure:

Pwn/Foo - Builds under 22.04
Pwn/Bar - Builds under 16.04
Pwn/Baz - No builder version preference

Let's say that the default Ubuntu version used by a plain pwnmake call from the root directory runs an Ubuntu 18.04 container. This is fine for building Pwn/Baz, as it doesn't have a builder version preference. However, for Pwn/Foo and Pwn/Bar, this will not be okay. Therefore, the all[Pwn/Bar] and all[Pwn/Baz] targets will need to be defined to do a sub-pwnmake build of those directories rather than directly building them. Unfortunately, make's jobserver won't correctly handle job slot sharing automatically, but that can be worried about in a later issue.

I'll probably allow Build.mk files to do something like this:

Pwn/Foo/Build.mk

BUILDER_VERSION := 22.04

Ubuntu aliases such as "jammy" could be used in place of the version number (22.04).

C0deH4cker commented 1 year ago

After #21 lands, but before this issue is implemented, challenges which require specific versions can be built manually like pwnmake --tag 22.04 all[Pwn/Foo].