Skip to content
Newer
Older
100755 81 lines (73 sloc) 2.34 KB
447c384 first commit
Adam Laurie authored Oct 31, 2011
1 #!/usr/bin/python
2
3 # froschtest.py - test frosch HTRM112 reader`
4 #
5 # Adam Laurie <adam@algroup.co.uk>
6 # http://rfidiot.org/
7 #
8 # This code is copyright (c) Adam Laurie, 2006, All rights reserved.
9 # For non-commercial use only, the following terms apply - for all other
10 # uses, please contact the author:
11 #
12 # This code is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17 # This code is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
23 import rfidiot
447c384 first commit
Adam Laurie authored Oct 31, 2011
24 import sys
25 import os
26
27 try:
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
28 card= rfidiot.card
447c384 first commit
Adam Laurie authored Oct 31, 2011
29 except:
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
30 print "Couldn't open reader!"
447c384 first commit
Adam Laurie authored Oct 31, 2011
31 os._exit(True)
32
271cf40 @AdamLaurie more package changes - be sure to read INSTALL for small but importan…
authored Oct 4, 2012
33 card.info('froschtest v0.1d')
447c384 first commit
Adam Laurie authored Oct 31, 2011
34 print
35 print 'Trying Hitag1: ',
36 if card.frosch(card.FR_HT1_Get_Snr,''):
37 print card.data[:len(card.data) -2]
38 if not card.select():
39 print 'Select failed: ',
40 print card.FROSCH_Errors[card.errorcode]
41 else:
42 for x in range(0,8):
43 if card.readblock(x):
44 print '\tBlock %02d: %s' % (x,card.data)
45 else:
46 print '\tBlock %0d read failed: ' % x,
47 print card.FROSCH_Errors[card.errorcode]
48 else:
49 print card.FROSCH_Errors[card.errorcode]
50
51 print 'Trying Hitag2: ',
52 if card.frosch(card.FR_HT2_Get_Snr_PWD,''):
53 print card.data[:len(card.data) -2]
54 if not card.select():
55 print 'Select failed: ',
56 print card.FROSCH_Errors[card.errorcode]
57 else:
58 for x in range(0,8):
59 if card.readblock(x):
60 print '\tBlock %02d: %s' % (x,card.data)
61 else:
62 print '\tBlock %0d read failed' % x,
63 print card.FROSCH_Errors[card.errorcode]
64 else:
65 print card.FROSCH_Errors[card.errorcode]
66
67 print 'Trying Hitag2 Public A (Unique / Miro): ',
68 if card.frosch(card.FR_HT2_Read_Miro,''):
69 print card.data
70 else:
71 print card.FROSCH_Errors[card.errorcode]
72
73 print 'Trying Hitag2 Public B (FDX-B): ',
74 if card.frosch(card.FR_HT2_Read_PublicB,''):
75 print 'Raw: ' + card.data,
76 print 'ID: ' + card.FDXBID128BitDecode(card.ToBinaryString(card.ToBinary(card.data)))
77 card.FDXBIDPrint(card.FDXBID128BitDecode(card.ToBinaryString(card.ToBinary(card.data))))
78 else:
79 print card.FROSCH_Errors[card.errorcode]
80 os._exit(False)
Something went wrong with that request. Please try again.