Closed hughsie closed 2 years ago
Do I understand correctly that rizin
is installed?
It seems that the problem is in the installation of rizin
/ rzpipe
, but in any case, please upload the binary, I will check it on my side
Do I understand correctly that rizin is installed?
rizin-0.3.0-1.fc35.x86_64
please upload the binary
Reproducer with https://people.freedesktop.org/~hughsient/temp/foo.py on https://people.freedesktop.org/~hughsient/temp/foo.efi
Any ideas welcome, thanks!
UefiAnalyzer
cannot currently work with the with
keyword since I did not define the __enter__
attribute.
Also, note that if you want to use shm
, you should manually close the shm
device by calling the close()
method.
Here's a code that works for me:
from uefi_r2 import UefiAnalyzer
with open("./foo.efi", "rb") as f:
uefi_analyzer = UefiAnalyzer(blob=f.read())
print(uefi_analyzer.get_summary())
uefi_analyzer.close()
I agree that this is not very pretty, so in the next minor release I will fix it (to make it work through with ... as
).
And the most important thing: the version you are testing uploaded on 09/27/2021 but fix for shm://
came after this release, so it makes sense to use the newer version from dev
branch: https://github.com/rizinorg/rizin
so it makes sense to use the newer version from dev branch
You're completely correct, thanks. Using rizin from git it worked.
so in the next minor release I will fix it
In the meantime I'll use something like:
from uefi_r2 import UefiAnalyzer
from typing import Optional, Type
from types import TracebackType
class _UefiAnalyzer(UefiAnalyzer):
def __enter__(self):
return self
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> None:
self.close()
with open("./foo.efi", "rb") as f:
with _UefiAnalyzer(blob=f.read()) as uefi_analyzer:
print(uefi_analyzer.get_summary())
With the new rizin code I'm getting occasionally:
any ideas? I can upload the PE binary that makes it crash somewhere if that helps.