Code Monkey home page Code Monkey logo

Comments (9)

gambr0 avatar gambr0 commented on August 25, 2024 4

Hi
I had the same error as yours and my directory structure was like yours. But after I tried following steps, it seems to work well now:

  1. move /firmadyne into /firmware-analysis-toolkit
  2. navigate to the Firmadyne folder and execute "sudo ./download.sh" (seems like I missed this step when setting up Firmadyne)
  3. move fat.py and reset.py into Firmadyne folder
  4. modify the firmadyne_path (in fat.py) and FIRMWARE_DIR (in firmadyne.config) to the current path of Firmadyne.

from firmware-analysis-toolkit.

Dwijad avatar Dwijad commented on August 25, 2024

Copied fat.py and reset.py to /fat/firmadyne folder and issuing the command from there.

cd /fat/firmadyne
python fat.py latlon.bin

The previous error has gone away but another pops up.

[?] Enter the name or absolute path of the firmware you want to analyse : latlon.bin
[?] Enter the brand of the firmware : qa
[+] Now going to extract the firmware. Hold on..
[+] Firmware : latlon.bin
[+] Brand : qa
[+] Database image ID : 2
[+] Identifying architecture
[+] Architecture : ./images/2.tar.gz: Cannot open: No such file or directory
Traceback (most recent call last):
  File "fat.py", line 122, in <module>
    main()
  File "fat.py", line 114, in main
    arch = identify_arch(image_id)
  File "fat.py", line 62, in identify_arch
    child.expect("Password for user firmadyne: ")
  File "/usr/local/lib/python2.7/dist-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/local/lib/python2.7/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python2.7/dist-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python2.7/dist-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f875b7da650>
command: /fat/firmadyne/scripts/getArch.sh
args: ['/fat/firmadyne/scripts/getArch.sh', './images/2.tar.gz']
buffer (last 100 chars): ''
before (last 100 chars): 'mages/2.tar.gz: Cannot open: No such file or directory\r\ntar: Error is not recoverable: exiting now\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 328
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile('Password for user firmadyne: ')

I guess it is the issue with firmadyne password !

from firmware-analysis-toolkit.

extremecoders-re avatar extremecoders-re commented on August 25, 2024

You have to edit fat.py and reset.py and provide the correct root password if not already done so.

root_pass = "root"
firmadyne_pass = "firmadyne"

from firmware-analysis-toolkit.

Dwijad avatar Dwijad commented on August 25, 2024

Hi
Thanks for the reply !

I have the firmadyne user in the postgresql database with the password 'firmadyne'

I have also executed the following query to make sure the user 'firmadyne' exists in the database.

postgres=# sudo -u postgres createuser firmadyne
postgres=# alter user firmadyne with encrypted password 'firmadyne'
postgres=# grant all privileges on database firmadyne to firmadyne
postgres-# \l
                              List of databases
   Name    |   Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+-----------+----------+---------+---------+-----------------------
 firmadyne | firmadyne | UTF8     | C.UTF-8 | C.UTF-8 |
 firmware  | firmadyne | UTF8     | C.UTF-8 | C.UTF-8 |

But the error still persists.

from firmware-analysis-toolkit.

extremecoders-re avatar extremecoders-re commented on August 25, 2024

Hi, looks like you're missing a step somewhere.
You can refer to this blog post on how to setup FAT https://blog.attify.com/getting-started-with-firmware-emulation/

from firmware-analysis-toolkit.

Dwijad avatar Dwijad commented on August 25, 2024

Hi
I was testing with a wrong bin file from https://www.ncl.ucar.edu/Applications/Data/ and when i changed the binary file from http://files.dlink.com.au/products/DIR-850L/REV_B/Firmware/Firmware_v2.20b03/ the FAT works producing outputs but at the end the kernel got panic and system needs a restart.

[    1.872000] No filesystem could mount root, tried:  ext3 ext2 ext4 cramfs squashfs vfat iso9660 romfs udf
[    1.880000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)

root_pass is defined in fat.py
Out.txt

from firmware-analysis-toolkit.

extremecoders-re avatar extremecoders-re commented on August 25, 2024

Hi, just checked on the DIR850LB1_FW210WWb03.bin file. Its working well.

$ ./fat.py DIR850LB1_FW210WWb03.bin 

                               __           _   
                              / _|         | |  
                             | |_    __ _  | |_ 
                             |  _|  / _` | | __|
                             | |   | (_| | | |_ 
                             |_|    \__,_|  \__|                    
                    
                Welcome to the Firmware Analysis Toolkit - v0.2
    Offensive IoT Exploitation Training  - http://offensiveiotexploitation.com
                  By Attify - https://attify.com  | @attifyme
    
[?] Enter the name or absolute path of the firmware you want to analyse : DIR850LB1_FW210WWb03.bin
[?] Enter the brand of the firmware : dlink
[+] Now going to extract the firmware. Hold on..
[+] Firmware : DIR850LB1_FW210WWb03.bin
[+] Brand : dlink
[+] Database image ID : 2
[+] Identifying architecture
[+] Architecture : mipseb
[+] Storing filesystem in database
[+] Building QEMU disk image
[+] Setting up the network connection, please standby
[+] Network interfaces : [('br0', '192.168.0.1'), ('br1', '192.168.7.1')]
[+] Running the firmware finally
[+] command line : sudo /home/ec/tools/firmadyne/scratch/2/run.sh
[*] Press ENTER to run the firmware...

The web server is reachable as well.
image

from firmware-analysis-toolkit.

Dwijad avatar Dwijad commented on August 25, 2024

Hi
I am running FAT inside docker. Want to know if the No filesystem could mount root as mentioned in my last post is okay. Also i don't see any network interfaces as well during initialization.

 [?] Enter the name or absolute path of the firmware you want to analyse : DIR850LB1_FW210WWb03.bin
[?] Enter the brand of the firmware : dlink
[+] Now going to extract the firmware. Hold on..
[+] Firmware : DIR850LB1_FW210WWb03.bin
[+] Brand : dlink
[+] Database image ID : 2
[+] Identifying architecture
[+] Architecture : mipseb
[+] Storing filesystem in database
[+] Building QEMU disk image
[+] Setting up the network connection, please standby
**[+] Network interfaces : []**
[+] Running the firmware finally
[+] command line : sudo /fat/firmware-analysis-toolkit/firmadyne//scratch/2/run.sh
[*] Press ENTER to run the firmware...

The base image of FAT is based on Ubuntu 16.04

from firmware-analysis-toolkit.

extremecoders-re avatar extremecoders-re commented on August 25, 2024

No, it shouldn't happen. Same for the network interface.

I've tested the image on Ubuntu 18.04. Sometimes using a different version of qemu does magically makes such issue disappear. Firmware emulation is quite an experimental thing and you are bound to run into such problems every now and then.

from firmware-analysis-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.