@@ -101,10 +101,15 @@ def show(s='', prompt="[" + color("=", fg="yellow") + "] ", **kwargs):
101101 start_time = time .time ()
102102 p = pm3 .pm3 ()
103103
104- p .console ("hf 14a read" )
104+ cmd = "hf 14a read"
105+ if debug :
106+ print (cmd )
107+ p .console (cmd )
105108 uid = None
106109
107110 for line in p .grabbed_output .split ('\n ' ):
111+ if debug :
112+ print (line )
108113 if "UID:" in line :
109114 uid = int (line [10 :].replace (' ' , '' )[- 8 :], 16 )
110115
@@ -117,8 +122,14 @@ def show_key(sec, key_type, key):
117122 kt = ['A' , 'B' ][key_type ]
118123 show (f"Sector { sec :2} key{ kt } = " + color (key , fg = "green" ))
119124
120- p .console ("prefs show --json" )
121- prefs = json .loads (p .grabbed_output )
125+ cmd = "prefs show --json"
126+ if debug :
127+ print (cmd )
128+ p .console (cmd )
129+ jprefs = p .grabbed_output
130+ if debug :
131+ print (jprefs )
132+ prefs = json .loads (jprefs )
122133 save_path = prefs ['file.default.dumppath' ] + os .path .sep
123134
124135 found_keys = [["" , "" ] for _ in range (NUM_SECTORS + NUM_EXTRA_SECTORS )]
@@ -132,9 +143,14 @@ def show_key(sec, key_type, key):
132143
133144 if init_check :
134145 show ("Checking default keys..." )
135- p .console ("hf mf fchk" )
146+ cmd = "hf mf fchk"
147+ if debug :
148+ print (cmd )
149+ p .console (cmd )
136150 for line in p .grabbed_output .split ('\n ' ):
137151 if "[+] 0" in line :
152+ if debug :
153+ print (line )
138154 res = [x .strip () for x in line .split ('|' )]
139155 sec = int (res [0 ][4 :])
140156 if res [3 ] == '1' :
@@ -148,12 +164,16 @@ def show_key(sec, key_type, key):
148164 nonces_with_data = ""
149165 for key in BACKDOOR_KEYS :
150166 cmd = f"hf mf isen --collect_fm11rf08s_with_data --key { key } "
167+ if debug :
168+ print (cmd )
151169 p .console (cmd )
152170 for line in p .grabbed_output .split ('\n ' ):
153171 if "Wrong" in line or "error" in line :
154172 break
155173 matched = "Saved to json file "
156174 if matched in line :
175+ if debug :
176+ print (line )
157177 nonces_with_data = line [line .index (matched )+ len (matched ):]
158178 if nonces_with_data != "" :
159179 break
@@ -466,6 +486,8 @@ def show_key(sec, key_type, key):
466486 abort = True
467487 matched = match_key (line )
468488 if matched is not None :
489+ if debug :
490+ print (line )
469491 found_keys [sec ][key_type ] = matched
470492 show_key (real_sec , key_type , found_keys [sec ][key_type ])
471493 if nt [sec ][0 ] == nt [sec ][1 ] and found_keys [sec ][key_type ^ 1 ] == "" :
@@ -493,6 +515,8 @@ def show_key(sec, key_type, key):
493515 abort = True
494516 matched = match_key (line )
495517 if matched is not None :
518+ if debug :
519+ print (line )
496520 found_keys [sec ][key_type ] = matched
497521 show_key (real_sec , key_type , found_keys [sec ][key_type ])
498522 if abort :
@@ -515,6 +539,8 @@ def show_key(sec, key_type, key):
515539 abort = True
516540 matched = match_key (line )
517541 if matched is not None :
542+ if debug :
543+ print (line )
518544 found_keys [sec ][0 ] = matched
519545 found_keys [sec ][1 ] = matched
520546 show_key (real_sec , 0 , found_keys [sec ][0 ])
@@ -558,6 +584,8 @@ def show_key(sec, key_type, key):
558584 abort = True
559585 matched = match_key (line )
560586 if matched is not None :
587+ if debug :
588+ print (line )
561589 found_keys [sec ][key_type_target ] = matched
562590 elif len (keys ) == 1 :
563591 found_keys [sec ][key_type_target ] = keys .pop ()
@@ -583,6 +611,8 @@ def show_key(sec, key_type, key):
583611 p .console (cmd , capture = True , quiet = False )
584612 for line in p .grabbed_output .split ('\n ' ):
585613 if "Found keys have been dumped to" in line :
614+ if debug :
615+ print (line )
586616 keyfile = line [line .index ("`" ):].strip ("`" )
587617 else :
588618 show (prompt = plus )
0 commit comments