redballoonsecurity / ofrak

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

OFRAK fixes for Windows #261

Closed rbs-jacob closed 1 year ago

rbs-jacob commented 1 year ago

One sentence summary of this PR (This should go in the CHANGELOG!)

These changes fix both pip install ofrak on Windows, and ofrak unpack on Windows.

Anyone you think should look at this, specifically? @EdwardLarson @whyitfor

rbs-jacob commented 1 year ago

Though this PR isn't a draft and could theoretically be merged at any time, I'll leave it open for a bit while I look for other possible fixes to incorporate. I'll re-request review if applicable.

whyitfor commented 1 year ago

Per @rbs-jacob, there are a few other things that need to be added to this.

Also, @rbs-jacob can you update the changelog?

morpheuslord commented 1 year ago

I am getting this error Traceback (most recent call last):

  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\Scripts\ofrak.exe\__main__.py", line 4, in <module>
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\ofrak\__init__.py", line 8, in <module>
    from ofrak.ofrak_context import OFRAK, OFRAKContext
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\ofrak\ofrak_context.py", line 13, in <module>
    from ofrak.core.binary import GenericBinary
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\ofrak\core\__init__.py", line 1, in <module>
    from ofrak.core.elf.model import *
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\ofrak\core\elf\model.py", line 19, in <module>
    from ofrak.core.magic import MagicDescriptionIdentifier
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\ofrak\core\magic.py", line 5, in <module>
    import magic
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\magic\__init__.py", line 209, in <module>
    libmagic = loader.load_lib()
  File "C:\Users\Chira\AppData\Local\Programs\Python\Python310\lib\site-packages\magic\loader.py", line 49, in load_lib
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation
rbs-jacob commented 1 year ago

I am getting this error Traceback (most recent call last):

...

@morpheuslord To fix this error, run the following from the console:

python -m pip uninstall python-magic python-magic-bin
python -m pip install --upgrade python-magic-bin