nccgroup / depthcharge

A U-Boot hacking toolkit for security researchers and tinkerers
https://depthcharge.readthedocs.io
BSD 3-Clause "New" or "Revised" License
256 stars 14 forks source link

Send custom string BEFORE waiting input from U-Boot #109

Open st47k3r opened 9 months ago

st47k3r commented 9 months ago

Describe new feature Some of devices use silent boot on RS232. If you first sent, as example "Hi, Device!" in RS232, then you get in U-Boot ccommand line with "=>". But if you just only waiting for "=>" it's not showing without you interaction..

Describe the solution you'd like Need commad line argument for string to send to device

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

jynik commented 5 months ago

Hi @st47k3r , I'm so sorry how incredibly delayed this response is. I'm no longer with NCC Group, so I'm no longer getting notifications or actively monitoring the project.

If I'm understanding your request, we ran into something similar on some MediaTek-based portable Wi-Fi Routers. Take a look at this example; I think it may be exactly what you need:

https://github.com/nccgroup/depthcharge/blob/main/python/examples/mt7628_console_menu.py

Basically, it shows how you can create a Console object to handle the pre-boot stuff, before creating a Depthcharge context object or just letting another script take over. In your case, you wouldn't wait in a read loop, but rather, spam your "stop string" and then see if it triggered a prompt.