A Node.js console application for reading and writing data to NFC cards.
- 🔍 Automatic card detection - Detects when NFC cards are placed on the reader
- 📖 Read support - Read data from various NFC card types
- ✍️ Write support - Write custom text data to NFC cards
- 🎯 Interactive prompts - User-friendly command-line interface
- 🔄 Continuous operation - Keeps running and detects multiple cards
- 📋 Detailed card info - Shows UID, type, standard, and ATR
- MIFARE Ultralight (fully supported - automatic detection)
- MIFARE Classic (1K, 4K)
- MIFARE DESFire
- ISO-DEP cards
- Most ISO 14443-3 and ISO 14443-4 compatible cards
- NDEF formatted tags
The application automatically detects the card type by analyzing the ATR (Answer To Reset) and adjusts its behavior accordingly:
- MIFARE Ultralight: Uses 4-byte page addressing (pages 0-15+)
- MIFARE Classic: Uses 16-byte block addressing with sector authentication (blocks 0-63)
- Other cards: Attempts standard NDEF or ISO-DEP operations
- Install PC/SC driver (usually pre-installed on Windows 10/11)
- NFC reader compatible with PC/SC (e.g., ACR122U, PN532)
- PC/SC driver is built-in
- NFC reader compatible with PC/SC
- Install
pcscdpackage:sudo apt-get install pcscd pcsc-tools
- NFC reader compatible with PC/SC
- Install dependencies:
npm install-
Connect your NFC reader to your computer
-
Run the application:
npm start-
Run the application with
npm start -
Place an NFC card on the reader
-
Choose from the menu:
- Read - Displays all readable data from the card
- Write - Prompts for text input and writes it to the card
- Skip - Ignores the current card
-
Remove the card when done
-
Place another card to continue, or press
Ctrl+Cto exit
When writing data:
- Select "Write" from the menu
- Enter the text you want to write
- Confirm the operation
- The data will be written starting from block 4 (to preserve system blocks)
- The application will verify the write operation
Note:
- Writing requires authentication (uses default key: FF FF FF FF FF FF)
- Some cards may be write-protected
- System blocks (0-3) are preserved to avoid damaging the card
The application attempts to read data using different methods based on card type:
- MIFARE Classic: Reads all 64 blocks (1K cards) with authentication
- ISO-DEP cards: Attempts to read NDEF application data
- Other cards: Reads common NDEF data locations
All readable data is displayed in both hexadecimal and ASCII format.
- Ensure your NFC reader is properly connected
- Check that drivers are installed (PC/SC)
- Try unplugging and reconnecting the reader
- The card may use different keys than the default
- Try different MIFARE keys or consult card documentation
- Ensure the card is properly placed on the reader
- Some readers require the card to be centered
- Try removing and replacing the card
This application uses default MIFARE keys (FF FF FF FF FF FF). For production use with sensitive data, you should:
- Use custom keys for authentication
- Implement proper key management
- Add encryption for sensitive data
- Follow security best practices for your specific use case
MIT