勇闖新世界︰ W!o《卡夫卡村》變形祭︰神奇護照‧五

假使不介紹一下『 RFIDIOt.org 』,恐讀者會少了一個學習派生 NFC 程式的園地,故此特別的加以補足。

rfidiot qr code

News

October 2012: Migrated source code to https://github.com/AdamLaurie/RFIDIOt. I realised one of the reasons I haven’t been doing many updates is because it’s always such a faff getting a new tarball together, updating the webpage etc., etc. Now, should you be vaguely interested, you can simply watch the project on github and get notified whenever a change is committed… Even better, if you have updates you want to contribute, just fork and create a merge request… (The first of which was Nick von Dadelszen’s Android support package). Sweet!

I will follow my usual practice of ‘commit early, commit often’, so whenever I’m working on something, expect daily updates… Speaking of which, I finally got around to bringing libNFC support up to date, so it now works with libnfc 1.6.0-rc1.

………

What is RFIDIOt?

RFIDIOt is an open source python library for exploring RFID devices. It’s called “RFIDIOt” for two reasons:

  1. I like puns. This one stands for “RFID IO tools”
  2. Since I haven’t done any serious programming for a long time, I felt like an idiot having to learn a whole new language and the code probably looks like it’s written by an idiot. However, python rocks, so it was worth it!

What does it do?

It currently drives a range of RFID readers made by ACG, called the HF Dual ISO and HF Multi ISO, which are both 13.56MHz devices, and the LF MultiTag which is 125/134.2kHz. Frosch Hitag reader/writers are also now supported. There’s no reason it couldn’t work with others, these are just the first ones I got my hands on, and since they present themselves to the O/S as standard serial devices without having to install any drivers, it made interfacing very simple (but see the Technical Note section below as I’ve had some issues recently). I have written some example programs to read/write tags and have started on the library routines to handle the data structures of specific tags like MIFARE. It is far from complete but I thought I’d follow the “publish early, publish often” philosophy on this one…

PC/SC (MUSCLE) devices, such as the Omnikey CardMan are also supported. I am curently testing with a CardMan 5321.

───

 

考之以『 pynfc.py 』原始碼,

RFIDIOt/rfidiot/pynfc.py

#!/usr/bin/python
#
# pynfc.py – Python wrapper for libnfc
# version 0.2 (should work with libnfc 1.2.1 and 1.3.0)
# version 0.2a – tweaked by rfidiot for libnfc 1.6.0-rc1 october 2012
# Nick von Dadelszen (nick@lateralsecurity.com)
# Lateral Security (www.lateralsecurity.com)
# Thanks to metlstorm for python help 🙂
#
# This code is copyright (c) Nick von Dadelszen, 2009, All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

 

可知這些程式範例需要『 libnfc-1.6.0-rc1 』,底下略講取得及編譯之方法 。務須注意,不要安裝到已經裝有『 libnfc-1.7.1 』程式庫的系統上,以免發生版本衝突。

 

# libnfc 1.6.0-rc1 編譯與安裝
sudo apt-get install libudev-dev
sudo apt-get install libusb-dev
sudo apt-get install libpcsclite-dev

# 取得檔案
wget http://libnfc.googlecode.com/files/libnfc-1.6.0-rc1.tar.gz

# 編譯及安裝
./configure --prefix=/usr --sysconfdir=/etc --with-drivers=all

make

sudo make install

 

最後用

git clone https://github.com/AdamLaurie/RFIDIOt.git

取得『 RFIDIOt 』。至於說該如何開始的呢?就請讀者自行閱讀

rfidiot qr code    說明文件的了。
Documentation