From: iceman1001 Date: Tue, 10 Mar 2015 08:18:35 +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/12d708fec157dfde6f94d61e5fdc265713a71578 Merge branch 'master' of https://github.com/Proxmark/proxmark3 Conflicts: client/cmddata.c client/cmddata.h --- 12d708fec157dfde6f94d61e5fdc265713a71578 diff --cc armsrc/apps.h index dc8a9c93,928a3075..3fe8acae --- a/armsrc/apps.h +++ b/armsrc/apps.h @@@ -118,10 -116,11 +118,13 @@@ void ReadTItag(void) void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc); void AcquireTiType(void); void AcquireRawBitsTI(void); -void SimulateTagLowFrequency(int period, int gap, int ledcontrol); +void SimulateTagLowFrequency( uint16_t period, uint32_t gap, uint8_t ledcontrol); +//void SimulateTagLowFrequencyA(int period, int gap); + void CmdHIDsimTAG(int hi, int lo, int ledcontrol); + void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream); + void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream); + void CmdPSKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream); void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol); void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol); void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol); diff --cc armsrc/iso14443a.c index f2fa1ff2,f2fa1ff2..fe5533e0 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@@ -2301,8 -2301,8 +2301,6 @@@ void Mifare1ksim(uint8_t flags, uint8_ } if(cardSTATE == MFEMUL_NOFIELD) continue; -- //Now, get data -- res = EmGetCmd(receivedCmd, &len, receivedCmd_par); if (res == 2) { //Field is off! cardSTATE = MFEMUL_NOFIELD; @@@ -2373,7 -2373,7 +2371,7 @@@ uint32_t nr = bytes_to_num(&receivedCmd[4], 4); //Collect AR/NR -- if(ar_nr_collected < 2){ ++ if(ar_nr_collected < 2 && cardAUTHSC == 2){ if(ar_nr_responses[2] != ar) {// Avoid duplicates... probably not necessary, ar should vary. ar_nr_responses[ar_nr_collected*4] = cuid; @@@ -2381,6 -2381,6 +2379,11 @@@ ar_nr_responses[ar_nr_collected*4+2] = ar; ar_nr_responses[ar_nr_collected*4+3] = nr; ar_nr_collected++; ++ } ++ // Interactive mode flag, means we need to send ACK ++ if(flags & FLAG_INTERACTIVE && ar_nr_collected == 2) ++ { ++ finished = true; } } @@@ -2528,7 -2528,7 +2531,7 @@@ mf_crypto1_encrypt(pcs, response, 18, response_par); EmSendCmdPar(response, 18, response_par); numReads++; -- if(exitAfterNReads > 0 && numReads == exitAfterNReads) { ++ if(exitAfterNReads > 0 && numReads >= exitAfterNReads) { Dbprintf("%d reads done, exiting", numReads); finished = true; } @@@ -2648,12 -2648,12 +2651,12 @@@ if(flags & FLAG_INTERACTIVE)// Interactive mode flag, means we need to send ACK { //May just aswell send the collected ar_nr in the response aswell -- cmd_send(CMD_ACK,CMD_SIMULATE_MIFARE_CARD,0,0,&ar_nr_responses,ar_nr_collected*4*4); ++ cmd_send(CMD_ACK,CMD_SIMULATE_MIFARE_CARD,1,0,&ar_nr_responses,ar_nr_collected*4*4); } -- if(flags & FLAG_NR_AR_ATTACK) ++ if(flags & FLAG_NR_AR_ATTACK && MF_DBGLEVEL >= 1 ) { -- if(ar_nr_collected > 1) { ++ if(ar_nr_collected > 1 ) { Dbprintf("Collected two pairs of AR/NR which can be used to extract keys from reader:"); Dbprintf("../tools/mfkey/mfkey32 %08x %08x %08x %08x %08x %08x", ar_nr_responses[0], // UID @@@ -2665,7 -2665,7 +2668,7 @@@ ); } else { Dbprintf("Failed to obtain two AR/NR pairs!"); -- if(ar_nr_collected >0) { ++ if(ar_nr_collected > 0 ) { Dbprintf("Only got these: UID=%08x, nonce=%08x, AR1=%08x, NR1=%08x", ar_nr_responses[0], // UID ar_nr_responses[1], //NT diff --cc client/cmddata.c index 8b29dc9c,95c7dc87..cea3bcfe --- a/client/cmddata.c +++ b/client/cmddata.c @@@ -884,8 -1033,9 +1039,9 @@@ int FSKrawDemod(const char *Cmd, bool v if(size > (8*32)+2) size = (8*32)+2; //only output a max of 8 blocks of 32 bits most tags will have full bit stream inside that sample size if (verbose) { PrintAndLog("FSK decoded bitstream:"); - printBitStream(BitStream,size); + printBitStream(BitStream,size); } + return 1; } else{ if (verbose) PrintAndLog("no FSK data found"); @@@ -1634,11 -1788,11 +1795,11 @@@ int NRZrawDemod(const char *Cmd, bool v PrintAndLog("# Errors during Demoding (shown as 77 in bit stream): %d",errCnt); } if (verbose) { - PrintAndLog("NRZ demoded bitstream:"); - // Now output the bitstream to the scrollback by line of 16 bits - printDemodBuff(); + PrintAndLog("NRZ demoded bitstream:"); + // Now output the bitstream to the scrollback by line of 16 bits + printDemodBuff(); } - return 1; + return 1; } int CmdNRZrawDemod(const char *Cmd) diff --cc client/cmddata.h index c7dbf297,6866bcb1..48bd0d91 --- a/client/cmddata.h +++ b/client/cmddata.h @@@ -14,9 -14,9 +14,10 @@@ command_t * CmdDataCommands(); int CmdData(const char *Cmd); + void printDemodBuff(void); + void printBitStream(uint8_t BitStream[], uint32_t bitLen); void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx); - void printDemodBuff(); + int CmdAmp(const char *Cmd); int Cmdaskdemod(const char *Cmd); int CmdAskEM410xDemod(const char *Cmd); diff --cc client/cmdlf.c index 849b96ef,79d6787b..9d62b2a8 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@@ -777,10 -1119,17 +1130,13 @@@ static command_t CommandTable[] {"read", CmdLFRead, 0, "Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"}, {"search", CmdLFfind, 1, "[offline] ['u'] Read and Search for valid known tag (in offline mode it you can load first then search) - 'u' to search for unknown tags"}, {"sim", CmdLFSim, 0, "[GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds)"}, + {"simask", CmdLFaskSim, 0, "[clock] [invert <1|0>] [manchester/raw <'m'|'r'>] [msg separator 's'] [d ] -- Simulate LF ASK tag from demodbuffer or input"}, + {"simfsk", CmdLFfskSim, 0, "[c ] [i] [H ] [L ] [d ] -- Simulate LF FSK tag from demodbuffer or input"}, + {"simpsk", CmdLFpskSim, 0, "[1|2|3] [c ] [i] [r ] [d ] -- Simulate LF PSK tag from demodbuffer or input"}, {"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"}, - {"simman", CmdLFSimManchester, 0, " [GAP] Simulate arbitrary Manchester LF 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/lualibs/commands.lua index 6f309001,ad8f6e00..ef9b8f18 --- a/client/lualibs/commands.lua +++ b/client/lualibs/commands.lua @@@ -212,6 -217,7 +217,6 @@@ function Command:getBytes( local data = self.data local cmd = self.cmd local arg1, arg2, arg3 = self.arg1, self.arg2, self.arg3 - return bin.pack("LLLLH",cmd, arg1, arg2, arg3,data); end - return _commands + return _commands