Merge branch 'main' into extractor

This commit is contained in:
Queen Vinyl Da.i'gyu-Kazotetsu committed 2024-06-07 15:48:12 -07:00
commit a0913240db
5 files changed
+561 -108

No files matched your search

+111 -108
View File
@@ -249,62 +249,64 @@ If you place the Proxmark in between the AMS reader and the spool, make sure tha
```
[+] saved 1024 bytes to binary file /Users/mitch/hf-mf-75066B1D-dump.bin
```
## Tag Documentation
This contains documentation for the known and unknown data that is contained in each block on the RFID tag.
### Block Overview
Summary of what kind of data is stored in each block. Detailed info for each block is documented below.
| sec | blk | Data |
|-----|-----|----------------------------------------------------------------------------------------|
| 0 | 0 | [Block 0](#block-0) UID and Tag Manufacturer Data |
| 0 | 1 | [Block 1](#block-1) Tray Info Index |
| 0 | 2 | [Block 2](#block-2) Filament Type |
| 0 | 3 | [Block 3](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 1 | 0 | [Block 4](#block-4) Detailed Filament Type |
| 1 | 1 | [Block 5](#block-5) Spool Weight, Color Code |
| 1 | 2 | [Block 6](#block-6) Min/Max Hotend, Bed Temp, Bed Temp Type, Drying Time, Drying Temp |
| 1 | 3 | [Block 7](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 2 | 0 | [Block 8](#block-8) X Cam Info |
| 2 | 1 | [Block 9](#block-9) Tray UID |
| 2 | 2 | [Block 10](#block-10) **Unknown** |
| 2 | 3 | [Block 11](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 3 | 0 | [Block 12](#block-12) Production Date/Time |
| 3 | 1 | [Block 13](#block-13) **Unknown** |
| 3 | 2 | [Block 14](#block-14) **Unknown** |
| 3 | 3 | [Block 15](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 4 | 0 | **Empty** |
| 4 | 1 | **Empty** |
| 4 | 2 | **Empty** |
| 4 | 3 | [Block 19](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 5 | 0 | **Empty** |
| 5 | 1 | **Empty** |
| 5 | 2 | **Empty** |
| 5 | 3 | [Block 23](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 6 | 0 | **Empty** |
| 6 | 1 | **Empty** |
| 6 | 2 | **Empty** |
| 6 | 3 | [Block 27](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 7 | 0 | **Empty** |
| 7 | 1 | **Empty** |
| 7 | 2 | **Empty** |
| 7 | 3 | [Block 31](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 8 | 0 | **Empty** |
| 8 | 1 | **Empty** |
| 8 | 2 | **Empty** |
| 8 | 3 | [Block 35](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 9 | 0 | **Empty** |
| 9 | 1 | **Empty** |
| 9 | 2 | **Empty** |
| 9 | 3 | [Block 39](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 10-15 | * | **RSA-2048 Signature** |
This contains documentation for the known and unknown data that is contained in each block on the RFID tag.
### Block Overview
Summary of what kind of data is stored in each block. Detailed info for each block is documented below.
| sec | blk | Data |
|-----|-----|----------------------------------------------------------------------------------------|
| 0 | 0 | [Block 0](#block-0) UID and Tag Manufacturer Data |
| 0 | 1 | [Block 1](#block-1) Tray Info Index |
| 0 | 2 | [Block 2](#block-2) Filament Type |
| 0 | 3 | [Block 3](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 1 | 0 | [Block 4](#block-4) Detailed Filament Type |
| 1 | 1 | [Block 5](#block-5) Spool Weight, Color Code |
| 1 | 2 | [Block 6](#block-6) Min/Max Hotend, Bed Temp, Bed Temp Type, Drying Time, Drying Temp |
| 1 | 3 | [Block 7](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 2 | 0 | [Block 8](#block-8) X Cam Info |
| 2 | 1 | [Block 9](#block-9) Tray UID |
| 2 | 2 | [Block 10](#block-10) **Unknown** |
| 2 | 3 | [Block 11](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 3 | 0 | [Block 12](#block-12) Production Date/Time |
| 3 | 1 | [Block 13](#block-13) **Unknown** |
| 3 | 2 | [Block 14](#block-14) **Unknown** |
| 3 | 3 | [Block 15](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 4 | 0 | **Empty** |
| 4 | 1 | **Empty** |
| 4 | 2 | **Empty** |
| 4 | 3 | [Block 19](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 5 | 0 | **Empty** |
| 5 | 1 | **Empty** |
| 5 | 2 | **Empty** |
| 5 | 3 | [Block 23](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 6 | 0 | **Empty** |
| 6 | 1 | **Empty** |
| 6 | 2 | **Empty** |
| 6 | 3 | [Block 27](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 7 | 0 | **Empty** |
| 7 | 1 | **Empty** |
| 7 | 2 | **Empty** |
| 7 | 3 | [Block 31](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 8 | 0 | **Empty** |
| 8 | 1 | **Empty** |
| 8 | 2 | **Empty** |
| 8 | 3 | [Block 35](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 9 | 0 | **Empty** |
| 9 | 1 | **Empty** |
| 9 | 2 | **Empty** |
| 9 | 3 | [Block 39](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 10-15 | \* | **RSA-2048 Signature** |
The first part of the filament serial number seems to be the Tag UID.
LE = Little Endian
> [!NOTE]
> All numbers are encoded as Little Endian (LE).
### MIFARE Encryption Keys
Every 4th block (eg Sector X, Block 3) contains encryption keys that are part of the MIFARE RFID standard.
This has nothing to do with BambuLab's memory format.
All BambuLab tags use the same Permission Bits (Access Control)
@@ -312,11 +314,11 @@ All BambuLab tags use the same Permission Bits (Access Control)
Example Data:
`AA AA AA AA AA AA PP PP PP PP BB BB BB BB BB BB`
| bytes | type | example data location | Description |
|---------|----------|--------------------------|-----------------------------------------------|
| 5-0 | RAW Bin | AA AA AA AA AA AA | A-Key |
| 9-6 | RAW Bin | PP PP PP PP | Permission Bits (Access Control)<br>ALWAYS `87 87 87 69` (hex) for Bambu Tags |
| 15-10 | RAW Bin | BB BB BB BB BB BB | B-Key (always `00 00 00 00 00 00` for Bambu tags) |
| position | length | type | Description |
| -------- | ------ | ------- | ------------------------------------------------------------------------------ |
| 0 (AA) | 6 | RAW Bin | A-Key |
| 6 (PP) | 4 | RAW Bin | Permission Bits (Access Control)<br>ALWAYS `87 87 87 69` (hex) for Bambu Tags |
| 10 (BB) | 6 | RAW Bin | B-Key (always `00 00 00 00 00 00` for Bambu tags) |
### Block 0
@@ -325,125 +327,126 @@ Note: Block 0 is Read-only. The contents are set by the tag manufacturer.
Example Data:
`AA AA AA AA BB BB BB BB BB BB BB BB BB BB BB BB`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------|-----------------------------------------------|
| 7-0 | string | AA AA AA AA | Tag UID |
| 15-8 | string | BB BB BB BB BB BB BB BB BB BB BB BB | Tag Manufacturer Data (Bin) |
| position | length | type | Description |
| -------- | ------ | ------- | --------------------- |
| 0 (AA) | 4 | string | Tag UID |
| 4 (BB) | 12 | RAW Bin | Tag Manufacturer Data |
### Block 1
Example Data:
`AA AA AA AA AA AA AA AA BB BB BB BB BB BB BB BB`
| bytes | type | example data location | Description |
|-------|----------|--------------------------|-----------------------------------------------|
| 7-0 | string | BB BB BB BB BB BB BB BB | Tray Info Index - Unique Material Identifier |
| 15-8 | string | AA AA AA AA AA AA AA AA | **Unkown** |
| position | length | type | Description |
| -------- | ------ | ------ | --------------------------------------------- |
| 0 (AA) | 8 | string | Tray Info Index - Material Variant Identifier |
| 8 (BB) | 16 | string | Tray Info Index - Unique Material Identifier |
### Block 2
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|-----------------------------------|
| 15-0 | string | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | Filament type |
| position | length | type | Description |
| -------- | ------ | ------ | ------------- |
| 0 (AA) | 16 | string | Filament Type |
### Block 4
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location |description |
|-------|----------|-------------------------------------------------|---------------------------------|
| 15-0 | string | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | detailed Filament type |
| position | length | type | description |
| -------- | ------ | ------ | ---------------------- |
| 0 (AA) | 16 | string | Detailed Filament Type |
Known Values:
- PLA Basic
- PLA Tough
- Support for PLA
- PLA-CF
- PETG Basic
### Block 5
Example Data:
`AA AA AA AA BB BB CC CC CC CC CC CC CC CC CC CC`
`AA AA AA AA BB BB __ __ CC CC CC CC __ __ __ __`
| bytes | type | example data location | Description |
|-------|----------------|--------------------------------|-----------------------------------------------|
| 9-0 | **Unkown** | CC CC CC CC CC CC CC CC CC CC | **Unkown** |
| 11-10 | uint16 (LE) | BB BB | Spool Weight in g HEX: E803 --> 1000 g |
| 15-12 | RGBA in HEX | AA AA AA AA | Color in hex RBGA |
| position | length | type | Description |
| -------- | ------ | ----------- | -------------------------------------------- |
| 0 (AA) | 4 | RGBA | Color in hex RBGA |
| 4 (BB) | 2 | uint16 (LE) | Spool Weight in grams (`E8 03` --> 1000 g) |
| 8 (CC) | 8 | float (LE) | Filament Diameter in milimeters |
### Block 6
Example Data:
`AA AA BB BB CC CC DD DD EE EE FF FF GG GG GG GG`
| bytes | type | example data location | Description |
|-------|---------------|--------------------------|-----------------------------------------------|
| 3-0 | **Unused?** | GG GG GG GG | **Unkown** |
| 5-4 | uint16 (LE) | FF FF | Min- or Maxtemperature for Hotend |
| 7-6 | uint16 (LE) | EE EE | Min- or Maxtemperature for Hotend |
| 9-8 | uint16 (LE) | DD DD | Bed Temperatur in °C |
| 11-10 | uint16 (LE) | CC CC | Bed Temerature Type |
| 13-12 | uint16 (LE) | BB BB | Drying time in h |
| 15-14 | uint16 (LE) | AA AA | Drying temp in °C |
`AA AA BB BB CC CC DD DD EE EE FF FF __ __ __ __`
| position | length | type | Description |
| -------- | ------ | ----------- | --------------------------------------- |
| 0 (AA) | 2 | uint16 (LE) | Drying Temperature in °C |
| 2 (BB) | 2 | uint16 (LE) | Drying time in hours |
| 4 (CC) | 4 | uint16 (LE) | Bed Temerature Type **(types unknown)** |
| 6 (DD) | 2 | uint16 (LE) | Bed Temperature in °C |
| 8 (EE) | 2 | uint16 (LE) | Min Temperature for Hotend in °C |
| 10 (FF) | 2 | uint16 (LE) | Max Temperature for Hotend in °C |
### Block 8
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA BB BB BB BB`
| bytes | type | example data location |description |
|-------|------------|-------------------------------------|---------------------------------|
| 3-0 | **Unkown** | BB BB BB BB | **Unkown** |
| 15-4 | RAW Bin | AA AA AA AA AA AA AA AA AA AA AA AA | X Cam info |
| position | length | type | description |
| -------- | ------ | ---------- | ----------------------- |
| 0 (AA) | 12 | RAW Bin | X Cam info |
| 12 (BB) | 4 | float (LE) | **Nozzle Diameter...?** |
### Block 9
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|-----------------------------------|
| 15-0 | UID | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | TrayUID |
| position | length | type | Description |
| -------- | ------ | ------ | ----------- |
| 0 (AA) | 16 | string | Tray UID |
### Block 10
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
`__ __ __ __ AA AA __ __ __ __ __ __ __ __ __ __`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|-----------------------------------|
| 15-0 | Unknown | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | **Unknown** (binary data) |
| position | length | type | Description |
| -------- | ------ | ------- | ------------------------- |
| 4 (AA) | 2 | uint16 (LE) | Spool Width in µm (`E1 19` --> 6625µm --> 66.25mm ) |
### Block 12
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|----------------------------------------|
| 15-0 | string | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | Production Date and Time in ASCII ? `<year>_<month>_<day>_<hour>_<minute>` |
| position | length | type | Description |
| -------- | ------ | ------ | -------------------------------------------------------------------------- |
| 0 (AA) | 16 | string | Production Date and Time in ASCII (`<year>_<month>_<day>_<hour>_<minute>`) |
### Block 13
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|-----------------------------------|
| 15-0 | Unknown | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | **Unknown** (ASCII data) |
| position | length | type | Description |
| -------- | ------ | ------ | ---------------------------------- |
| 0 (AA) | 16 | string | **Short Production Date/Time...?** |
### Block 14
Example Data:
`AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA`
| bytes | type | example data location | Description |
|-------|----------|-------------------------------------------------|-----------------------------------|
| 15-0 | Unknown | AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA | **Unknown** (binary data) |
`__ __ __ __ AA AA __ __ __ __ __ __ __ __ __ __`
| position | length | type | Description |
| -------- | ------ | ----------- | --------------------------------- |
| 4 (AA) | 2 | uint16 (LE) | **Filament length in meters...?** |
## Compatible RFID tags - By generation
Binary file not shown.
+269
View File
@@ -0,0 +1,269 @@
{
"Created": "proxmark3",
"FileType": "mfc v2",
"Card": {
"UID": "75886B1D",
"ATQA": "0400",
"SAK": "08"
},
"blocks": {
"0": "75886B1D8B080400034339DB5B5E0A90",
"1": "4130302D413000004746413030000000",
"2": "504C4100000000000000000000000000",
"3": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"4": "504C4120426173696300000000000000",
"5": "FF6A13FFFA0000000000E03F00000000",
"6": "3700080001002D00DC00DC0000000000",
"7": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"8": "8813100EE803E8039A99193FCDCC4C3E",
"9": "D7AC3B89A16B47C4B061728044E1F2D5",
"10": "00000000E11900000000000000000000",
"11": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"12": "323032325F31305F31355F30385F3236",
"13": "36303932323032000000000000000000",
"14": "00000000520000000000000000000000",
"15": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"16": "00000000000000000000000000000000",
"17": "00000000000000000000000000000000",
"18": "00000000000000000000000000000000",
"19": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"20": "00000000000000000000000000000000",
"21": "00000000000000000000000000000000",
"22": "00000000000000000000000000000000",
"23": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"24": "00000000000000000000000000000000",
"25": "00000000000000000000000000000000",
"26": "00000000000000000000000000000000",
"27": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"28": "00000000000000000000000000000000",
"29": "00000000000000000000000000000000",
"30": "00000000000000000000000000000000",
"31": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"32": "00000000000000000000000000000000",
"33": "00000000000000000000000000000000",
"34": "00000000000000000000000000000000",
"35": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"36": "00000000000000000000000000000000",
"37": "00000000000000000000000000000000",
"38": "00000000000000000000000000000000",
"39": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"40": "01CFDF394071DF7AC33C01793531B538",
"41": "4B0A3F1D24CBFD0E4D4A853D4D151519",
"42": "58CFDF394071DF7AC33C01793531B538",
"43": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"44": "4B0A3F1D24CBFD0E4D4A853D4D151519",
"45": "C062CF9B1A8AC8AC6A6C8A23B1DC3632",
"46": "EC8EABFC54D29247764D0ED867C17BB6",
"47": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"48": "AEAF544F605BF114E687DACCDA406DE1",
"49": "D2E3A6110FE31224F762A5E528722D88",
"50": "75FACEA72FCF6921394A9D1BCF161996",
"51": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"52": "0F888A3E17818083E8AFC47262F32179",
"53": "518945A59C088C6882DFF5403AFF485A",
"54": "6C7491617EA5402510E0784F0ED76F9E",
"55": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"56": "17A58D26A3BC95D559466E9631AC3DB5",
"57": "1701E73C8320F7D7D4F3D2BF064841EE",
"58": "8AA430A049C8ABF81FC604CE998DF497",
"59": "FFFFFFFFFFFF87878769FFFFFFFFFFFF",
"60": "A1F23E081A4231A9E8D1079BDA5EAB35",
"61": "DEEB804E6F4CFF949E2EF5DB0946585F",
"62": "320069B051FA908C574A6B2BA2322AB9",
"63": "FFFFFFFFFFFF87878769FFFFFFFFFFFF"
},
"SectorKeys": {
"0": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block0": "read AB",
"block1": "read AB",
"block2": "read AB",
"block3": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"1": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block4": "read AB",
"block5": "read AB",
"block6": "read AB",
"block7": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"2": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block8": "read AB",
"block9": "read AB",
"block10": "read AB",
"block11": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"3": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block12": "read AB",
"block13": "read AB",
"block14": "read AB",
"block15": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"4": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block16": "read AB",
"block17": "read AB",
"block18": "read AB",
"block19": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"5": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block20": "read AB",
"block21": "read AB",
"block22": "read AB",
"block23": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"6": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block24": "read AB",
"block25": "read AB",
"block26": "read AB",
"block27": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"7": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block28": "read AB",
"block29": "read AB",
"block30": "read AB",
"block31": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"8": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block32": "read AB",
"block33": "read AB",
"block34": "read AB",
"block35": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"9": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block36": "read AB",
"block37": "read AB",
"block38": "read AB",
"block39": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"10": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block40": "read AB",
"block41": "read AB",
"block42": "read AB",
"block43": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"11": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block44": "read AB",
"block45": "read AB",
"block46": "read AB",
"block47": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"12": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block48": "read AB",
"block49": "read AB",
"block50": "read AB",
"block51": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"13": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block52": "read AB",
"block53": "read AB",
"block54": "read AB",
"block55": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"14": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block56": "read AB",
"block57": "read AB",
"block58": "read AB",
"block59": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
},
"15": {
"KeyA": "FFFFFFFFFFFF",
"KeyB": "FFFFFFFFFFFF",
"AccessConditions": "87878769",
"AccessConditionsText": {
"block60": "read AB",
"block61": "read AB",
"block62": "read AB",
"block63": "read ACCESS by AB; write ACCESS by B",
"UserData": "69"
}
}
}
}
Binary file not shown.
+181
View File
@@ -0,0 +1,181 @@
# -*- coding: utf-8 -*-
# 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
import sys
import struct
from datetime import datetime
COMPARISON_BLOCKS = [1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14]
IMPORTANT_BLOCKS = [0] + COMPARISON_BLOCKS
BYTES_PER_BLOCK = 16
BLOCKS_PER_TAG = 64
TOTAL_BYTES = BLOCKS_PER_TAG * BYTES_PER_BLOCK
# Byte conversions
def bytes_to_string(data):
return data.decode('ascii').replace('\x00', ' ').strip()
def bytes_to_hex(data, chunkify = False):
output = data.hex().upper()
return " ".join((string[0+i:2+i] for i in range(0, len(string), 2))) if chunkify else output
def bytes_to_int(data):
return int.from_bytes(data, 'little')
def bytes_to_float(data):
return struct.unpack('<f', data)[0]
def bytes_to_date(data):
string = bytes_to_string(data)
parts = string.split("_")
if len(parts) < 5:
return string # Not a date we can process, if it's a date at all
return datetime(
year=int(parts[0]),
month=int(parts[1]),
day=int(parts[2]),
hour=int(parts[3]),
minute=int(parts[4])
)
# Classes
class TagLengthMismatchError(TypeError):
def __init__(self, actual_length):
super().__init__(f"The data does not appear to be a valid MIFARE 1K RFID tag (received {actual_length} bytes / {int(actual_length / BYTES_PER_BLOCK)} blocks, expected {TOTAL_BYTES} bytes / {BLOCKS_PER_TAG} blocks).")
class Unit():
def __init__(self, value, unit):
self.value = value
self.unit = unit
def __str__(self):
return str(self.value) + ("º" if self.unit in ["C", "F"] else "") + self.unit
def __get_comparison_values(self, other):
if type(other) in [int, float]:
return [self.value, other]
if type(other) != Unit:
raise TypeError(f"Type {type(other)} cannot be compared with type Unit")
if self.unit != other.unit:
raise TypeError(f"Unit type {other.unit} is not identical to {self.unit}")
return [self.value, other.value]
def __eq__(self, other):
values = self.__get_comparison_values(self, other)
return values[0] == values[1]
def __lt__(self, other):
values = self.__get_comparison_values(self, other)
return values[0] < values[1]
def __gt__(self, other):
values = self.__get_comparison_values(self, other)
return values[0] > values[1]
class Tag():
def __init__(self, filename, data):
# Check to make sure the data is 1KB
if len(data) != TOTAL_BYTES:
raise TagLengthMismatchError(len(data))
# Store the raw data
self.filename = filename
self.blocks = list(data[0+i:BYTES_PER_BLOCK+i] for i in range(0, len(data), BYTES_PER_BLOCK))
# Check for blank blocks
for bi in IMPORTANT_BLOCKS:
if self.blocks[bi] == b'\x00' * BYTES_PER_BLOCK:
print(f"Warning! Block {bi} is blank!")
# Parse the data
self.data = {
"uid": bytes_to_hex(self.blocks[0][0:4]),
"filament_type": bytes_to_string(self.blocks[2]),
"detailed_filament_type": bytes_to_string(self.blocks[4]),
"filament_color": "#" + bytes_to_hex(self.blocks[5][0:4]),
"spool_weight": Unit(bytes_to_int(self.blocks[5][4:6]), "g"),
"filament_length": Unit(bytes_to_int(self.blocks[14][4:6]), "m"),
"filament_diameter": Unit(bytes_to_float(self.blocks[5][8:12]), "mm"),
"spool_width": Unit(bytes_to_int(self.blocks[10][4:6]) / 100, "mm"),
"material_id": bytes_to_string(self.blocks[1][8:16]),
"variant_id": bytes_to_string(self.blocks[1][0:8]),
"nozzle_diameter": Unit(round(bytes_to_float(self.blocks[8][12:16]), 1), "mm"),
"temperatures": {
"min_hotend": Unit(bytes_to_int(self.blocks[6][10:12]), "C"),
"max_hotend": Unit(bytes_to_int(self.blocks[6][8:10]), "C"),
"bed_temp": Unit(bytes_to_int(self.blocks[6][6:8]), "C"),
"bed_temp_type": bytes_to_int(self.blocks[6][4:6]),
"drying_time": Unit(bytes_to_int(self.blocks[6][2:4]), "h"),
"drying_temp": Unit(bytes_to_int(self.blocks[6][0:2]), "C"),
},
"x_cam_info": self.blocks[8][0:12],
"tray_uid": self.blocks[9],
"production_date": bytes_to_date(self.blocks[12]),
"unknown": bytes_to_string(self.blocks[13]), # Appears to be some sort of date -- on some tags, this is identical to the production date, but not always
}
def __str__(self, blocks_to_output = IMPORTANT_BLOCKS):
result = ""
for key in self.data:
if type(self.data[key]) == dict:
result += f"- {key}:\n"
for tkey in self.data[key]:
result += f" - {tkey}: {self.data[key][tkey]}\n"
else:
result += f"- {key}: {bytes_to_hex(self.data[key]) if type(self.data[key]) == bytes else self.data[key]}\n"
return result[:-1]
def print_blocks(self, blocks_to_output = IMPORTANT_BLOCKS):
for b in range(len(self.blocks)):
if b not in blocks_to_output:
continue
print(f"Block {b:02d}: {bytes_to_hex(self.blocks[b], True)} ({self.blocks[b]})")
def compare(self, other, blocks_to_compare = COMPARISON_BLOCKS):
cmp_result = [[False for i in range(BYTES_PER_BLOCK)] for b in blocks_to_compare]
# Compare all of the blocks
for bi in range(len(blocks_to_compare)):
b = blocks_to_compare[bi]
for i in range(BYTES_PER_BLOCK):
cmp_result[bi][i] = self.blocks[b][i] == other.blocks[b][i]
# Print results
for bi in range(len(cmp_result)):
print("Block {0:02d}: {1}".format(blocks_to_compare[bi], "".join("✅" if i else "❌" for i in cmp_result[bi])))
def load_data(files_to_load, silent = False):
data = []
for filename in files_to_load:
try:
with open(filename, "rb") as f:
newdata = Tag(filename, f.read())
data.append(newdata)
except TagLengthMismatchError:
if not silent: print(f"{filename} not a valid tag, skipping")
return data
def print_data(data, print_comparisons):
for i in range(len(data)):
tag = data[i]
print(tag.filename)
print(tag)
print()
if print_comparisons and i > 0:
tag.compare(data[i-1])
print()
if __name__ == "__main__":
data = load_data(sys.argv[1:])
print_data(data, False)