To write a Python script that does the DESFire UID manipulation, please refer to the steps below:
Step 1:
Create a new MIFARE DESFire definition, according to your preferences.
Step 2:
Insert a Text box on the card.
Step 3:
A window will pop-up and you change the “Fixed Value” to “Script”.
Step 4:
After you change the “Fixed Value” to “Script” you define it as uid_var. Then another window will appear, it’s where you attribute the uid_var the value of UID. Then Press Ok.
Step 5:
Your Insert new object window should look as the image that follows and then you click on the arrow on the left side of varuid.
Step 6:
Select MIFARE DESFire UID.
Step 7:
Go to functions.
On the Functions tab insert the Python Script.
Example: Last 8 Numbers
uid = uid_var
str = str(uid)
x = len(str)
uid_var = str[x-8:x]
Code explanation:
uid = uid_var
str = str(uid)
sizeOfUid = len(str)
numberOfChars = 8
uid_var = str[sizeOfUid-numberOfChars:sizeOfUid]
str = str(uid)
sizeOfUid = len(str)
numberOfChars = 8
uid_var = str[sizeOfUid-numberOfChars:sizeOfUid]
Close the properties window, save the changes made and you should have the expected result.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article