mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
added no-authenticate option to read file
This commit is contained in:
parent
737ff2d465
commit
e5fe614a4f
1 changed files with 16 additions and 6 deletions
|
@ -184,6 +184,7 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
arg_str0("k", "key", "<hex>", "key for authenticate"),
|
arg_str0("k", "key", "<hex>", "key for authenticate"),
|
||||||
arg_str0("f", "file", "<hex>", "file ID"),
|
arg_str0("f", "file", "<hex>", "file ID"),
|
||||||
arg_int0("o", "offset", "<dec>", "offset for reading data from file"),
|
arg_int0("o", "offset", "<dec>", "offset for reading data from file"),
|
||||||
|
arg_lit0(NULL, "noauth", "read file without authentication"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
@ -216,6 +217,13 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
fileId = (hdata[0] << 8) + hdata[1];
|
fileId = (hdata[0] << 8) + hdata[1];
|
||||||
|
|
||||||
size_t offset = arg_get_int_def(ctx, 6, 0);
|
size_t offset = arg_get_int_def(ctx, 6, 0);
|
||||||
|
|
||||||
|
bool noAuth = arg_get_lit(ctx, 7);
|
||||||
|
|
||||||
|
//CipurseCChannelSetSecurityLevels(&cpc, CPSEncrypted, CPSEncrypted);
|
||||||
|
//CipurseCChannelSetSecurityLevels(&cpc, CPSMACed, CPSMACed);
|
||||||
|
//CipurseCChannelSetSecurityLevels(&cpc, CPSPlain, CPSPlain);
|
||||||
|
|
||||||
|
|
||||||
SetAPDULogging(APDULogging);
|
SetAPDULogging(APDULogging);
|
||||||
|
|
||||||
|
@ -231,12 +239,14 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLogEx(INFO, "File id: %x offset %d key id: %d key: %s", fileId, offset, keyId, sprint_hex(key, CIPURSE_AES_KEY_LENGTH));
|
PrintAndLogEx(INFO, "File id: %x offset %d key id: %d key: %s", fileId, offset, keyId, sprint_hex(key, CIPURSE_AES_KEY_LENGTH));
|
||||||
|
|
||||||
bool bres = CIPURSEChannelAuthenticate(keyId, key, verbose);
|
if (noAuth == false) {
|
||||||
if (bres == false) {
|
bool bres = CIPURSEChannelAuthenticate(keyId, key, verbose);
|
||||||
if (verbose == false)
|
if (bres == false) {
|
||||||
PrintAndLogEx(ERR, "Authentication " _RED_("ERROR"));
|
if (verbose == false)
|
||||||
DropField();
|
PrintAndLogEx(ERR, "Authentication " _RED_("ERROR"));
|
||||||
return PM3_ESOFT;
|
DropField();
|
||||||
|
return PM3_ESOFT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue