adamlaurie / rfidiot Goto Github PK
View Code? Open in Web Editor NEWpython RFID / NFC library & tools
Home Page: http://www.rfidiot.org/
python RFID / NFC library & tools
Home Page: http://www.rfidiot.org/
Python 2.x will no longer be supported by their upstream developers in 2020. Thus Debian developers are actively removing Python 2 support in Debian Testing with the goal of getting rid of Python 2 in Debian 11 (bullseye).
Kali is tracking Debian Testing and is thus affected by this. You should consider to switch RFIDIOt to Python 3.
FWIW this is tracked in https://gitlab.com/kalilinux/packages/rfidiot/issues/1 on the Kali side.
When I try to use the writeblock function defined in RFIDIOT.py with the option readertype=READER_LIBNFC defined in init.py i get the error "9000 no further qualification" which is weird as this code is not an error code but a code to point out a well processed command in ISO7816
As i looked out into the code, it turned out that the function writeblock only has code for READER_FROSCH, READER_AGC and READER_PCSC.
Is READER_LIBNFC supported with the writeblock operation ?
Thanks for the attention,
Erwan
I spent a lot of time trying to figure out what was going wrong and eventually managed to read my Russian passport by simply changing timeout=-1
to timeout=0
(which is infinite).
Loving the library - see it hasn't been updated in a while though. BIt of an RFID noob, just wondering if any of these scripts specifically support HID iClass cards?
It looks like the ACR122 reader isn't supported for pn532emulate.py. It's not in the officially supported readers list, and if I try anyway I get the following error:
Traceback (most recent call last):
File "pn532emulate.py", line 135, in <module>
status= card.acs_send_apdu(PN532_APDU['TG_INIT_AS_TARGET']+mode+sens_res+uid+sel_res+felica+nfcid+lengt+gt+lentk+tk)
File "/home/nvidia/Documents/RFIDIOt/rfidiot/RFIDIOt.py", line 1186, in acs_send_apdu
result, sw1, sw2= self.acs_transmit_apdu(apduout)
File "/home/nvidia/Documents/RFIDIOt/rfidiot/RFIDIOt.py", line 1231, in acs_transmit_apdu
sw1 = response[-2]
IndexError: list index out of range
What would it take to get pn532emulate.py working with this reader?
Hello, when I run any of the examples (like multiselect.py) with not any cart on my reader (ACR122U) an error is thrown :
Failed to control: Transaction failed.
Did you set DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED in ifdDriverOptions in libccid_Info.plist?
Do you have any idea?
Hi,
I apologize in advance for posting this here, there just does not seem to be a forum dedicated to rfidiot.
I'm starting a project for an NFC toolkit GUI based on rfidiot, but I cannot seem to make it detect my reader (a PN533-based Ask LoGo). I thought rfidiot was based on libnfc, but nfc-list can access my reader without trouble, whereas rfidiot gives me:
"There is no such reader #0, PCSC sees only 0 reader(s)".
I'm using libnfc 1.7.0 in a Kali Linux VM, running in VMWare, my C programs based on libnfc work perfectly on it.
When I try using the VMWare CCID driver instead of the libnfc one, rfidiot detects my reader but is still unable to select any card I present.
Any thoughts on that? Is this a compatibility issue with the newest API? Should I downgrade to libnfc 1.6 ?
Sorry and thank you!
When I try to run any python file, i get this error.
NameError: global name 'smartcard' is not defined
Let me know how we can resolve this.
I looked for it in archive.org wayback machine and there seems to be some kind of redirect to http://www.hidglobal.com - do you have a more modern link? Most of the device links in http://www.rfidiot.org/documentation.html#mozTocId711704 seem stale too.
I seem to have a problem making my ACS ACR38U communicate with RFIDIOt.
I'm using Ubuntu 14.04. I have also downloaded the dependencies.
pcsc_scan command is executed successfully and shows reader as: Reader
0: ACS ACR 38U-CCID 00 00
I set my device as readertype= RFIDIOt.rfidiot.READER_PCSC in the RFIDIOtconfig.py file.
When I run command ./cardselect -L i get the below error, any suggestions on how to solve it?
bob@bob-HP-250-G3-Notebook-PC:~/RFIDIOt$ sudo python ./cardselect.py -L
Traceback (most recent call last):
File "./cardselect.py", line 25, in
import rfidiot
File "/home/bob/RFIDIOt/rfidiot/init.py", line 187, in
card= RFIDIOt.rfidiot(readernum,readertype,line,speed,timeout,rfidiotglobals.Debug,noinit,nfcreader)
File "/home/bob/RFIDIOt/rfidiot/RFIDIOt.py", line 160, in init
self.acs_set_retry(to)
File "/home/bob/RFIDIOt/rfidiot/RFIDIOt.py", line 1319, in acs_set_retry
return self.acs_send_apdu(self.PCSC_APDU['ACS_SET_RETRY'])
File "/home/bob/RFIDIOt/rfidiot/RFIDIOt.py", line 1186, in acs_send_apdu
result, sw1, sw2= self.acs_transmit_apdu(apduout)
File "/home/bob/RFIDIOt/rfidiot/RFIDIOt.py", line 1210, in acs_transmit_apdu
result, sw1, sw2= self.pcsc_connection.transmit(apdu,protocol=
self.pcsc_protocol)
File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.5-py2.7-linux-x86_64.egg/smartcard/CardConnectionDecorator.py",
line 82, in transmit
return self.component.transmit(bytes, protocol)
File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.5-py2.7-linux-x86_64.egg/smartcard/CardConnection.py",
line 146, in transmit
data, sw1, sw2 = self.doTransmit(bytes, protocol)
File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.5-py2.7-linux-x86_64.egg/smartcard/pcsc/PCSCCardConnection.py",
line 205, in doTransmit
SCardGetErrorMessage(hresult))
smartcard.Exceptions.CardConnectionException: Failed to transmit with
protocol T0. Transaction failed.
.
Hello,
What is the actual license of rfidiot? I had the impression that it was GPLv2, but it seems it has additional restrictions. The license in rfidiot-cli.py mentions:
"For non-commercial use only, the following terms apply - for all other uses, please contact the author:"
and an excerpt of GPLv2 follows.
You cannot impose additional restrictions to GPLv2, such as non-commercial use only, so clearly this isn't not a GPLv2-licensed application.
Hi,
the script is pretty cool but by getting the mifare password out of the DKeyA and DKeyB I've some problems:
mifarekeys v0.1b
DKeyA: FEFEFEFEFEFE7E00
DKeyB: 007EFEFEFEFEFEFE
Traceback (most recent call last):
File "mifarepwd.py", line 119, in
des3= DES3.new(deskeyABA,DES.MODE_CBC,'\0\0\0\0\0\0\0\0')
File "C:\Python33\lib\site-packages\Crypto\Cipher\DES3.py", line
return DES3Cipher(key, _args, *_kwargs)
File "C:\Python33\lib\site-packages\Crypto\Cipher\DES3.py", line
__
blockalgo.BlockAlgo.init(self, _DES3, key, _args, *_kwargs)
File "C:\Python33\lib\site-packages\Crypto\Cipher\blockalgo.py",
init
self._cipher = factory.new(key, _args, *_kwargs)
ValueError: Invalid key size (must be either 16 or 24 bytes
got this today trying to wipe a card
`shane@laptop:~/nfc/RFIDIOt$ sudo python formatmifare1kvalue.py
formatmifare1k v0.1c (using RFIDIOt v1.0i)
Reader: PCSC ACS ACR122U PICC Interface 00 00
(Firmware: ACR122U214)
Card ID: XXXXXXXX
*** Warning! This will overwrite all data blocks! Proceed (y/n)? y
sector 01: Keytype: FF
block 04: Value: 00000000
Traceback (most recent call last):
File "formatmifare1kvalue.py", line 55, in <module>
if card.writevalueblock((sector * 4) + block,data):
File "/home/shane/nfc/RFIDIOt/rfidiot/RFIDIOt.py", line 1770, in writevalueblock
self.ser.write('wv%02x%s' % (block,data))
AttributeError: rfidiot instance has no attribute 'ser'
I tried to use pn532mitm.py with 2 acr122 to read and emulated.
The part to read no have problem, wait for a card and when the card is closed read and wait for emulated, in this step get trouble in
emulator.acs_send_apdu(PN532_APDU['TG_INIT_AS_TARGET']+mode+sens_res+uid+sel_res+felica+nfcid+lengt+gt+lentk+tk
The error is:
Traceback (most recent call last):
File "pn532mitm.py", line 315, in <module>
status= emulator.acs_send_apdu(PN532_APDU['TG_INIT_AS_TARGET']+mode+sens_res+uid+sel_res+felica+nfcid+lengt+gt+lentk+tk)
File "$HOME/RFIDIOt/rfidiot/RFIDIOt.py", line 1212, in acs_send_apdu
result, sw1, sw2= self.acs_transmit_apdu(apduout)
File "$HOME/RFIDIOt/rfidiot/RFIDIOt.py", line 1258, in acs_transmit_apdu
sw1 = response[-2]
IndexError: list index out of range
The readers information is:
Reader NXP PN532 Firmware:
IC: 32
Rev: 1.6
And the command that used was
python pn532mitm.py -r 0 1
Can someone help me with this problem??
the error is: error 6300 No information given
(the driver ok, i can read data succ and the card is mifare1k)
my environment is: mac os sierra 10.12.3
really hope get the answer
This happens because you fill empty optional data with X
instead of <
and as a result last two check digits end up being wrong.
Hi Adam,
Currently working on a project which uses your awesome lib to read out two touchatag readers (using libnfc). I've ran into a problem though. We also need to read out another serial data coming from an arduino, but whenever I start a serial.read() (one the arduino port) the readers stall.
In our while loop we have:
while 42:
msg = ser.readline().strip()
if card1.select():
#dostuff
if card2.select():
#dostuff
If we remove the ser.readline() the readers work fine, whenever it's there, the readers stall.
Any idea what's causing this?
Thanks a bunch,
Kevin
Hi and many thanks for the work.
Is it supposed to work with nfc tag213 with 144bytes ?
I try to use the readcard example but it seems not to work.
Many thanks
Hello,
I'm trying to create a package of rfidiot in Fedora 20 which ships libnfc 1.7.0. I'm testing with omnikey CardMan 5321 and when I run:
/usr/bin/cardselect.py -N
I get a segmentation fault.
A valgrind backtrace (don't know how helpful it is), is as follows:
==11960== Invalid read of size 1
==11960== at 0x4A092F2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11960== by 0x3E0309821F: PyString_FromString (stringobject.c:121)
==11960== by 0xCFC8E58: _ctypes_callproc (callproc.c:927)
==11960== by 0xCFC2A84: PyCFuncPtr_call (_ctypes.c:3929)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== by 0x3E030DE38B: PyEval_EvalFrameEx (ceval.c:4316)
==11960== by 0x3E030E098F: PyEval_EvalFrameEx (ceval.c:4184)
==11960== by 0x3E030E21EC: PyEval_EvalCodeEx (ceval.c:3330)
==11960== by 0x3E0306F0F7: function_call (funcobject.c:526)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== by 0x3E030590C4: instancemethod_call (classobject.c:2602)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== Address 0x20 is not stack'd, malloc'd or (recently) free'd
==11960==
==11960==
==11960== Process terminating with default action of signal 11 (SIGSEGV)
==11960== Access not within mapped region at address 0x20
==11960== at 0x4A092F2: strlen (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11960== by 0x3E0309821F: PyString_FromString (stringobject.c:121)
==11960== by 0xCFC8E58: _ctypes_callproc (callproc.c:927)
==11960== by 0xCFC2A84: PyCFuncPtr_call (_ctypes.c:3929)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== by 0x3E030DE38B: PyEval_EvalFrameEx (ceval.c:4316)
==11960== by 0x3E030E098F: PyEval_EvalFrameEx (ceval.c:4184)
==11960== by 0x3E030E21EC: PyEval_EvalCodeEx (ceval.c:3330)
==11960== by 0x3E0306F0F7: function_call (funcobject.c:526)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== by 0x3E030590C4: instancemethod_call (classobject.c:2602)
==11960== by 0x3E0304A0C2: PyObject_Call (abstract.c:2529)
==11960== If you believe this happened as a result of a stack
==11960== overflow in your program's main thread (unlikely but
==11960== possible), you can try to increase the size of the
==11960== main thread stack using the --main-stacksize= flag.
==11960== The main thread stack size used in this run was 8388608.
The equivalent for PCSC works pretty ok:
$ cardselect.py -L
PCSC devices:
No: 0 OMNIKEY CardMan 5321 (OKCM0072903120829265736952848153) 00 00
Any ideas?
Hello @AdamLaurie!
Is it possible to put the package on pypi.python.org so it can be installed directly using pip
?
I can do it if you no time anymore for that.
After installing the library I try to run pn532emulate.py but I get:
ImportError: No module named Crypto.Hash
I have installed pycrypto but then I seen that is DEPRECATED. Also I have seen this:
https://www.daniweb.com/programming/software-development/threads/476126/importerror-no-module-named-crypto-cipher
Is this lib compatible with Windows or I have to run in Linux OS?
What would people think? It seems to me that the libraries in /rfidiot are the most important feature of the repository (other projects may want to use it as a submodule).
Does anyone else agree?
i want to write data to certain mifare ultralignt c page , i need help please urgent
There are many tools which expect that all Python modules can be imported without any side-effect. Unfortunately rfidiot is not in that category, when you import the module it will exit with an error messages like this one:
There is no such reader #0, PCSC sees only 0 reader(s)
In Kali Linux, we got this bug report showing an application feature that is broken by rfidiot:
https://bugs.kali.org/view.php?id=4056
Please refactor the code to avoid such side effects at import time.
Hello adam
i have omnikey Reader 5021 CL
I can read the uid
I need simple python program like readmifare1k.py to:
1)read data from specific sector Example sector 4 and not all sector
2)Write data to specific sector example :
Data=myname
How can i do it??
3)change authentification default key FFFFFFFFFFFF
To specific key example :
mifarekey='my secret'
There is no such reader #0, PCSC sees only 0 reader(s)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.