-
Notifications
You must be signed in to change notification settings - Fork 227
/
froschtest.py
executable file
·80 lines (73 loc) · 2.38 KB
/
froschtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/python
# froschtest.py - test frosch HTRM112 reader`
#
# Adam Laurie <[email protected]>
# http://rfidiot.org/
#
# This code is copyright (c) Adam Laurie, 2006, All rights reserved.
# For non-commercial use only, the following terms apply - for all other
# uses, please contact the author:
#
# This code 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 code 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.
#
import rfidiot
import sys
import os
try:
card= rfidiot.card
except:
print "Couldn't open reader!"
os._exit(True)
card.info('froschtest v0.1d')
print
print 'Trying Hitag1: ',
if card.frosch(card.FR_HT1_Get_Snr,''):
print card.data[:len(card.data) -2]
if not card.select():
print 'Select failed: ',
print card.FROSCH_Errors[card.errorcode]
else:
for x in range(0,8):
if card.readblock(x):
print '\tBlock %02d: %s' % (x,card.data)
else:
print '\tBlock %0d read failed: ' % x,
print card.FROSCH_Errors[card.errorcode]
else:
print card.FROSCH_Errors[card.errorcode]
print 'Trying Hitag2: ',
if card.frosch(card.FR_HT2_Get_Snr_PWD,'') or card.frosch(card.FR_HT2_Get_Snr_CRYPTO,''):
print card.data[:len(card.data) -2]
if not card.select():
print 'Select failed: ',
print card.FROSCH_Errors[card.errorcode]
else:
for x in range(0,8):
if card.readblock(x):
print '\tBlock %02d: %s' % (x,card.data)
else:
print '\tBlock %0d read failed' % x,
print card.FROSCH_Errors[card.errorcode]
else:
print card.FROSCH_Errors[card.errorcode]
print 'Trying Hitag2 Public A (Unique / Miro): ',
if card.frosch(card.FR_HT2_Read_Miro,''):
print card.data
else:
print card.FROSCH_Errors[card.errorcode]
print 'Trying Hitag2 Public B (FDX-B): ',
if card.frosch(card.FR_HT2_Read_PublicB,''):
print 'Raw: ' + card.data,
print 'ID: ' + card.FDXBID128BitDecode(card.ToBinaryString(card.ToBinary(card.data)))
card.FDXBIDPrint(card.FDXBID128BitDecode(card.ToBinaryString(card.ToBinary(card.data))))
else:
print card.FROSCH_Errors[card.errorcode]
os._exit(False)