Last active
August 29, 2015 14:09
-
-
Save mbarrerar/41747d152e26beed35a4 to your computer and use it in GitHub Desktop.
Pof Write NFC CARD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-nfc' | |
require 'logger' | |
$logger = Logger.new(STDOUT) | |
def p(str) | |
$logger.debug str | |
end | |
readers = NFC::Reader.all | |
readers[0].poll(Mifare::Classic::Tag) do |tag| | |
begin | |
p "Applied #{tag.class.name}: #{tag}" | |
case tag | |
when Mifare::Classic::Tag | |
if auth(1, :key_b, "FFFFFFFFFFFF") | |
p "Contents of block 0x01: #{tag.read.unpack('H*').pop}" | |
nro = '00000000f4f0ba000000000000000090'.bytes.to_a.pack('C*') | |
tag.write(nro) | |
processed! | |
end | |
end | |
rescue Exception => e | |
p e | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment