Command Line Interface Reference

This part of our documentation works as quick-reference to all the firmwire.py and firmwire_dev.py CLI arguments, and provides links about where they are covered. For more information about the single command line flags, you can also run FirmWire with the --help flag.

firmwire.py arguments

ArgumentCovered inDescription
modem_fileGetting StartedThe modem file FirmWire shall create an emulation environment for. Only mandatory argument(!)
--consecutive-ports CONSECUTIVE_PORTSGetting StartedChoose consecutive ports for the any listening sockets (e.g. QEMU's GDB & QMP), starting with the port provided.
-h/--helpCLI referenceShow help for for different cli flags on commandline
-w/--workspace WORKSPACEWorkspacesPath to the workspace to use
--snapshot-at SNAPSHOT_ATWorkspacesAddress and name for taking a snapshot. (Syntax: address,name)
--restore-snapshot SNAPSHOT_NAMEWorkspacesName of snapshot to be restored
-t/--module INJECTED_TASKModkitModule / Task to be injected to the baseband modem
-S/--stopInteractive explorationStop CPU after initializing the Machine. Useful for interactive exploration.
-s/--gdb-serverInteractive explorationStart GDB server on TCP port. Default is 1234. NOTE: this is a minimal GDB stub.
--consoleInteractive explorationSpawn an ipython remote kernel that can be connected to from another terminal using jupyter console --existing
--fuzz FUZZFuzzingInject and invoke the passed AFL fuzz task module (headless).
--fuzz-input FUZZ_INPUTFuzzingPath the AFL test case (@@ should be sufficient) or just the path to a single test file.
--fuzz-triage FUZZ_TRIAGEFuzzingInvoke the fuzzer, but without an AFL front end. Enables debug hooks and saves code coverage.
--fuzz-persistent FUZZ_PERSISTENTFuzzingEnable persistent fuzzing with a loop count as the argument.
--fuzz-crashlog-dir FUZZ_CRASHLOG_DIRFuzzingFolder to which logs of all testcases (length testcase) for a crashing run in persistent mode
--fuzz-crashlog-replay FUZZ_CRASHLOG_REPLAYFuzzingReplay a persistent-mode crash trace written with fuzz-crashcase-dir.
--fuzz-state-addr-file FUZZ_STATE_ADDR_FILEFuzzingTextfile containing the hex-addresses of state-variables
--full-coverageFuzzingEnable full coverage collection (logs every executed basic block)
--shannon-loader-nv_data NV_DATATBD(Shannon only) Specify the NV_DATA to be used
--mtk-loader-nv_data NV_DATATBD(MediaTek only) Specify the NV_DATA to be used

Developer options

Note: These arguments are mostly useful for development and debugging. As of now, they are part of firmwire.py, but will be moved to a custom firmwire_dev.py interface to clearly distinguish developer and user features in a future iteration of FirmWire.

ArgumentCovered inDescription
--debugTBDEnable FirmWire debugging
--debug-peripheralTBDEnable debugging for specified peripheralas
--avatar-debugTBDEnable debug logging for Avatar2
--avatar-debug-memoryTBDEnable Avatar2 remote memory debugging (useful when Peripherals crash)
--unassigned-access-logTBDPrint log messages when memory accesses to undefined memory occur
--raw-asm-loggingTBDPrint assembly basic blocks as QEMU executes them. Useful for determining infinite loops.
--trace-bb-translationTBDPrint the address of each new Basic Block, useful to eval BBs reached during fuzzing.