Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

# Python script to parse Bambu Lab RFID tag data
# Created for https://github.com/Bambu-Research-Group/RFID-Tag-Guide
# Written by Vinyl Da.i'gyu-Kazotetsu (www.queengoob.org), 2024
# Written by Vinyl Da.i'gyu-Kazotetsu (www.queengoob.org), 2024-2025

import sys
import struct
import re
import json
from datetime import datetime
from pathlib import Path

Expand Down Expand Up @@ -130,10 +131,20 @@ def extend(self, other):

class Tag():
def __init__(self, filename, data):
# Check to make sure the data is 1KB or a known alternative
# Proxmark3 JSON dump
try:
json_data = json.loads(data)
if json_data.get("Created") == "proxmark3":
data = b"".join([bytes.fromhex(json_data["blocks"][key].replace("??", "00")) for key in json_data["blocks"]])
except ValueError:
# We know that the data isn't JSON now
pass

# Flipper NFC dump
if data.startswith(b"Filetype: Flipper NFC"):
# Flipper NFC dump
data = strip_flipper_data(data)

# Check to make sure the data is 1KB or a known alternative
if len(data) not in TOTAL_BYTES:
raise TagLengthMismatchError(len(data))

Expand Down