From: iceman1001 Date: Thu, 12 Feb 2015 08:54:21 +0000 (+0100) Subject: Merge branch 'master' of https://github.com/Proxmark/proxmark3 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/31b3689f0b54048de31957e001c60bbd8dfca5a3 Merge branch 'master' of https://github.com/Proxmark/proxmark3 Conflicts: armsrc/epa.c --- 31b3689f0b54048de31957e001c60bbd8dfca5a3 diff --cc armsrc/epa.c index 7bff9f19,0006d59d..86f7c864 --- a/armsrc/epa.c +++ b/armsrc/epa.c @@@ -433,11 -422,7 +429,9 @@@ int EPA_Setup( // power up the field iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD); - + + iso14a_set_timeout(10500); + - iso14a_set_timeout(10500); - // select the card return_code = iso14443a_select_card(uid, &card_select_info, NULL); if (return_code != 1) { diff --cc client/Makefile index fcbd4d7c,e63581ba..48a18c94 --- a/client/Makefile +++ b/client/Makefile @@@ -12,9 -12,9 +12,9 @@@ CXX=g+ VPATH = ../common OBJDIR = obj --LDLIBS = -L/opt/local/lib -L/usr/local/lib ../liblua/liblua.a -lreadline -lpthread -lm ++LDLIBS = -L/mingw/lib -L/opt/local/lib -L/usr/local/lib ../liblua/liblua.a -lm -lreadline -lpthread -lgdi32 LDFLAGS = $(COMMON_FLAGS) --CFLAGS = -std=c99 -I. -I../include -I../common -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4 ++CFLAGS = -std=c99 -I. -I../include -I../common -I/mingw/include -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4 LUAPLATFORM = generic ifneq (,$(findstring MINGW,$(platform))) CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui @@@ -146,6 -137,6 +146,17 @@@ clean tarbin: $(BINS) $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) ++# must be run as root ++install_kext: Info.plist ++ mkdir -p /System/Library/Extensions/Proxmark3.kext/Contents ++ cp Info.plist /System/Library/Extensions/Proxmark3.kext/Contents ++ chown -R root:wheel /System/Library/Extensions/Proxmark3.kext ++ chmod 755 /System/Library/Extensions/Proxmark3.kext /System/Library/Extensions/Proxmark3.kext/Contents ++ chmod 644 /System/Library/Extensions/Proxmark3.kext/Contents/Info.plist ++ rm -rf /System/Library/Caches/com.apple.kext.caches ++ touch /System/Library/Extensions ++ @echo "*** You may need to reboot for the kext to take effect." ++ lua_build: @echo Compiling liblua, using platform $(LUAPLATFORM) cd ../liblua && make $(LUAPLATFORM) diff --cc client/cmdlf.c index b7c1b13f,b7c1b13f..136b0533 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@@ -756,12 -756,12 +756,18 @@@ int CmdLFfind(const char *Cmd static command_t CommandTable[] = { {"help", CmdHelp, 1, "This help"}, -- {"cmdread", CmdLFCommandRead, 0, " <'0' period> <'1' period> ['h'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'h' for 134)"}, {"em4x", CmdLFEM4X, 1, "{ EM4X RFIDs... }"}, ++ {"hid", CmdLFHID, 1, "{ HID RFIDs... }"}, ++ {"hitag", CmdLFHitag, 1, "{ HITAG RFIDs... }"}, ++ {"io", CmdLFIO, 1, "{ IOPROX RFIDs... }"}, ++ {"pcf7931", CmdLFPCF7931, 1, "{ PCF7931 RFIDs... }"}, ++ {"ti", CmdLFTI, 1, "{ TI RFIDs... }"}, ++ {"t55xx", CmdLFT55XX, 1, "{ T55X7 RFIDs... }"}, ++ {"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"}, ++ ++ {"cmdread", CmdLFCommandRead, 0, " <'0' period> <'1' period> ['h'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'h' for 134)"}, {"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"}, -- {"hid", CmdLFHID, 1, "{ HID RFIDs... }"}, -- {"io", CmdLFIO, 1, "{ ioProx tags... }"}, {"indalademod", CmdIndalaDemod, 1, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"}, {"indalaclone", CmdIndalaClone, 0, " ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"}, {"read", CmdLFRead, 0, "Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"}, @@@ -770,11 -770,11 +776,7 @@@ {"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"}, {"simman", CmdLFSimManchester, 0, " [GAP] Simulate arbitrary Manchester LF tag"}, {"snoop", CmdLFSnoop, 0, "['l'|'h'|] [trigger threshold]-- Snoop LF (l:125khz, h:134khz)"}, -- {"ti", CmdLFTI, 1, "{ TI RFIDs... }"}, -- {"hitag", CmdLFHitag, 1, "{ Hitag tags and transponders... }"}, {"vchdemod", CmdVchDemod, 1, "['clone'] -- Demodulate samples for VeriChip"}, -- {"t55xx", CmdLFT55XX, 1, "{ T55xx RFIDs... }"}, -- {"pcf7931", CmdLFPCF7931, 1, "{PCF7931 RFIDs...}"}, {NULL, NULL, 0, NULL} }; diff --cc client/cmdlft55xx.c index 4ac466d1,a719c7ad..b060bdee --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@@ -76,91 -20,52 +76,104 @@@ int usage_t55xx_dump() static int CmdHelp(const char *Cmd); ++/* ++FSK1 / FSK1a ++size = fskdemod(dest, size, 32, 0, 8, 10); // fsk1 RF/32 ++size = fskdemod(dest, size, 32, 1, 8, 10); // fsk1a RF/32 ++ ++FSK2 / FSK2a ++size = fskdemod(dest, size, 32, 0, 10, 8); // fsk2 RF/32 ++size = fskdemod(dest, size, 32, 1, 10, 8); // fsk2a RF/32 ++size = fskdemod(dest, size, 50, 1, 10, 8); // fsk2a RF/50 ++size = fskdemod(dest, size, 64, 1, 10, 8); // FSK2a RF/64 ++ ++*/ + int CmdReadBlk(const char *Cmd) { - int Block = 8; //default to invalid block - UsbCommand c; + int invert = 0; + int clk = 0; + int block = -1; + int password = 0xFFFFFFFF; //default to blank Block 7 + int errCnt; + size_t bitlen; + int maxErr = 100; + //uint8_t askAmp = 0; + uint32_t blockData; + uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0x00}; + + + char cmdp = param_getchar(Cmd, 0); + if (cmdp == 'h' || cmdp == 'H') { + usage_t55xx_rd(); + return 0; + } - sscanf(Cmd, "%d", &Block); + int res = sscanf(Cmd, "%d %x", &block, &password); - if (Block > 7) { - PrintAndLog("Block must be between 0 and 7"); - return 1; - } + if ( res < 1 || res > 2 ){ + usage_t55xx_rd(); + return 1; + } + + if ((block < 0) | (block > 7)) { + PrintAndLog("Block must be between 0 and 7"); + return 1; + } - PrintAndLog("Reading block %d", Block); + UsbCommand c = {CMD_T55XX_READ_BLOCK, {0, block, 0}}; + c.d.asBytes[0] = 0x0; - c.cmd = CMD_T55XX_READ_BLOCK; - c.d.asBytes[0] = 0x0; //Normal mode - c.arg[0] = 0; - c.arg[1] = Block; - c.arg[2] = 0; - SendCommand(&c); - return 0; -} + //Password mode + if ( res == 2 ) { + c.arg[2] = password; + c.d.asBytes[0] = 0x1; + } -int CmdReadBlkPWD(const char *Cmd) -{ - int Block = 8; //default to invalid block - int Password = 0xFFFFFFFF; //default to blank Block 7 - UsbCommand c; + SendCommand(&c); + if ( !WaitForResponseTimeout(CMD_ACK,NULL,1500) ) { + PrintAndLog("command execution time out"); + return 2; + } + + CmdSamples("12000"); - sscanf(Cmd, "%d %x", &Block, &Password); + bitlen = getFromGraphBuf(bits); + + //errCnt = askrawdemod(bits, &bitlen, &clk, &invert, maxErr, askAmp); + errCnt = askmandemod(bits, &bitlen, &clk, &invert, maxErr); + + //throw away static - allow 1 and -1 (in case of threshold command first) + if ( errCnt == -1 || bitlen < 16 ){ + PrintAndLog("no data found"); + if (g_debugMode) + PrintAndLog("errCnt: %d, bitlen: %d, clk: %d, invert: %d", errCnt, bitlen, clk, invert); + return 3; + } + if (g_debugMode) + PrintAndLog("Using Clock: %d - invert: %d - Bits Found: %d", clk, invert, bitlen); - if (Block > 7) { - PrintAndLog("Block must be between 0 and 7"); - return 1; - } + //move bits back to DemodBuffer + setDemodBuf(bits, bitlen, 0); + printBitStream(bits,bitlen); + + // bits has the manchester encoded data. + errCnt = manrawdecode(bits, &bitlen); + if ( errCnt == -1 || bitlen < 16 ){ + PrintAndLog("no data found"); + if (g_debugMode) + PrintAndLog("errCnt: %d, bitlen: %d, clk: %d, invert: %d", errCnt, bitlen, clk, invert); + return 4; + } - PrintAndLog("Reading block %d with password %08X", Block, Password); + blockData = PackBits(1, 32, bits); - c.cmd = CMD_T55XX_READ_BLOCK; - c.d.asBytes[0] = 0x1; //Password mode - c.arg[0] = 0; - c.arg[1] = Block; - c.arg[2] = Password; - SendCommand(&c); - return 0; + if ( block < 0) + PrintAndLog(" Decoded : 0x%08X %s", blockData, sprint_bin(bits+1,32) ); + else + PrintAndLog(" Block %d : 0x%08X %s", block, blockData, sprint_bin(bits+1,32) ); + + return 0; } int CmdWriteBlk(const char *Cmd)