Skip to content

Commit e968f25

Browse files
Copilotgusdcoder
andcommitted
Final bug fixes: complete cleanup of unused variables and encoding specification
Co-authored-by: gusdcoder <[email protected]>
1 parent ec4a2bb commit e968f25

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed
14.6 KB
Binary file not shown.
10.8 KB
Binary file not shown.

extrair_nfc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def wait_for_card():
177177
connection.connect()
178178
print("Card connected successfully!")
179179
return connection
180-
except Exception as e:
180+
except Exception:
181181
print(f"Waiting for card... (Attempt {attempt + 1}/{max_attempts})")
182182
attempt += 1
183183
time.sleep(2)
@@ -287,7 +287,7 @@ def extractApplication(aid, app_label):
287287
os.makedirs('dumps')
288288
filename = f"{track2 or 'notrack2'}_{aid}.json"
289289
filepath = os.path.join('dumps', filename)
290-
with open(filepath, 'w') as f:
290+
with open(filepath, 'w', encoding='utf-8') as f:
291291
json.dump(output, f, indent=4, ensure_ascii=False)
292292
print(f"Output saved to: {filepath}")
293293
print(json.dumps(output, indent=4, ensure_ascii=False))
@@ -300,7 +300,7 @@ def main():
300300

301301
# Step 1: SELECT PPSE
302302
select_ppse = [0x00, 0xA4, 0x04, 0x00, 0x0E] + list(b"2PAY.SYS.DDF01") + [0x00]
303-
resp, sw1, sw2 = send_apdu(connection, select_ppse)
303+
resp, _, _ = send_apdu(connection, select_ppse)
304304
script.append({"apdu": toHexString(select_ppse).replace(" ", "").lower(),
305305
"response": toHexString(resp).replace(" ", "")})
306306

extrair_nfc_limpo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def main():
127127

128128
# Step 1: SELECT PPSE
129129
select_ppse = [0x00, 0xA4, 0x04, 0x00, 0x0E] + list(b"2PAY.SYS.DDF01") + [0x00]
130-
resp, sw1, sw2 = send_apdu(connection, select_ppse)
130+
resp, _, _ = send_apdu(connection, select_ppse)
131131
script.append({"apdu": toHexString(select_ppse).replace(" ", "").lower(),
132132
"response": toHexString(resp).replace(" ", "")})
133133

@@ -145,7 +145,7 @@ def main():
145145
# Step 2: SELECT AID
146146
aid_bytes = toBytes(aid)
147147
select_aid = [0x00, 0xA4, 0x04, 0x00, len(aid_bytes)] + aid_bytes + [0x00]
148-
resp, sw1, sw2 = send_apdu(connection, select_aid)
148+
resp, _, _ = send_apdu(connection, select_aid)
149149
script.append({"apdu": toHexString(select_aid).replace(" ", "").lower(),
150150
"response": toHexString(resp).replace(" ", "")})
151151

@@ -154,7 +154,7 @@ def main():
154154

155155

156156
# Step 3: GPO
157-
resp, sw1, sw2, gpo_apdu = get_processing_options(connection, pdol)
157+
resp, _, _, gpo_apdu = get_processing_options(connection, pdol)
158158
script.append({"apdu": toHexString(gpo_apdu).replace(" ", "").lower(),
159159
"response": toHexString(resp).replace(" ", "")})
160160

@@ -173,7 +173,7 @@ def main():
173173

174174
try:
175175
# Generate ARQC
176-
resp, sw1, sw2 = generate_arqc(connection)
176+
resp, _, _ = generate_arqc(connection)
177177
script.append({
178178
"apdu": toHexString([0x80, 0xAE, 0x80, 0x00]).replace(" ", "").lower(),
179179
"response": toHexString(resp).replace(" ", "")
@@ -244,7 +244,7 @@ def main():
244244
filepath = os.path.join('dumps', filename)
245245

246246
# Save to file
247-
with open(filepath, 'w') as f:
247+
with open(filepath, 'w', encoding='utf-8') as f:
248248
f.write(json.dumps(output, indent=4, ensure_ascii=False))
249249

250250
print(f"Output saved to: {filepath}")

0 commit comments

Comments
 (0)