redballoonsecurity / ofrak

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

Create root resource from directory #353

Open csisl opened 1 year ago

csisl commented 1 year ago

What is the use case for the feature?

If a file has already been extracted, let the user create a resource for the root directory of that output.

An example scenario:

A compressed file is extracted, but not recursively. The process ends and only some files have been extracted. Later, if the user wants to extract other files, they would have to start over by unpacking the original compressed file.

Rather than re-extracting from the top-level, let the user resume where they left off and navigate the resource by creating a resource from a root directory.

Does the feature contain any proprietary information about another company's intellectual property?

No

How would you implement this feature?

Inside of ofrak_context.py, implement a create_root_resource_from_directory('/path/to/dir') method. Then the method filesystem.py:initialize_from_disk('/path/to/dir') can be called so that all children and grandchildren in the directory can be registered.

This would make it easy to resume extraction if the process spans multiple runs.

whyitfor commented 1 year ago

I like this idea! I actually found myself wishing this was possible recently as well.

@EdwardLarson, @rbs-jacob, what are your thoughts on adding this higher-level API?

EdwardLarson commented 1 year ago

Yup, this is sensible and straightforward, I like it.

whyitfor commented 1 year ago

@csisl, do you have any interest in implementing this?

Figured giving you first dibs makes sense as it was your idea:)

csisl commented 1 year ago

Thank you for asking, but you guys can go ahead