[Pcsclite-cvs-commit] r5036 - /trunk/PCSC/UnitaryTests/stress_apdu.py
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jun 24 09:24:00 UTC 2010
Author: rousseau
Date: Thu Jun 24 09:23:58 2010
New Revision: 5036
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5036
Log:
send an apdu in loop
Added:
trunk/PCSC/UnitaryTests/stress_apdu.py (with props)
Added: trunk/PCSC/UnitaryTests/stress_apdu.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/UnitaryTests/stress_apdu.py?rev=5036&op=file
==============================================================================
--- trunk/PCSC/UnitaryTests/stress_apdu.py (added)
+++ trunk/PCSC/UnitaryTests/stress_apdu.py Thu Jun 24 09:23:58 2010
@@ -1,0 +1,60 @@
+#! /usr/bin/env python
+
+"""
+ stress_apdu.py: send an apdu in loop
+ Copyright (C) 2010 Ludovic Rousseau
+"""
+
+# this program is free software; you can redistribute it and/or modify
+# it under the terms of the gnu general public license as published by
+# the free software foundation; either version 2 of the license, or
+# (at your option) any later version.
+#
+# this program is distributed in the hope that it will be useful,
+# but without any warranty; without even the implied warranty of
+# merchantability or fitness for a particular purpose. see the
+# gnu general public license for more details.
+#
+# you should have received a copy of the gnu general public license along
+# with this program; if not, write to the free software foundation, inc.,
+# 51 franklin street, fifth floor, boston, ma 02110-1301 usa.
+
+from smartcard.System import readers
+
+
+def stress(reader):
+ # define the APDUs used in this script
+ SELECT = [0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0, 0x00, 0x00, 0x00, 0x62,
+ 0x03, 0x01, 0x0C, 0x06, 0x01]
+ COMMAND = [0x00, 0x00, 0x00, 0x00]
+
+ connection = reader.createConnection()
+ connection.connect()
+
+ data, sw1, sw2 = connection.transmit(SELECT)
+ print data
+ print "Select Applet: %02X %02X" % (sw1, sw2)
+
+ i = 0
+ while True:
+ data, sw1, sw2 = connection.transmit(COMMAND)
+ print data
+ print "%d Command: %02X %02X" % (i, sw1, sw2)
+ i += 1
+
+if __name__ == "__main__":
+ import sys
+
+ # get all the available readers
+ readers = readers()
+ print "Available readers:", readers
+
+ try:
+ i = int(sys.argv[1])
+ except IndexError:
+ i = 0
+
+ reader = readers[i]
+ print "Using:", reader
+
+ stress(reader)
Propchange: trunk/PCSC/UnitaryTests/stress_apdu.py
------------------------------------------------------------------------------
svn:executable = *
More information about the Pcsclite-cvs-commit
mailing list