Interactive Firmware Emulator Usage
Running Firmware Emulator
The interactive firmware emulator is built using Riposte and provide a CLI to interact with a firmware while attempting to emulate it. This page breaks down each of the commands offered by the CLI.
https://github.com/ChrisTheCoolHut/firmware_emulator
$ python fw_emulator.py
______ _
| ___(_)
| |_ _ _ __ _ __ _____ ____ _ _ __ ___
| _| | | '__| '_ ` _ \ \ /\ / / _` | '__/ _ \
| | | | | | | | | | \ V V / (_| | | | __/
\_| |_|_| |_| |_| |_|\_/\_/ \__,_|_| \___|
_____ _ _
| ___| | | | |
| |__ _ __ ___ _ _| | __ _| |_ ___ _ __
| __| '_ ` _ \| | | | |/ _` | __/ _ \| '__|
| |__| | | | | | |_| | | (_| | || (_) | |
\____/_| |_| |_|\__,_|_|\__,_|\__\___/|_|
emu:~$add_file
The add_file command will copy a file from the host to the built image's file system.
Parameter
Description
local_file
Path to file on the host to copy
remote_file
Path in firmware to place file
Example
add_network
The add_network command will attempt to create a tap adapter at run time connecting the device ip address and host ip address under the name interface.
Parameter
Description
device_ip
Device IP address to use
host_ip
Host IP address to use
iface_dev
Name of adapter to use
Example
del_file
The del_file command will delete a file inside of the firmware image given the file path.
Parameter
Description
file_path
Path to file in firmware to delete
Example
export
The export command will export the given emulator with dependencies into a provided folder with. This includes a runner.sh file which can run the emulator, the kernel that was to emulate it, and the emulator image.
Parameter
Description
location
Path to export folder
Example
force_network
The force_network command will attempt to force the router image to network with the host during boot by adding an additional forcenetworking script to run at boot.
Parameter
Description
None
force_tty_login
The force_tty login command will attempt to force the router image to drop to /bin/sh instead a general login binary in the inittab.
Parameter
Description
None
info
The info command will list out some information about the currently loaded image being emulated.
Parameter
Description
None
make_image
The make_image command will take a given firmware image, run an extractor on it, look for a root file system, identify the architecture of the firmware, and prepare initial emulator configurations.
Note, this command may ask for your sudo password to mount the image.
Parameter
Description
firmware_path
A path to the firmware to make an image out of.
mount
The mount command will mount the active image and provide a path to the temporary mount location. The file system can be unmount using the unmount command.
Changes made to the mounted file system will persist into the image.
Parameter
Description
None
remove_root_password
The remove_root_password command will attempt to remove the root password hidden in the /etc/passwd or /etc/shadow file.
Parameter
Description
None
run
The run command will run the current emulator image and if any networking is configured, run the networking commands as well.
To exit the emulator Ctrl+a, x
Parameter
Description
None
setup_network
The setup_network command will run the firmware image and monitor for the router's attempt to network itself. On successful identification this information is captured and transferred to the image's networking config and will be used on future runs. It will run for 60 seconds.
Parameter
Description
None
unmount
The unmount command will unmount the active image
Changes made to the mounted file system will persist into the image.
Parameter
Description
None
Last updated
Was this helpful?