Merge branch 'master' of https://github.com/Proxmark/proxmark3
Conflicts: armsrc/iclass.c
This commit is contained in:
@@ -224,3 +224,16 @@ int LogTraceHitag(const uint8_t * btBytes, int iBits, int iSamples, uint32_t dwP
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
// Emulator memory
|
||||
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length){
|
||||
uint8_t* mem = BigBuf_get_EM_addr();
|
||||
if(offset+length < CARD_MEMORY_SIZE)
|
||||
{
|
||||
memcpy(mem+offset, data, length);
|
||||
return 0;
|
||||
}else
|
||||
{
|
||||
Dbprintf("Error, trying to set memory outside of bounds! %d > %d", (offset+length), CARD_MEMORY_SIZE);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,5 @@ void clear_trace();
|
||||
void set_tracing(bool enable);
|
||||
bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag);
|
||||
int LogTraceHitag(const uint8_t * btBytes, int iBits, int iSamples, uint32_t dwParity, int bReader);
|
||||
uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length);
|
||||
#endif /* __BIGBUF_H */
|
||||
|
||||
@@ -902,6 +902,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||
case CMD_READER_ICLASS_REPLAY:
|
||||
ReaderIClass_Replay(c->arg[0], c->d.asBytes);
|
||||
break;
|
||||
case CMD_ICLASS_EML_MEMSET:
|
||||
emlSet(c->d.asBytes,c->arg[0], c->arg[1]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case CMD_SIMULATE_TAG_HF_LISTEN:
|
||||
|
||||
@@ -1706,7 +1706,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
||||
//Set card_data to all zeroes, we'll fill it with data
|
||||
memset(card_data,0x0,USB_CMD_DATA_SIZE);
|
||||
uint8_t failedRead =0;
|
||||
uint8_t stored_data_length =0;
|
||||
uint32_t stored_data_length =0;
|
||||
//then loop around remaining blocks
|
||||
for(int block=0; block < cardsize; block++){
|
||||
|
||||
@@ -1725,7 +1725,6 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
||||
//Fill up the buffer
|
||||
memcpy(card_data+stored_data_length,resp,8);
|
||||
stored_data_length += 8;
|
||||
|
||||
if(stored_data_length +8 > USB_CMD_DATA_SIZE)
|
||||
{//Time to send this off and start afresh
|
||||
cmd_send(CMD_ACK,
|
||||
@@ -1744,6 +1743,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *MAC) {
|
||||
Dbprintf("Failed to dump block %d", block);
|
||||
}
|
||||
}
|
||||
|
||||
//Send off any remaining data
|
||||
if(stored_data_length > 0)
|
||||
{
|
||||
|
||||
@@ -1286,9 +1286,10 @@ void CopyIndala224toT55x7(int uid1, int uid2, int uid3, int uid4, int uid5, int
|
||||
#define max(x,y) ( x<y ? y:x)
|
||||
|
||||
int DemodPCF7931(uint8_t **outBlocks) {
|
||||
uint8_t BitStream[256];
|
||||
uint8_t Blocks[8][16];
|
||||
uint8_t *GraphBuffer = BigBuf_get_addr();
|
||||
|
||||
uint8_t BitStream[256] = {0x00};
|
||||
uint8_t Blocks[8][16] = [0x00};
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
int GraphTraceLen = BigBuf_max_traceLen();
|
||||
int i, j, lastval, bitidx, half_switch;
|
||||
int clock = 64;
|
||||
@@ -1300,8 +1301,7 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||
uint8_t dir;
|
||||
|
||||
LFSetupFPGAForADC(95, true);
|
||||
DoAcquisition_default(0, 0);
|
||||
|
||||
DoAcquisition_default(0, true);
|
||||
|
||||
lmin = 64;
|
||||
lmax = 192;
|
||||
@@ -1309,9 +1309,9 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||
i = 2;
|
||||
|
||||
/* Find first local max/min */
|
||||
if(GraphBuffer[1] > GraphBuffer[0]) {
|
||||
if(dest[1] > dest[0]) {
|
||||
while(i < GraphTraceLen) {
|
||||
if( !(GraphBuffer[i] > GraphBuffer[i-1]) && GraphBuffer[i] > lmax)
|
||||
if( !(dest[i] > dest[i-1]) && dest[i] > lmax)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||
}
|
||||
else {
|
||||
while(i < GraphTraceLen) {
|
||||
if( !(GraphBuffer[i] < GraphBuffer[i-1]) && GraphBuffer[i] < lmin)
|
||||
if( !(dest[i] < dest[i-1]) && v[i] < lmin)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
@@ -1333,7 +1333,7 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||
|
||||
for (bitidx = 0; i < GraphTraceLen; i++)
|
||||
{
|
||||
if ( (GraphBuffer[i-1] > GraphBuffer[i] && dir == 1 && GraphBuffer[i] > lmax) || (GraphBuffer[i-1] < GraphBuffer[i] && dir == 0 && GraphBuffer[i] < lmin))
|
||||
if ( (dest[i-1] > dest[i] && dir == 1 && dest[i] > lmax) || (dest[i-1] < dest[i] && dir == 0 && dest[i] < lmin))
|
||||
{
|
||||
lc = i - lastval;
|
||||
lastval = i;
|
||||
@@ -1400,7 +1400,7 @@ int DemodPCF7931(uint8_t **outBlocks) {
|
||||
}
|
||||
if(i < GraphTraceLen)
|
||||
{
|
||||
if (GraphBuffer[i-1] > GraphBuffer[i]) dir=0;
|
||||
if (dest[i-1] > dest[i]) dir=0;
|
||||
else dir = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "lfsampling.h"
|
||||
|
||||
sample_config config = { 1, 8, 1, 88, 0 } ;
|
||||
sample_config config = { 1, 8, 1, 95, 0 } ;
|
||||
|
||||
void printConfig()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user