Upd MFC keys: added 41 from RRG pm3

This commit is contained in:
Willy-JL
2024-02-08 23:46:10 +00:00
parent 6a35b87376
commit 134e74dda3
2 changed files with 53 additions and 6 deletions

View File

@@ -2,8 +2,8 @@ import pathlib
import string
file = (
pathlib.Path(__file__)
/ "../../applications/main/nfc/resources/nfc/assets/mf_classic_dict.nfc"
pathlib.Path(__file__).parent
/ "../applications/main/nfc/resources/nfc/assets/mf_classic_dict.nfc"
)
try:
lines = file.read_text(encoding="ascii").splitlines()
@@ -14,13 +14,16 @@ except UnicodeDecodeError:
exit()
for i, line in enumerate(lines):
lines[i] = line = line.strip()
if line.startswith("#"):
continue
lines[i] = line = line.upper()
if not line:
continue
if len(line) != 12 or any(char not in string.hexdigits for char in line):
print(f"line {i} is not correct: {line}")
print(f"line {i + 1} is not correct: {line}")
for j in reversed(range(i + 1, len(lines))):
if lines[j].upper() == line:
if lines[j].upper().strip() == line:
del lines[j]
file.write_text("\n".join(lines))
file.write_text("\n".join(line for line in lines if line.removeprefix("#")))