style
This commit is contained in:
1 parent
4af87a2f91
commit
e578d75e66
11 files changed
+104
-50
No files matched your search
@@ -3154,7 +3154,7 @@ static int CmdHF14ADesGetKeyVersions(const char *Cmd) {
|
||||
arg_str0(NULL, "keynum", "<hex>", "Key number/count (1 hex byte). (def: 0x00)"),
|
||||
arg_str0(NULL, "keyset", "<hex>", "Keyset number (1 hex byte)"),
|
||||
arg_lit0(NULL, "no-auth", "Execute without authentication"),
|
||||
|
||||
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
@@ -3199,7 +3199,7 @@ static int CmdHF14ADesGetKeyVersions(const char *Cmd) {
|
||||
DropField();
|
||||
PrintAndLogEx(FAILED, "Select or authentication %s " _RED_("failed") ". Result [%d] %s", DesfireWayIDStr(selectway, id), res, DesfireAuthErrorToStr(res));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t buf[APDU_RES_LEN] = {0};
|
||||
size_t buflen = 0;
|
||||
@@ -3509,7 +3509,7 @@ static int CmdHF14ADesGetFileIDs(const char *Cmd) {
|
||||
PrintAndLogEx(FAILED, "Select or authentication %s " _RED_("failed") ". Result [%d] %s", DesfireWayIDStr(selectway, id), res, DesfireAuthErrorToStr(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t buf[APDU_RES_LEN] = {0};
|
||||
size_t buflen = 0;
|
||||
@@ -4235,7 +4235,7 @@ static int CmdHF14ADesCreateRecordFile(const char *Cmd) {
|
||||
DesfireContext_t dctx;
|
||||
int securechann = defaultSecureChannel;
|
||||
uint32_t appid = 0x000000;
|
||||
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0,&securechann, DCMMACed, &appid, NULL);
|
||||
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, &securechann, DCMMACed, &appid, NULL);
|
||||
if (res) {
|
||||
CLIParserFree(ctx);
|
||||
return res;
|
||||
@@ -4460,7 +4460,7 @@ static int CmdHF14ADesDeleteFile(const char *Cmd) {
|
||||
int securechann = defaultSecureChannel;
|
||||
uint32_t id = 0x000000;
|
||||
DesfireISOSelectWay selectway = ISW6bAID;
|
||||
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0,&securechann, DCMMACed, &id, &selectway);
|
||||
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, &securechann, DCMMACed, &id, &selectway);
|
||||
if (res) {
|
||||
CLIParserFree(ctx);
|
||||
return res;
|
||||
|
||||
@@ -2428,8 +2428,8 @@ int ht2_read_uid(void) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
|
||||
PrintAndLogEx(SUCCESS, "TYPE... " _GREEN_("%s"), getHitagTypeStr(uid));
|
||||
PrintAndLogEx(SUCCESS, "UID....... " _GREEN_("%08X"), uid);
|
||||
PrintAndLogEx(SUCCESS, "TYPE...... " _GREEN_("%s"), getHitagTypeStr(uid));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,8 +182,8 @@ int read_hts_uid(void) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
|
||||
PrintAndLogEx(SUCCESS, "TYPE... " _GREEN_("%s"), hts_get_type_str(uid));
|
||||
PrintAndLogEx(SUCCESS, "UID....... " _GREEN_("%08X"), uid);
|
||||
PrintAndLogEx(SUCCESS, "TYPE...... " _GREEN_("%s"), hts_get_type_str(uid));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -197,8 +197,8 @@ int read_htu_uid(void) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%012llX"), uid);
|
||||
// PrintAndLogEx(SUCCESS, "TYPE... " _GREEN_("%s"), htu_get_type_str(uid));
|
||||
PrintAndLogEx(SUCCESS, "UID....... " _GREEN_("%012llX"), uid);
|
||||
// PrintAndLogEx(SUCCESS, "TYPE...... " _GREEN_("%s"), htu_get_type_str(uid));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -498,25 +498,28 @@ int getPyramidBits(uint32_t fc, uint32_t cn, uint8_t *pyramidBits) {
|
||||
|
||||
// FSK Demod then try to locate a Farpointe Data (pyramid) ID
|
||||
int detectPyramid(uint8_t *dest, size_t *size, int *waveStartIdx) {
|
||||
//make sure buffer has data
|
||||
// make sure buffer has data
|
||||
if (*size < 128 * 50) return -1;
|
||||
|
||||
//test samples are not just noise
|
||||
// test samples are not just noise
|
||||
if (getSignalProperties()->isnoise) return -2;
|
||||
|
||||
// FSK demodulator RF/50 FSK 10,8
|
||||
*size = fskdemod(dest, *size, 50, 1, 10, 8, waveStartIdx); // pyramid fsk2
|
||||
|
||||
//did we get a good demod?
|
||||
// did we get a good demod?
|
||||
if (*size < 128) return -3;
|
||||
|
||||
size_t startIdx = 0;
|
||||
uint8_t preamble[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx))
|
||||
return -4; //preamble not found
|
||||
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx)) {
|
||||
return -4; // preamble not found
|
||||
}
|
||||
|
||||
// wrong size? (between to preambles)
|
||||
if (*size < 128) return -5;
|
||||
if (*size < 128) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
return (int)startIdx;
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ int DesfireSelectAndAuthenticateW(DesfireContext_t *dctx, DesfireSecureChannel s
|
||||
DesfirePrintContext(dctx);
|
||||
|
||||
int res = 0;
|
||||
|
||||
|
||||
// Handle DF Name selection if it's present in the context
|
||||
if (dctx->selectedDFNameLen > 0) {
|
||||
// Select DF by name using ISO7816 SELECT
|
||||
@@ -1114,7 +1114,7 @@ int DesfireSelectAndAuthenticateW(DesfireContext_t *dctx, DesfireSecureChannel s
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "DF %s is " _GREEN_("selected"), sprint_hex(dctx->selectedDFName, dctx->selectedDFNameLen));
|
||||
}
|
||||
|
||||
|
||||
// If both dfname and aid are specified, now also select by AID
|
||||
if (way == ISW6bAID && id != 0x000000) {
|
||||
if (dctx->cmdSet == DCCISO) {
|
||||
|
||||
@@ -108,7 +108,7 @@ void DesfireSetKdf(DesfireContext_t *ctx, uint8_t kdfAlgo, uint8_t *kdfInput, ui
|
||||
void DesfireSetDFName(DesfireContext_t *ctx, uint8_t *dfname, uint8_t dfnameLen) {
|
||||
ctx->selectedDFNameLen = 0;
|
||||
memset(ctx->selectedDFName, 0, sizeof(ctx->selectedDFName));
|
||||
|
||||
|
||||
if (dfname && dfnameLen > 0 && dfnameLen <= 16) {
|
||||
ctx->selectedDFNameLen = dfnameLen;
|
||||
memcpy(ctx->selectedDFName, dfname, dfnameLen);
|
||||
|
||||
@@ -74,7 +74,7 @@ typedef struct {
|
||||
bool isoChaining;
|
||||
bool appSelected; // for iso auth
|
||||
uint32_t selectedAID;
|
||||
|
||||
|
||||
uint8_t selectedDFName[16];
|
||||
uint8_t selectedDFNameLen;
|
||||
|
||||
|
||||
@@ -477,6 +477,7 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 0, "hf mfdes getkeyversions" },
|
||||
{ 0, "hf mfdes getfileids" },
|
||||
{ 0, "hf mfdes getfileisoids" },
|
||||
{ 0, "hf mfdes lsfile" },
|
||||
{ 0, "hf mfdes lsfiles" },
|
||||
{ 0, "hf mfdes dump" },
|
||||
{ 0, "hf mfdes createfile" },
|
||||
|
||||
Reference in new issue
Block a user