from .conftest import TREZOR_VERSION
import pytest
@pytest.mark.skip_t1
@pytest.mark.skip_t2
from trezorlib.client import get_default_client | |
from trezorlib.misc import encrypt_keyvalue | |
from trezorlib.tools import parse_path | |
client = get_default_client() | |
PATH = parse_path("m/10016'/0'") | |
KEY = "Generate Restic backup password?" | |
VALUE = b"\x00" * 16 |
class HashBuilderCollection: | |
def __init__(self, size: int) -> None: | |
self.size = size | |
self.remaining = size | |
self.hash_fn: HashContext | None = None | |
self.parent: "HashBuilderCollection" | None = None | |
self.have_nested_child = False | |
def start(self, hash_fn: HashContext) -> "HashBuilderCollection": |
import hashlib | |
MINIKEY = "S6c56bnXQiBjk9mqSYE7ykVQ7NzrRy" | |
ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
def sha256(x): | |
return hashlib.sha256(x).digest() | |
#!/usr/bin/env python3 | |
# Place this script into trezor-firmware/core | |
# usage: ./re-sign.py trezor-2.0.6.bin trezor-2.0.6-unsigned.bin | |
from hashlib import blake2s | |
import os | |
from typing import List, Tuple |
#%% | |
import libcst as cst | |
from glob import glob | |
#%% | |
from collections import Counter | |
self_symbols = set() | |
setup_mnemonics = Counter() |
#!/usr/bin/env python3 | |
# script to insert red lines to passthrough output | |
# usage: | |
# redline.py command -w -args ... | |
import os | |
import sys | |
import subprocess | |
p = subprocess.Popen(sys.argv[1:], stdout=sys.stdout, stderr=sys.stderr, stdin=subprocess.PIPE, bufsize=0) |
# foxmingus - an rudimentary interface from mingus to foxdot | |
# | |
# install mingus from a fork with: | |
# pip install git+https://github.com/edudobay/python-mingus@python3 | |
# | |
# place this file somewhere convenient, and run the following | |
# in FoxDot: | |
# -->8-- | |
# import sys | |
# sys.path.insert(0, "/path/to/foxmingus/directory") |
import binascii, struct, io, sys | |
from trezorlib import mapping, protobuf | |
def dump_message(msg): | |
data = binascii.unhexlify(msg) | |
headerlen = struct.calcsize('>HL') | |
msg_type, datalen = struct.unpack('>HL', data[:headerlen]) | |
data = io.BytesIO(data[headerlen:headerlen + datalen]) | |
msg = protobuf.load_message(data, mapping.get_class(msg_type)) |
import binascii | |
import construct as c | |
import pyblake2 | |
from trezorlib import cosi | |
Toif = c.Struct( | |
"magic" / c.Const(b"TOI"), | |
"format" / c.Enum(c.Byte, full_color=b"f", grayscale=b"g"), |