mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
monster merge...
all those changes marshmellow did.. and more...
This commit is contained in:
parent
208550823d
commit
f28da2da6e
107 changed files with 5087 additions and 3777 deletions
|
@ -319,6 +319,7 @@ int HFiClassReader(const char *Cmd, bool loop, bool verbose) {
|
|||
c.arg[0] |= FLAG_ICLASS_READER_ONLY_ONCE | FLAG_ICLASS_READER_ONE_TRY;
|
||||
UsbCommand resp;
|
||||
while (!ukbhit()){
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp, 4500)) {
|
||||
|
@ -336,8 +337,23 @@ int HFiClassReader(const char *Cmd, bool loop, bool verbose) {
|
|||
PrintAndLog("CSN: %s",sprint_hex(data,8));
|
||||
tagFound = true;
|
||||
}
|
||||
if( readStatus & FLAG_ICLASS_READER_CC) PrintAndLog("CC: %s", sprint_hex(data+16, 8));
|
||||
if( readStatus & FLAG_ICLASS_READER_CONF) printIclassDumpInfo(data);
|
||||
if( readStatus & FLAG_ICLASS_READER_CC) {
|
||||
PrintAndLog(" CC: %s",sprint_hex(data+16,8));
|
||||
}
|
||||
if( readStatus & FLAG_ICLASS_READER_CONF) {
|
||||
printIclassDumpInfo(data);
|
||||
}
|
||||
if (readStatus & FLAG_ICLASS_READER_AA) {
|
||||
bool legacy = true;
|
||||
PrintAndLog(" AppIA: %s",sprint_hex(data+8*5,8));
|
||||
for (int i = 0; i<8; i++) {
|
||||
if (data[8*5+i] != 0xFF) {
|
||||
legacy = false;
|
||||
}
|
||||
}
|
||||
PrintAndLog(" : Possible iClass %s",(legacy) ? "(legacy tag)" : "(NOT legacy tag)");
|
||||
}
|
||||
|
||||
if (tagFound && !loop) return 1;
|
||||
} else {
|
||||
if (verbose) PrintAndLog("Command execute timeout");
|
||||
|
@ -876,9 +892,6 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
|
|||
// add diversified keys to dump
|
||||
if (have_debit_key) memcpy(tag_data+(3*8),div_key,8);
|
||||
if (have_credit_key) memcpy(tag_data+(4*8),c_div_key,8);
|
||||
|
||||
printf("Num of bytes: %zu\n", gotBytes);
|
||||
|
||||
// print the dump
|
||||
printf("------+--+-------------------------+\n");
|
||||
printf("CSN |00| %s|\n", sprint_hex(tag_data, 8));
|
||||
|
@ -1160,20 +1173,21 @@ int CmdHFiClassCloneTag(const char *Cmd) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int ReadBlock(uint8_t *KEY, uint8_t blockno, uint8_t keyType, bool elite, bool rawkey, bool verbose) {
|
||||
static int ReadBlock(uint8_t *KEY, uint8_t blockno, uint8_t keyType, bool elite, bool rawkey, bool verbose, bool auth) {
|
||||
uint8_t MAC[4]={0x00,0x00,0x00,0x00};
|
||||
uint8_t div_key[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
|
||||
// block 0,1 should always be able to read, and block 5 on some cards.
|
||||
if (blockno >= 2 ) {
|
||||
if (auth || blockno >= 2) {
|
||||
if (!select_and_auth(KEY, MAC, div_key, (keyType==0x18), elite, rawkey, verbose))
|
||||
return 0;
|
||||
} else {
|
||||
uint8_t CSN[8]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
uint8_t CCNR[12]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
if (!select_only(CSN, CCNR, false, verbose))
|
||||
return false;
|
||||
if (!select_only(CSN, CCNR, (keyType==0x18), verbose))
|
||||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand resp;
|
||||
UsbCommand w = {CMD_ICLASS_READBLOCK, {blockno}};
|
||||
clearCommandBuffer();
|
||||
|
@ -1203,6 +1217,7 @@ int CmdHFiClass_ReadBlock(const char *Cmd) {
|
|||
bool elite = false;
|
||||
bool rawkey = false;
|
||||
bool errors = false;
|
||||
bool auth = false;
|
||||
uint8_t cmdp = 0;
|
||||
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||
switch(param_getchar(Cmd, cmdp)) {
|
||||
|
@ -1229,6 +1244,7 @@ int CmdHFiClass_ReadBlock(const char *Cmd) {
|
|||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
auth = true;
|
||||
dataLen = param_getstr(Cmd, cmdp+1, tempStr);
|
||||
if (dataLen == 16) {
|
||||
errors = param_gethex(tempStr, 0, KEY, dataLen);
|
||||
|
@ -1259,7 +1275,10 @@ int CmdHFiClass_ReadBlock(const char *Cmd) {
|
|||
}
|
||||
if (errors || cmdp < 4) return usage_hf_iclass_readblock();
|
||||
|
||||
return ReadBlock(KEY, blockno, keyType, elite, rawkey, true);
|
||||
|
||||
if (!auth)
|
||||
PrintAndLog("warning: no authentication used with read, only a few specific blocks can be read accurately without authentication.");
|
||||
return ReadBlock(KEY, blockno, keyType, elite, rawkey, true, auth);
|
||||
}
|
||||
|
||||
int CmdHFiClass_loclass(const char *Cmd) {
|
||||
|
@ -1597,8 +1616,8 @@ int CmdHFiClassManageKeys(const char *Cmd) {
|
|||
case 'n':
|
||||
case 'N':
|
||||
keyNbr = param_get8(Cmd, cmdp+1);
|
||||
if (keyNbr == 0) {
|
||||
PrintAndLog("Wrong block number");
|
||||
if (keyNbr >= ICLASS_KEYS_MAX) {
|
||||
PrintAndLog("Invalid block number");
|
||||
errors = true;
|
||||
}
|
||||
cmdp += 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue