mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
style
This commit is contained in:
parent
b50fe594da
commit
d28fac3ef0
9 changed files with 175 additions and 175 deletions
|
@ -528,7 +528,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "got ack. Status %d", resp.arg[0]);
|
PrintAndLogEx(NORMAL, "got ack. Status %d", resp.arg[0]);
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
PrintAndLogEx(NORMAL, "-- " _BLUE_("its my message") "\n");
|
PrintAndLogEx(NORMAL, "-- " _BLUE_("its my message") "\n");
|
||||||
PrintAndLogEx(NORMAL, "-- " _RED_("its my message") "\n");
|
PrintAndLogEx(NORMAL, "-- " _RED_("its my message") "\n");
|
||||||
PrintAndLogEx(NORMAL, "-- " _YELLOW_("its my message") "\n");
|
PrintAndLogEx(NORMAL, "-- " _YELLOW_("its my message") "\n");
|
||||||
|
@ -539,7 +539,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
// Sequence X followed by Sequence Y followed by Sequence Z (111100x1 11111111 00x11111)
|
// Sequence X followed by Sequence Y followed by Sequence Z (111100x1 11111111 00x11111)
|
||||||
// we therefore look for a ...xx1111 11111111 00x11111xxxxxx... pattern
|
// we therefore look for a ...xx1111 11111111 00x11111xxxxxx... pattern
|
||||||
// (12 '1's followed by 2 '0's, eventually followed by another '0', followed by 5 '1's)
|
// (12 '1's followed by 2 '0's, eventually followed by another '0', followed by 5 '1's)
|
||||||
# define SYNC_16BIT 0xB24D
|
# define SYNC_16BIT 0xB24D
|
||||||
uint32_t shiftReg = param_get32ex(Cmd, 0, 0xb24d, 16);
|
uint32_t shiftReg = param_get32ex(Cmd, 0, 0xb24d, 16);
|
||||||
uint8_t bt = param_get8ex(Cmd, 1, 0xBB, 16);
|
uint8_t bt = param_get8ex(Cmd, 1, 0xBB, 16);
|
||||||
uint8_t byte_offset = 99;
|
uint8_t byte_offset = 99;
|
||||||
|
@ -557,14 +557,14 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
n1 = (n1 << 4) | (rev & (uint8_t)(~(0xFF << 4)));
|
n1 = (n1 << 4) | (rev & (uint8_t)(~(0xFF << 4)));
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "rev %02X | %02X %s | %02X %s |\n", rev, n0, pb(n0), n1, pb(n1));
|
PrintAndLogEx(NORMAL, "rev %02X | %02X %s | %02X %s |\n", rev, n0, pb(n0), n1, pb(n1));
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
hex(0xb24d shr 0) 0xB24D 0b1011001001001101
|
hex(0xb24d shr 0) 0xB24D 0b1011001001001101
|
||||||
hex(0xb24d shr 1) 0x5926
|
hex(0xb24d shr 1) 0x5926
|
||||||
hex(0xb24d shr 2) 0x2C93
|
hex(0xb24d shr 2) 0x2C93
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
PrintAndLogEx(NORMAL, " (shiftReg >> %d) & 0xFFFF == %08x ---", i, ((shiftReg >> i) & 0xFFFF));
|
PrintAndLogEx(NORMAL, " (shiftReg >> %d) & 0xFFFF == %08x ---", i, ((shiftReg >> i) & 0xFFFF));
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
uint8_t p1 = (rev & (uint8_t)(~(0xFF << byte_offset)));
|
uint8_t p1 = (rev & (uint8_t)(~(0xFF << byte_offset)));
|
||||||
PrintAndLogEx(NORMAL, "Offset %u | leftovers %02x %s \n", byte_offset, p1, pb(p1));
|
PrintAndLogEx(NORMAL, "Offset %u | leftovers %02x %s \n", byte_offset, p1, pb(p1));
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pm3 --> da hex2bin 4db2 0100110110110010
|
pm3 --> da hex2bin 4db2 0100110110110010
|
||||||
|
@ -621,7 +621,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
*/
|
*/
|
||||||
// return 0;
|
// return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// 14443-A
|
// 14443-A
|
||||||
uint8_t u14_c[] = {0x09, 0x78, 0x00, 0x92, 0x02, 0x54, 0x13, 0x02, 0x04, 0x2d, 0xe8 }; // atqs w crc
|
uint8_t u14_c[] = {0x09, 0x78, 0x00, 0x92, 0x02, 0x54, 0x13, 0x02, 0x04, 0x2d, 0xe8 }; // atqs w crc
|
||||||
uint8_t u14_w[] = {0x09, 0x78, 0x00, 0x92, 0x02, 0x54, 0x13, 0x02, 0x04, 0x2d, 0xe7 }; // atqs w crc
|
uint8_t u14_w[] = {0x09, 0x78, 0x00, 0x92, 0x02, 0x54, 0x13, 0x02, 0x04, 0x2d, 0xe7 }; // atqs w crc
|
||||||
|
@ -697,11 +697,11 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
uid(3e172b29) nt(039b7bd2) ks(0c0e0f0505080800) nr(00000001)
|
uid(3e172b29) nt(039b7bd2) ks(0c0e0f0505080800) nr(00000001)
|
||||||
uid(3e172b29) nt(039b7bd2) ks(0e06090d03000b0f) nr(00000002)
|
uid(3e172b29) nt(039b7bd2) ks(0e06090d03000b0f) nr(00000002)
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
uint64_t *keylistA = NULL, *keylistB = NULL;
|
uint64_t *keylistA = NULL, *keylistB = NULL;
|
||||||
uint32_t keycountA = 0, keycountB = 0;
|
uint32_t keycountA = 0, keycountB = 0;
|
||||||
// uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0, 0x0c0e0f0505080800};
|
// uint64_t d1[] = {0x3e172b29, 0x039b7bd2, 0x0000001, 0, 0x0c0e0f0505080800};
|
||||||
// uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0, 0x0e06090d03000b0f};
|
// uint64_t d2[] = {0x3e172b29, 0x039b7bd2, 0x0000002, 0, 0x0e06090d03000b0f};
|
||||||
uint64_t d1[] = {0x6e442129, 0x8f699195, 0x0000001, 0, 0x090d0b0305020f02};
|
uint64_t d1[] = {0x6e442129, 0x8f699195, 0x0000001, 0, 0x090d0b0305020f02};
|
||||||
uint64_t d2[] = {0x6e442129, 0x8f699195, 0x0000004, 0, 0x00040f0f0305030e};
|
uint64_t d2[] = {0x6e442129, 0x8f699195, 0x0000004, 0, 0x00040f0f0305030e};
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||||
|
|
||||||
free(keylistA);
|
free(keylistA);
|
||||||
free(keylistB);
|
free(keylistB);
|
||||||
*/
|
*/
|
||||||
// qsort(keylist, keycount, sizeof(*keylist), compare_uint64);
|
// qsort(keylist, keycount, sizeof(*keylist), compare_uint64);
|
||||||
// keycount = intersection(last_keylist, keylist);
|
// keycount = intersection(last_keylist, keylist);
|
||||||
|
|
||||||
|
|
|
@ -1314,11 +1314,11 @@ static int CmdRawDemod(const char *Cmd) {
|
||||||
|
|
||||||
str_lower((char *)Cmd);
|
str_lower((char *)Cmd);
|
||||||
|
|
||||||
if (str_startswith(Cmd, "fs") || Cmd[0] == 'f' ) ans = CmdFSKrawdemod(Cmd+2);
|
if (str_startswith(Cmd, "fs") || Cmd[0] == 'f') ans = CmdFSKrawdemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "ab")) ans = Cmdaskbiphdemod(Cmd + 2);
|
else if (str_startswith(Cmd, "ab")) ans = Cmdaskbiphdemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "am")) ans = Cmdaskmandemod(Cmd + 2);
|
else if (str_startswith(Cmd, "am")) ans = Cmdaskmandemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "ar")) ans = Cmdaskrawdemod(Cmd + 2);
|
else if (str_startswith(Cmd, "ar")) ans = Cmdaskrawdemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "nr") || Cmd[0] == 'n') ans = CmdNRZrawDemod(Cmd+2);
|
else if (str_startswith(Cmd, "nr") || Cmd[0] == 'n') ans = CmdNRZrawDemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "p1") || Cmd[0] == 'p') ans = CmdPSK1rawDemod(Cmd + 2);
|
else if (str_startswith(Cmd, "p1") || Cmd[0] == 'p') ans = CmdPSK1rawDemod(Cmd + 2);
|
||||||
else if (str_startswith(Cmd, "p2")) ans = CmdPSK2rawDemod(Cmd + 2);
|
else if (str_startswith(Cmd, "p2")) ans = CmdPSK2rawDemod(Cmd + 2);
|
||||||
else PrintAndLogEx(WARNING, "Unknown modulation entered - see help ('h') for parameter structure");
|
else PrintAndLogEx(WARNING, "Unknown modulation entered - see help ('h') for parameter structure");
|
||||||
|
|
|
@ -200,7 +200,7 @@ static int CmdLegicInfo(const char *Cmd) {
|
||||||
crc = data[4];
|
crc = data[4];
|
||||||
uint32_t calc_crc = CRC8Legic(data, 4);
|
uint32_t calc_crc = CRC8Legic(data, 4);
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("CDF: System Area") );
|
PrintAndLogEx(NORMAL, _YELLOW_("CDF: System Area"));
|
||||||
PrintAndLogEx(NORMAL, "------------------------------------------------------");
|
PrintAndLogEx(NORMAL, "------------------------------------------------------");
|
||||||
PrintAndLogEx(NORMAL, "MCD: %02x, MSN: %02x %02x %02x, MCC: %02x %s",
|
PrintAndLogEx(NORMAL, "MCD: %02x, MSN: %02x %02x %02x, MCC: %02x %s",
|
||||||
data[0],
|
data[0],
|
||||||
|
@ -313,7 +313,7 @@ static int CmdLegicInfo(const char *Cmd) {
|
||||||
if (dcf > 60000)
|
if (dcf > 60000)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("\nADF: User Area") );
|
PrintAndLogEx(NORMAL, _YELLOW_("\nADF: User Area"));
|
||||||
PrintAndLogEx(NORMAL, "------------------------------------------------------");
|
PrintAndLogEx(NORMAL, "------------------------------------------------------");
|
||||||
|
|
||||||
if (bIsSegmented) {
|
if (bIsSegmented) {
|
||||||
|
@ -403,7 +403,7 @@ static int CmdLegicInfo(const char *Cmd) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remain_seg_payload_len > 0 ) {
|
if (remain_seg_payload_len > 0) {
|
||||||
PrintAndLogEx(NORMAL, "Remaining segment payload: (I %d | K %d | Remain LEN %d)", i, k, remain_seg_payload_len);
|
PrintAndLogEx(NORMAL, "Remaining segment payload: (I %d | K %d | Remain LEN %d)", i, k, remain_seg_payload_len);
|
||||||
PrintAndLogEx(NORMAL, "\nrow | data");
|
PrintAndLogEx(NORMAL, "\nrow | data");
|
||||||
PrintAndLogEx(NORMAL, "-----+------------------------------------------------");
|
PrintAndLogEx(NORMAL, "-----+------------------------------------------------");
|
||||||
|
@ -468,7 +468,7 @@ static int CmdLegicInfo(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( remain_seg_payload_len > 0 ) {
|
if (remain_seg_payload_len > 0) {
|
||||||
PrintAndLogEx(NORMAL, "Remaining segment payload: (I %d | Remain LEN %d)", i, remain_seg_payload_len);
|
PrintAndLogEx(NORMAL, "Remaining segment payload: (I %d | Remain LEN %d)", i, remain_seg_payload_len);
|
||||||
PrintAndLogEx(NORMAL, "\nrow | data");
|
PrintAndLogEx(NORMAL, "\nrow | data");
|
||||||
PrintAndLogEx(NORMAL, "-----+------------------------------------------------");
|
PrintAndLogEx(NORMAL, "-----+------------------------------------------------");
|
||||||
|
|
|
@ -226,7 +226,7 @@ static int CmdFdxDemod(const char *Cmd) {
|
||||||
PrintAndLogEx(SUCCESS, "Reserved/RFU %u (0x04%X)", reservedCode, reservedCode);
|
PrintAndLogEx(SUCCESS, "Reserved/RFU %u (0x04%X)", reservedCode, reservedCode);
|
||||||
PrintAndLogEx(SUCCESS, "Animal Tag %s", animalBit ? _YELLOW_("True") : "False");
|
PrintAndLogEx(SUCCESS, "Animal Tag %s", animalBit ? _YELLOW_("True") : "False");
|
||||||
PrintAndLogEx(SUCCESS, "Has extended data %s [0x%X]", dataBlockBit ? _YELLOW_("True") : "False", extended);
|
PrintAndLogEx(SUCCESS, "Has extended data %s [0x%X]", dataBlockBit ? _YELLOW_("True") : "False", extended);
|
||||||
PrintAndLogEx(SUCCESS, "CRC-16 0x%04X - 0x%04X [%s]", crc_16, calcCrc, (calcCrc == crc_16) ? _GREEN_("Ok") : _RED_("Fail") );
|
PrintAndLogEx(SUCCESS, "CRC-16 0x%04X - 0x%04X [%s]", crc_16, calcCrc, (calcCrc == crc_16) ? _GREEN_("Ok") : _RED_("Fail"));
|
||||||
|
|
||||||
if (g_debugMode) {
|
if (g_debugMode) {
|
||||||
PrintAndLogEx(DEBUG, "Start marker %d; Size %d", preambleIndex, size);
|
PrintAndLogEx(DEBUG, "Start marker %d; Size %d", preambleIndex, size);
|
||||||
|
|
|
@ -287,8 +287,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
for (int m = strlen(argv[0]); m > 0; m--) {
|
for (int m = strlen(argv[0]); m > 0; m--) {
|
||||||
if ( argv[0][m] == '\\' ) {
|
if (argv[0][m] == '\\') {
|
||||||
show_help(true, argv[0] + (++m) );
|
show_help(true, argv[0] + (++m));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// ensure gmtime_r is available even with -std=c99; must be included before
|
// ensure gmtime_r is available even with -std=c99; must be included before
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,14 @@ inline int16_t usart_readbuffer(uint8_t *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usart_readcheck(uint8_t *data,size_t len) {
|
void usart_readcheck(uint8_t *data, size_t len) {
|
||||||
if (pUS1->US_RCR<len){
|
if (pUS1->US_RCR < len) {
|
||||||
if (check == 0){
|
if (check == 0) {
|
||||||
StartCountUS();
|
StartCountUS();
|
||||||
check = 1;
|
check = 1;
|
||||||
}
|
}
|
||||||
//300ms
|
//300ms
|
||||||
if (GetCountUS() > 300000){
|
if (GetCountUS() > 300000) {
|
||||||
pUS1->US_RPR = (uint32_t)data;
|
pUS1->US_RPR = (uint32_t)data;
|
||||||
pUS1->US_RCR = len;
|
pUS1->US_RCR = len;
|
||||||
check = 0;
|
check = 0;
|
||||||
|
|
|
@ -13,7 +13,7 @@ int16_t usart_readbuffer(uint8_t *data);
|
||||||
int16_t usart_writebuffer(uint8_t *data, size_t len);
|
int16_t usart_writebuffer(uint8_t *data, size_t len);
|
||||||
bool usart_dataavailable(void);
|
bool usart_dataavailable(void);
|
||||||
int16_t usart_readcommand(uint8_t *data);
|
int16_t usart_readcommand(uint8_t *data);
|
||||||
void usart_readcheck(uint8_t *data,size_t len);
|
void usart_readcheck(uint8_t *data, size_t len);
|
||||||
|
|
||||||
bool usart_commandavailable(void);
|
bool usart_commandavailable(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue