Skip to content

A consol app that allows you to read/write NFC MIFARE Classic and Ultralight cards.

Notifications You must be signed in to change notification settings

SuperGamer001/NFC-RW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFC Reader/Writer Application

A Node.js console application for reading and writing data to NFC cards.

Features

  • 🔍 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

Supported Card Types

  • 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

Automatic Card Detection

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

Prerequisites

Windows

  • Install PC/SC driver (usually pre-installed on Windows 10/11)
  • NFC reader compatible with PC/SC (e.g., ACR122U, PN532)

macOS

  • PC/SC driver is built-in
  • NFC reader compatible with PC/SC

Linux

  • Install pcscd package:
    sudo apt-get install pcscd pcsc-tools
  • NFC reader compatible with PC/SC

Installation

  1. Install dependencies:
npm install
  1. Connect your NFC reader to your computer

  2. Run the application:

npm start

Usage

  1. Run the application with npm start

  2. Place an NFC card on the reader

  3. 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
  4. Remove the card when done

  5. Place another card to continue, or press Ctrl+C to exit

Writing Data

When writing data:

  1. Select "Write" from the menu
  2. Enter the text you want to write
  3. Confirm the operation
  4. The data will be written starting from block 4 (to preserve system blocks)
  5. 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

Reading Data

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.

Troubleshooting

"No NFC reader connected" error

  • Ensure your NFC reader is properly connected
  • Check that drivers are installed (PC/SC)
  • Try unplugging and reconnecting the reader

"Authentication failed" when reading/writing

  • The card may use different keys than the default
  • Try different MIFARE keys or consult card documentation

Card not detected

  • Ensure the card is properly placed on the reader
  • Some readers require the card to be centered
  • Try removing and replacing the card

Security Note

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

License

MIT

README.md written by GitHub Copilot

About

A consol app that allows you to read/write NFC MIFARE Classic and Ultralight cards.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published