mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
monster merge...
all those changes marshmellow did.. and more...
This commit is contained in:
parent
208550823d
commit
f28da2da6e
107 changed files with 5087 additions and 3777 deletions
|
@ -6,8 +6,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Low frequency NEDAP tag commands
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "cmdlfnedap.h"
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
|
@ -37,6 +36,20 @@ int usage_lf_nedap_sim(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// find nedap preamble in already demoded data
|
||||
int detectNedap(uint8_t *dest, size_t *size) {
|
||||
//make sure buffer has data
|
||||
if (*size < 128) return -3;
|
||||
|
||||
size_t startIdx = 0;
|
||||
//uint8_t preamble[] = {1,1,1,1,1,1,1,1,1,0,0,0,1};
|
||||
uint8_t preamble[] = {1,1,1,1,1,1,1,1,1,0};
|
||||
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx))
|
||||
return -4; //preamble not found
|
||||
return (int) startIdx;
|
||||
}
|
||||
|
||||
|
||||
int GetNedapBits(uint32_t cn, uint8_t *nedapBits) {
|
||||
|
||||
uint8_t pre[128];
|
||||
|
@ -89,7 +102,7 @@ int CmdLFNedapDemod(const char *Cmd) {
|
|||
return 0;
|
||||
}
|
||||
size_t size = DemodBufferLen;
|
||||
int idx = NedapDemod(DemodBuffer, &size);
|
||||
int idx = detectNedap(DemodBuffer, &size);
|
||||
if (idx < 0){
|
||||
if (g_debugMode){
|
||||
// if (idx == -5)
|
||||
|
@ -135,8 +148,8 @@ int CmdLFNedapDemod(const char *Cmd) {
|
|||
raw[1] = bytebits_to_byte(DemodBuffer+idx+64,32);
|
||||
raw[2] = bytebits_to_byte(DemodBuffer+idx+32,32);
|
||||
raw[3] = bytebits_to_byte(DemodBuffer+idx,32);
|
||||
setDemodBuf(DemodBuffer,128,idx);
|
||||
setGrid_Clock(64);
|
||||
setDemodBuf(DemodBuffer, 128, idx);
|
||||
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||
|
||||
uint8_t firstParity = GetParity( DemodBuffer, EVEN, 63);
|
||||
if ( firstParity != DemodBuffer[63] ) {
|
||||
|
@ -202,9 +215,8 @@ lf t55xx wr b 4 d 4c0003ff
|
|||
*/
|
||||
|
||||
int CmdLFNedapRead(const char *Cmd) {
|
||||
CmdLFRead("s");
|
||||
getSamples("12000", true);
|
||||
return CmdLFNedapDemod("");
|
||||
lf_read(true, 12000);
|
||||
return CmdLFNedapDemod(Cmd);
|
||||
}
|
||||
/*
|
||||
int CmdLFNedapClone(const char *Cmd) {
|
||||
|
@ -345,9 +357,9 @@ int CmdLFNedapChk(const char *Cmd){
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"demod", CmdLFNedapDemod,0, "Demodulate an Nedap tag from the GraphBuffer"},
|
||||
{"read", CmdLFNedapRead, 0, "Attempt to read and extract tag data"},
|
||||
// {"clone", CmdLFNedapClone,0, "<Card Number> clone nedap tag"},
|
||||
{"sim", CmdLFNedapSim, 0, "<Card Number> simulate nedap tag"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue