mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
ADD: added the "hf snoop" patch original from @Enio, rearranged by @Etmatrix.
ADD: added the "t55x7" refactoring by @marshmellow42
This commit is contained in:
parent
1c8fbeb93e
commit
1d0ccbe04b
24 changed files with 704 additions and 604 deletions
|
@ -67,7 +67,8 @@ VPATH = . ../common ../fpga ../zlib
|
|||
|
||||
INCLUDES = ../include/proxmark3.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES)
|
||||
|
||||
CFLAGS = -c $(INCLUDE) -Wall -Werror -pedantic -std=c99 $(APP_CFLAGS) -Os
|
||||
#-Wunused -Wsign-compare -Wtype-limits -Wuninitialized -Wno-deprecated -Wstrict-aliasing -Wpointer-arith -Wpointer-arith -Wformat-nonliteral -Winit-self -Wparentheses -Wunreachable-code
|
||||
CFLAGS = -c $(INCLUDE) -Wall -Werror -pedantic -Wunused -std=c99 $(APP_CFLAGS) -Os
|
||||
LDFLAGS = -nostartfiles -nodefaultlibs -Wl,-gc-sections -n
|
||||
|
||||
LIBS = -lgcc
|
||||
|
|
|
@ -282,6 +282,16 @@ int manrawdecode(uint8_t * BitStream, size_t *size, uint8_t invert)
|
|||
return bestErr;
|
||||
}
|
||||
|
||||
uint32_t manchesterEncode2Bytes(uint16_t datain) {
|
||||
uint32_t output = 0;
|
||||
uint8_t curBit = 0;
|
||||
for (uint8_t i=0; i<16; i++) {
|
||||
curBit = (datain >> (15-i) & 1);
|
||||
output |= (1<<(((15-i)*2)+curBit));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
//by marshmellow
|
||||
//encode binary data into binary manchester
|
||||
int ManchesterEncode(uint8_t *BitStream, size_t size)
|
||||
|
|
|
@ -30,6 +30,7 @@ int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t
|
|||
uint8_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *hi, uint64_t *lo);
|
||||
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
||||
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
||||
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
||||
int ManchesterEncode(uint8_t *BitStream, size_t size);
|
||||
int manrawdecode(uint8_t *BitStream, size_t *size, uint8_t invert);
|
||||
int nrzRawDemod(uint8_t *dest, size_t *size, int *clk, int *invert, int maxErr);
|
||||
|
|
|
@ -3,13 +3,36 @@
|
|||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include "protocols.h"
|
||||
|
||||
// ATA55xx shared presets & routines
|
||||
uint32_t GetT55xxClockBit(uint32_t clock) {
|
||||
switch (clock) {
|
||||
case 128:
|
||||
return T55x7_BITRATE_RF_128;
|
||||
case 100:
|
||||
return T55x7_BITRATE_RF_100;
|
||||
case 64:
|
||||
return T55x7_BITRATE_RF_64;
|
||||
case 50:
|
||||
return T55x7_BITRATE_RF_50;
|
||||
case 40:
|
||||
return T55x7_BITRATE_RF_40;
|
||||
case 32:
|
||||
return T55x7_BITRATE_RF_32;
|
||||
case 16:
|
||||
return T55x7_BITRATE_RF_16;
|
||||
case 8:
|
||||
return T55x7_BITRATE_RF_8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef ON_DEVICE
|
||||
#include "ui.h"
|
||||
#define prnt PrintAndLog
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// iclass / picopass chip config structures and shared routines
|
||||
typedef struct {
|
||||
uint8_t app_limit; //[8]
|
||||
uint8_t otp[2]; //[9-10]
|
||||
|
@ -31,20 +54,7 @@ typedef struct {
|
|||
|
||||
}picopass_hdr;
|
||||
|
||||
|
||||
//#define prnt printf
|
||||
/*void prnt(char *fmt,...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vprintf(fmt, argptr);
|
||||
printf(" "); // cleaning prompt
|
||||
va_end(argptr);
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
uint8_t isset(uint8_t val, uint8_t mask)
|
||||
{
|
||||
uint8_t isset(uint8_t val, uint8_t mask) {
|
||||
return (val & mask);
|
||||
}
|
||||
|
||||
|
@ -52,8 +62,7 @@ uint8_t notset(uint8_t val, uint8_t mask){
|
|||
return !(val & mask);
|
||||
}
|
||||
|
||||
void fuse_config(const picopass_hdr *hdr)
|
||||
{
|
||||
void fuse_config(const picopass_hdr *hdr) {
|
||||
uint8_t fuses = hdr->conf.fuses;
|
||||
|
||||
if (isset(fuses,FUSE_FPERS))prnt(" Mode: Personalization [Programmable]");
|
||||
|
@ -104,8 +113,7 @@ void getMemConfig(uint8_t mem_cfg, uint8_t chip_cfg, uint8_t *max_blk, uint8_t *
|
|||
}
|
||||
}
|
||||
|
||||
void mem_app_config(const picopass_hdr *hdr)
|
||||
{
|
||||
void mem_app_config(const picopass_hdr *hdr) {
|
||||
uint8_t mem = hdr->conf.mem_config;
|
||||
uint8_t chip = hdr->conf.chip_config;
|
||||
uint8_t applimit = hdr->conf.app_limit;
|
||||
|
@ -118,28 +126,25 @@ void mem_app_config(const picopass_hdr *hdr)
|
|||
prnt(" AA1: blocks 06-%02X", applimit);
|
||||
prnt(" AA2: blocks %02X-%02X", applimit+1, max_blk);
|
||||
}
|
||||
void print_picopass_info(const picopass_hdr *hdr)
|
||||
{
|
||||
void print_picopass_info(const picopass_hdr *hdr) {
|
||||
fuse_config(hdr);
|
||||
mem_app_config(hdr);
|
||||
}
|
||||
void printIclassDumpInfo(uint8_t* iclass_dump)
|
||||
{
|
||||
// picopass_hdr hdr;
|
||||
// memcpy(&hdr, iclass_dump, sizeof(picopass_hdr));
|
||||
void printIclassDumpInfo(uint8_t* iclass_dump) {
|
||||
print_picopass_info((picopass_hdr *) iclass_dump);
|
||||
}
|
||||
|
||||
/*
|
||||
void test()
|
||||
{
|
||||
void test() {
|
||||
picopass_hdr hdr = {0x27,0xaf,0x48,0x01,0xf9,0xff,0x12,0xe0,0x12,0xff,0xff,0xff,0x7f,0x1f,0xff,0x3c};
|
||||
prnt("Picopass configuration:");
|
||||
print_picopass_info(&hdr);
|
||||
}
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]) {
|
||||
test();
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
//ON_DEVICE
|
||||
|
|
|
@ -267,4 +267,57 @@ ISO 7816-4 Basic interindustry commands. For command APDU's.
|
|||
void printIclassDumpInfo(uint8_t* iclass_dump);
|
||||
void getMemConfig(uint8_t mem_cfg, uint8_t chip_cfg, uint8_t *max_blk, uint8_t *app_areas, uint8_t *kb);
|
||||
|
||||
#endif // PROTOCOLS_H
|
||||
/* T55x7 configuration register definitions */
|
||||
#define T55x7_POR_DELAY 0x00000001
|
||||
#define T55x7_ST_TERMINATOR 0x00000008
|
||||
#define T55x7_PWD 0x00000010
|
||||
#define T55x7_MAXBLOCK_SHIFT 5
|
||||
#define T55x7_AOR 0x00000200
|
||||
#define T55x7_PSKCF_RF_2 0
|
||||
#define T55x7_PSKCF_RF_4 0x00000400
|
||||
#define T55x7_PSKCF_RF_8 0x00000800
|
||||
#define T55x7_MODULATION_DIRECT 0
|
||||
#define T55x7_MODULATION_PSK1 0x00001000
|
||||
#define T55x7_MODULATION_PSK2 0x00002000
|
||||
#define T55x7_MODULATION_PSK3 0x00003000
|
||||
#define T55x7_MODULATION_FSK1 0x00004000
|
||||
#define T55x7_MODULATION_FSK2 0x00005000
|
||||
#define T55x7_MODULATION_FSK1a 0x00006000
|
||||
#define T55x7_MODULATION_FSK2a 0x00007000
|
||||
#define T55x7_MODULATION_MANCHESTER 0x00008000
|
||||
#define T55x7_MODULATION_BIPHASE 0x00010000
|
||||
#define T55x7_MODULATION_DIPHASE 0x00018000
|
||||
#define T55x7_BITRATE_RF_8 0
|
||||
#define T55x7_BITRATE_RF_16 0x00040000
|
||||
#define T55x7_BITRATE_RF_32 0x00080000
|
||||
#define T55x7_BITRATE_RF_40 0x000C0000
|
||||
#define T55x7_BITRATE_RF_50 0x00100000
|
||||
#define T55x7_BITRATE_RF_64 0x00140000
|
||||
#define T55x7_BITRATE_RF_100 0x00180000
|
||||
#define T55x7_BITRATE_RF_128 0x001C0000
|
||||
|
||||
/* T5555 (Q5) configuration register definitions */
|
||||
#define T5555_ST_TERMINATOR 0x00000001
|
||||
#define T5555_MAXBLOCK_SHIFT 0x00000001
|
||||
#define T5555_MODULATION_MANCHESTER 0
|
||||
#define T5555_MODULATION_PSK1 0x00000010
|
||||
#define T5555_MODULATION_PSK2 0x00000020
|
||||
#define T5555_MODULATION_PSK3 0x00000030
|
||||
#define T5555_MODULATION_FSK1 0x00000040
|
||||
#define T5555_MODULATION_FSK2 0x00000050
|
||||
#define T5555_MODULATION_BIPHASE 0x00000060
|
||||
#define T5555_MODULATION_DIRECT 0x00000070
|
||||
#define T5555_INVERT_OUTPUT 0x00000080
|
||||
#define T5555_PSK_RF_2 0
|
||||
#define T5555_PSK_RF_4 0x00000100
|
||||
#define T5555_PSK_RF_8 0x00000200
|
||||
#define T5555_USE_PWD 0x00000400
|
||||
#define T5555_USE_AOR 0x00000800
|
||||
#define T5555_BITRATE_SHIFT 12
|
||||
#define T5555_FAST_WRITE 0x00004000
|
||||
#define T5555_PAGE_SELECT 0x00008000
|
||||
|
||||
uint32_t GetT55xxClockBit(uint32_t clock);
|
||||
|
||||
#endif
|
||||
// PROTOCOLS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue