mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 21:03:23 -07:00
Issue 20 patch (refactored code of the iso15693 implementation as well as several enhancements) [Adrian Dabrowski "atrox"]
This commit is contained in:
parent
6c1e2d95f4
commit
9455b51c2a
14 changed files with 1902 additions and 656 deletions
|
@ -15,7 +15,7 @@ APP_CFLAGS = -O2 -DWITH_LF -DWITH_ISO15693 -DWITH_ISO14443a -DWITH_ISO14443b
|
|||
|
||||
#SRC_LCD = fonts.c LCD.c
|
||||
SRC_LF = lfops.c hitag2.c
|
||||
SRC_ISO15693 = iso15693.c
|
||||
SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
SRC_ISO14443a = iso14443a.c
|
||||
SRC_ISO14443b = iso14443.c
|
||||
|
||||
|
@ -35,7 +35,7 @@ ARMSRC = fpgaloader.c \
|
|||
crc16.c \
|
||||
$(SRC_ISO14443a) \
|
||||
$(SRC_ISO14443b) \
|
||||
legic_prng.c \
|
||||
legic_prng.c \
|
||||
crc.c
|
||||
|
||||
# stdint.h provided locally until GCC 4.5 becomes C99 compliant
|
||||
|
|
|
@ -124,6 +124,29 @@ void Dbprintf(const char *fmt, ...) {
|
|||
DbpString(output_string);
|
||||
}
|
||||
|
||||
// prints HEX & ASCII
|
||||
void Dbhexdump(int len, uint8_t *d) {
|
||||
int l=0,i;
|
||||
char ascii[9];
|
||||
|
||||
while (len>0) {
|
||||
if (len>8) l=8;
|
||||
else l=len;
|
||||
|
||||
memcpy(ascii,d,l);
|
||||
ascii[l]=0;
|
||||
|
||||
// filter safe ascii
|
||||
for (i=0;i<l;i++)
|
||||
if (ascii[i]<32 || ascii[i]>126) ascii[i]='.';
|
||||
|
||||
Dbprintf("%-8s %*D",ascii,l,d," ");
|
||||
|
||||
len-=8;
|
||||
d+=8;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Read an ADC channel and block till it completes, then return the result
|
||||
// in ADC units (0 to 1023). Also a routine to average 32 samples and
|
||||
|
@ -598,6 +621,24 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_ISO15693
|
||||
case CMD_RECORD_RAW_ADC_SAMPLES_ISO_15693:
|
||||
RecordRawAdcSamplesIso15693();
|
||||
break;
|
||||
|
||||
case CMD_ISO_15693_COMMAND:
|
||||
DirectTag15693Command(c->arg[0],c->arg[1],c->arg[2],c->d.asBytes);
|
||||
break;
|
||||
|
||||
case CMD_ISO_15693_FIND_AFI:
|
||||
BruteforceIso15693Afi(c->arg[0]);
|
||||
break;
|
||||
|
||||
case CMD_ISO_15693_DEBUG:
|
||||
SetDebugIso15693(c->arg[0]);
|
||||
break;
|
||||
|
||||
#endif
|
||||
case CMD_BUFF_CLEAR:
|
||||
BufferClear();
|
||||
break;
|
||||
|
|
|
@ -31,6 +31,7 @@ void SamyRun(void);
|
|||
//void DbpIntegers(int a, int b, int c);
|
||||
void DbpString(char *str);
|
||||
void Dbprintf(const char *fmt, ...);
|
||||
void Dbhexdump(int len, uint8_t *d);
|
||||
|
||||
void ToSendStuffBit(int b);
|
||||
void ToSendReset(void);
|
||||
|
@ -107,9 +108,13 @@ void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
|
|||
void ReaderMifare(uint32_t parameter);
|
||||
|
||||
/// iso15693.h
|
||||
void RecordRawAdcSamplesIso15693(void);
|
||||
void AcquireRawAdcSamplesIso15693(void);
|
||||
void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
|
||||
void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg
|
||||
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
|
||||
void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
|
||||
void SetDebugIso15693(uint32_t flag);
|
||||
|
||||
/// util.h
|
||||
|
||||
|
|
1360
armsrc/iso15693.c
1360
armsrc/iso15693.c
File diff suppressed because it is too large
Load diff
|
@ -69,3 +69,47 @@ char* strncat(char *dest, const char *src, unsigned int n)
|
|||
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* strcat(char *dest, const char *src)
|
||||
{
|
||||
unsigned int dest_len = strlen(dest);
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0 ; src[i] != '\0' ; i++)
|
||||
dest[dest_len + i] = src[i];
|
||||
dest[dest_len + i] = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
////////////////////////////////////////// code to do 'itoa'
|
||||
|
||||
/* reverse: reverse string s in place */
|
||||
void strreverse(char s[])
|
||||
{
|
||||
int c, i, j;
|
||||
|
||||
for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
|
||||
c = s[i];
|
||||
s[i] = s[j];
|
||||
s[j] = c;
|
||||
}
|
||||
}
|
||||
|
||||
/* itoa: convert n to characters in s */
|
||||
void itoa(int n, char s[])
|
||||
{
|
||||
int i, sign;
|
||||
|
||||
if ((sign = n) < 0) /* record sign */
|
||||
n = -n; /* make n positive */
|
||||
i = 0;
|
||||
do { /* generate digits in reverse order */
|
||||
s[i++] = n % 10 + '0'; /* get next digit */
|
||||
} while ((n /= 10) > 0); /* delete it */
|
||||
if (sign < 0)
|
||||
s[i++] = '-';
|
||||
s[i] = '\0';
|
||||
strreverse(s);
|
||||
}
|
||||
|
||||
//////////////////////////////////////// END 'itoa' CODE
|
||||
|
|
|
@ -17,5 +17,9 @@ void *memcpy(void *dest, const void *src, int len);
|
|||
void *memset(void *dest, int c, int len);
|
||||
int memcmp(const void *av, const void *bv, int len);
|
||||
char *strncat(char *dest, const char *src, unsigned int n);
|
||||
char *strcat(char *dest, const char *src);
|
||||
void strreverse(char s[]);
|
||||
void itoa(int n, char s[]);
|
||||
|
||||
|
||||
#endif /* __STRING_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue