This commit is contained in:
iceman1001 committed 2024-05-14 10:04:28 +02:00
1 parent 72a11cfd89
commit 42f0699c78
17 files changed
+256 -167

No files matched your search

+24 -24
View File
@@ -3670,8 +3670,8 @@ static int CmdXor(const char *Cmd) {
static int CmdTestSaveState8(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "data test_ss8",
"Tests the implementation of Buffer Save States (8-bit buffer)",
"data test_ss8");
"Tests the implementation of Buffer Save States (8-bit buffer)",
"data test_ss8");
void *argtable[] = {
arg_param_begin,
arg_param_end
@@ -3682,10 +3682,10 @@ static int CmdTestSaveState8(const char *Cmd) {
srand(time(NULL));
size_t length = 64;
uint8_t *srcBuffer = (uint8_t*)calloc(length, sizeof(uint8_t));
uint8_t *srcBuffer = (uint8_t *)calloc(length, sizeof(uint8_t));
//Set up the source buffer with random data
for(int i = 0; i < length; i++) {
for (int i = 0; i < length; i++) {
srcBuffer[i] = (rand() % 256);
}
@@ -3696,10 +3696,10 @@ static int CmdTestSaveState8(const char *Cmd) {
test8.offset = rand();
PrintAndLogEx(DEBUG, "Save State clock=%u, offset=%u", test8.clock, test8.offset);
uint8_t *destBuffer = (uint8_t*)calloc(length, sizeof(uint8_t));
uint8_t *destBuffer = (uint8_t *)calloc(length, sizeof(uint8_t));
size_t returnedLength = restore_buffer8(test8, destBuffer);
if(returnedLength != length) {
if (returnedLength != length) {
PrintAndLogEx(FAILED, "Return Length != Buffer Length! Expected '%llu', got '%llu", g_DemodBufferLen, returnedLength);
free(srcBuffer);
free(destBuffer);
@@ -3707,8 +3707,8 @@ static int CmdTestSaveState8(const char *Cmd) {
}
PrintAndLogEx(DEBUG, _GREEN_("Lengths match!") "\n");
for(size_t i = 0; i < length; i++) {
if(srcBuffer[i] != destBuffer[i]) {
for (size_t i = 0; i < length; i++) {
if (srcBuffer[i] != destBuffer[i]) {
PrintAndLogEx(FAILED, "Buffers don't match at index %lu!, Expected %i, got %i", i, srcBuffer[i], destBuffer[i]);
free(srcBuffer);
free(destBuffer);
@@ -3726,8 +3726,8 @@ static int CmdTestSaveState8(const char *Cmd) {
static int CmdTestSaveState32(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "data test_ss32",
"Tests the implementation of Buffer Save States (32-bit buffer)",
"data test_ss32");
"Tests the implementation of Buffer Save States (32-bit buffer)",
"data test_ss32");
void *argtable[] = {
arg_param_begin,
arg_param_end
@@ -3738,10 +3738,10 @@ static int CmdTestSaveState32(const char *Cmd) {
srand(time(NULL));
size_t length = 64;
uint32_t *srcBuffer = (uint32_t*)calloc(length, sizeof(uint32_t));
uint32_t *srcBuffer = (uint32_t *)calloc(length, sizeof(uint32_t));
//Set up the source buffer with random data
for(size_t i = 0; i < length; i++) {
for (size_t i = 0; i < length; i++) {
srcBuffer[i] = (rand());
}
@@ -3752,10 +3752,10 @@ static int CmdTestSaveState32(const char *Cmd) {
test32.offset = rand();
PrintAndLogEx(DEBUG, "Save State clock=%u, offset=%u", test32.clock, test32.offset);
uint32_t *destBuffer = (uint32_t*)calloc(length, sizeof(uint32_t));
uint32_t *destBuffer = (uint32_t *)calloc(length, sizeof(uint32_t));
size_t returnedLength = restore_buffer32(test32, destBuffer);
if(returnedLength != length) {
if (returnedLength != length) {
PrintAndLogEx(FAILED, "Return Length != Buffer Length! Expected '%llu', got '%llu", g_DemodBufferLen, returnedLength);
free(srcBuffer);
free(destBuffer);
@@ -3763,8 +3763,8 @@ static int CmdTestSaveState32(const char *Cmd) {
}
PrintAndLogEx(DEBUG, _GREEN_("Lengths match!") "\n");
for(size_t i = 0; i < length; i++) {
if(srcBuffer[i] != destBuffer[i]) {
for (size_t i = 0; i < length; i++) {
if (srcBuffer[i] != destBuffer[i]) {
PrintAndLogEx(FAILED, "Buffers don't match at index %lu!, Expected %i, got %i", i, srcBuffer[i], destBuffer[i]);
free(srcBuffer);
free(destBuffer);
@@ -3782,8 +3782,8 @@ static int CmdTestSaveState32(const char *Cmd) {
static int CmdTestSaveState32S(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "data test_ss32s",
"Tests the implementation of Buffer Save States (32-bit signed buffer)",
"data test_ss32s");
"Tests the implementation of Buffer Save States (32-bit signed buffer)",
"data test_ss32s");
void *argtable[] = {
arg_param_begin,
arg_param_end
@@ -3794,10 +3794,10 @@ static int CmdTestSaveState32S(const char *Cmd) {
srand(time(NULL));
size_t length = 64;
int32_t *srcBuffer = (int32_t*)calloc(length, sizeof(int32_t));
int32_t *srcBuffer = (int32_t *)calloc(length, sizeof(int32_t));
//Set up the source buffer with random data
for(int i = 0; i < length; i++) {
for (int i = 0; i < length; i++) {
srcBuffer[i] = (rand() - 4294967296);
}
@@ -3808,10 +3808,10 @@ static int CmdTestSaveState32S(const char *Cmd) {
test32.offset = rand();
PrintAndLogEx(DEBUG, "Save State clock=%u, offset=%u", test32.clock, test32.offset);
int32_t *destBuffer = (int32_t*)calloc(length, sizeof(int32_t));
int32_t *destBuffer = (int32_t *)calloc(length, sizeof(int32_t));
size_t returnedLength = restore_bufferS32(test32, destBuffer);
if(returnedLength != length) {
if (returnedLength != length) {
PrintAndLogEx(FAILED, "Return Length != Buffer Length! Expected '%llu', got '%llu", g_DemodBufferLen, returnedLength);
free(srcBuffer);
free(destBuffer);
@@ -3819,8 +3819,8 @@ static int CmdTestSaveState32S(const char *Cmd) {
}
PrintAndLogEx(DEBUG, _GREEN_("Lengths match!") "\n");
for(int i = 0; i < length; i++) {
if(srcBuffer[i] != destBuffer[i]) {
for (int i = 0; i < length; i++) {
if (srcBuffer[i] != destBuffer[i]) {
PrintAndLogEx(FAILED, "Buffers don't match at index %i!, Expected %i, got %i", i, srcBuffer[i], destBuffer[i]);
free(srcBuffer);
free(destBuffer);
+3 -3
View File
@@ -2452,9 +2452,9 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
get_compact_tlv(card.ats + pos, calen);
} else {
PrintAndLogEx(SUCCESS, "%s - %s"
, sprint_hex_inrow(card.ats + pos, calen)
, sprint_ascii(card.ats + pos, calen)
);
, sprint_hex_inrow(card.ats + pos, calen)
, sprint_ascii(card.ats + pos, calen)
);
}
PrintAndLogEx(NORMAL, "");
+48 -48
View File
@@ -403,7 +403,7 @@ uint8_t *get_uid_from_filename(const char *filename) {
}
// extract uid part from filename
char uidinhex[17] = {0};
char uidinhex[17] = {0};
strncpy(uidinhex, found + 7, 16);
uidinhex[16] = '\0';
@@ -2486,16 +2486,16 @@ static int CmdHF14BAPDU(const char *Cmd) {
uint16_t sw = get_sw(data, datalen);
if (sw != ISO7816_OK) {
PrintAndLogEx(SUCCESS, "APDU response: " _YELLOW_("%02x %02x") " - %s"
, data[datalen - 2]
, data[datalen - 1]
, GetAPDUCodeDescription(data[datalen - 2], data[datalen - 1])
);
, data[datalen - 2]
, data[datalen - 1]
, GetAPDUCodeDescription(data[datalen - 2], data[datalen - 1])
);
} else {
PrintAndLogEx(SUCCESS, "APDU response: " _GREEN_("%02x %02x") " - %s"
, data[datalen - 2]
, data[datalen - 1]
, GetAPDUCodeDescription(data[datalen - 2], data[datalen - 1])
);
, data[datalen - 2]
, data[datalen - 1]
, GetAPDUCodeDescription(data[datalen - 2], data[datalen - 1])
);
}
// TLV decoder
@@ -2708,30 +2708,30 @@ static int CmdHF14BCalypsoRead(const char *Cmd) {
{"19.SpecEv1", "\x94\xb2\x01\x04\x1d", 5},
};
/*
local CLA = '94'
local _calypso_cmds = {
/*
local CLA = '94'
local _calypso_cmds = {
-- Break down of command bytes:
-- A4 = select
-- Master File 3F00
-- 0x3F = master file
-- 0x00 = master file id, is constant to 0x00.
-- Break down of command bytes:
-- A4 = select
-- Master File 3F00
-- 0x3F = master file
-- 0x00 = master file id, is constant to 0x00.
-- DF Dedicated File 38nn
-- can be seen as directories
-- 0x38
-- 0xNN id
-- ["01.Select ICC file"] = '0294 a4 080004 3f00 0002',
-- DF Dedicated File 38nn
-- can be seen as directories
-- 0x38
-- 0xNN id
-- ["01.Select ICC file"] = '0294 a4 080004 3f00 0002',
-- EF Elementary File
-- EF1 Pin file
-- EF2 Key file
-- Grey Lock file
-- Electronic deposit file
-- Electronic Purse file
-- Electronic Transaction log file
*/
-- EF Elementary File
-- EF1 Pin file
-- EF2 Key file
-- Grey Lock file
-- Electronic deposit file
-- Electronic Purse file
-- Electronic Transaction log file
*/
bool activate_field = true;
bool leave_signal_on = true;
uint8_t response[PM3_CMD_DATA_SIZE] = { 0x00 };
@@ -2741,15 +2741,15 @@ local _calypso_cmds = {
int user_timeout = -1;
int resplen = 0;
int res = exchange_14b_apdu(
(uint8_t*)cmds[i].apdu,
cmds[i].apdulen,
activate_field,
leave_signal_on,
response,
PM3_CMD_DATA_SIZE,
&resplen,
user_timeout
);
(uint8_t *)cmds[i].apdu,
cmds[i].apdulen,
activate_field,
leave_signal_on,
response,
PM3_CMD_DATA_SIZE,
&resplen,
user_timeout
);
if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "sending command failed, aborting!");
@@ -2846,15 +2846,15 @@ static int CmdHF14BMobibRead(const char *Cmd) {
int user_timeout = -1;
int resplen = 0;
int res = exchange_14b_apdu(
(uint8_t*)cmds[i].apdu,
cmds[i].apdulen,
activate_field,
leave_signal_on,
response,
PM3_CMD_DATA_SIZE,
&resplen,
user_timeout
);
(uint8_t *)cmds[i].apdu,
cmds[i].apdulen,
activate_field,
leave_signal_on,
response,
PM3_CMD_DATA_SIZE,
&resplen,
user_timeout
);
if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "sending command failed, aborting!");
+11 -11
View File
@@ -130,15 +130,15 @@ static const productName_t uidmapping[] = {
{ 0xe002480000000000LL, 24, "ST Microelectronics; ST25TV16K"},
{ 0xe002480000000000LL, 24, "ST Microelectronics; ST25TV64K"},
/*
ST25TV02K 0xe0 02 23
ST25TV512 0xe0 02 23
ST25TV02KC 0xe00208
ST25TV512C 0xe00208
ST25TV04K-P 0xe00235
ST25TV16K 0xe00248
ST25TV64K 0xe00248
*/
/*
ST25TV02K 0xe0 02 23
ST25TV512 0xe0 02 23
ST25TV02KC 0xe00208
ST25TV512C 0xe00208
ST25TV04K-P 0xe00235
ST25TV16K 0xe00248
ST25TV64K 0xe00248
*/
{ 0xE003000000000000LL, 16, "Hitachi, Ltd Japan" },
@@ -480,7 +480,7 @@ static int iso15_error_handling_card_response(uint8_t *d, uint16_t n) {
return PM3_ECRC;
}
if ( (d[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR ) {
if ((d[0] & ISO15_RES_ERROR) == ISO15_RES_ERROR) {
if (d[1] == 0x0F || d[1] == 0x10) {
return PM3_EOUTOFBOUND;
}
@@ -1911,7 +1911,7 @@ static int CmdHF15Dump(const char *Cmd) {
uint8_t dCpt = 10;
int res = iso15_error_handling_card_response(d, resp.length);
if ( res != PM3_SUCCESS ) {
if (res != PM3_SUCCESS) {
free(tag);
free(packet);
return res;
+4 -4
View File
@@ -4858,10 +4858,10 @@ static int DesfileReadFileAndPrint(DesfireContext_t *dctx,
if (verbose) {
PrintAndLogEx(INFO, _CYAN_("File type:") " %s Option: %s comm mode: %s",
GetDesfireFileType(fsettings.fileType),
CLIGetOptionListStr(DesfireReadFileTypeOpts, filetype),
CLIGetOptionListStr(DesfireCommunicationModeOpts, fsettings.commMode)
);
GetDesfireFileType(fsettings.fileType),
CLIGetOptionListStr(DesfireReadFileTypeOpts, filetype),
CLIGetOptionListStr(DesfireCommunicationModeOpts, fsettings.commMode)
);
}
} else {
PrintAndLogEx(WARNING, "GetFileSettings error. Can't get file type.");
+1 -1
View File
@@ -42,7 +42,7 @@ const char *get_st_chip_model(uint8_t pc) {
return "SRT512";
case 0xC4:
return "ST25TA64K";
case 0xC5:
case 0xC5:
return "ST25TA16K";
case 0xE2:
return "ST25??? IKEA Rothult";
+4 -4
View File
@@ -190,13 +190,13 @@ static int print_st25ta_signature(uint8_t *uid, uint8_t *signature) {
}
static int st25ta_get_signature(uint8_t *signature) {
/*
/*
hf 14a raw -sck 0200A4040007D276000085010100
hf 14a raw -ck 0300A4000C020001
hf 14a raw -c 02a2b000e020
*/
*/
typedef struct {
const char* apdu;
const char *apdu;
uint8_t apdulen;
} transport_st25a_apdu_t;
@@ -211,7 +211,7 @@ static int st25ta_get_signature(uint8_t *signature) {
bool activate_field = true;
for (uint8_t i = 0; i < ARRAYLEN(cmds); i++) {
int res = ExchangeAPDU14a( (uint8_t*)cmds[i].apdu, cmds[i].apdulen, activate_field, true, resp, sizeof(resp), &resplen);
int res = ExchangeAPDU14a((uint8_t *)cmds[i].apdu, cmds[i].apdulen, activate_field, true, resp, sizeof(resp), &resplen);
if (res != PM3_SUCCESS) {
DropField();
return res;
+1 -1
View File
@@ -1587,7 +1587,7 @@ out:
restore_bufferS32(saveState_gb, g_GraphBuffer);
g_GridOffset = saveState_gb.offset;
return retval;
}
+1 -1
View File
@@ -1107,7 +1107,7 @@ static int CmdEM4x70AutoRecover_ParseArgs(const char *Cmd, em4x70_cmd_input_reco
,
"lf em 4x70 autorecover --rnd 45F54ADA252AAC --frn 4866BB70 --grn 9BD180 (pm3 test key)\n"
"lf em 4x70 autorecover --rnd 3FFE1FB6CC513F --frn F355F1A0 --grn 609D60 (research paper key)\n"
"lf em 4x70 autorecover --rnd 7D5167003571F8 --frn 982DBCC0 --grn 36C0E0 (autorecovery test key)\n"
"lf em 4x70 autorecover --rnd 7D5167003571F8 --frn 982DBCC0 --grn 36C0E0 (autorecovery test key)\n"
);
void *argtable[] = {
+10 -10
View File
@@ -127,7 +127,7 @@ size_t getFromGraphBuffer(uint8_t *dest) {
}
size_t getFromGraphBufferEx(uint8_t *dest, size_t maxLen) {
if (dest == NULL){
if (dest == NULL) {
return 0;
}
@@ -511,7 +511,7 @@ void remove_temporary_markers(void) {
buffer_savestate_t save_buffer32(uint32_t *src, size_t length) {
//calloc the memory needed
uint32_t* savedBuffer = (uint32_t*)calloc(length, sizeof(uint32_t));
uint32_t *savedBuffer = (uint32_t *)calloc(length, sizeof(uint32_t));
//Make a copy of the source buffer
memcpy(savedBuffer, src, (length * sizeof(uint32_t)));
@@ -527,7 +527,7 @@ buffer_savestate_t save_buffer32(uint32_t *src, size_t length) {
buffer_savestate_t save_bufferS32(int32_t *src, size_t length) {
//calloc the memory needed
uint32_t* savedBuffer = (uint32_t*)calloc(length, (sizeof(uint32_t)));
uint32_t *savedBuffer = (uint32_t *)calloc(length, (sizeof(uint32_t)));
//Make a copy of the source buffer
memcpy(savedBuffer, src, (length * sizeof(uint32_t)));
@@ -552,15 +552,15 @@ buffer_savestate_t save_buffer8(uint8_t *src, size_t length) {
}
// calloc the memory needed
uint32_t* savedBuffer = (uint32_t*)calloc(buffSize, sizeof(uint32_t));
uint32_t *savedBuffer = (uint32_t *)calloc(buffSize, sizeof(uint32_t));
size_t index = 0;
// Pack the source array into the backing array
for(size_t i = 0; i < length; i += 4) {
for (size_t i = 0; i < length; i += 4) {
savedBuffer[index] = MemLeToUint4byte(src + i);
index++;
}
buffer_savestate_t bst = {
.type = sizeof(uint8_t),
.bufferSize = buffSize,
@@ -571,7 +571,7 @@ buffer_savestate_t save_buffer8(uint8_t *src, size_t length) {
}
size_t restore_buffer32(buffer_savestate_t saveState, uint32_t *dest) {
if(saveState.type != sizeof(uint32_t)) {
if (saveState.type != sizeof(uint32_t)) {
PrintAndLogEx(WARNING, "Invalid Save State type! Expected uint32_t!");
PrintAndLogEx(WARNING, "Buffer not modified!\n");
return 0;
@@ -583,7 +583,7 @@ size_t restore_buffer32(buffer_savestate_t saveState, uint32_t *dest) {
}
size_t restore_bufferS32(buffer_savestate_t saveState, int32_t *dest) {
if(saveState.type != (sizeof(int32_t) >> 8)) {
if (saveState.type != (sizeof(int32_t) >> 8)) {
PrintAndLogEx(WARNING, "Invalid Save State type! Expected int32_t");
PrintAndLogEx(WARNING, "Buffer not modified!\n");
return 0;
@@ -595,7 +595,7 @@ size_t restore_bufferS32(buffer_savestate_t saveState, int32_t *dest) {
}
size_t restore_buffer8(buffer_savestate_t saveState, uint8_t *dest) {
if(saveState.type != sizeof(uint8_t)) {
if (saveState.type != sizeof(uint8_t)) {
PrintAndLogEx(WARNING, "Invalid Save State type! Expected uint8_t!");
PrintAndLogEx(WARNING, "Buffer not modified!\n");
return 0;
@@ -604,7 +604,7 @@ size_t restore_buffer8(buffer_savestate_t saveState, uint8_t *dest) {
size_t index = 0;
// Unpack the array
for(size_t i = 0; i < saveState.bufferSize; i++) {
for (size_t i = 0; i < saveState.bufferSize; i++) {
dest[index++] = saveState.buffer[i];
dest[index++] = (saveState.buffer[i] >> 8) & 0xFF;
dest[index++] = (saveState.buffer[i] >> 16) & 0xFF;
+7 -1
View File
@@ -118,6 +118,9 @@ const static vocabulary_t vocabulary[] = {
{ 1, "data diff" },
{ 0, "data hexsamples" },
{ 0, "data samples" },
{ 0, "data test_ss8" },
{ 0, "data test_ss32" },
{ 0, "data test_ss32s" },
{ 1, "emv help" },
{ 1, "emv list" },
{ 1, "emv test" },
@@ -170,6 +173,8 @@ const static vocabulary_t vocabulary[] = {
{ 0, "hf 14b wrbl" },
{ 1, "hf 14b view" },
{ 1, "hf 14b valid" },
{ 0, "hf 14b calypso" },
{ 0, "hf 14b mobib" },
{ 1, "hf 15 help" },
{ 1, "hf 15 list" },
{ 1, "hf 15 demod" },
@@ -645,7 +650,7 @@ const static vocabulary_t vocabulary[] = {
{ 1, "lf hitag help" },
{ 1, "lf hitag list" },
{ 0, "lf hitag info" },
{ 1, "lf hitag selftest" },
{ 1, "lf hitag test" },
{ 0, "lf hitag dump" },
{ 0, "lf hitag read" },
{ 0, "lf hitag sniff" },
@@ -655,6 +660,7 @@ const static vocabulary_t vocabulary[] = {
{ 0, "lf hitag eview" },
{ 0, "lf hitag sim" },
{ 0, "lf hitag cc" },
{ 0, "lf hitag crack2" },
{ 0, "lf hitag chk" },
{ 1, "lf hitag lookup" },
{ 0, "lf hitag ta" },
+4 -4
View File
@@ -1270,14 +1270,14 @@ void Plot::mouseMoveEvent(QMouseEvent *event) {
int x = event->x();
//Only run the marker place code if a mouse button is pressed
if((event->buttons() & Qt::LeftButton) || (event->buttons() & Qt::RightButton)) {
if ((event->buttons() & Qt::LeftButton) || (event->buttons() & Qt::RightButton)) {
x -= WIDTH_AXES;
x = (int)(x / g_GraphPixelsPerPoint);
x += g_GraphStart;
if(x > (int)g_GraphTraceLen) x = 0; // Set to 0 if the number is stupidly big
else if(x < (int)g_GraphStart) x = (int)g_GraphStart; // Bounds checking for the start of the Graph Window
else if(x > (int)g_GraphStop) x = (int)g_GraphStop; // Bounds checking for the end of the Graph Window
if (x > (int)g_GraphTraceLen) x = 0; // Set to 0 if the number is stupidly big
else if (x < (int)g_GraphStart) x = (int)g_GraphStart; // Bounds checking for the start of the Graph Window
else if (x > (int)g_GraphStop) x = (int)g_GraphStop; // Bounds checking for the end of the Graph Window
if ((event->buttons() & Qt::LeftButton)) { // True for left click, false otherwise
g_MarkerA.pos = x;