Code Monkey home page Code Monkey logo

pyrfidhid's Introduction

pyrfidhid

Python library to control Chinese USB HID 125Khz RFID Reader/Writer

Introduction

This library is the result of reverse-engineering the communication protocol of a Chinese USB 125Khz RFID Reader/Writer. A detailed document describing the whole procedure can be found at the wiki section of this project:

How to reverse engineer a USB HID RFID Reader/Writer

The library can be used to control the USB RFID device under Linux or MacOS, and it uses pyusb and libusb to communicate through the USB port.

Installation

You will need Python 2.7.x or greater, and pip. Just clone this repo, install the dependencies and run the setup.py script.

MacOS

$ brew install libusb
$ pip install pyusb --user
$ python setup.py install --user

Linux

$ sudo apt-get install libusb-1.0-0-dev
$ sudo pip install pyusb
$ sudo python setup.py install

Usage

The library should work with both Python 2.7.x and 3.x. After running the setup.py script you should be able to import and use the library within your project like this:

from rfidhid.core import RfidHid

try:
    # Try to open RFID device using default vid:pid (ffff:0035)
    rfid = RfidHid()
except Exception as e:
    print(e)
    exit()

payload_response = rfid.read_tag()
uid = payload_response.get_tag_uid()

rfid.beep()
print(uid)

The above script should try to connect to the device, read a Tag (if it is already close to the device), print the UID and beep.

For more complex read/write examples, please check out the examples folder.

You can also check the API documentation for a list of exported methods.

RFID CLI Tool

A command line tool called rfid_cli is also included with the library, and it can be used to read, write and clone tags. For a complete documentation please check rfid_cli documentation

Final notes

If you are looking for an Android tool similar to IDRW V3 you can check this project

pyrfidhid's People

Contributors

charlysan avatar danieltwagner avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.