From 5f44bb2b7c8792754b4ce2b047626b8e5423e348 Mon Sep 17 00:00:00 2001 From: Roel Verdult Date: Fri, 1 May 2009 15:47:07 +0000 Subject: [PATCH] renamed simulate utility to emulate --- linux/Makefile | 2 +- macosx/Makefile | 2 +- simulate.c | 111 ---------------------- win32/{simulate.vcproj => emulate.vcproj} | 6 +- win32/libnfc.sln | 2 +- 5 files changed, 6 insertions(+), 117 deletions(-) delete mode 100644 simulate.c rename win32/{simulate.vcproj => emulate.vcproj} (92%) diff --git a/linux/Makefile b/linux/Makefile index eb602b1..ee677a9 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -27,7 +27,7 @@ LDFLAGS = -fPIC -Wall -O4 OBJS = dev_pn531.o dev_acr122.o bitutils.o libnfc.o HEADERS = devices.h bitutils.h defines.h libnfc.h LIBNFC = libnfc.$(LIBNFC_TYPE) -EXES = anticol list simulate relay mftool +EXES = anticol emulate list mftool relay all: $(LIBNFC) $(EXES) diff --git a/macosx/Makefile b/macosx/Makefile index 830768f..cab8233 100644 --- a/macosx/Makefile +++ b/macosx/Makefile @@ -27,7 +27,7 @@ LDFLAGS = -fPIC -Wall -O4 OBJS = dev_pn531.o dev_acr122.o bitutils.o libnfc.o HEADERS = devices.h bitutils.h defines.h libnfc.h LIBNFC = libnfc.$(LIBNFC_TYPE) -EXES = anticol list simulate relay mftool +EXES = anticol emulate list mftool relay all: $(LIBNFC) $(EXES) diff --git a/simulate.c b/simulate.c deleted file mode 100644 index d8cf0eb..0000000 --- a/simulate.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - -Public platform independent Near Field Communication (NFC) library -Copyright (C) 2009, Roel Verdult - -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 . - -*/ - -#include -#include -#include -#include "libnfc.h" - -static byte abtRecv[MAX_FRAME_LEN]; -static ui32 uiRecvBits; -static dev_info* pdi; - -// ISO14443A Anti-Collision response -byte abtAtqa [2] = { 0x04,0x00 }; -byte abtUidBcc [5] = { 0xDE,0xAD,0xBE,0xAF,0x62 }; -byte abtSak [9] = { 0x08,0xb6,0xdd }; - -int main(int argc, const char* argv[]) -{ - byte* pbtTx = null; - ui32 uiTxBits; - - // Try to open the NFC reader - pdi = nfc_connect(); - - if (pdi == INVALID_DEVICE_INFO) - { - printf("Error connecting NFC second reader\n"); - return 1; - } - - printf("\n"); - printf("[+] Connected to NFC reader: %s\n",pdi->acName); - printf("[+] Try to break out the auto-simulation, this requires a second reader!\n"); - printf("[+] To do this, please send any command after the anti-collision\n"); - printf("[+] For example, send a RATS command or use the \"anticol\" tool\n"); - if (!nfc_target_init(pdi,abtRecv,&uiRecvBits)) - { - printf("Error: Could not come out of auto-simulation, no command was received\n"); - return 1; - } - printf("[+] Received initiator command: "); - print_hex_bits(abtRecv,uiRecvBits); - printf("[+] Configuring communication\n"); - nfc_configure(pdi,DCO_HANDLE_CRC,false); - nfc_configure(pdi,DCO_HANDLE_PARITY,true); - printf("[+] Done, the simulated tag is initialized\n\n"); - - while(true) - { - // Test if we received a frame - if (nfc_target_receive_bits(pdi,abtRecv,&uiRecvBits,null)) - { - // Prepare the command to send back for the anti-collision request - switch(uiRecvBits) - { - case 7: // Request or Wakeup - pbtTx = abtAtqa; - uiTxBits = 16; - // New anti-collsion session started - printf("\n"); - break; - - case 16: // Select All - pbtTx = abtUidBcc; - uiTxBits = 40; - break; - - case 72: // Select Tag - pbtTx = abtSak; - uiTxBits = 24; - break; - - default: // unknown length? - uiTxBits = 0; - break; - } - - printf("R: "); - print_hex_bits(abtRecv,uiRecvBits); - - // Test if we know how to respond - if(uiTxBits) - { - // Send and print the command to the screen - nfc_target_send_bits(pdi,pbtTx,uiTxBits,null); - printf("T: "); - print_hex_bits(pbtTx,uiTxBits); - } - } - } - - nfc_disconnect(pdi); -} diff --git a/win32/simulate.vcproj b/win32/emulate.vcproj similarity index 92% rename from win32/simulate.vcproj rename to win32/emulate.vcproj index d5bafe8..ca52ed6 100644 --- a/win32/simulate.vcproj +++ b/win32/emulate.vcproj @@ -2,9 +2,9 @@ @@ -173,7 +173,7 @@ diff --git a/win32/libnfc.sln b/win32/libnfc.sln index 8dab969..4c04a7d 100644 --- a/win32/libnfc.sln +++ b/win32/libnfc.sln @@ -8,7 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "anticol", "anticol.vcproj", {AAEEDA5F-F86F-452D-BFA3-53B1C00B8884} = {AAEEDA5F-F86F-452D-BFA3-53B1C00B8884} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simulate", "simulate.vcproj", "{9F813EB4-8F43-4E58-8C62-8E43D9AC137D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emulate", "emulate.vcproj", "{9F813EB4-8F43-4E58-8C62-8E43D9AC137D}" ProjectSection(ProjectDependencies) = postProject {9CC505F9-AE58-4827-8921-A59E7C4839FE} = {9CC505F9-AE58-4827-8921-A59E7C4839FE} {BB0A837B-DAEF-4B3F-AF5B-9A757A97FFF3} = {BB0A837B-DAEF-4B3F-AF5B-9A757A97FFF3}