Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/barnabyshearer/pynfc

`ctypeslib` converted libnfc and libfreefare.
https://github.com/barnabyshearer/pynfc

desfire mifare nfc rfid

Last synced: about 5 hours ago
JSON representation

`ctypeslib` converted libnfc and libfreefare.

Awesome Lists containing this project

README

        

..
Autogenerated by https://github.com/BarnabyShearer/meta

=====
pynfc
=====
.. image:: https://readthedocs.org/projects/pynfc/badge/?version=latest
:target: https://pynfc.readthedocs.io/en/latest/
.. image:: https://img.shields.io/pypi/v/pynfc?color=success
:target: https://pypi.org/project/pynfc

`ctypeslib` converted libnfc and libfreefare.

Install
-------

.. code-block:: bash

sudo apt install libclang-dev libfreefare-dev
python3 -m pip install pynfc

Usage
-----

.. code-block:: python

from pynfc import Nfc, Desfire, Timeout

n = Nfc("pn532_uart:/dev/ttyUSB0:115200")

DESFIRE_DEFAULT_KEY = b'\x00' * 8
MIFARE_BLANK_TOKEN = b'\xFF' * 1024 * 4

for target in n.poll():
try:
print(target.uid, target.auth(DESFIRE_DEFAULT_KEY if type(target) == Desfire else MIFARE_BLANK_TOKEN))
except TimeoutException:
pass

Develop
-------

.. code-block:: bash

sudo apt install libfreefare-dev libclang-5.0-dev
git clone https://github.com/BarnabyShearer/pynfc.git
cd pynfc
python3 setup.py develop --user