mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-10 23:15:22 +08:00
ADD: @marshmellows fixes
This commit is contained in:
parent
7a5d49b5b4
commit
224e8c1a4d
5 changed files with 19 additions and 17 deletions
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
uint8_t g_debugMode;
|
uint8_t g_debugMode;
|
||||||
int DemodBufferLen;
|
size_t DemodBufferLen;
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
//set the demod buffer with given array of binary (one bit per byte)
|
//set the demod buffer with given array of binary (one bit per byte)
|
||||||
|
@ -1484,7 +1484,7 @@ int CmdIndalaDecode(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t invert=0;
|
uint8_t invert=0;
|
||||||
ans = indala26decode(DemodBuffer,(size_t *) &DemodBufferLen, &invert);
|
ans = indala26decode(DemodBuffer, &DemodBufferLen, &invert);
|
||||||
if (ans < 1) {
|
if (ans < 1) {
|
||||||
if (g_debugMode==1)
|
if (g_debugMode==1)
|
||||||
PrintAndLog("Error2: %d",ans);
|
PrintAndLog("Error2: %d",ans);
|
||||||
|
|
|
@ -70,7 +70,7 @@ int getSamples(const char *Cmd, bool silent);
|
||||||
|
|
||||||
#define MAX_DEMOD_BUF_LEN (1024*128)
|
#define MAX_DEMOD_BUF_LEN (1024*128)
|
||||||
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
extern int DemodBufferLen;
|
extern size_t DemodBufferLen;
|
||||||
extern uint8_t g_debugMode;
|
extern uint8_t g_debugMode;
|
||||||
#define BIGBUF_SIZE 40000
|
#define BIGBUF_SIZE 40000
|
||||||
|
|
||||||
|
|
|
@ -347,8 +347,7 @@ static int ulc_print_3deskey( uint8_t *data){
|
||||||
PrintAndLog(" deskey1 [45/0x2D]: %s [%.4s]", sprint_hex(data+4 ,4),data+4);
|
PrintAndLog(" deskey1 [45/0x2D]: %s [%.4s]", sprint_hex(data+4 ,4),data+4);
|
||||||
PrintAndLog(" deskey2 [46/0x2E]: %s [%.4s]", sprint_hex(data+8 ,4),data+8);
|
PrintAndLog(" deskey2 [46/0x2E]: %s [%.4s]", sprint_hex(data+8 ,4),data+8);
|
||||||
PrintAndLog(" deskey2 [47/0x2F]: %s [%.4s]", sprint_hex(data+12,4),data+12);
|
PrintAndLog(" deskey2 [47/0x2F]: %s [%.4s]", sprint_hex(data+12,4),data+12);
|
||||||
|
PrintAndLog("\n 3des key : %s", sprint_hex(SwapEndian64(data, 16, 8), 16));
|
||||||
PrintAndLog("\n 3des key : %s", sprint_hex(SwapEndian64(data, 16), 16));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,10 +655,9 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
uint8_t ulc_conf[16] = {0x00};
|
uint8_t ulc_conf[16] = {0x00};
|
||||||
status = ul_read(0x28, ulc_conf, sizeof(ulc_conf));
|
status = ul_read(0x28, ulc_conf, sizeof(ulc_conf));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ - possibly locked");
|
PrintAndLog("Error: tag didn't answer to READ UL-C");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulc_print_configuration(ulc_conf);
|
ulc_print_configuration(ulc_conf);
|
||||||
|
|
||||||
if ((tagtype & MAGIC)){
|
if ((tagtype & MAGIC)){
|
||||||
|
@ -673,17 +671,19 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
ulc_print_3deskey(ulc_deskey);
|
ulc_print_3deskey(ulc_deskey);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// if we called info with key, just return
|
// if we called info with key, just return
|
||||||
if ( hasAuthKey ) return 1;
|
if ( hasAuthKey ) return 1;
|
||||||
|
|
||||||
|
// also try to diversify default keys.. look into CmdHF14AMfuGenDiverseKeys
|
||||||
PrintAndLog("Trying some default 3des keys");
|
PrintAndLog("Trying some default 3des keys");
|
||||||
ul_switch_off_field();
|
ul_switch_off_field();
|
||||||
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ){
|
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ){
|
||||||
key = default_3des_keys[i];
|
key = default_3des_keys[i];
|
||||||
if (try3DesAuthentication(key) == 1){
|
if (try3DesAuthentication(key) == 1){
|
||||||
PrintAndLog("Found default 3des key: "); //%s", sprint_hex(key,16));
|
PrintAndLog("Found default 3des key: "); //%s", sprint_hex(key,16));
|
||||||
ulc_print_3deskey(SwapEndian64(key,16));
|
uint8_t keySwap[16];
|
||||||
|
memcpy(keySwap, SwapEndian64(key,16,8), 16);
|
||||||
|
ulc_print_3deskey(keySwap);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -984,7 +984,7 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
if(errors) return usage_hf_mfu_dump();
|
if(errors) return usage_hf_mfu_dump();
|
||||||
|
|
||||||
if (swapEndian)
|
if (swapEndian)
|
||||||
keyPtr = SwapEndian64(data, 16);
|
keyPtr = SwapEndian64(data, 16, 8);
|
||||||
|
|
||||||
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
||||||
if (tagtype == UL_ERROR) return -1;
|
if (tagtype == UL_ERROR) return -1;
|
||||||
|
|
|
@ -164,14 +164,16 @@ uint64_t bytes_to_num(uint8_t* src, size_t len)
|
||||||
// to
|
// to
|
||||||
// hh,gg,ff,ee,dd,cc,bb,aa, pp,oo,nn,mm,ll,kk,jj,ii
|
// hh,gg,ff,ee,dd,cc,bb,aa, pp,oo,nn,mm,ll,kk,jj,ii
|
||||||
// up to 64 bytes or 512 bits
|
// up to 64 bytes or 512 bits
|
||||||
uint8_t *SwapEndian64(uint8_t *src, size_t len){
|
uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockSize){
|
||||||
static uint8_t temp[64]={0};
|
static uint8_t buf[64];
|
||||||
for (uint8_t block=0; block < (uint8_t)len/8; block++){
|
memset(buf, 0x00, 64);
|
||||||
for (size_t i = 0; i < 8; i++){
|
uint8_t *tmp = buf;
|
||||||
temp[i+(8*block)] = src[(7-i)+(8*block)];
|
for (uint8_t block=0; block < (uint8_t)(len/blockSize); block++){
|
||||||
|
for (size_t i = 0; i < blockSize; i++){
|
||||||
|
tmp[i+(blockSize*block)] = src[(blockSize-1-i)+(blockSize*block)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return temp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//assumes little endian
|
//assumes little endian
|
||||||
|
|
|
@ -44,7 +44,7 @@ char * sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t bre
|
||||||
void num_to_bytes(uint64_t n, size_t len, uint8_t* dest);
|
void num_to_bytes(uint64_t n, size_t len, uint8_t* dest);
|
||||||
uint64_t bytes_to_num(uint8_t* src, size_t len);
|
uint64_t bytes_to_num(uint8_t* src, size_t len);
|
||||||
char * printBits(size_t const size, void const * const ptr);
|
char * printBits(size_t const size, void const * const ptr);
|
||||||
uint8_t *SwapEndian64(uint8_t *src, size_t len);
|
uint8_t *SwapEndian64(const uint8_t *src, const size_t len, const uint8_t blockSize);
|
||||||
|
|
||||||
char param_getchar(const char *line, int paramnum);
|
char param_getchar(const char *line, int paramnum);
|
||||||
uint8_t param_get8(const char *line, int paramnum);
|
uint8_t param_get8(const char *line, int paramnum);
|
||||||
|
|
Loading…
Reference in a new issue