Giter VIP home page Giter VIP logo

py-acr122u's People

Contributors

davidblore avatar flowtter avatar robertdijk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

py-acr122u's Issues

Can't read other blocks than from sector 0

Hi,

Thanks for this project ! It helps me a lot.

I face a kind of problem because I can authenticate on sector 0 and read block 1,2 and 3. But I don't manage to read others blocks frorm others sectors.
I would like to read blocks from sector 7, for instance!

Below is an extract of my code.
sector_id can vary from 0 to 15.
KEYS dict is correctly populated somewhere else!

KEY_A = 0x60
KEY_B = 0x61
KEY_LOCATION = 0x01
KEY_VALUE = KEYS[sector_id][KEY_A]

reader.load_authentication_data(KEY_LOCATION, KEY_VALUE)
reader.authentication(sector_id, KEY_A, KEY_LOCATION)

BYTES_COUNT_TO_READ = 16
print("".join(int_list_to_string_list(reader.read_binary_blocks(1, BYTES_COUNT_TO_READ)))) # This is only OK for sector 0
print("".join(int_list_to_string_list(reader.read_binary_blocks(2, BYTES_COUNT_TO_READ)))) # This is only OK for sector 0

Regards,
JD

Errors installing py122u

I run "pip install py122u" but get following errors:

`Collecting py122u
Using cached py122u-2.3.5-py3-none-any.whl.metadata (2.8 kB)
Collecting pyscard>=2.0.7 (from py122u)
Using cached pyscard-2.0.7.tar.gz (152 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Using cached py122u-2.3.5-py3-none-any.whl (8.3 kB)
Building wheels for collected packages: pyscard
Building wheel for pyscard (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pyscard (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Package libpcsclite was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcsclite.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpcsclite' found
running bdist_wheel
running build
running build_py
running build_ext
building 'smartcard.scard._scard' extension
swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
error: command 'swig' failed: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyscard
Failed to build pyscard
ERROR: Could not build wheels for pyscard, which is required to install pyproject.toml-based projects`

Instruction authentication failed after writing to another block inside my MIFARE CLASSIC 1K

I'm facing a problem after writing to another block different than 0x01.
After writing to another block, i can't authenticate to previous the blocks that i have wrote data.
My code

from nfc import nfc as nfcReader

reader = nfcReader.Reader()
block_number = 0x01
custom_number = 0x20
key_location = 0x01
reader.load_authentication_data(key_location, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
reader.authentication(block_number, 0x61, key_location)

def write(position=block_number, number=custom_number, data=[0x00 for i in range(16)]):
    """ Write data to mifare tag
    Example:
        write(reader, 0x01, 0x20, [0x00 for i in range(16)])
    """

    while number >= 16:
        write_16(reader, position, 16, data)
        number -= 16
        position += 1


def write_16(r, position, number, data):
    
    r.update_binary_blocks(position, number, data)


def read(position=block_number, number=custom_number):
    """ Read data from mifare tag
    >>> read(reader, 0x01, 0x20)
    """
    print(f'block {block_number}')
    result = []
    while number >= 16:
        result.append(read_16(position, 16, reader))
        number -= 16
        position += 1
    return result


def read_16(position, number, r):
    return r.read_binary_blocks(position, number)

Get only 8 hexadecimal uid

Hello,

is it possible to read the UID from the reader in such a way that only the 8 digit hexadecimal is read like on an HID reader?

I would like to get the same values as an HID reader in order to establish the assignment via such a reader and to connect the ACR122 to the Raspberry and scan the card there for use on the Pi.

Unfortunately, I only get a 16-digit hex number.

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.