mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -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()
|
||||
|
||||
global keyfile
|
||||
global mad
|
||||
|
||||
mad = False
|
||||
keyfile = f"{dpath}hf-mf-{uid:08X}-key.bin"
|
||||
keyok = False
|
||||
|
||||
|
@ -196,13 +198,12 @@ def getDarkKey():
|
|||
for k in dklist:
|
||||
cmd = f"hf mf rdbl -c 4 --key {k} --blk 0"
|
||||
print(f"{prompt} `{cmd}`", end='', flush=True)
|
||||
res = p.console(f"{cmd}")
|
||||
res = p.console(f"{cmd}", capture=False)
|
||||
if res == 0:
|
||||
print(" - success")
|
||||
dkey = k;
|
||||
break;
|
||||
print(f" - fail [{res}]")
|
||||
_ = p.grabbed_output
|
||||
|
||||
if dkey == "":
|
||||
print(f"{prompt}")
|
||||
|
@ -230,7 +231,7 @@ def decodeBlock0():
|
|||
lprint(prompt)
|
||||
lprint(f"{prompt} UID BCC ++----- RF08 ID -----++")
|
||||
lprint(f"{prompt} ! ! SAK !! !!")
|
||||
lprint(f"{prompt} ! ! ! ATQA !! RF08 Hash !!")
|
||||
lprint(f"{prompt} ! ! ! ATQA !! Fudan Sig !!")
|
||||
lprint(f"{prompt} !---------. !. !. !---. VV .---------------. VV")
|
||||
# 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
|
||||
# >> "keyfile"
|
||||
# >> "key[17][2]"
|
||||
# >> mad!
|
||||
#==============================================================================
|
||||
def loadKeys():
|
||||
global keyfile
|
||||
global key
|
||||
global mad
|
||||
|
||||
key = [[0 for _ in range(2)] for _ in range(17)] # create a fresh array
|
||||
|
||||
|
@ -402,7 +401,6 @@ def verifyKeys():
|
|||
global mad
|
||||
|
||||
badk = 0
|
||||
mad = False
|
||||
|
||||
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}"
|
||||
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="")
|
||||
if res == 0:
|
||||
lprint(" ... PASS", end="")
|
||||
|
@ -434,9 +432,6 @@ def verifyKeys():
|
|||
else:
|
||||
lprint("")
|
||||
|
||||
# We need to flush all the output we just collected <shrug>
|
||||
_ = p.grabbed_output
|
||||
|
||||
if badk > 0:
|
||||
lprint(f"{prompt} ! {badk} bad key", end='')
|
||||
lprint("s exist" if badk != 1 else " exists")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue