Skip to main content

ctypeslib converted libnfc and libfreefare with just enough of the interals to actually be usable.

sudo apt install libfreefare-dev
pip install pynfc
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

Download files

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

Source Distribution

pynfc-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

File details

Details for the file pynfc-0.1.1.tar.gz.

File metadata

  • Download URL: pynfc-0.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

File hashes

Hashes for pynfc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dca9a7aa364d6bbfa4dc56afb13993263eb41a32f087205601f748ee593a6cac
MD5 2ce8e3acf2da3e952935604a7ada1ad4
BLAKE2b-256 086329d09b71ad116e33e659846fabc4e6c662852c37e80d20737af990fb3688

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 file

0.0.4

1 file

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page