Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_uc can take a long time #47

Closed
steven-hh-ding opened this issue Mar 17, 2021 · 1 comment
Closed

init_uc can take a long time #47

steven-hh-ding opened this issue Mar 17, 2021 · 1 comment

Comments

@steven-hh-ding
Copy link
Contributor

Hello!

unipacker/unipacker/core.py

Lines 152 to 155 in 37724cc

self.disassembler = Cs(CS_ARCH_X86, CS_MODE_32)
self.disassembler.detail = True
self.init_uc()

In our test, init_uc can take a really long time for certain file that is intentionally made large e.g.
https://bazaar.abuse.ch/sample/c92af6007b3c7f48e9c18d73dd99d889dd08dbccfe12c346724a149ba483ec2c/

So we can't set timeout on this function. Can we move the call for init_uc to engine.emu ?

@Masrepus
Copy link
Member

Unfortunately that can't easily be moved, as the interactive shell can only start once the unicorn engine has been initialized. This is because otherwise we can't give the user the option to do basically anything before starting the emulation, like inspecting/modifying registers and memory.
Without having tried it yet, I suspect the main part that takes a long time is the pefile loading, as we have already seen several samples that pefile can't handle quickly or even at all. Having a custom PE loader that is more robust has already been on our roadmap for quite some time, but until we have this, I think there is no real way around this issue rather than maybe using a new thread when you create the UnpackerEngine object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants