mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
Merge branch 'master' into experimental_varlen
* master: rework Dbprintf & add color support use color macros doc magic archive and fix hid-flasher update standalone readme
This commit is contained in:
commit
1c136c8fc6
32 changed files with 210 additions and 183 deletions
|
@ -96,10 +96,10 @@ void BigBuf_free_keep_EM(void) {
|
|||
}
|
||||
|
||||
void BigBuf_print_status(void) {
|
||||
Dbprintf("Memory");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Memory"));
|
||||
Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE);
|
||||
Dbprintf(" Available memory........%d", BigBuf_hi);
|
||||
Dbprintf("Tracing");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Tracing"));
|
||||
Dbprintf(" tracing ................%d", tracing);
|
||||
Dbprintf(" traceLen ...............%d", traceLen);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ void cjPrintBigArray(const char *bigar, int len, uint8_t newlines, uint8_t debug
|
|||
}
|
||||
if (newlines > 0)
|
||||
{
|
||||
DbprintfEx(FLAG_NOLOG, " ");
|
||||
DbprintfEx(FLAG_NEWLINE, " ");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -81,7 +81,7 @@ void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type
|
|||
char tosendkey[13];
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[0], foundKey[1], foundKey[2], foundKey[3], foundKey[4], foundKey[5]);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x | KEY : %s | TYP: %d", sectorNo, tosendkey, type);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x | KEY : %s | TYP: %d", sectorNo, tosendkey, type);
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -94,7 +94,7 @@ void ReadLastTagFromFlash() {
|
|||
uint32_t startidx = 0;
|
||||
uint16_t len = 1024;
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "Button HELD ! Using LAST Known TAG for Simulation...");
|
||||
DbprintfEx(FLAG_NEWLINE, "Button HELD ! Using LAST Known TAG for Simulation...");
|
||||
cjSetCursLeft();
|
||||
|
||||
size_t size = len;
|
||||
|
@ -114,7 +114,7 @@ void ReadLastTagFromFlash() {
|
|||
if (isok == len) {
|
||||
emlSetMem(mem, 0, 64);
|
||||
} else {
|
||||
DbprintfEx(FLAG_NOLOG, "FlashMem reading failed | %d | %d", len, isok);
|
||||
DbprintfEx(FLAG_NEWLINE, "FlashMem reading failed | %d | %d", len, isok);
|
||||
cjSetCursLeft();
|
||||
FlashStop();
|
||||
SpinOff(100);
|
||||
|
@ -122,9 +122,9 @@ void ReadLastTagFromFlash() {
|
|||
}
|
||||
}
|
||||
end_time = GetTickCount();
|
||||
DbprintfEx(FLAG_NOLOG, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_READ", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
FlashStop();
|
||||
SpinOff(0);
|
||||
|
@ -173,7 +173,7 @@ void WriteTagToFlash(uint8_t index, size_t size) {
|
|||
uint8_t isok = (res == bytes_in_packet) ? 1 : 0;
|
||||
|
||||
if (!isok) {
|
||||
DbprintfEx(FLAG_NOLOG, "FlashMem write FAILEd [offset %u]", bytes_sent);
|
||||
DbprintfEx(FLAG_NEWLINE, "FlashMem write FAILEd [offset %u]", bytes_sent);
|
||||
cjSetCursLeft();
|
||||
SpinOff(100);
|
||||
return;
|
||||
|
@ -186,9 +186,9 @@ void WriteTagToFlash(uint8_t index, size_t size) {
|
|||
}
|
||||
end_time = GetTickCount();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "[OK] TAG WRITTEN TO FLASH ! [0-to offset %u]", bytes_sent);
|
||||
DbprintfEx(FLAG_NEWLINE, "[OK] TAG WRITTEN TO FLASH ! [0-to offset %u]", bytes_sent);
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "%s[IN]%s %s%dms%s for TAG_FLASH_WRITE", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[IN]%s %s%dms%s for TAG_FLASH_WRITE", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
FlashStop();
|
||||
SpinOff(0);
|
||||
|
@ -328,9 +328,9 @@ void RunMod() {
|
|||
|
||||
// banner:
|
||||
vtsend_reset(NULL);
|
||||
DbprintfEx(FLAG_NOLOG, "\r\n%s", clearTerm);
|
||||
DbprintfEx(FLAG_NOLOG, "%s%s%s", _CYAN_, sub_banner, _WHITE_);
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s C.J.B's MifareFastPwn Started\r\n", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE, "\r\n%s", clearTerm);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s%s%s", _CYAN_, sub_banner, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s C.J.B's MifareFastPwn Started\r\n", _RED_, _WHITE_);
|
||||
|
||||
currline = 20;
|
||||
curlline = 20;
|
||||
|
@ -342,7 +342,7 @@ failtag:
|
|||
vtsend_cursor_position_save(NULL);
|
||||
vtsend_set_attribute(NULL, 1);
|
||||
vtsend_set_attribute(NULL, 5);
|
||||
DbprintfEx(FLAG_NOLOG, "\t\t\t[ Waiting For Tag ]");
|
||||
DbprintfEx(FLAG_NEWLINE, "\t\t\t[ Waiting For Tag ]");
|
||||
vtsend_set_attribute(NULL, 0);
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
@ -360,7 +360,7 @@ failtag:
|
|||
|
||||
if (BUTTON_HELD(10) > 0) {
|
||||
WDT_HIT();
|
||||
DbprintfEx(FLAG_NOLOG, "\t\t\t[ READING FLASH ]");
|
||||
DbprintfEx(FLAG_NEWLINE, "\t\t\t[ READING FLASH ]");
|
||||
ReadLastTagFromFlash();
|
||||
goto readysim;
|
||||
}
|
||||
|
@ -370,16 +370,16 @@ failtag:
|
|||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
vtsend_cursor_position_restore(NULL);
|
||||
DbprintfEx(FLAG_NOLOG, "\t\t\t%s[ GOT a Tag ! ]%s", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "\t\t\t%s[ GOT a Tag ! ]%s", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "\t\t\t `---> Breaking keys ---->");
|
||||
DbprintfEx(FLAG_NEWLINE, "\t\t\t `---> Breaking keys ---->");
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "\t%sGOT TAG :%s %08x%s", _RED_, _CYAN_, cjcuid, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "\t%sGOT TAG :%s %08x%s", _RED_, _CYAN_, cjcuid, _WHITE_);
|
||||
|
||||
if (cjcuid == 0) {
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s BUG: 0000_CJCUID! Retrying...", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s BUG: 0000_CJCUID! Retrying...", _RED_, _WHITE_);
|
||||
SpinErr(0, 100, 8);
|
||||
goto failtag;
|
||||
}
|
||||
|
@ -387,11 +387,11 @@ failtag:
|
|||
SpinOff(50);
|
||||
LED_B_ON();
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "--------+--------------------+-------");
|
||||
DbprintfEx(FLAG_NEWLINE, "--------+--------------------+-------");
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, " SECTOR | KEY | A/B ");
|
||||
DbprintfEx(FLAG_NEWLINE, " SECTOR | KEY | A/B ");
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "--------+--------------------+-------");
|
||||
DbprintfEx(FLAG_NEWLINE, "--------+--------------------+-------");
|
||||
|
||||
uint32_t end_time;
|
||||
uint32_t start_time = end_time = GetTickCount();
|
||||
|
@ -445,26 +445,26 @@ failtag:
|
|||
char tosendkey[13];
|
||||
num_to_bytes(key64, 6, foundKey[type][sec]);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %012" PRIx64 " ; TYP: %i", sec, key64, type);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %012" PRIx64 " ; TYP: %i", sec, key64, type);
|
||||
/*reply_old(CMD_CJB_INFORM_CLIENT_KEY, 12, sec, type, tosendkey, 12);*/
|
||||
switch (key64) {
|
||||
/////////////////////////////////////////////////////////
|
||||
// COMMON SCHEME 1 : INFINITRON/HEXACT
|
||||
case 0x484558414354:
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%sDetected: %s INFI_HEXACT_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sDetected: %s INFI_HEXACT_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
;
|
||||
// Type 0 / A first
|
||||
uint16_t t = 0;
|
||||
|
@ -473,7 +473,7 @@ failtag:
|
|||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][s][0], foundKey[t][s][1], foundKey[t][s][2],
|
||||
foundKey[t][s][3], foundKey[t][s][4], foundKey[t][s][5]);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
}
|
||||
t = 1;
|
||||
uint16_t sectorNo = 0;
|
||||
|
@ -482,112 +482,112 @@ failtag:
|
|||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 1;
|
||||
num_to_bytes(0x49fae4e3849f, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 2;
|
||||
num_to_bytes(0x38fcf33072e0, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 3;
|
||||
num_to_bytes(0x8ad5517b4b18, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 4;
|
||||
num_to_bytes(0x509359f131b1, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 5;
|
||||
num_to_bytes(0x6c78928e1317, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 6;
|
||||
num_to_bytes(0xaa0720018738, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 7;
|
||||
num_to_bytes(0xa6cac2886412, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 8;
|
||||
num_to_bytes(0x62d0c424ed8e, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 9;
|
||||
num_to_bytes(0xe64a986a5d94, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 10;
|
||||
num_to_bytes(0x8fa1d601d0a2, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 11;
|
||||
num_to_bytes(0x89347350bd36, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 12;
|
||||
num_to_bytes(0x66d2b7dc39ef, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 13;
|
||||
num_to_bytes(0x6bc1e1ae547d, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 14;
|
||||
num_to_bytes(0x22729a9bd40f, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
sectorNo = 15;
|
||||
num_to_bytes(0x484558414354, 6, foundKey[t][sectorNo]);
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[t][sectorNo][0], foundKey[t][sectorNo][1], foundKey[t][sectorNo][2],
|
||||
foundKey[t][sectorNo][3], foundKey[t][sectorNo][4], foundKey[t][sectorNo][5]);
|
||||
cjSetCursRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", sectorNo, tosendkey, t);
|
||||
trapped = 1;
|
||||
break;
|
||||
////////////////END OF SCHEME 1//////////////////////////////
|
||||
|
@ -597,19 +597,19 @@ failtag:
|
|||
case 0x8829da9daf76:
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%sDetected :%sURMET_CAPTIVE_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sDetected :%sURMET_CAPTIVE_VIGIK_TAG%s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
// emlClearMem();
|
||||
|
@ -626,7 +626,7 @@ failtag:
|
|||
foundKey[i][s][5]
|
||||
);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, i);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, i);
|
||||
}
|
||||
}
|
||||
trapped = 1;
|
||||
|
@ -639,19 +639,19 @@ failtag:
|
|||
case 0x424c41524f4e:
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*STOP*!<<<<<<<<<<<<<<%s", _RED_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, " .TAG SEEMS %sDETERMINISTIC%s. ", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s Detected :%sNORALSY_VIGIK_TAG %s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s Detected :%sNORALSY_VIGIK_TAG %s", _ORANGE_, _CYAN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "...%s[%sKey_derivation_schemeTest%s]%s...", _YELLOW_, _GREEN_, _YELLOW_, _GREEN_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>>>>>>!*DONE*!<<<<<<<<<<<<<<%s", _GREEN_, _WHITE_);
|
||||
|
||||
t = 0;
|
||||
for (uint16_t s = 0; s < sectorsCnt; s++) {
|
||||
|
@ -664,7 +664,7 @@ failtag:
|
|||
foundKey[t][s][4],
|
||||
foundKey[t][s][5]);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
}
|
||||
|
||||
t = 1;
|
||||
|
@ -678,7 +678,7 @@ failtag:
|
|||
foundKey[t][s][4],
|
||||
foundKey[t][s][5]);
|
||||
cjSetCursRight();
|
||||
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
DbprintfEx(FLAG_NEWLINE, "SEC: %02x ; KEY : %s ; TYP: %d", s, tosendkey, t);
|
||||
}
|
||||
trapped = 1;
|
||||
break;
|
||||
|
@ -692,7 +692,7 @@ failtag:
|
|||
if (!allKeysFound) {
|
||||
cjSetCursLeft();
|
||||
cjTabulize();
|
||||
DbprintfEx(FLAG_NOLOG, "%s[ FAIL ]%s\r\n->did not found all the keys :'(", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[ FAIL ]%s\r\n->did not found all the keys :'(", _RED_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
SpinErr(1, 100, 8);
|
||||
SpinOff(100);
|
||||
|
@ -711,25 +711,25 @@ failtag:
|
|||
}
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _YELLOW_, _WHITE_, _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _YELLOW_, _WHITE_, _GREEN_, _WHITE_);
|
||||
|
||||
/* filling TAG to emulator */
|
||||
uint8_t filled = 0;
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s Filling Emulator <- from A keys...", _YELLOW_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Filling Emulator <- from A keys...", _YELLOW_, _WHITE_);
|
||||
e_MifareECardLoad(sectorsCnt, 0, 0, &filled);
|
||||
if (filled != 1) {
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _RED_, _ORANGE_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _RED_, _ORANGE_, _WHITE_);
|
||||
|
||||
/* no trace, no dbg */
|
||||
e_MifareECardLoad(sectorsCnt, 1, 0, &filled);
|
||||
if (filled != 1) {
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "FATAL:EML_FALLBACKFILL_B");
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "FATAL:EML_FALLBACKFILL_B");
|
||||
SpinErr(2, 100, 8);
|
||||
SpinOff(100);
|
||||
return;
|
||||
|
@ -739,13 +739,13 @@ failtag:
|
|||
end_time = GetTickCount();
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>%s Time for VIGIK break :%s%dms%s", _GREEN_, _WHITE_, _YELLOW_, end_time - start_time, _WHITE_);
|
||||
|
||||
vtsend_cursor_position_save(NULL);
|
||||
vtsend_set_attribute(NULL, 1);
|
||||
vtsend_set_attribute(NULL, 5);
|
||||
cjTabulize();
|
||||
DbprintfEx(FLAG_NOLOG, "[ WRITING FLASH ]");
|
||||
DbprintfEx(FLAG_NEWLINE, "[ WRITING FLASH ]");
|
||||
cjSetCursLeft();
|
||||
cjSetCursLeft();
|
||||
|
||||
|
@ -755,20 +755,20 @@ readysim:
|
|||
// SIM ?
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "-> We launch Emulation ->");
|
||||
DbprintfEx(FLAG_NEWLINE, "-> We launch Emulation ->");
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s!> HOLD ON : %s When you'll click, simm will stop", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s!> HOLD ON : %s When you'll click, simm will stop", _RED_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "Then %s immediately %s we'll try to %s dump our emulator state%s \r\nin a %s chinese tag%s", _RED_, _WHITE_, _YELLOW_, _WHITE_,
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "Then %s immediately %s we'll try to %s dump our emulator state%s \r\nin a %s chinese tag%s", _RED_, _WHITE_, _YELLOW_, _WHITE_,
|
||||
_CYAN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
cjSetCursLeft();
|
||||
|
||||
cjTabulize();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "[ SIMULATION ]");
|
||||
DbprintfEx(FLAG_NEWLINE, "[ SIMULATION ]");
|
||||
vtsend_set_attribute(NULL, 0);
|
||||
|
||||
SpinOff(100);
|
||||
|
@ -777,21 +777,21 @@ readysim:
|
|||
LED_C_OFF();
|
||||
SpinOff(50);
|
||||
vtsend_cursor_position_restore(NULL);
|
||||
DbprintfEx(FLAG_NOLOG, "[ SIMUL ENDED ]%s", _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "[ SIMUL ENDED ]%s", _GREEN_, _WHITE_);
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "<- We're out of Emulation");
|
||||
DbprintfEx(FLAG_NEWLINE, "<- We're out of Emulation");
|
||||
// END SIM
|
||||
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "-> Trying a clone !");
|
||||
DbprintfEx(FLAG_NEWLINE, "-> Trying a clone !");
|
||||
saMifareMakeTag();
|
||||
cjSetCursLeft();
|
||||
vtsend_cursor_position_restore(NULL);
|
||||
DbprintfEx(FLAG_NOLOG, "%s[ CLONED? ]", _CYAN_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s[ CLONED? ]", _CYAN_);
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "-> End Cloning.");
|
||||
DbprintfEx(FLAG_NEWLINE, "-> End Cloning.");
|
||||
WDT_HIT();
|
||||
|
||||
// Debunk...
|
||||
|
@ -799,7 +799,7 @@ readysim:
|
|||
cjTabulize();
|
||||
vtsend_set_attribute(NULL, 0);
|
||||
vtsend_set_attribute(NULL, 7);
|
||||
DbprintfEx(FLAG_NOLOG, "- [ LA FIN ] -\r\n%s`-> You can take shell back :) ...", _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "- [ LA FIN ] -\r\n%s`-> You can take shell back :) ...", _WHITE_);
|
||||
cjSetCursLeft();
|
||||
vtsend_set_attribute(NULL, 0);
|
||||
SpinErr(3, 100, 16);
|
||||
|
@ -844,14 +844,14 @@ void e_MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *dat
|
|||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_FIRST)) {
|
||||
|
||||
if (MF_DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NOLOG, "Sector[%2d]. Auth error", s);
|
||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth error", s);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_NESTED)) {
|
||||
isOK = false;
|
||||
if (MF_DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NOLOG, "Sector[%2d]. Auth nested error", s);
|
||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth nested error", s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -860,7 +860,7 @@ void e_MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *dat
|
|||
if (isOK && mifare_classic_readblock(pcs, cjcuid, FirstBlockOfSector(s) + blockNo, dataoutbuf)) {
|
||||
isOK = false;
|
||||
if (MF_DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NOLOG, "Error reading sector %2d block %2d", s, blockNo);
|
||||
DbprintfEx(FLAG_NEWLINE, "Error reading sector %2d block %2d", s, blockNo);
|
||||
break;
|
||||
};
|
||||
if (isOK) {
|
||||
|
@ -881,7 +881,7 @@ void e_MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *dat
|
|||
|
||||
if (mifare_classic_halt(pcs, cjcuid)) {
|
||||
if (MF_DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
};
|
||||
|
||||
crypto1_destroy(pcs);
|
||||
|
@ -909,7 +909,7 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
|||
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
||||
if (!iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true)) {
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NOLOG, "%sFATAL%s : E_MF_LOSTTAG", _RED_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%sFATAL%s : E_MF_LOSTTAG", _RED_, _WHITE_);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -938,12 +938,12 @@ void saMifareMakeTag(void) {
|
|||
cjTabulize();
|
||||
vtsend_cursor_position_save(NULL);
|
||||
vtsend_set_attribute(NULL, 1);
|
||||
DbprintfEx(FLAG_NOLOG, "[ CLONING ]");
|
||||
DbprintfEx(FLAG_NEWLINE, "[ CLONING ]");
|
||||
vtsend_set_attribute(NULL, 0);
|
||||
|
||||
cjSetCursFRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, ">> Write to Special:");
|
||||
DbprintfEx(FLAG_NEWLINE, ">> Write to Special:");
|
||||
int flags = 0;
|
||||
for (int blockNum = 0; blockNum < 16 * 4; blockNum++) {
|
||||
uint8_t mblock[16];
|
||||
|
@ -968,7 +968,7 @@ void saMifareMakeTag(void) {
|
|||
if (currfline > 53) {
|
||||
currfline = 54;
|
||||
}
|
||||
DbprintfEx(FLAG_NOLOG, "Block :%02x %sOK%s", blockNum, _GREEN_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "Block :%02x %sOK%s", blockNum, _GREEN_, _WHITE_);
|
||||
// DbprintfEx(FLAG_RAWPRINT,"FATAL:E_MF_CHINESECOOK_NORICE");
|
||||
// cfail=1;
|
||||
// return;
|
||||
|
@ -977,15 +977,15 @@ void saMifareMakeTag(void) {
|
|||
cjSetCursLeft();
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _RED_, _WHITE_, blockNum);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _RED_, _WHITE_, blockNum);
|
||||
cjSetCursFRight();
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>%s STOP AT %02x", _RED_, _WHITE_, blockNum);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>%s STOP AT %02x", _RED_, _WHITE_, blockNum);
|
||||
cfail++;
|
||||
break;
|
||||
}
|
||||
cjSetCursFRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "%s>>>>>>>> END <<<<<<<<%s", _YELLOW_, _WHITE_);
|
||||
DbprintfEx(FLAG_NEWLINE|FLAG_ANSI, "%s>>>>>>>> END <<<<<<<<%s", _YELLOW_, _WHITE_);
|
||||
// break;
|
||||
/*if (cfail == 1) {
|
||||
DbprintfEx(FLAG_RAWPRINT,"FATAL: E_MF_HARA_KIRI_\r\n");
|
||||
|
@ -1039,12 +1039,12 @@ int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *data
|
|||
// get UID from chip
|
||||
if (workFlags & 0x01) {
|
||||
if (!iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Can't select card");
|
||||
DbprintfEx(FLAG_NEWLINE, "Can't select card");
|
||||
break;
|
||||
};
|
||||
|
||||
if (mifare_classic_halt(NULL, cjcuid)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -1053,18 +1053,18 @@ int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *data
|
|||
if (needWipe) {
|
||||
ReaderTransmitBitsPar(wupC1, 7, 0, NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC1 error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC1 error");
|
||||
break;
|
||||
};
|
||||
|
||||
ReaderTransmit(wipeC, sizeof(wipeC), NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wipeC error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wipeC error");
|
||||
break;
|
||||
};
|
||||
|
||||
if (mifare_classic_halt(NULL, cjcuid)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -1074,19 +1074,19 @@ int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *data
|
|||
if (workFlags & 0x02) {
|
||||
ReaderTransmitBitsPar(wupC1, 7, 0, NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC1 error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC1 error");
|
||||
break;
|
||||
};
|
||||
|
||||
ReaderTransmit(wupC2, sizeof(wupC2), NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC2 errorv");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC2 errorv");
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
if ((mifare_sendcmd_short(NULL, 0, 0xA0, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 1) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "write block send command error");
|
||||
DbprintfEx(FLAG_NEWLINE, "write block send command error");
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *data
|
|||
AddCrc14A(d_block, 16);
|
||||
ReaderTransmit(d_block, sizeof(d_block), NULL);
|
||||
if ((ReaderReceive(receivedAnswer, receivedAnswerPar) != 1) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "write block send data error");
|
||||
DbprintfEx(FLAG_NEWLINE, "write block send data error");
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *data
|
|||
if (mifare_classic_halt(NULL, cjcuid)) {
|
||||
cjSetCursFRight();
|
||||
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -75,12 +75,12 @@ static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_
|
|||
// get UID from chip
|
||||
if (workFlags & 0x01) {
|
||||
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Can't select card");
|
||||
DbprintfEx(FLAG_NEWLINE, "Can't select card");
|
||||
break;
|
||||
};
|
||||
|
||||
if (mifare_classic_halt(NULL, cuid)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -89,18 +89,18 @@ static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_
|
|||
if (needWipe) {
|
||||
ReaderTransmitBitsPar(wupC1, 7, 0, NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC1 error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC1 error");
|
||||
break;
|
||||
};
|
||||
|
||||
ReaderTransmit(wipeC, sizeof(wipeC), NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wipeC error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wipeC error");
|
||||
break;
|
||||
};
|
||||
|
||||
if (mifare_classic_halt(NULL, cuid)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -110,19 +110,19 @@ static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_
|
|||
if (workFlags & 0x02) {
|
||||
ReaderTransmitBitsPar(wupC1, 7, 0, NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC1 error");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC1 error");
|
||||
break;
|
||||
};
|
||||
|
||||
ReaderTransmit(wupC2, sizeof(wupC2), NULL);
|
||||
if (!ReaderReceive(receivedAnswer, receivedAnswerPar) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "wupC2 errorv");
|
||||
DbprintfEx(FLAG_NEWLINE, "wupC2 errorv");
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
if ((mifare_sendcmd_short(NULL, 0, 0xA0, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 1) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "write block send command error");
|
||||
DbprintfEx(FLAG_NEWLINE, "write block send command error");
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -130,13 +130,13 @@ static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_
|
|||
AddCrc14A(d_block, 16);
|
||||
ReaderTransmit(d_block, sizeof(d_block), NULL);
|
||||
if ((ReaderReceive(receivedAnswer, receivedAnswerPar) != 1) || (receivedAnswer[0] != 0x0a)) {
|
||||
DbprintfEx(FLAG_NOLOG, "write block send data error");
|
||||
DbprintfEx(FLAG_NEWLINE, "write block send data error");
|
||||
break;
|
||||
};
|
||||
|
||||
if (workFlags & 0x04) {
|
||||
if (mifare_classic_halt(NULL, cuid)) {
|
||||
DbprintfEx(FLAG_NOLOG, "Halt error");
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
|||
/* no need for anticollision. just verify tag is still here */
|
||||
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
||||
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
||||
DbprintfEx(FLAG_NOLOG, "FATAL : E_MF_LOSTTAG");
|
||||
DbprintfEx(FLAG_NEWLINE, "FATAL : E_MF_LOSTTAG");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ As it is now, you can only have one standalone mode installed at the time.
|
|||
|
||||
## Implementing a standalone mode
|
||||
|
||||
We suggest you keep your standalone code inside the Armsrc/Standalone folder. And that you name your files according to your standalone mode name.
|
||||
We suggest you keep your standalone code inside the `armsrc/Standalone` folder. And that you name your files according to your standalone mode name.
|
||||
|
||||
The `standalone.h` states that you must have two function implemented.
|
||||
The `standalone.h` states that you must have two functions implemented.
|
||||
|
||||
The ModInfo function, which is your identification of your standalone mode. This string will show when running the command `hw status` on the client.
|
||||
|
||||
|
@ -19,7 +19,7 @@ The RunMod function, which is your "main" function when running. You need to ch
|
|||
|
||||
````
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF good description of your mode - aka FooRun (my name)");
|
||||
DbpString(" LF good description of your mode - aka FooRun (your name)");
|
||||
}
|
||||
|
||||
void RunMod(void) {
|
||||
|
@ -40,27 +40,27 @@ void RunMod(void) {
|
|||
}
|
||||
````
|
||||
|
||||
Each standalone mode needs to have its own compiler flag to be added in `armsrc\makefile`.
|
||||
Each standalone mode needs to have its own compiler flag to be added in `armsrc/Makefile`.
|
||||
|
||||
## Naming your standalone mode
|
||||
|
||||
We suggest that you follow these guidelines,
|
||||
- Use HF/LF to denote which frequence your mod is targeting.
|
||||
We suggest that you follow these guidelines:
|
||||
- Use HF/LF to denote which frequency your mode is targeting.
|
||||
- Use you own github name/similar for perpetual honour to denote your mode.
|
||||
|
||||
sample:
|
||||
`LF_FOORUN`
|
||||
`LF_FOO`
|
||||
|
||||
Which indicates your mode targets LF and is called FOO.
|
||||
|
||||
This leads to your next step, your DEFINE name needed in Makefile.
|
||||
|
||||
`WITH_STANDALONE_LF_FOORUN`
|
||||
`WITH_STANDALONE_LF_FOO`
|
||||
|
||||
|
||||
## Update COMMON/MAKEFILE.HAL
|
||||
|
||||
Samples of directive flag used in the `common/Makefile.ha` and your suggested DEFINE.
|
||||
Add your suggested DEFINE to the samples of directive flag provided in the `common/Makefile.hal`.
|
||||
```
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_ICERUN
|
||||
|
@ -70,7 +70,7 @@ Samples of directive flag used in the `common/Makefile.ha` and your suggested DE
|
|||
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_MATTYRUN
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_HF_BOG
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_FOORUN
|
||||
#PLATFORM_DEFS += -DWITH_STANDALONE_LF_FOO
|
||||
```
|
||||
|
||||
## Update ARMSRC/MAKEFILE
|
||||
|
@ -90,11 +90,11 @@ endif
|
|||
|
||||
## Adding identification string of your mode
|
||||
Do please add a identification string in a function called `ModInfo` inside your source code file.
|
||||
This will enable an easy way to detect on client side which standalone mods has been installed on the device.
|
||||
This will enable an easy way to detect on client side which standalone mode has been installed on the device.
|
||||
|
||||
````
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF good description of your mode - aka FooRun (my name)");
|
||||
DbpString(" LF good description of your mode - aka FooRun (your name)");
|
||||
}
|
||||
````
|
||||
|
||||
|
|
|
@ -114,13 +114,13 @@ void print_result(char *name, uint8_t *buf, size_t len) {
|
|||
// Debug print functions, to go out over USB, to the usual PC-side client.
|
||||
//=============================================================================
|
||||
|
||||
void DbpStringEx(char *str, uint32_t cmd) {
|
||||
void DbpStringEx(uint32_t flags, char *str) {
|
||||
#if DEBUG
|
||||
struct {
|
||||
uint16_t flag;
|
||||
uint8_t buf[USB_CMD_DATA_SIZE - sizeof(uint16_t)];
|
||||
} PACKED data;
|
||||
data.flag = cmd;
|
||||
data.flag = flags;
|
||||
uint16_t len = MIN(strlen(str), sizeof(data.buf));
|
||||
memcpy(data.buf, str, len);
|
||||
reply_ng(CMD_DEBUG_PRINT_STRING, PM3_SUCCESS, (uint8_t *)&data, sizeof(data.flag) + len);
|
||||
|
@ -129,7 +129,7 @@ void DbpStringEx(char *str, uint32_t cmd) {
|
|||
|
||||
void DbpString(char *str) {
|
||||
#if DEBUG
|
||||
DbpStringEx(str, 0);
|
||||
DbpStringEx(FLAG_LOG, str);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void DbpIntegers(int x1, int x2, int x3) {
|
|||
reply_old(CMD_DEBUG_PRINT_INTEGERS, x1, x2, x3, 0, 0);
|
||||
}
|
||||
#endif
|
||||
void DbprintfEx(uint32_t cmd, const char *fmt, ...) {
|
||||
void DbprintfEx(uint32_t flags, const char *fmt, ...) {
|
||||
#if DEBUG
|
||||
// should probably limit size here; oh well, let's just use a big buffer
|
||||
char output_string[128] = {0x00};
|
||||
|
@ -147,7 +147,7 @@ void DbprintfEx(uint32_t cmd, const char *fmt, ...) {
|
|||
kvsprintf(fmt, output_string, 10, ap);
|
||||
va_end(ap);
|
||||
|
||||
DbpStringEx(output_string, cmd);
|
||||
DbpStringEx(flags, output_string);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -316,10 +316,10 @@ void MeasureAntennaTuningHf(void) {
|
|||
} else {
|
||||
volt = (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
}
|
||||
DbprintfEx(FLAG_NONEWLINE, "%u mV / %5u V", volt, (uint16_t)(volt / 1000));
|
||||
DbprintfEx(FLAG_INPLACE, "%u mV / %5u V", volt, (uint16_t)(volt / 1000));
|
||||
}
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
DbprintfEx(FLAG_NOOPT, "\n[+] cancelled", 1);
|
||||
DbprintfEx(FLAG_LOG, "\n[+] cancelled", 1);
|
||||
}
|
||||
|
||||
void ReadMem(int addr) {
|
||||
|
@ -371,7 +371,7 @@ void SendVersion(void) {
|
|||
// measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
|
||||
void printUSBSpeed(void) {
|
||||
Dbprintf("USB Speed");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("USB Speed"));
|
||||
Dbprintf(" Sending USB packets to client...");
|
||||
|
||||
#define USB_SPEED_TEST_MIN_TIME 1500 // in milliseconds
|
||||
|
@ -412,12 +412,12 @@ void SendStatus(void) {
|
|||
printT55xxConfig(); // LF T55XX Config
|
||||
#endif
|
||||
printUSBSpeed();
|
||||
Dbprintf("Various");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Various"));
|
||||
Dbprintf(" MF_DBGLEVEL.............%d", MF_DBGLEVEL);
|
||||
Dbprintf(" ToSendMax...............%d", ToSendMax);
|
||||
Dbprintf(" ToSendBit...............%d", ToSendBit);
|
||||
Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE);
|
||||
DbpString("Installed StandAlone Mode");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Installed StandAlone Mode"));
|
||||
ModInfo();
|
||||
|
||||
//DbpString("Running ");
|
||||
|
|
|
@ -45,6 +45,7 @@ void ReadMem(int addr);
|
|||
void __attribute__((noreturn)) AppMain(void);
|
||||
//void DbpIntegers(int a, int b, int c);
|
||||
void DbpString(char *str);
|
||||
void DbpStringEx(uint32_t cmd, char *str);
|
||||
void Dbprintf(const char *fmt, ...);
|
||||
void DbprintfEx(uint32_t cmd, const char *fmt, ...);
|
||||
void Dbhexdump(int len, uint8_t *d, bool bAsci);
|
||||
|
|
|
@ -512,7 +512,7 @@ void Flash_EraseChip(void) {
|
|||
*/
|
||||
|
||||
void Flashmem_print_status(void) {
|
||||
DbpString("Flash memory");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Flash memory"));
|
||||
Dbprintf(" Baudrate................%dMHz", FLASHMEM_SPIBAUDRATE / 1000000);
|
||||
|
||||
if (!FlashInit()) {
|
||||
|
|
|
@ -483,7 +483,7 @@ void SetAdcMuxFor(uint32_t whichGpio) {
|
|||
}
|
||||
|
||||
void Fpga_print_status(void) {
|
||||
Dbprintf("Currently loaded FPGA image");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Currently loaded FPGA image"));
|
||||
Dbprintf(" mode....................%s", fpga_version_information[downloaded_bitstream - 1]);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Default LF T55xx config is set to:
|
|||
t55xx_config t_config = { 29 * 8, 17 * 8, 15 * 8, 47 * 8, 15 * 8 } ;
|
||||
|
||||
void printT55xxConfig(void) {
|
||||
Dbprintf("LF T55XX config");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("LF T55XX config"));
|
||||
Dbprintf(" [a] startgap............%d*8 (%d)", t_config.start_gap / 8, t_config.start_gap);
|
||||
Dbprintf(" [b] writegap............%d*8 (%d)", t_config.write_gap / 8, t_config.write_gap);
|
||||
Dbprintf(" [c] write_0.............%d*8 (%d)", t_config.write_0 / 8, t_config.write_0);
|
||||
|
|
|
@ -19,7 +19,7 @@ Default LF config is set to:
|
|||
sample_config config = { 1, 8, 1, 95, 0 } ;
|
||||
|
||||
void printConfig() {
|
||||
Dbprintf("LF Sampling config");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("LF Sampling config"));
|
||||
Dbprintf(" [q] divisor.............%d (%d KHz)", config.divisor, 12000 / (config.divisor + 1));
|
||||
Dbprintf(" [b] bps.................%d", config.bits_per_sample);
|
||||
Dbprintf(" [d] decimation..........%d", config.decimation);
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
#include "ticks.h"
|
||||
|
||||
// Basic macros
|
||||
# define _BLUE_(s) "\x1b[34m" s "\x1b[0m "
|
||||
# define _RED_(s) "\x1b[31m" s "\x1b[0m "
|
||||
# define _GREEN_(s) "\x1b[32m" s "\x1b[0m "
|
||||
# define _YELLOW_(s) "\x1b[33m" s "\x1b[0m "
|
||||
# define _MAGENTA_(s) "\x1b[35m" s "\x1b[0m "
|
||||
# define _CYAN_(s) "\x1b[36m" s "\x1b[0m "
|
||||
|
||||
#ifndef SHORT_COIL
|
||||
#define SHORT_COIL() LOW(GPIO_SSC_DOUT)
|
||||
#endif
|
||||
|
|
|
@ -499,11 +499,7 @@ void pm3_version(bool verbose) {
|
|||
#else
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
||||
#endif
|
||||
#ifdef __WIN32
|
||||
PrintAndLogEx(NORMAL, "\n [ Proxmark3 RFID instrument ]\n");
|
||||
#else
|
||||
PrintAndLogEx(NORMAL, "\n\e[34m [ Proxmark3 RFID instrument ]\e[0m\n");
|
||||
#endif
|
||||
PrintAndLogEx(NORMAL, "\n" _BLUE_(" [ Proxmark3 RFID instrument ]") "\n");
|
||||
char s[60] = {0};
|
||||
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) || defined(WITH_FPC)
|
||||
strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
|
||||
|
|
|
@ -235,6 +235,39 @@ static int getReply(PacketResponseNG *packet) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void memcpy_filtered(void *dest, const void *src, size_t n, bool filter) {
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
memcpy(dest, src, n);
|
||||
#else
|
||||
if (filter)
|
||||
// Filter out ANSI sequences on these OS
|
||||
uint16_t si=0;
|
||||
for (uint16_t i=0; i < n; i++) {
|
||||
if ((src[i] == '\x1b') && (i < n - 1) && (src[i+1] >= 0x40) && (src[i+1] <= 0x5F)) { // entering ANSI sequence
|
||||
i++;
|
||||
if ((src[i] == '[') && (i < n - 1)) { // entering CSI sequence
|
||||
i++;
|
||||
while ((i < n - 1) && (src[i] >= 0x30) && (src[i] <= 0x3F)) { // parameter bytes
|
||||
i++;
|
||||
}
|
||||
while ((i < n - 1) && (src[i] >= 0x20) && (src[i] <= 0x2F)) { // intermediate bytes
|
||||
i++;
|
||||
}
|
||||
if ((src[i] >= 0x40) && (src[i] <= 0x7F)) { // final byte
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dest[si++] = src[i];
|
||||
}
|
||||
} else {
|
||||
memcpy(dest, src, n);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Entry point into our code: called whenever we received a packet over USB
|
||||
// that we weren't necessarily expecting, for example a debug print.
|
||||
|
@ -263,31 +296,24 @@ static void PacketResponseReceived(PacketResponseNG *packet) {
|
|||
} PACKED;
|
||||
struct d *data = (struct d *)&packet->data.asBytes;
|
||||
len = packet->length - sizeof(data->flag);
|
||||
memcpy(s, data->buf, len);
|
||||
flag = data->flag;
|
||||
memcpy_filtered(s, data->buf, len, flag & FLAG_ANSI);
|
||||
} else {
|
||||
len = MIN(packet->oldarg[0], USB_CMD_DATA_SIZE);
|
||||
memcpy(s, packet->data.asBytes, len);
|
||||
flag = packet->oldarg[1];
|
||||
memcpy_filtered(s, packet->data.asBytes, len, flag & FLAG_ANSI);
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
case FLAG_RAWPRINT:
|
||||
printf("%s", s);
|
||||
break;
|
||||
case FLAG_NONEWLINE:
|
||||
printf("\r%s", s);
|
||||
break;
|
||||
case FLAG_NOLOG:
|
||||
printf("%s\r\n", s);
|
||||
break;
|
||||
//case FLAG_NOPROMPT:
|
||||
// break;
|
||||
case FLAG_NOOPT:
|
||||
default:
|
||||
if (flag & FLAG_LOG) {
|
||||
PrintAndLogEx(NORMAL, "#db# %s", s);
|
||||
break;
|
||||
} else {
|
||||
if (flag & FLAG_INPLACE)
|
||||
printf("\r");
|
||||
printf("%s", s);
|
||||
if (flag & FLAG_NEWLINE)
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,26 +3,23 @@
|
|||
# at your option, any later version. See the LICENSE.txt file for the text of
|
||||
# the license.
|
||||
#-----------------------------------------------------------------------------
|
||||
include ../../common/Makefile.common
|
||||
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
#COMMON_FLAGS = -m32
|
||||
|
||||
VPATH = ../../common
|
||||
OBJDIR = obj
|
||||
|
||||
LDLIBS = -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
ifeq ($(platform),Darwin)
|
||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lusb-1.0 -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -I. -I../include -I../common -I/usr/local/include -I/opt/local/include -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
LDLIBS += -lusb-1.0
|
||||
else
|
||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lusb -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -I. -I../include -I../common -I/opt/local/include -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
LDLIBS += -lusb
|
||||
endif
|
||||
|
||||
LDFLAGS = $(COMMON_FLAGS)
|
||||
CXXFLAGS =
|
||||
QTLDLIBS =
|
||||
|
||||
RM = rm -f
|
||||
BINS = flasher
|
|
@ -11,11 +11,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "util_posix.h"
|
||||
#include "proxusb.h"
|
||||
#include "flash.h"
|
||||
#include "elf.h"
|
||||
#include "proxendian.h"
|
||||
#include "sleep.h"
|
||||
|
||||
#define FLASH_START 0x100000
|
||||
#define FLASH_SIZE (256*1024)
|
|
@ -9,9 +9,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "util_posix.h"
|
||||
#include "proxusb.h"
|
||||
#include "flash.h"
|
||||
#include "sleep.h"
|
||||
|
||||
static void usage(char *argv0) {
|
||||
fprintf(stderr, "Usage: %s [-b] image.elf [image.elf...]\n\n", argv0);
|
|
@ -9,6 +9,7 @@
|
|||
// USB utilities
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "proxusb.h"
|
||||
#include "sleep.h"
|
||||
|
||||
// It seems to be missing for mingw
|
||||
#ifndef ETIMEDOUT
|
|
@ -22,7 +22,6 @@
|
|||
#include <errno.h>
|
||||
#include "proxmark3.h"
|
||||
#include "usb_cmd.h"
|
||||
#include "util_posix.h"
|
||||
|
||||
extern unsigned char return_on_error;
|
||||
extern unsigned char error_occured;
|
|
@ -916,7 +916,7 @@ int detect_classic_nackbug(bool verbose) {
|
|||
} else {
|
||||
printf(
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
"\e[32m\e[s%c\e[u\e[0m", star[(staridx++ % 4) ]
|
||||
_GREEN_("\e[s%c\e[u"), star[(staridx++ % 4) ]
|
||||
#else
|
||||
"."
|
||||
#endif
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
static void showBanner(void) {
|
||||
printf("\n\n");
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
printf("\e[34m██████╗ ███╗ ███╗ ████╗\e[0m ...iceman fork\n");
|
||||
printf("\e[34m██╔══██╗████╗ ████║ ══█║\e[0m ...dedicated to \e[34mRDV40\e[0m\n");
|
||||
printf("\e[34m██████╔╝██╔████╔██║ ████╔╝\e[0m\n");
|
||||
printf("\e[34m██╔═══╝ ██║╚██╔╝██║ ══█║\e[0m iceman@icesql.net\n");
|
||||
printf("\e[34m██║ ██║ ╚═╝ ██║ ████╔╝\e[0m https://github.com/rfidresearchgroup/proxmark3/\n");
|
||||
printf("\e[34m╚═╝ ╚═╝ ╚═╝ ╚═══╝\e[0m pre-release v4.0\n");
|
||||
printf(_BLUE_("██████╗ ███╗ ███╗ ████╗ ") " ...iceman fork\n");
|
||||
printf(_BLUE_("██╔══██╗████╗ ████║ ══█║") " ...dedicated to " _BLUE_("RDV40") "\n");
|
||||
printf(_BLUE_("██████╔╝██╔████╔██║ ████╔╝") "\n");
|
||||
printf(_BLUE_("██╔═══╝ ██║╚██╔╝██║ ══█║") " iceman@icesql.net\n");
|
||||
printf(_BLUE_("██║ ██║ ╚═╝ ██║ ████╔╝") " https://github.com/rfidresearchgroup/proxmark3/\n");
|
||||
printf(_BLUE_("╚═╝ ╚═╝ ╚═╝ ╚═══╝ ") "pre-release v4.0\n");
|
||||
#else
|
||||
printf("======. ===. ===. ====. ...iceman fork\n");
|
||||
printf("==...==.====. ====. ..=. ...dedicated to RDV40\n");
|
||||
|
|
|
@ -593,7 +593,7 @@ bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t d
|
|||
}
|
||||
|
||||
void I2C_print_status(void) {
|
||||
DbpString("Smart card module (ISO 7816)");
|
||||
DbpStringEx(FLAG_LOG|FLAG_ANSI, _BLUE_("Smart card module (ISO 7816"));
|
||||
uint8_t resp[] = {0, 0, 0, 0};
|
||||
I2C_Reset_EnterMainProgram();
|
||||
uint8_t len = I2C_BufferRead(resp, sizeof(resp), I2C_DEVICE_CMD_GETVERSION, I2C_DEVICE_ADDRESS_MAIN);
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
//NVDD goes LOW when USB is attached.
|
||||
#define USB_ATTACHED() !((AT91C_BASE_PIOA->PIO_PDSR & GPIO_NVDD_ON) == GPIO_NVDD_ON)
|
||||
|
||||
#define VERSION_INFORMATION_MAGIC 0x56334d50
|
||||
#define VERSION_INFORMATION_MAGIC 0x56334d50 // "PM3V"
|
||||
struct version_information {
|
||||
int magic; /* Magic sequence to identify this as a correct version information structure. Must be VERSION_INFORMATION_MAGIC */
|
||||
char versionversion; /* Must be 1 */
|
||||
|
@ -118,7 +118,7 @@ struct version_information {
|
|||
char buildtime[30]; /* string with the build time */
|
||||
} __attribute__((packed));
|
||||
|
||||
#define COMMON_AREA_MAGIC 0x43334d50
|
||||
#define COMMON_AREA_MAGIC 0x43334d50 // "PM3C"
|
||||
#define COMMON_AREA_COMMAND_NONE 0
|
||||
#define COMMON_AREA_COMMAND_ENTER_FLASH_MODE 1
|
||||
struct common_area {
|
||||
|
|
|
@ -390,11 +390,11 @@ typedef struct {
|
|||
#define FLAG_ICLASS_READER_CEDITKEY 0x40
|
||||
|
||||
// Dbprintf flags
|
||||
#define FLAG_RAWPRINT 0x0111
|
||||
#define FLAG_NOOPT 0x0000
|
||||
#define FLAG_NOLOG 0x0001
|
||||
#define FLAG_NONEWLINE 0x0010
|
||||
#define FLAG_NOPROMPT 0x0100
|
||||
#define FLAG_RAWPRINT 0x00
|
||||
#define FLAG_LOG 0x01
|
||||
#define FLAG_NEWLINE 0x02
|
||||
#define FLAG_INPLACE 0x04
|
||||
#define FLAG_ANSI 0x08
|
||||
|
||||
// Error codes Usages:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue