PiFare is a Raspberry Pi tool for reading Mifare classic 1k cards with a RC522 module via SPI. This project is for fun and for learning RFID related things.
PiFare is based on these projects (I have changed the "print" statements to make them work with Python3):
- MFRC522-python: https://github.com/mxgxw/MFRC522-python (using it for reading with the RC522 module)
- SPI-Py: https://github.com/lthiery/SPI-Py (using commit 8cce26b9ee6e69eb041e9d5665944b88688fca68 as the last commit does not seem to work)
- First, you need to enable SPI interface in the Raspberry pi: https://pimylifeup.com/raspberry-pi-spi/
sudo raspi-config
- Connect the RC522 with the Raspberry. The wiring is described here ("Wiring the RFID RC522"): https://pimylifeup.com/raspberry-pi-rfid-rc522/
- To install necessary libs, execute the install script:
./installation/install.sh
Run the script with python3:
python PiFare.py
The script will ask for a card and read the UID. Then, it ask you if you want to bruteforce the keys (first KeysA, after that, it does the same process for KeysB) with the dictionary in the "dict" folder which contains around 1400 keys.
If you found some Keys, the script will read the data from the different blocks:
All the information related to the card read is saved in /data/{UID}.json file (I have copied the same structure as the proxmark uses). If you open the file, you can see the keys, the content of the blocks read, etc.
Here you can find useful information about Mifare Clasic 1k: https://github.com/XaviTorello/mifare-classic-toolkit
- Create a "Write" mode to write data into the cards
- Fill "AccessConditions" and "AccessConditionsText" information in the json files.