mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
chg: colors
This commit is contained in:
parent
38437a3916
commit
0997c55800
1 changed files with 27 additions and 34 deletions
|
@ -980,11 +980,11 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
if ( hasAuthKey ) return 1;
|
if ( hasAuthKey ) return 1;
|
||||||
|
|
||||||
// also try to diversify default keys.. look into CmdHF14AMfuGenDiverseKeys
|
// also try to diversify default keys.. look into CmdHF14AMfuGenDiverseKeys
|
||||||
PrintAndLogEx(NORMAL, "Trying some default 3des keys");
|
PrintAndLogEx(INFO, "Trying some default 3des keys");
|
||||||
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ) {
|
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ) {
|
||||||
key = default_3des_keys[i];
|
key = default_3des_keys[i];
|
||||||
if (ulc_authentication(key, true)) {
|
if (ulc_authentication(key, true)) {
|
||||||
PrintAndLogEx(NORMAL, "Found default 3des key: ");
|
PrintAndLogEx(SUCCESS, "Found default 3des key: ");
|
||||||
uint8_t keySwap[16];
|
uint8_t keySwap[16];
|
||||||
memcpy(keySwap, SwapEndian64(key,16,8), 16);
|
memcpy(keySwap, SwapEndian64(key,16,8), 16);
|
||||||
ulc_print_3deskey(keySwap);
|
ulc_print_3deskey(keySwap);
|
||||||
|
@ -1079,7 +1079,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
num_to_bytes( ul_ev1_pwdgenA(card.uid), 4, key);
|
num_to_bytes( ul_ev1_pwdgenA(card.uid), 4, key);
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
if (len > -1) {
|
if (len > -1) {
|
||||||
PrintAndLogEx(NORMAL, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLogEx(SUCCESS, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
num_to_bytes( ul_ev1_pwdgenB(card.uid), 4, key);
|
num_to_bytes( ul_ev1_pwdgenB(card.uid), 4, key);
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
if (len > -1) {
|
if (len > -1) {
|
||||||
PrintAndLogEx(NORMAL, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLogEx(SUCCESS, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
num_to_bytes( ul_ev1_pwdgenC(card.uid), 4, key);
|
num_to_bytes( ul_ev1_pwdgenC(card.uid), 4, key);
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
if (len > -1) {
|
if (len > -1) {
|
||||||
PrintAndLogEx(NORMAL, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLogEx(SUCCESS, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1109,7 +1109,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
num_to_bytes( ul_ev1_pwdgenD(card.uid), 4, key);
|
num_to_bytes( ul_ev1_pwdgenD(card.uid), 4, key);
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
if (len > -1) {
|
if (len > -1) {
|
||||||
PrintAndLogEx(NORMAL, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLogEx(SUCCESS, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,13 +1119,13 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
key = default_pwd_pack[i];
|
key = default_pwd_pack[i];
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
if (len > -1) {
|
if (len > -1) {
|
||||||
PrintAndLogEx(NORMAL, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLogEx(SUCCESS, "Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (!ul_auth_select( &card, tagtype, hasAuthKey, authkeyptr, pack, sizeof(pack))) return -1;
|
if (!ul_auth_select( &card, tagtype, hasAuthKey, authkeyptr, pack, sizeof(pack))) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len < 1) PrintAndLogEx(NORMAL, "password not known");
|
if (len < 1) PrintAndLogEx(WARNING, "password not known");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -1250,7 +1250,7 @@ int CmdHF14AMfUWrBl(const char *Cmd){
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
uint8_t isOK = resp.arg[0] & 0xff;
|
uint8_t isOK = resp.arg[0] & 0xff;
|
||||||
PrintAndLogEx(NORMAL, "isOk:%02x", isOK);
|
PrintAndLogEx(SUCCESS, "isOk:%02x", isOK);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(WARNING, "Command execute timeout");
|
PrintAndLogEx(WARNING, "Command execute timeout");
|
||||||
}
|
}
|
||||||
|
@ -1365,7 +1365,7 @@ int CmdHF14AMfURdBl(const char *Cmd){
|
||||||
PrintAndLogEx(WARNING, "Failed reading block: (%02x)", isOK);
|
PrintAndLogEx(WARNING, "Failed reading block: (%02x)", isOK);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(NORMAL, "Command execute time-out");
|
PrintAndLogEx(WARNING, "Command execute time-out");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1912,12 +1912,10 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
memset(authkey, 0x00, sizeof(authkey));
|
memset(authkey, 0x00, sizeof(authkey));
|
||||||
|
|
||||||
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||||
switch(param_getchar(Cmd, cmdp)) {
|
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'H':
|
|
||||||
return usage_hf_mfu_restore();
|
return usage_hf_mfu_restore();
|
||||||
case 'k':
|
case 'k':
|
||||||
case 'K':
|
|
||||||
keylen = param_getstr(Cmd, cmdp+1, tempStr, sizeof(tempStr));
|
keylen = param_getstr(Cmd, cmdp+1, tempStr, sizeof(tempStr));
|
||||||
if (keylen == 32 || keylen == 8) { //ul-c or ev1/ntag key length
|
if (keylen == 32 || keylen == 8) { //ul-c or ev1/ntag key length
|
||||||
errors = param_gethex(tempStr, 0, authkey, keylen);
|
errors = param_gethex(tempStr, 0, authkey, keylen);
|
||||||
|
@ -1930,12 +1928,10 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
hasKey = true;
|
hasKey = true;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
|
||||||
swapEndian = true;
|
swapEndian = true;
|
||||||
cmdp++;
|
cmdp++;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
case 'F':
|
|
||||||
filelen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
|
filelen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
|
||||||
|
|
||||||
if (filelen > FILE_PATH_SIZE-5)
|
if (filelen > FILE_PATH_SIZE-5)
|
||||||
|
@ -1947,17 +1943,14 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
|
||||||
cmdp++;
|
cmdp++;
|
||||||
write_special = true;
|
write_special = true;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
case 'E':
|
|
||||||
cmdp++;
|
cmdp++;
|
||||||
write_extra = true;
|
write_extra = true;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'R':
|
|
||||||
cmdp++;
|
cmdp++;
|
||||||
read_key = true;
|
read_key = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1972,7 +1965,7 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
if (errors || cmdp == 0) return usage_hf_mfu_restore();
|
if (errors || cmdp == 0) return usage_hf_mfu_restore();
|
||||||
|
|
||||||
if ((f = fopen(filename,"rb")) == NULL) {
|
if ((f = fopen(filename,"rb")) == NULL) {
|
||||||
PrintAndLogEx(WARNING, "Could not find file %s", filename);
|
PrintAndLogEx(WARNING, "Could not find file " _YELLOW_(%s), filename);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2000,7 +1993,7 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "Restoring %s to card", filename);
|
PrintAndLogEx(INFO, "Restoring " _YELLOW_(%s)" to card", filename);
|
||||||
|
|
||||||
mfu_dump_t *mem = (mfu_dump_t*)dump;
|
mfu_dump_t *mem = (mfu_dump_t*)dump;
|
||||||
uint8_t pages = (bytes_read-48)/4;
|
uint8_t pages = (bytes_read-48)/4;
|
||||||
|
@ -2084,7 +2077,7 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "Restoring data blocks.");
|
PrintAndLogEx(INFO, "Restoring data blocks.");
|
||||||
// write all other data
|
// write all other data
|
||||||
// Skip block 0,1,2,3 (only magic tags can write to them)
|
// Skip block 0,1,2,3 (only magic tags can write to them)
|
||||||
// Skip last 5 blocks usually is configuration
|
// Skip last 5 blocks usually is configuration
|
||||||
|
@ -2103,7 +2096,7 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
// write special data last
|
// write special data last
|
||||||
if (write_special) {
|
if (write_special) {
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "Restoring configuration blocks.\n");
|
PrintAndLogEx(INFO, "Restoring configuration blocks.\n");
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "authentication with keytype[%x] %s\n", (uint8_t)(c.arg[1] & 0xff), sprint_hex(p_authkey,4));
|
PrintAndLogEx(NORMAL, "authentication with keytype[%x] %s\n", (uint8_t)(c.arg[1] & 0xff), sprint_hex(p_authkey,4));
|
||||||
|
|
||||||
|
@ -2128,16 +2121,16 @@ int CmdHF14AMfURestore(const char *Cmd){
|
||||||
// Load emulator with dump file
|
// Load emulator with dump file
|
||||||
//
|
//
|
||||||
int CmdHF14AMfUeLoad(const char *Cmd){
|
int CmdHF14AMfUeLoad(const char *Cmd){
|
||||||
char c = param_getchar(Cmd, 0);
|
char c = tolower(param_getchar(Cmd, 0));
|
||||||
if ( c == 'h' || c == 'H' || c == 0x00) return usage_hf_mfu_eload();
|
if ( c == 'h' || c == 0x00) return usage_hf_mfu_eload();
|
||||||
return CmdHF14AMfELoad(Cmd);
|
return CmdHF14AMfELoad(Cmd);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Simulate tag
|
// Simulate tag
|
||||||
//
|
//
|
||||||
int CmdHF14AMfUSim(const char *Cmd){
|
int CmdHF14AMfUSim(const char *Cmd){
|
||||||
char c = param_getchar(Cmd, 0);
|
char c = tolower(param_getchar(Cmd, 0));
|
||||||
if ( c == 'h' || c == 'H' || c == 0x00) return usage_hf_mfu_sim();
|
if ( c == 'h' || c == 0x00) return usage_hf_mfu_sim();
|
||||||
return CmdHF14ASim(Cmd);
|
return CmdHF14ASim(Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2153,16 +2146,16 @@ int CmdHF14AMfucAuth(const char *Cmd){
|
||||||
uint8_t keyNo = 3;
|
uint8_t keyNo = 3;
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
|
|
||||||
//Change key to user defined one
|
//Change key to user defined one
|
||||||
if (cmdp == 'k' || cmdp == 'K'){
|
if (cmdp == 'k'){
|
||||||
keyNo = param_get8(Cmd, 1);
|
keyNo = param_get8(Cmd, 1);
|
||||||
if(keyNo >= KEYS_3DES_COUNT)
|
if(keyNo >= KEYS_3DES_COUNT)
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdp == 'h' || cmdp == 'H') errors = true;
|
if (cmdp == 'h') errors = true;
|
||||||
|
|
||||||
if (errors) return usage_hf_mfu_ucauth();
|
if (errors) return usage_hf_mfu_ucauth();
|
||||||
|
|
||||||
|
@ -2278,9 +2271,9 @@ int CmdTestDES(const char * cmd)
|
||||||
int CmdHF14AMfucSetPwd(const char *Cmd){
|
int CmdHF14AMfucSetPwd(const char *Cmd){
|
||||||
|
|
||||||
uint8_t pwd[16] = {0x00};
|
uint8_t pwd[16] = {0x00};
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
|
|
||||||
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_hf_mfu_ucsetpwd();
|
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_hf_mfu_ucsetpwd();
|
||||||
|
|
||||||
if (param_gethex(Cmd, 0, pwd, 32)) {
|
if (param_gethex(Cmd, 0, pwd, 32)) {
|
||||||
PrintAndLogEx(WARNING, "Password must include 32 HEX symbols");
|
PrintAndLogEx(WARNING, "Password must include 32 HEX symbols");
|
||||||
|
@ -2295,7 +2288,7 @@ int CmdHF14AMfucSetPwd(const char *Cmd){
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK,&resp,1500) ) {
|
if (WaitForResponseTimeout(CMD_ACK,&resp,1500) ) {
|
||||||
if ( (resp.arg[0] & 0xff) == 1) {
|
if ( (resp.arg[0] & 0xff) == 1) {
|
||||||
PrintAndLogEx(NORMAL, "Ultralight-C new password: %s", sprint_hex(pwd,16));
|
PrintAndLogEx(INFO, "Ultralight-C new password: %s", sprint_hex(pwd,16));
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(WARNING, "Failed writing at block %d", resp.arg[1] & 0xff);
|
PrintAndLogEx(WARNING, "Failed writing at block %d", resp.arg[1] & 0xff);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2315,9 +2308,9 @@ int CmdHF14AMfucSetUid(const char *Cmd){
|
||||||
UsbCommand c = {CMD_MIFAREU_READBL};
|
UsbCommand c = {CMD_MIFAREU_READBL};
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
uint8_t uid[7] = {0x00};
|
uint8_t uid[7] = {0x00};
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
|
|
||||||
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_hf_mfu_ucsetuid();
|
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_hf_mfu_ucsetuid();
|
||||||
|
|
||||||
if (param_gethex(Cmd, 0, uid, 14)) {
|
if (param_gethex(Cmd, 0, uid, 14)) {
|
||||||
PrintAndLogEx(WARNING, "UID must include 14 HEX symbols");
|
PrintAndLogEx(WARNING, "UID must include 14 HEX symbols");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue