Пример #1
0
def main():
    parser = ArgumentParser()
    parser.add_argument("-m", dest="mnemonic", help="Set mnemonic", type=str)
    parser.add_argument("-p", dest="pin", help="Set pin", type=str)
    parser.add_argument("--passphrase", dest="passphrase", help="Enable passphrase", action="store_true")
    parser.add_argument("--no-passphrase", dest="passphrase", help="Enable passphrase", action="store_false")
    parser.set_defaults(passphrase=True)

    args = parser.parse_args()

    # Setup link
    wirelink = get_device()
    debuglink = wirelink.find_debug()

    client = TrezorClientDebugLink(wirelink)
    client.set_debuglink(debuglink)
    # Setup link: END

    client.wipe_device()
    client.transport.session_begin()

    client.load_device_by_mnemonic(
        mnemonic=args.mnemonic, pin=args.pin, passphrase_protection=args.passphrase, label='test')


    print(client.features)

    client.transport.session_end()
    client.close()
Пример #2
0
    def setUp(self):
        transport = config.TRANSPORT(*config.TRANSPORT_ARGS,
                                     **config.TRANSPORT_KWARGS)
        if hasattr(config, 'DEBUG_TRANSPORT'):
            debug_transport = config.DEBUG_TRANSPORT(
                *config.DEBUG_TRANSPORT_ARGS, **config.DEBUG_TRANSPORT_KWARGS)
            self.client = TrezorClientDebugLink(transport)
            self.client.set_debuglink(debug_transport)
        else:
            self.client = TrezorClient(transport)
        self.client.set_tx_api(tx_api.TxApiBitcoin)
        # self.client.set_buttonwait(3)

        #                     1      2     3    4      5      6      7     8      9    10    11    12
        self.mnemonic12 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle'
        self.mnemonic18 = 'owner little vague addict embark decide pink prosper true fork panda embody mixture exchange choose canoe electric jewel'
        self.mnemonic24 = 'dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic'
        self.mnemonic_all = ' '.join(['all'] * 12)

        self.pin4 = '1234'
        self.pin6 = '789456'
        self.pin8 = '45678978'

        self.client.wipe_device()

        print("Setup finished")
        print("--------------")
Пример #3
0
    def setup_method(self, method):
        wirelink = conftest.get_device()
        debuglink = wirelink.find_debug()
        self.client = TrezorClientDebugLink(wirelink)
        self.client.set_debuglink(debuglink)
        self.client.set_tx_api(coins.tx_api["Bitcoin"])
        # self.client.set_buttonwait(3)

        device.wipe(self.client)
        self.client.transport.session_begin()
Пример #4
0
    def _connect(self):
        self.wirelink = get_transport(self.path)
        self.client = (TrezorClientDebugLink(self.wirelink)
                       if self.debug else TrezorClient(self.wirelink))

        if self.debug:
            try:
                self.debuglink = self.wirelink.find_debug()
                self.client.set_debuglink(self.debuglink)
            except Exception as e:
                pass
Пример #5
0
def client():
    wirelink = get_device()
    debuglink = wirelink.find_debug()
    client = TrezorClientDebugLink(wirelink)
    client.set_debuglink(debuglink)
    client.set_tx_api(coins.tx_api['Bitcoin'])
    client.wipe_device()
    client.transport.session_begin()

    yield client

    client.transport.session_end()
Пример #6
0
def client():
    wirelink = get_device()
    debuglink = wirelink.find_debug()
    client = TrezorClientDebugLink(wirelink)
    client.set_debuglink(debuglink)
    client.set_tx_api(coins.tx_api['Bitcoin'])
    client.wipe_device()
    client.transport.session_begin()

    yield client

    client.transport.session_end()

    # XXX debuglink session must also be closed
    # client.close accomplishes that for now; going forward, there should
    # also be proper session handling for debuglink
    client.close()
Пример #7
0
    def setup_method(self, method):
        wirelink, debuglink = get_transport()
        self.client = TrezorClientDebugLink(wirelink)
        self.client.set_debuglink(debuglink)
        self.client.set_tx_api(tx_api.TxApiBitcoin)
        # self.client.set_buttonwait(3)

        #                     1      2     3    4      5      6      7     8      9    10    11    12
        self.mnemonic12 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle'
        self.mnemonic18 = 'owner little vague addict embark decide pink prosper true fork panda embody mixture exchange choose canoe electric jewel'
        self.mnemonic24 = 'dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic'
        self.mnemonic_all = ' '.join(['all'] * 12)

        self.pin4 = '1234'
        self.pin6 = '789456'
        self.pin8 = '45678978'

        self.client.wipe_device()
        self.client.transport.session_begin()
Пример #8
0
)
mnemonic24 = "permit universe parent weapon amused modify essay borrow tobacco budget walnut " "lunch consider gallery ride amazing frog forget treat market chapter velvet useless topple"

debug_mode = args.debug
if args.trezor_path:
    path = args.trezor_path
elif args.trezor_idx:
    path = "bridge:web01" if args.trezor_idx == "usb" else "udp:127.0.0.1:21324"
else:
    path = os.environ.get("TREZOR_PATH", "bridge:web01")

mnemonic = mnemonic24 if args.mnemonic == 1 else mnemonic12


wirelink = get_transport(path)
client = TrezorClientDebugLink(wirelink) if debug_mode else TrezorClient(wirelink)
if debug_mode:
    debuglink = wirelink.find_debug()
    client.set_debuglink(debuglink)

client.transport.session_begin()

client.wipe_device()
client.load_device_by_mnemonic(
    mnemonic=mnemonic,
    pin="",
    passphrase_protection=False,
    label="ph4test",
    language="english",
)