mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
Added ability to write to 2kB and 4kB of blocks in SL0.
This commit is contained in:
parent
bda0d7e04b
commit
7e5923d0be
1 changed files with 11 additions and 2 deletions
|
@ -67,10 +67,19 @@ function writePerso()
|
||||||
-- 0x0C - unexpected command length
|
-- 0x0C - unexpected command length
|
||||||
|
|
||||||
|
|
||||||
-- First, set all the data in the card (4kB of data) to zeros. The keys, stored in the sector trailer block, are also set to zeros.
|
-- First, set all the data in the card to zeros. The keys, stored in the sector trailer block, are also set to zeros.
|
||||||
-- The only block which cannot be explicitly set is block 0x0000, the manufacturer block.
|
-- The only block which cannot be explicitly set is block 0x0000, the manufacturer block.
|
||||||
print("Setting values of normal blocks")
|
print("Setting values of normal blocks")
|
||||||
for i=1,255,1 do --skip block 0
|
cardsize = 4 --need to set to 4 for 4k or 2 for 2k
|
||||||
|
if(cardsize == 4) then
|
||||||
|
numblocks = 255
|
||||||
|
elseif(cardsize == 2) then
|
||||||
|
numblocks = 127
|
||||||
|
else
|
||||||
|
oops("Invalid card size")
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1,numblocks,1 do --skip block 0
|
||||||
--convert the number to hex with leading zeros, then use it as the block number in writeBlock()
|
--convert the number to hex with leading zeros, then use it as the block number in writeBlock()
|
||||||
blocknum = string.format("%04x", i)
|
blocknum = string.format("%04x", i)
|
||||||
writeBlock(blocknum, SIXTEEN_BYTES_ZEROS)
|
writeBlock(blocknum, SIXTEEN_BYTES_ZEROS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue