redballoonsecurity / ofrak

OFRAK: unpack, modify, and repack binaries.
https://ofrak.com
Other
1.85k stars 127 forks source link

Add an ability to install OFRAK from source #314

Open ANogin opened 1 year ago

ANogin commented 1 year ago

One sentence summary of this PR (This should go in the CHANGELOG!) Add an ability to install OFRAK from source

Link to Related Issue(s) N/A

Please describe the changes in your request. This is a source tree equivalent of pip install for OFRAK - works similar to build_image.py approach, but does not require docker.

(This also adds handling of binja as a potentially-missing dependency, as make install_develop easily triggers a situation where the ofrak binja modules are there, but binja is not - let me know if you'd rather have that as a separate PR).

Anyone you think should look at this, specifically? @Edward-Larson probably? Maybe @rbs-jacob?

whyitfor commented 1 year ago

@ANogin, if I understand the intent behind this PR, you are looking for a way to install OFRAK from source natively.

Did you consider building a Makefile target to do this? What I'm envisioning is something like:

OFRAK_CONFIG=ofrak-dev.yml PYTHON_PATH=python3 make develop

The Makefile target could then:

  1. Parse the yaml to get list of packages to install
  2. Call make develop/install in the respective directory
  3. There could be an optional argument at the end to run apt/brew commands

I also wonder if we need an automated script to install from source -- this is going to increase the amount of things taht need to be tested and maintained.

ANogin commented 1 year ago

Did you consider building a Makefile target to do this? What I'm envisioning is something like:

OFRAK_CONFIG=ofrak-dev.yml PYTHON_PATH=python3 make develop

@whyitfor , I can add OFRAK_CONFIG, but then would probably want to do the same for the build_image targets? Right now we have a few hardcoded targets with specific configs, rather than OFRAK_CONFIG, so I kept the same for consistency.

  1. Parse the yaml to get list of packages to install
  2. Call make develop/install in the respective directory

At least the above steps would presumably still require a python script?

  1. There could be an optional argument at the end to run apt/brew commands

Is there any benefit to handling the apt vs brew vs just print the suggestion logic in Makefile rather than in Python?

I also wonder if we need an automated script to install from source -- this is going to increase the amount of things taht need to be tested and maintained.