Skip to content

Commit 052522b

Browse files
committed
rfidiot-cli.py set WAIT to pass when any TAG present and add CHANGE for requesting new TAG
1 parent e04474c commit 052522b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

rfidiot-cli.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
print ' AID <AID|"ALL"|"ANY"> Select ISO 7816 AID'
5050
print ' AIDS List well known AIDs'
5151
print ' APDU <CLA> <INS> <P1> <P2> <LC> <DATA> <LE> Send raw ISO 7816 APDU (use "" for empty elements)'
52+
print ' CHANGE <MESSAGE> Print message and wait for TAG to change'
5253
print ' FILE <"A|H"> <ASCII|HEX> Select ISO 7816 FILE'
5354
print ' HSS <SPEED> High Speed Select TAG. SPEED values are:'
5455
print ' 1 == 106 kBaud'
@@ -70,7 +71,7 @@
7071
print ' PROMPT <MESSAGE> Print message and wait for Y/N answer (exit if N)'
7172
print ' SCRIPT <FILE> Read commands from FILE (see script.txt for example)'
7273
print ' SELECT Select TAG'
73-
print ' WAIT <MESSAGE> Print message and wait for TAG to change'
74+
print ' WAIT <MESSAGE> Print message and wait for TAG'
7475
print
7576
print ' Commands will be executed sequentially and must be combined as appropriate.'
7677
print ' Block numbers must be specified in HEX.'
@@ -157,6 +158,15 @@
157158
else:
158159
print ' Failed: '+card.ISO7816ErrorCodes[card.errorcode]
159160
continue
161+
if command == 'CHANGE':
162+
message= args.pop()
163+
print
164+
current= card.uid
165+
card.waitfortag(message)
166+
while card.uid == current or card.uid == '':
167+
card.waitfortag('')
168+
print
169+
continue
160170
if command == 'FILE':
161171
mode= args.pop().upper()
162172
if mode == 'A':
@@ -490,8 +500,6 @@
490500
print
491501
current= card.uid
492502
card.waitfortag(message)
493-
while card.uid == current or card.uid == '':
494-
card.waitfortag('')
495503
print
496504
continue
497505
print

script.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ mf key a 112233445566 mf auth a 0
1111
#mf write 0 mifare.dat
1212
# blank lines are ignored
1313

14-
prompt 'Continue (Y/N)?'
1514
mf dump 0 3
16-
wait 'Waiting for you to change TAG!'
15+
prompt 'Remove TAG and continue (Y/N)?'
16+
wait 'Place a TAG on reader...' identify change 'Now provide a different TAG...' identify
1717
select
1818
select # comments are allowed on end of lines
1919

0 commit comments

Comments
 (0)