mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-18 04:28:18 +00:00
burn_tests: add pin cycling
This commit is contained in:
parent
526f729420
commit
f7aa6ae22e
@ -37,6 +37,22 @@ def get_device():
|
|||||||
raise RuntimeError("No debuggable device found")
|
raise RuntimeError("No debuggable device found")
|
||||||
|
|
||||||
|
|
||||||
|
def pin_input_flow(client, old_pin, new_pin):
|
||||||
|
# do you want to change pin?
|
||||||
|
yield
|
||||||
|
client.debug.press_yes()
|
||||||
|
if old_pin is not None:
|
||||||
|
# enter old pin
|
||||||
|
yield
|
||||||
|
client.debug.input(old_pin)
|
||||||
|
# enter new pin
|
||||||
|
yield
|
||||||
|
client.debug.input(new_pin)
|
||||||
|
# repeat new pin
|
||||||
|
yield
|
||||||
|
client.debug.input(new_pin)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
wirelink = get_device()
|
wirelink = get_device()
|
||||||
client = TrezorClientDebugLink(wirelink)
|
client = TrezorClientDebugLink(wirelink)
|
||||||
@ -46,6 +62,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
|
last_pin = None
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# set private field
|
# set private field
|
||||||
device.apply_settings(client, use_passphrase=True)
|
device.apply_settings(client, use_passphrase=True)
|
||||||
@ -58,5 +76,12 @@ if __name__ == "__main__":
|
|||||||
device.apply_settings(client, label=label)
|
device.apply_settings(client, label=label)
|
||||||
assert client.features.label == label
|
assert client.features.label == label
|
||||||
|
|
||||||
|
# change PIN
|
||||||
|
new_pin = "".join(random.choices(string.digits, k=random.randint(6, 10)))
|
||||||
|
client.set_input_flow(pin_input_flow(client, last_pin, new_pin))
|
||||||
|
device.change_pin(client)
|
||||||
|
client.set_input_flow(None)
|
||||||
|
last_pin = new_pin
|
||||||
|
|
||||||
print("iteration %d" % i)
|
print("iteration %d" % i)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user