SkillAgentSearch skills...

Pynfc

`ctypeslib` converted libnfc and libfreefare.

Install / Use

/learn @BarnabyShearer/Pynfc
About this skill

Quality Score

0/100

Supported Platforms

Universal

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

Related Skills

View on GitHub
GitHub Stars17
CategoryDevelopment
Updated5mo ago
Forks4

Languages

C

Security Score

92/100

Audited on Oct 12, 2025

No findings