From df4567d0159eb8eebab11025fcd14a9911f18aa1 Mon Sep 17 00:00:00 2001 From: Brandon Hammond Date: Sun, 30 Jul 2017 11:09:32 -0400 Subject: [PATCH] new file: Testing/APDU/interface.py --- Testing/APDU/interface.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Testing/APDU/interface.py diff --git a/Testing/APDU/interface.py b/Testing/APDU/interface.py new file mode 100644 index 0000000..9110941 --- /dev/null +++ b/Testing/APDU/interface.py @@ -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()