FirmAE: Binwalk Extractor failed

Just tested this on 2 freshly installed Ubuntu machines. When trying to run FirmAE, binwalk seems to throw some errors related to its running uid.

sudo ./run.sh -c dlink ../Downloads/dataset/dlink/DIR822B1_FW200KRb06.bin 
[*] ../Downloads/dataset/dlink/DIR822B1_FW200KRb06.bin emulation start!!!
 
Extractor Exception: Binwalk extraction uses many third party utilities, which may not be secure. If you wish to have extraction utilities executed as the current user, use '--run-as=root' (binwalk itself must be run as root).
----------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/binwalk/core/module.py", line 258, in __init__
    self.load()
  File "/usr/local/lib/python3.9/dist-packages/binwalk/modules/extractor.py", line 147, in load
    raise ModuleException("Binwalk extraction uses many third party utilities, which may not be secure. If you wish to have extraction utilities executed as the current user, use '--run-as=%s' (binwalk itself must be run as root)." % user_info.pw_name)
binwalk.core.exceptions.ModuleException: Binwalk extraction uses many third party utilities, which may not be secure. If you wish to have extraction utilities executed as the current user, use '--run-as=root' (binwalk itself must be run as root).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Great!

Thanks a lot. I Will be testing it with my students next week.

Kind regards,

Mick Beer

Op zo 31 jul. 2022 om 11:18 schreef Mingeun Kim @.***>

This issue was fixed in 6911f56 https://github.com/pr0v3rbs/FirmAE/commit/6911f56d92937b0d30bb58ab36d622c31a97a1ee

— Reply to this email directly, view it on GitHub https://github.com/pr0v3rbs/FirmAE/issues/33#issuecomment-1200385427, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATNYJ77YT72JVPAY2JFAMX3VWZAGNANCNFSM5E5BHUDA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

In FirmAE/sources/extractor/extractor.py on line 445 add --run-as=root to binwalk-scan. This will allow binwalk to run as expected.

for module in binwalk.scan(self.item, "--run-as=root", "-e", "-r", "-C", self.temp,
                                       signature=True, quiet=True):

@pr0v3rbs Im Already root user that’s why sudo is missing in the command. (anyway i checked also with sudo before i commented.)

# sudo ./run.sh -d tplink /root/Desktop/firmware/DIR880A1_FW107WWb08.bin [*] /root/Desktop/firmware/DIR880A1_FW107WWb08.bin emulation start!!!

General Error: Cannot open file --run-as=root (CWD: /tmp/tmpgm2pp_2h) : [Errno 2] No such file or directory: ‘–run-as=root’

Traceback (most recent call last): File “/root/Desktop/FirmAE/./sources/extractor/extractor.py”, line 445, in extract for module in binwalk.scan(self.item, “–run-as=root”, “-e”, “-r”, “-C”, self.temp, File “/usr/lib/python3/dist-packages/binwalk/init.py”, line 10, in scan objs = m.execute() File “/usr/lib/python3/dist-packages/binwalk/core/module.py”, line 783, in execute obj = self.run(module) File “/usr/lib/python3/dist-packages/binwalk/core/module.py”, line 802, in run obj = self.load(module, kwargs) File “/usr/lib/python3/dist-packages/binwalk/core/module.py”, line 833, in load argv.update(self.dependencies(module, argv[‘enabled’])) File “/usr/lib/python3/dist-packages/binwalk/core/module.py”, line 865, in dependencies raise ModuleException(“Failed to load " + dependency.name + " module”) binwalk.core.exceptions.ModuleException: Failed to load General module

thanks