Trezor Communication Inquiries

Correct. HID was swapped for webusb at 1.7.0.

I strongly recommend figuring out that part. It’s easier than doing everything you need by hand.

(it’s not really different from using any other Python library. have a look at tools/helloworld.py in the python subdir.)

So uhh you want to be able to invoke the PIN dialog on Trezor, and then, like, brute-force the PIN from host? So you would need to change the layout to not be randomized for every attempt, or just to use the host-provided input directly against the stored pin, instead of going through the matrix?

That would be a change you need to do in the firmware, yes. But when you do that, you can basically just call normal GetAddress, which triggers the PIN dialog, then send the PIN from host, and you get back either another PIN request, or the address.

Two ways to do this:

  1. implement a custom ui object to give to the TrezorClient constructor. It is something that has a get_pin method. This will get called every time the PIN is shown on screen, and should return whatever the user has actually typed (so like "123" for all bottom row buttons).
  2. maybe easier for you: construct a GetAddress by hand (see btc.py::get_address), call it via client.call_raw(), and then check the return value. if it is a PinMatrixRequest, send a PinMatrixAck (see client.py::TrezorClient::_callback_pin). You can do that in a loop.