clear

reset

auto_response on
showapdu on
prompt on

00 a4 04 00 00
if sw != 9000
    
?
    
pause
endif
set resp
isd = gettlv( $resp, 6f 84 )

00 a4 04 00 ( $isd )
if sw != 9000
    
?
    
pause
endif
set resp

jcop22_ext_auth_nonblock 0, 404142434445464748494a4b4c4d4e4f
if sw != 9000
    
?
    
pause
endif
set resp

? "枚举所有package"
80 f2  20 00 ( 4f 00 )
if sw != 9000
    
?
    
pause
endif
set resp

do 2
    
offset      = 0000
    
total_len   = strlen( $resp )
    
again:

    
len         = hmid( $resp, $offset, 01 )
    
package_aid = hmid( $resp, hex( 0x$offset + 1 ), $len )

    
delete $package_aid

    
offset      = add( $offset, 01 )
    
offset      = add( $offset, $len )
    
offset      = add( $offset, 02 )

    
if $offset >= $total_len
    
else
        
goto again
    
endif

loop

? "所有能删的包都删光了"
80 f2  20 00 ( 4f 00 )