Skip to main content

CLI for interacting with Mifare Classic 1K cards using an ACR122U NFC reader.

Project description

RFID Client

This is a command-line interface (CLI) application for interacting with Mifare Classic 1K cards using a NFC reader.

Installation

Linux requires some libraries to be installed:

sudo apt-get update
sudo apt-get install libpcsclite-dev libpcsclite1 pcscd pcsc-tools

Installation through pip package manager

pip3 install crid

Installation from source

git clone https://github.com/VinnieV/crid.git
cd crid
pip3 install .

If the crid command is not available after using any of these installation methods, please review the detailed installation walkthrough below.

Executing from source:

git clone https://github.com/VinnieV/crid.git
cd crid
pip3 install -r requirements.txt
python3 main.py

Usage/Examples

# Read the UID of the card
crid --read_uid

# Identify the card to the user
crid --identify

# Read a block from the card using key type A and key value ffffffffffff
crid --read_block 2 --key_type A --key_value ffffffffffff

# Write "Hello, World!" to block 3 using key type B and key value a1b2c3d4e5f6
crid --write_block 3 --data "48656C6C6F2C20576F726C6421" --key_type B --key_value a1b2c3d4e5f6

# Read sector 1 from the card using key type A and key value ffffffffffff
crid --read_sector 1 --key_type A --key_value ffffffffffff

# Read all 16 sectors from the card using key type B and key value a1b2c3d4e5f6
crid --read_full --key_type B --key_value a1b2c3d4e5f6

# Find keys for a Mifare Classic card (requires mfoc binary)
crid --find_mifare_keys

# Brute force keys for block 18 using the key list file keys.txt
crid --brute_force_keys 18 --key_list mifare_access_keys_top100.lst

# Mute the buzzer on the reader
crid --mute

# Provide the flag option
crid --flag

# Enable the buzzer on the reader
crid --beep

# Set the log level to DEBUG
crid --log_level DEBUG

# Send an APDU command to the NFC device
crid --apdu_command 00A4040007A000000003101000

# Set the data format to string
crid --data_format string

API Reference

The main class in this project is RFIDClient within the cli.py source file which provides methods to interact with the NFC reader and the Mifare Classic 1K card.

Detailed Installation Walkthrough

To install the RFID Client application, follow the steps below:

  1. Clone the repository using the following command:

    git clone https://github.com/VinnieV/crid.git
    
  2. Navigate to the cloned repository:

    cd crid
    
  3. If you have Python 3 installed, pip3 should be available. If not, you can install Python 3 and pip3 by following the instructions provided in the links below:

  4. Install the application using pip3. There are two ways to install pip packages: as a user or system-wide. Choose the appropriate method based on your requirements:

    System-wide:

    pip3 install .
    

    User-wide:

    pip3 install . --user
    
  5. Add the Python Scripts directory to your PATH environment variable. This step is necessary to ensure that the crid binary is accessible from anywhere in the command prompt or terminal. The process for adding the Python path to the PATH variable differs between Windows and Linux:

    • Windows:

      • Open the Start menu and search for "Environment Variables".
      • Click on "Edit the system environment variables".
      • In the System Properties window, click on the "Environment Variables" button.
      • In the "System Variables" section, select the "Path" variable and click on "Edit".
      • Execute the following command to retrieve the path:
      pip3 show crid
      
      • Based on the Location listed there you can find the Python Scripts folder, the path should look something similar like this:
      c:\users\<username>\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\Scripts
      
      • Click "OK" to save the changes.
    • Linux:

      • Open a terminal window.
      • Edit the .bashrc or .bash_profile file in your home directory using a text editor (e.g., nano ~/.bashrc).
      • Add the following line at the end of the file, replacing <username> with the your linux username:
      export PATH="/home/<username>/.local/bin/:$PATH"
      
      • Save the file and exit the text editor.
      • Run the following command to apply the changes:
      source ~/.bashrc
      

Once you have completed these steps, you should be able to use the RFID Client application successfully.

Build for distributing

pip3 install --upgrade build
python3 -m build
pip3 install --upgrade twine
python3 -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crid-0.3.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

crid-0.3.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file crid-0.3.0.tar.gz.

File metadata

  • Download URL: crid-0.3.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for crid-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f17de896b3fb4434e5825d979ff23c0f10cc38bb94e7620477162315c5c57bf7
MD5 e26bbd1887199b4e0a30b96bb05059f0
BLAKE2b-256 1121aa1fc558f21f0660fbdf0355dc81eaac773251b8c3b0d1085e16b22c2f2a

See more details on using hashes here.

File details

Details for the file crid-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: crid-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for crid-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d694c24871c958abe96f7aff6872993474c0b19ad5b697b05e9a2d967ab8855
MD5 3f2b905ab472a7f56047ad83d7c43383
BLAKE2b-256 8b60f1aaf1c62e2b1e54d363286a913c11c4afd15d2108cc5c659b2156176983

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page