dump blocks in hex
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 20 Jan 2011 18:30:39 +0000 (19:30 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 20 Jan 2011 18:30:39 +0000 (19:30 +0100)
mifare-mad.pl

index c6e3bed..5ae4481 100755 (executable)
@@ -38,4 +38,10 @@ die "expected 4096 bytes, got ",length($card), " bytes\n"
 foreach my $i ( 0 .. 15 ) {
        my $v = unpack('v',(substr($card, 0x10 + ( $i * 2 ), 2)));
        printf "MAD sector %-2d %04x %s\n", $i, $v, $mad_id->{$v} || '?';
+
+       foreach my $j ( 0 .. 3 ) {
+               my $offset = 0x40 * $i + $j * 0x10;
+               my $block = substr($card, $offset, 0x10);
+               printf "%04x %s\n", $offset, unpack('H*',$block);
+       }
 }