-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B21: Hack to not waste labels during testing #34
Comments
I assumed the RFID tags are read-only, and label counting is done on the app's side... Is it completely wrong then? Also linking kjy00302#4 as related |
I cannot say for sure, but the tag is definitely being written after the print. I will attach some logs This is how the communication looks like when lid is closed (no writes)
and this is when printing is completed:
It appears that the blocks 5 and 6 are being updated and it seems to be more complex than just a simple counter however i do not expect any difficult cryptography (judging from tag being protected with password 12345678) Additionally I do not know if the tag serial is not being stored in the persistent memory of the printer with a secondary counter. So it could be that the tags will expire even if the tag does not get written, but it should be at least be possible to use it in different printer. |
It would be interesting to check how the printer behaves when the label limit of rfid tag is exceeded (density will drop or not). |
I can confirm it. I have two printers.
Also official niimbot apps send label quota to the server: Upd: Tried to rewrite RFID tag contents to previous values (thanks to @etaloncop password) with rc522 module. Write is successful, but it seems like the printer is storing tag data inside internal memory and rewrites the tag if printer pages count is less than previous. |
@MultiMote Thank you so much for your research. Based on your findings i conclude that there is no way to easily overcome the label counting in the printers internal memory. I might attempt to dump the printer firmware and reverse engineer the firmware, but since this is very labor and time intensive I dont see myself doing it any time soon. Edit: Would be good idea to check if the SWD is unlocked. If that is the case dumping the firmware should be walk in the park |
@MultiMote One more idea, in theory it should be possible to lock the tag so its read only. I wonder if that might make it last forever. If the safety mechanism is implemented correctly it will not make a difference, however there is a chance that it might work. |
@etaloncop tried to lock pages 5 and 6 (lock bits are 3 and 4 byte of page 2).
The printer is no longer able to write data to these pages (tested with reader). |
RFID BLK 5, 6 are printed count. blk 5/6 seems like one is the real count data, another is the CRC. BLK 7-34 are fixed label data. The label RFID DATA are encrypted by TEA or DES. Because the BLOCK size is 16 bytes. I did some test on the B1. It seems the only way to stop count increase is to remove rfid from label roll, and put the rfid under the printer and close the lid.(Usually, I try for 3 times, the printer is not 100% detected RFID when RFID under the printer.) If the printer detected RFID, you can remove the rfid and print staffs, the printer will not tracker the count at this condition. For APP side. After each print. The app send log data to Another host is Block these two hosts should make APP work or just use 3-rd client to print. |
FW (5.14) for B1 (HW 5.10) - https://oss-print.niimbot.com/public_resources/font/0493a15092a6dabc452023234a1beb45.bin |
@cryoz Wow awesome job, thanks Once I have more time i will take closer look on the binaries |
@cryoz |
@cryoz my B1 revision (HW 5.10) has pin labels, looks like it is uart in my case (in your case it looks like SWD indeed, D - DIO, C - CLK, G - GND, V - VCC). |
yes, it's uart, but it's useless for now - only output |
well, some results from firmware: |
Well, customized dump for rfid tag successfully accepted by printer. dump structure almost finished, just increase print limit number, zeroing already printed pages counter and - if you want - change serial number for this tag. cannot say if official app accept this custom tag, but i don't use these apps. printer saves print limit and printed count in SRAM followed by tag serial in blocks 7-8, not UID of tag. cannot say if sram is zeroed after battery power disconnect, but sram is not infinite. |
Good luck guys. If u not use the app, just random generate a tag data and write them to a NTAG215 tag then everything fine. |
I did this long time ago, some detailed information already forgot... block 5 is printed label cnt. |
Be careful guys. I'm not sure it's a good idea to keep it in the public domain. |
FW for D11 (12.21) - https://niimbot-bison.oss-cn-hangzhou.aliyuncs.com/public_resources/font/6cb97e175a1ad1728756e2b8b40c344b.bin |
There is only so much the manufacturer could do, his hands are tied, afterall they need to keep backwards compatibility. Its better if community has resources on how to defeat the measures. |
i think, manufacturer is not main problem. Profiteers are real problem - selling universal tags for example. |
I will look into the swd interface then, if it is there and enabled. It could be used for precisely that. |
b1 and d11 don't have ARTERY CPU and based only on YC3121 CPU, sdk and datasheet are very hard to find, only datasheet i found is here (chinese): https://www.ycble.cn/apks/yc_file/YC3121%EF%BC%88BT%EF%BC%89%E8%8A%AF%E7%89%87%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV2.0.pdf |
you also need to remove editing history. |
If we can figure out how to reflash the firmware. Just need to mask few instructions then the rfid is no longer necessary and will not affect the print quality. In the disassembly code, the printer force lower the printing density if the rfid result false. |
we can reflash firmware. WIndows app includes printer server and electron webapp. webapp communicating with printer via printserver by simple websocket protocol.
|
I found fw for my printer version (B1 HW 3.01), patched and flashed it by (updated) script above. All is perfect now, printer worked like intended :) |
@cryoz how |
@MultiMote CRC32 of whole fw file. Here simple script:
Insert that 8-digit hex number into strCrc parameter as is. |
Trying to flash firmware from this comment #34 (comment) |
you shoud use full path of firmware file for filename parameter, jcPrint server cannot find file in his current directory without full path :) |
Oh, my really stupid error 😂 |
i can patch fw 5.14 for b1 and upload patched firmwares for B1 HW 3.01 or D11_H HW 4.01, but i don't think github is right place for that. |
use telegram to upload the file and paste link here, should be fine. Or someone could create a telegram group. |
EDIT: Read first. Thanks to findings by @MultiMote it appears the printer itself stores the tag serial number as well. So the methods described bellow are not working.
Been playing with my printer for quite a while and went throught quite a few labels. The printer has a Mifare ultralight tag inside every roll that is read and written with remaining count of labels after every print. The tag only appears to be written only after the print so if the tag is not inside the machine when the print is finished the machine will not reduce the amount of remaining labels. However the tag needs to be present at the time of closing the lid of the machine, otherwise it will print misaligned and defective labels.
The dirty hack
For testing purposes you can insert just a limited number of labels (or even unofficial labels) into the machine without the spool with the tag. when closing the lid place the tag with the spool underneath the machine roughly to the same position where the spool would normally sit inside. Once the machine recognizes the tags remove the spool and continue printing. This needs to be repeated after every reboot or opening of the lid.
Some other info
The tags are mifare ultralight (as already mentioned) with a every strong password of 12345678 (HEX)
here is a dump of my tag before and after printing a label, if anyone feels like reverse engineering the format
UID: 1D91AF2B071080 (HEX)
Before:
After:
after.json
before.json
Enjoy
The text was updated successfully, but these errors were encountered: