text
stringlengths
0
1.99k
uint32_t hw_rev; /* hardware revision */
uint32_t unk1;
uint8_t md5sum1[16];
uint32_t unk2;
uint8_t md5sum2[16];
uint32_t unk3;
uint32_t kernel_la; /* kernel load address */
uint32_t kernel_ep; /* kernel entry point */
uint32_t fw_length; /* total length of the firmware */
uint32_t kernel_ofs; /* kernel data offset */
uint32_t kernel_len; /* kernel data length */
uint32_t rootfs_ofs; /* rootfs data offset */
uint32_t rootfs_len; /* rootfs data length */
uint32_t boot_ofs; /* bootloader data offset */
uint32_t boot_len; /* bootloader data length */
uint16_t ver_hi;
uint16_t ver_mid;
uint16_t ver_lo;
uint8_t pad[354];
};
struct SPI_IO {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
MemoryRegion regs_region;
CharBackend chr;
char *spi_contents;
char model_number[5];
uint32_t read_offset;
uint32_t read_len;
uint8_t busy_flag;
uint32_t cmd;
uint8_t cmd_offset;
uint8_t cmd_in_progress;
};
```
Add this board to Qemu by modifying `qemu/hw/mips/meson.build` and
adding in the following statement:
`mips_ss.add(when: 'CONFIG_WR940N', if_true: files('0wl_wr940n_v6.c'))`
Then, go into `qemu/hw/mips/Kconfig` and add in the following statements:
```
config WR940N
bool
select SERIAL
select MIPSNET
```
NOTE: The peripherals above are copied from MIPSSIM, but other included
peripherals can be added if they can be utilized. (e.g XILINX UART)
To run this board, just run the following command after building:
`./qemu-system-mips -s -machine WR940NV6 -bios WR940NV6_FW_FILE
(e.g. wr940nv6_us_3_20_1_up_boot(220801).bin)`
The board will automatically extract the contents of the WR940Nv6 firmware
blob, map the bootloader + kernel, and begin execution at Das U-Boot.
You'll see the LED blink a few colors on the physical device and then the
virtual board should crash due to a MMIO region not being allocated. It
is up to the reader to complete the rest of the MMIO peripherals while
using the MITM technique to either narrow in on a specific device
(e.g. WiFi) or to simply see what's going on during the boot process or
when a driver is interacting with it.
Happy Hacking :)
--[ References
[1] https://static.tp-link.com/resources/gpl/TL-WR940NV6_GPL.tar.gz
/!\ AUTHOR_NOTE: If the above link 404s, go to the GPL code center
and look for WR940Nv6: https://www.tp-link.com/us/support/Sgpl-code/
[2] https://github.com/Deoptim/atheros
|=-----------------------------------------------------------------------=|
|=--------------=[ 7 - Shell Your Way to Network Mastery ]=--------------=|
|=-----------------------------------------------------------------------=|
|=------------------------=[ Gabriel & Thomas ]=-------------------------=|
|=-----------------------------------------------------------------------=|
1 - Abstract
2 - Introduction
3 - White-box audit
4 - Compilation and debugging
5 - Becoming a Bash Jiu Jitsu white belt
6 - Becoming a Bash Jiu Jitsu purple belt
7 - Becoming a Bash Jiu Jitsu black belt
8 - Claiming supremacy over the mats
9 - Conclusion
10 - Acknowledgments
11 - References
---------------------------------------------------------------------------
--[ 1. Abstract