mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-25 00:48:19 +00:00
Revert "feat(python): implement firmware dumping"
This reverts commit ee694f36cf
.
This commit is contained in:
parent
8ca785925d
commit
4c347b7acc
1
python/.changelog.d/2433.removed
Normal file
1
python/.changelog.d/2433.removed
Normal file
@ -0,0 +1 @@
|
||||
Remove firmware dumping capability.
|
@ -599,19 +599,3 @@ def get_hash(client: "TrezorClient", hex_challenge: Optional[str]) -> str:
|
||||
"""Get a hash of the installed firmware combined with the optional challenge."""
|
||||
challenge = bytes.fromhex(hex_challenge) if hex_challenge else None
|
||||
return firmware.get_hash(client, challenge).hex()
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument("file", type=click.File("wb"))
|
||||
@with_client
|
||||
def extract(client: "TrezorClient", file: BinaryIO) -> None:
|
||||
"""Extract the firmware from the device."""
|
||||
if client.features.model == "T":
|
||||
firmware_size = 13 * 128 * 1024
|
||||
elif client.features.model == "1":
|
||||
firmware_size = 7 * 128 * 1024 + 64 * 1024
|
||||
else:
|
||||
firmware_size = None
|
||||
|
||||
with click.progressbar(length=firmware_size) as bar:
|
||||
file.write(firmware.get_firmware(client, bar.update))
|
||||
|
@ -22,7 +22,7 @@ from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple
|
||||
import construct as c
|
||||
import ecdsa
|
||||
|
||||
from . import cosi, exceptions, messages
|
||||
from . import cosi, messages
|
||||
from .tools import expect, session
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -523,19 +523,3 @@ def update(
|
||||
@expect(messages.FirmwareHash, field="hash", ret_type=bytes)
|
||||
def get_hash(client: "TrezorClient", challenge: Optional[bytes]):
|
||||
return client.call(messages.GetFirmwareHash(challenge=challenge))
|
||||
|
||||
|
||||
@session
|
||||
def get_firmware(
|
||||
client: "TrezorClient", progress_update: Callable[[int], Any] = lambda _: None
|
||||
) -> bytes:
|
||||
resp = client.call(messages.GetFirmware())
|
||||
result = bytearray()
|
||||
while isinstance(resp, messages.FirmwareChunk):
|
||||
result.extend(resp.chunk)
|
||||
progress_update(len(resp.chunk))
|
||||
resp = client.call(messages.FirmwareChunkAck())
|
||||
|
||||
if not isinstance(resp, messages.Success):
|
||||
raise exceptions.TrezorException(f"Unexpected message {resp}")
|
||||
return bytes(result)
|
||||
|
Loading…
Reference in New Issue
Block a user