new file: Testing/APDU/interface.py
This commit is contained in:
parent
adcfd70dcf
commit
df4567d015
1 changed files with 32 additions and 0 deletions
32
Testing/APDU/interface.py
Normal file
32
Testing/APDU/interface.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# A simple interface for APDU testing
|
||||||
|
# By Brandon Hammond
|
||||||
|
|
||||||
|
# Import required modules
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from ledgerblue.comm import getDongle
|
||||||
|
|
||||||
|
# Define the main() function
|
||||||
|
def main():
|
||||||
|
# Function: main()
|
||||||
|
# Purpose: Act as an interface for testing APDU commands
|
||||||
|
|
||||||
|
# Get the dongle
|
||||||
|
dongle = getDongle(True)
|
||||||
|
|
||||||
|
# Create an infinite loop for sending user specified APDU commands
|
||||||
|
while True:
|
||||||
|
# Get the APDU command from the user
|
||||||
|
command = raw_input("=>")
|
||||||
|
|
||||||
|
# Transfer the APDU command to the dongle
|
||||||
|
dongle.exchange(bytes(command.decode("hex")))
|
||||||
|
|
||||||
|
# Note that the response will be displayed by
|
||||||
|
# the dongle.exchange() function rather than
|
||||||
|
# by this script. It is an odd design, but
|
||||||
|
# it works.
|
||||||
|
|
||||||
|
# Make sure not running as a module and call main()
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue