pr0v3rbs / FirmAE

Towards Large-Scale Emulation of IoT Firmware for Dynamic Analysis
MIT License
603 stars 117 forks source link

KeyboardInterrupt #38

Open BurYiA-z opened 2 years ago

BurYiA-z commented 2 years ago

I got an error but I don't know what happened. I need help.

I install software on a pure Ubuntu system (Ubuntu 18.04.6 LTS) I have finished download.sh and install.sh but I got an run-time error when I run it.

What should I do next?

ubuntu@ubuntu:~/work/FirmAE$ sudo ./run.sh -r dir600 ../DIR600NA1_FW102CNb01.bin 
[*] ../DIR600NA1_FW102CNb01.bin emulation start!!!
Traceback (most recent call last):
  File "./sources/extractor/extractor.py", line 780, in <module>
    main()
  File "./sources/extractor/extractor.py", line 777, in main
    extract.extract()
  File "./sources/extractor/extractor.py", line 203, in extract
    self._extract_item(item)
  File "./sources/extractor/extractor.py", line 211, in _extract_item
    ExtractionItem(self, path, 0, None, self.debug).extract()
  File "./sources/extractor/extractor.py", line 474, in extract
    self._check_recursive(module, entry)
  File "./sources/extractor/extractor.py", line 730, in _check_recursive
    if new_item.extract():
  File "./sources/extractor/extractor.py", line 474, in extract
    self._check_recursive(module, entry)
  File "./sources/extractor/extractor.py", line 729, in _check_recursive
    self.debug)
  File "./sources/extractor/extractor.py", line 244, in __init__
    host=self.extractor.database)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
KeyboardInterrupt
BurYiA-z commented 2 years ago

After testing, I found when i run some dlink firmware it will fail

For example, DIR615, DIR600

ubuntu@ubuntu:~/work/FirmAE$ sudo ./run.sh -r dir615 /mnt/hgfs/share/iot/DIR-615V1_FW2201WWb01.bin 
[*] /mnt/hgfs/share/iot/DIR-615V1_FW2201WWb01.bin emulation start!!!
Traceback (most recent call last):
  File "./sources/extractor/extractor.py", line 780, in <module>
    main()
  File "./sources/extractor/extractor.py", line 777, in main
    extract.extract()
  File "./sources/extractor/extractor.py", line 203, in extract
    self._extract_item(item)
  File "./sources/extractor/extractor.py", line 211, in _extract_item
    ExtractionItem(self, path, 0, None, self.debug).extract()
  File "./sources/extractor/extractor.py", line 474, in extract
    self._check_recursive(module, entry)
  File "./sources/extractor/extractor.py", line 730, in _check_recursive
    if new_item.extract():
  File "./sources/extractor/extractor.py", line 474, in extract
    self._check_recursive(module, entry)
  File "./sources/extractor/extractor.py", line 729, in _check_recursive
    self.debug)
  File "./sources/extractor/extractor.py", line 244, in __init__
    host=self.extractor.database)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
KeyboardInterrupt

and in DIR613, DIR882, it will Extracting root filesystem failed!

ubuntu@ubuntu:~/work/FirmAE$ sudo ./run.sh -r dir882 /mnt/hgfs/share/iot/DIR882A1_FW110B02.bin 
[*] /mnt/hgfs/share/iot/DIR882A1_FW110B02.bin emulation start!!!
[-] Extracting root filesystem failed!
ubuntu@ubuntu:~/work/FirmAE$ sudo ./run.sh -r dir613 /mnt/hgfs/share/iot/DIR-613_V1.02.bin 
[*] /mnt/hgfs/share/iot/DIR-613_V1.02.bin emulation start!!!
[-] Extracting root filesystem failed!
pr0v3rbs commented 2 years ago

Sorry for the late.

It seems the extractor.py couldn't extract the filesystem in the limited time. Check out this run.sh script, you can increase the time limitation for the extraction. If you can't estimate the adjust the time, try this command. binwalk -Me [firmware]

If you can share the firmware, I can test it.