mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
refactor console flushing; make indentation consistent; change the word 'hash' for 'sig'nature
This commit is contained in:
parent
3e1c21ac83
commit
55f8e6ed4b
1 changed files with 18 additions and 23 deletions
|
@ -95,7 +95,9 @@ def main():
|
||||||
decodeBlock0()
|
decodeBlock0()
|
||||||
|
|
||||||
global keyfile
|
global keyfile
|
||||||
|
global mad
|
||||||
|
|
||||||
|
mad = False
|
||||||
keyfile = f"{dpath}hf-mf-{uid:08X}-key.bin"
|
keyfile = f"{dpath}hf-mf-{uid:08X}-key.bin"
|
||||||
keyok = False
|
keyok = False
|
||||||
|
|
||||||
|
@ -196,13 +198,12 @@ def getDarkKey():
|
||||||
for k in dklist:
|
for k in dklist:
|
||||||
cmd = f"hf mf rdbl -c 4 --key {k} --blk 0"
|
cmd = f"hf mf rdbl -c 4 --key {k} --blk 0"
|
||||||
print(f"{prompt} `{cmd}`", end='', flush=True)
|
print(f"{prompt} `{cmd}`", end='', flush=True)
|
||||||
res = p.console(f"{cmd}")
|
res = p.console(f"{cmd}", capture=False)
|
||||||
if res == 0:
|
if res == 0:
|
||||||
print(" - success")
|
print(" - success")
|
||||||
dkey = k;
|
dkey = k;
|
||||||
break;
|
break;
|
||||||
print(f" - fail [{res}]")
|
print(f" - fail [{res}]")
|
||||||
_ = p.grabbed_output
|
|
||||||
|
|
||||||
if dkey == "":
|
if dkey == "":
|
||||||
print(f"{prompt}")
|
print(f"{prompt}")
|
||||||
|
@ -230,7 +231,7 @@ def decodeBlock0():
|
||||||
lprint(prompt)
|
lprint(prompt)
|
||||||
lprint(f"{prompt} UID BCC ++----- RF08 ID -----++")
|
lprint(f"{prompt} UID BCC ++----- RF08 ID -----++")
|
||||||
lprint(f"{prompt} ! ! SAK !! !!")
|
lprint(f"{prompt} ! ! SAK !! !!")
|
||||||
lprint(f"{prompt} ! ! ! ATQA !! RF08 Hash !!")
|
lprint(f"{prompt} ! ! ! ATQA !! Fudan Sig !!")
|
||||||
lprint(f"{prompt} !---------. !. !. !---. VV .---------------. VV")
|
lprint(f"{prompt} !---------. !. !. !---. VV .---------------. VV")
|
||||||
# 0 12 15 18 24 27 45
|
# 0 12 15 18 24 27 45
|
||||||
# ! ! ! ! ! ! !
|
# ! ! ! ! ! ! !
|
||||||
|
@ -333,12 +334,10 @@ def fudanValidate():
|
||||||
# If keys cannot be loaded AND --recover is specified, then run key recovery
|
# If keys cannot be loaded AND --recover is specified, then run key recovery
|
||||||
# >> "keyfile"
|
# >> "keyfile"
|
||||||
# >> "key[17][2]"
|
# >> "key[17][2]"
|
||||||
# >> mad!
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
def loadKeys():
|
def loadKeys():
|
||||||
global keyfile
|
global keyfile
|
||||||
global key
|
global key
|
||||||
global mad
|
|
||||||
|
|
||||||
key = [[0 for _ in range(2)] for _ in range(17)] # create a fresh array
|
key = [[0 for _ in range(2)] for _ in range(17)] # create a fresh array
|
||||||
|
|
||||||
|
@ -402,7 +401,6 @@ def verifyKeys():
|
||||||
global mad
|
global mad
|
||||||
|
|
||||||
badk = 0
|
badk = 0
|
||||||
mad = False
|
|
||||||
|
|
||||||
lprint(f"{prompt} Check keys..")
|
lprint(f"{prompt} Check keys..")
|
||||||
|
|
||||||
|
@ -417,7 +415,7 @@ def verifyKeys():
|
||||||
cmd = f"hf mf rdbl -c {ab} --key {key[sec][ab].hex()} --blk {bn}"
|
cmd = f"hf mf rdbl -c {ab} --key {key[sec][ab].hex()} --blk {bn}"
|
||||||
lprint(f"{prompt} `{cmd}`", end='', flush=True)
|
lprint(f"{prompt} `{cmd}`", end='', flush=True)
|
||||||
|
|
||||||
res = p.console(f"{cmd}")
|
res = p.console(f"{cmd}", capture=False)
|
||||||
lprint(" " * (3-len(str(bn))), end="")
|
lprint(" " * (3-len(str(bn))), end="")
|
||||||
if res == 0:
|
if res == 0:
|
||||||
lprint(" ... PASS", end="")
|
lprint(" ... PASS", end="")
|
||||||
|
@ -434,9 +432,6 @@ def verifyKeys():
|
||||||
else:
|
else:
|
||||||
lprint("")
|
lprint("")
|
||||||
|
|
||||||
# We need to flush all the output we just collected <shrug>
|
|
||||||
_ = p.grabbed_output
|
|
||||||
|
|
||||||
if badk > 0:
|
if badk > 0:
|
||||||
lprint(f"{prompt} ! {badk} bad key", end='')
|
lprint(f"{prompt} ! {badk} bad key", end='')
|
||||||
lprint("s exist" if badk != 1 else " exists")
|
lprint("s exist" if badk != 1 else " exists")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue