redballoonsecurity / ofrak

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

File and Directory upload, simple text editor. #380

Closed shashankx86 closed 11 months ago

shashankx86 commented 11 months ago

File and Directory upload

What is the use case for the feature? after unpacking firmware there should option to add new files and Directory

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

How would you implement this feature? there should be a button to add new file and Directory in extracted firmware

Are there any (reasonable) alternative approaches? IDK

Are you interested in implementing it yourself? maybe, I guess

simple text editor

What is the use case for the feature? There should be option to open file in simple text editor in GUI like in my case I was working with android firmware and i had to modify buil.prop file, it contains readable text and can be edited with simple text editor

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

How would you implement this feature? there should be a option in modify button in which way user wants to open that file

Are there any (reasonable) alternative approaches? IDK

Are you interested in implementing it yourself? maybe, I guess

dannyp303 commented 11 months ago

Hello!

There are ways to do this in OFRAK, it is just not well supported in the GUI. See FilesystemRoot.addfile.

HINT: To access FilesystemRoot methods you have to call resource.view_as(FilesystemRoot) on the appropriate resource first. (Checking out the tests could help.)

If you're looking for a quick route to do what you want in the GUI I would suggest using the Show Script and Run Script features (more info can be found on our blog here and here). Modifying your auto-generated script is a great way to get started with the OFRAK python API (the way OFRAK was intended to be used).

If you have any ideas on how you would better implement this in the frontend feel free to submit a PR!

shashankx86 commented 11 months ago

Hello!

There are ways to do this in OFRAK, it is just not well supported in the GUI. See FilesystemRoot.addfile.

HINT: To access FilesystemRoot methods you have to call resource.view_as(FilesystemRoot) on the appropriate resource first. (Checking out the tests could help.)

If you're looking for a quick route to do what you want in the GUI I would suggest using the Show Script and Run Script features (more info can be found on our blog here and here). Modifying your auto-generated script is a great way to get started with the OFRAK python API (the way OFRAK was intended to be used).

If you have any ideas on how you would better implement this in the frontend feel free to submit a PR!

it would be nice have all that in GUI, can you guys add it. Thanks

rbs-jacob commented 11 months ago

I agree that it would be nice to have!

In the meantime, you can download a file, change it offline, and re-upload to achieve the same thing.

https://github.com/redballoonsecurity/ofrak/assets/99368685/11521e5b-e682-4ec6-87ba-ba3d0a03084b

It's definitely not as convenient. But until we get around to that feature, I wanted to point out that it's still possible to achieve what you want.

shashankx86 commented 11 months ago

what i do about this?

Using the Python implementation of the Shannon entropy calculation! This is potentially very slow, and is only used when the C extension cannot be built/found.

shashankx86 commented 11 months ago

https://github.com/redballoonsecurity/ofrak/assets/64682801/f6ce7c1a-3838-4821-8a47-ef0b42a028a9

for some reason my file (kinda) get merged @rbs-jacob @dannyp303

dannyp303 commented 11 months ago

untitled.mp4 for some reason my file (kinda) get merged @rbs-jacob @dannyp303

Thanks! Addressed in #381

rbs-jacob commented 11 months ago

@shashankx86 #381 has been merged, so it should be fixed if you pull and install the latest sources. But if you have installed via pip install, you'll have to wait until the next release on pip, or reinstall from source.

Instructions for installing from source are here.

shashankx86 commented 11 months ago

@rbs-jacob is there a way to extract firmware file to specific folder then modify firmware in from that folder and then repack it

shashankx86 commented 11 months ago

Done!