pr0v3rbs / FirmAE

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

extractor.py failed- Issue #24

Open subhalder opened 3 years ago

subhalder commented 3 years ago

During checking emulation using command: sudo ./run.sh -r DCS dcs930l_v108_b4.bin, I'm receiving following error:

[*] dcs930l_v108_b4.bin emulation start!!! Traceback (most recent call last): File "./sources/extractor/extractor.py", line 291, in generate_tag cur.execute("SELECT id FROM brand WHERE name=%s", (brand, )) psycopg2.errors.UndefinedTable: relation "brand" does not exist LINE 1: SELECT id FROM brand WHERE name='DCS' ^

Traceback (most recent call last): File "./sources/extractor/extractor.py", line 366, in update_database "' WHERE id=%s", (self.tag, )) psycopg2.errors.UndefinedTable: relation "image" does not exist LINE 1: UPDATE image SET rootfs_extracted='True' WHERE id='dcs930l_v... ^

[-] extractor.py failed!

Please suggest to avoid the above error.

pr0v3rbs commented 3 years ago

Thank you for your interest!

The second argument of the run.sh script is a lowercased <brand> such as dlink, netgear, etc. (Usage)

Can you check again with the sudo ./run.sh -r dlink dcs930l_v108_b4.bin command?

Thank you!

subhalder commented 3 years ago

Hi, Thanks for your reply. I'm still facing the same issue with the command you recommended. Here are the details:

ABCD@sh:~/FirmAE$ sudo ./run.sh -c dlink dcs930l_v108_b4.bin [*] dcs930l_v108_b4.bin emulation start!!! Traceback (most recent call last): File "./sources/extractor/extractor.py", line 291, in generate_tag cur.execute("SELECT id FROM brand WHERE name=%s", (brand, )) psycopg2.errors.UndefinedTable: relation "brand" does not exist LINE 1: SELECT id FROM brand WHERE name='dlink' ^

Traceback (most recent call last): File "./sources/extractor/extractor.py", line 366, in update_database "' WHERE id=%s", (self.tag, )) psycopg2.errors.UndefinedTable: relation "image" does not exist LINE 1: UPDATE image SET rootfs_extracted='True' WHERE id='dcs930l_v... ^

[-] extractor.py failed!

By the way, after downloading the FirmAE_dataset.zip, I have extracted the same and kept in the FirmAE folder under root. FirmAE is containing all the files currently. I am following the steps as described in the installation, usage guidelines. I'm stuck in the 3rd step of Usage. Whether I have to keep dcs930l_v108_b4.bin in root folder or firmware folder. Thanks for your help.

pr0v3rbs commented 3 years ago

Sorry for my misunderstood.

I think that the database did not create yet (or broken) in your PostgreSQL. Please check this command install.sh.

Thank you!

subhalder commented 3 years ago

Thanks for your response. I have checked the command install.sh. Now, it seems that firmware is emulating. Since last 18 hours, I am receiving following:

subir@sh:~/FirmAE$ sudo ./run.sh -r dlink dcs930l_v108_b4.bin [] dcs930l_v108_b4.bin emulation start!!! [] extract done!!! [] get architecture done!!! mke2fs 1.44.1 (24-Mar-2018) e2fsck 1.44.1 (24-Mar-2018) [] infer network start!!!

[IID] 1 [MODE] run [+] Network reachable on 2.65.87.200! [+] Web service on 2.65.87.200 Creating TAP device tap1_0... Set 'tap1_0' persistent and owned by uid 0 Bringing up TAP device... Starting emulation of firmware... 2.65.87.200 true true 9.211072478 76.772226352

Can you please let me know whether emulation is running in correct direction?

pr0v3rbs commented 3 years ago

As you can see from the log, the target firmware was successfully emulated and the connectable network is 2.65.87.200.

After running emulated firmware with run mode. Through the 2.65.87.200 on the host, you can access the services of the target firmware.

NHPT commented 4 months ago

image