initial commit to be in sync the-soon-defunct repo pm3rdv40.

This commit is contained in:
Chris
2018-08-12 21:54:31 +02:00
parent 905df58cc3
commit 5f77121694
34 changed files with 709 additions and 508 deletions

View File

@@ -66,7 +66,7 @@ int usage_analyse_nuid(void){
return 0;
}
int usage_analyse_a(void) {
PrintAndLogEx(NORMAL, "my personal garbage test command");
PrintAndLogEx(NORMAL, "Iceman's personal garbage test command");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Usage: analyse a [h] d <bytes>");
PrintAndLogEx(NORMAL, "Options:");
@@ -248,9 +248,17 @@ int CmdAnalyseLCR(const char *Cmd) {
if (strlen(Cmd) == 0|| cmdp == 'h' || cmdp == 'H') return usage_analyse_lcr();
int len = 0;
param_gethex_ex(Cmd, 0, data, &len);
if ( len%2 ) return usage_analyse_lcr();
len >>= 1;
switch (param_gethex_to_eol(Cmd, 0, data, sizeof(data), &len)) {
case 1:
PrintAndLogEx(WARNING, "Invalid HEX value.");
return 1;
case 2:
PrintAndLogEx(WARNING, "Too many bytes. Max %d bytes", sizeof(data));
return 1;
case 3:
PrintAndLogEx(WARNING, "Hex must have even number of digits.");
return 1;
}
uint8_t finalXor = calculateLRC(data, len);
PrintAndLogEx(NORMAL, "Target [%02X] requires final LRC XOR byte value: 0x%02X",data[len-1] ,finalXor);
return 0;

View File

@@ -150,6 +150,7 @@ int GetModels(char *Models[], int *count, uint8_t *width){
if (pset.flags & P_REFOUT)
prev(&apoly);
for (qptr = apolys; qptr < pptr; ++qptr) {
crc = pcrc(*qptr, pset.spoly, pset.init, apoly, 0);
if (ptst(crc)) {

View File

@@ -1,5 +1,6 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
// Modified 2018 iceman
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
@@ -89,12 +90,28 @@ int usage_hf_14b_write_srx(void){
PrintAndLogEx(NORMAL, " hf 14b sriwrite 2 FF 11223344");
return 0;
}
int usage_hf_14b_dump(void){
PrintAndLogEx(NORMAL, "This command dumps the contents of a ISO-14443-B tag and save it to file\n"
"\n"
"Usage: hf 14b dump [h] [card memory] <f filname> \n"
"Options:\n"
"\th this help\n"
"\t[card memory] 1 = SRIX4K (default), 2 = SRI512"
"\tf <name> filename, if no <name> UID will be used as filename\n"
"\n"
"Example:\n"
"\thf 14b dump f\n"
"\thf 14b dump 2 f mydump");
return 0;
}
/*
static void switch_on_field_14b(void) {
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
}
*/
static int switch_off_field_14b(void) {
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_DISCONNECT, 0, 0}};
@@ -109,11 +126,11 @@ int CmdHF14BList(const char *Cmd) {
}
int CmdHF14BSim(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H') return usage_hf_14b_sim();
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_hf_14b_sim();
uint32_t pupi = 0;
if (cmdp == 'u' || cmdp == 'U') {
if (cmdp == 'u') {
pupi = param_get32ex(Cmd, 1, 0, 16);
}
@@ -125,8 +142,8 @@ int CmdHF14BSim(const char *Cmd) {
int CmdHF14BSniff(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H') return usage_hf_14b_sniff();
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_hf_14b_sniff();
UsbCommand c = {CMD_SNOOP_ISO_14443B, {0, 0, 0}};
clearCommandBuffer();
@@ -151,26 +168,21 @@ int CmdHF14BCmdRaw (const char *Cmd) {
while (Cmd[i]!='\0') {
if (Cmd[i]==' ' || Cmd[i]=='\t') { ++i; continue; }
if (Cmd[i]=='-') {
switch (Cmd[i+1]) {
switch (tolower(Cmd[i+1])) {
case 'h':
case 'H':
return usage_hf_14b_raw();
case 'r':
case 'R':
reply = false;
break;
case 'c':
case 'C':
flags |= ISO14B_APPEND_CRC;
break;
case 'p':
case 'P':
power = true;
break;
case 's':
case 'S':
select = true;
if (Cmd[i+2]=='s' || Cmd[i+2]=='S') {
if (tolower(Cmd[i+2]) == 's') {
flags |= ISO14B_SELECT_SR;
++i;
} else {
@@ -229,6 +241,54 @@ int CmdHF14BCmdRaw (const char *Cmd) {
return 1;
}
static bool get_14b_UID(iso14b_card_select_t *card) {
if (!card)
return false;
uint8_t retry = 3;
UsbCommand resp;
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}};
// test for 14b SR
while (retry--) {
clearCommandBuffer();
SendCommand(&c);
if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
uint8_t status = resp.arg[0];
if ( status == 0) {
memcpy(card, (iso14b_card_select_t *)resp.d.asBytes, sizeof(iso14b_card_select_t));
return true;
}
}
} // retry
// test 14b standard
c.arg[0] = ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT;
retry = 3;
while (retry--) {
clearCommandBuffer();
SendCommand(&c);
if (WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
uint8_t status = resp.arg[0];
if ( status == 0) {
memcpy(card, (iso14b_card_select_t *)resp.d.asBytes, sizeof(iso14b_card_select_t));
return true;
}
}
} // retry
if ( !retry )
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
return false;
}
// print full atqb info
// bytes
// 0,1,2,3 = application data
@@ -374,8 +434,45 @@ static void print_st_general_info(uint8_t *data, uint8_t len){
// 14b get and print Full Info (as much as we know)
bool HF14B_Std_Info(bool verbose){
//add more info here
bool isSuccess = false;
// 14b get and print UID only (general info)
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
switch_off_field_14b();
return false;
}
iso14b_card_select_t card;
memcpy(&card, (iso14b_card_select_t *)resp.d.asBytes, sizeof(iso14b_card_select_t));
uint64_t status = resp.arg[0];
switch( status ){
case 0:
PrintAndLogEx(NORMAL, " UID : %s", sprint_hex(card.uid, card.uidlen));
PrintAndLogEx(NORMAL, " ATQB : %s", sprint_hex(card.atqb, sizeof(card.atqb)));
PrintAndLogEx(NORMAL, " CHIPID : %02X", card.chipid);
print_atqb_resp(card.atqb, card.cid);
isSuccess = true;
case 2:
if (verbose) PrintAndLogEx(FAILED, "ISO 14443-3 ATTRIB fail");
break;
case 3:
if (verbose) PrintAndLogEx(FAILED, "ISO 14443-3 CRC fail");
break;
default:
if (verbose) PrintAndLogEx(FAILED, "ISO 14443-b card select failed");
break;
}
return isSuccess;
}
// SRx get and print full info (needs more info...)
@@ -395,7 +492,10 @@ bool HF14B_ST_Info(bool verbose){
memcpy(&card, (iso14b_card_select_t *)resp.d.asBytes, sizeof(iso14b_card_select_t));
uint64_t status = resp.arg[0];
if ( status > 0 ) return switch_off_field_14b();
if ( status > 0 )
return false;
print_st_general_info(card.uid, card.uidlen);
//add locking bit information here. uint8_t data[16] = {0x00};
// uint8_t datalen = 2;
@@ -418,7 +518,6 @@ bool HF14B_ST_Info(bool verbose){
// if (datalen != resplen || !crc) return rawClose();
//print_ST_Lock_info(data[5]>>2);
switch_off_field_14b();
return true;
}
@@ -428,7 +527,7 @@ bool HF14BInfo(bool verbose){
// try std 14b (atqb)
if (HF14B_Std_Info(verbose)) return true;
// try st 14b
// try ST 14b
if (HF14B_ST_Info(verbose)) return true;
// try unknown 14b read commands (to be identified later)
@@ -439,10 +538,10 @@ bool HF14BInfo(bool verbose){
// menu command to get and print all info known about any known 14b tag
int CmdHF14Binfo(const char *Cmd){
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H') return usage_hf_14b_info();
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_hf_14b_info();
bool verbose = !((cmdp == 's') || (cmdp == 'S'));
bool verbose = !(cmdp == 's');
return HF14BInfo(verbose);
}
@@ -450,16 +549,13 @@ bool HF14B_ST_Reader(bool verbose){
bool isSuccess = false;
switch_on_field_14b();
// SRx get and print general info about SRx chip from UID
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_SELECT_SR, 0, 0}};
UsbCommand c = {CMD_ISO_14443B_COMMAND, {ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
switch_off_field_14b();
return false;
}
@@ -486,8 +582,6 @@ bool HF14B_ST_Reader(bool verbose){
if (verbose) PrintAndLogEx(FAILED, "ISO 14443-b card select SRx failed");
break;
}
switch_off_field_14b();
return isSuccess;
}
@@ -503,7 +597,6 @@ bool HF14B_Std_Reader(bool verbose){
if (!WaitForResponseTimeout(CMD_ACK, &resp, TIMEOUT)) {
if (verbose) PrintAndLogEx(WARNING, "command execution timeout");
switch_off_field_14b();
return false;
}
@@ -530,8 +623,6 @@ bool HF14B_Std_Reader(bool verbose){
if (verbose) PrintAndLogEx(FAILED, "ISO 14443-b card select failed");
break;
}
switch_off_field_14b();
return isSuccess;
}
@@ -613,10 +704,10 @@ bool HF14BReader(bool verbose){
// menu command to get and print general info about all known 14b chips
int CmdHF14BReader(const char *Cmd){
char cmdp = param_getchar(Cmd, 0);
if (cmdp == 'h' || cmdp == 'H') return usage_hf_14b_reader();
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_hf_14b_reader();
bool verbose = !((cmdp == 's') || (cmdp == 'S'));
bool verbose = !(cmdp == 's');
return HF14BReader(verbose);
}
@@ -625,8 +716,8 @@ int CmdHF14BReader(const char *Cmd){
* this command just dumps the contents of the memory/
*/
int CmdHF14BReadSri(const char *Cmd){
char cmdp = param_getchar(Cmd, 0);
if (strlen(Cmd) < 1 || cmdp == 'h' || cmdp == 'H') return usage_hf_14b_read_srx();
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) < 1 || cmdp == 'h') return usage_hf_14b_read_srx();
uint8_t tagtype = param_get8(Cmd, 0);
uint8_t blocks = (tagtype == 1) ? 0x7F : 0x0F;
@@ -648,14 +739,14 @@ int CmdHF14BWriteSri(const char *Cmd){
* Special block FF = otp_lock_reg block.
* Data len 4 bytes-
*/
char cmdp = param_getchar(Cmd, 0);
char cmdp = tolower(param_getchar(Cmd, 0));
uint8_t blockno = -1;
uint8_t data[4] = {0x00};
bool isSrix4k = true;
char str[30];
memset(str, 0x00, sizeof(str));
if (strlen(Cmd) < 1 || cmdp == 'h' || cmdp == 'H') return usage_hf_14b_write_srx();
if (strlen(Cmd) < 1 || cmdp == 'h') return usage_hf_14b_write_srx();
if ( cmdp == '2' )
isSrix4k = false;
@@ -703,6 +794,162 @@ int CmdHF14BWriteSri(const char *Cmd){
return 0;
}
// need to write to file
int CmdHF14BDump(const char*Cmd) {
uint8_t fileNameLen = 0;
char filename[FILE_PATH_SIZE] = {0};
char * fptr = filename;
bool errors = false;
uint8_t cmdp = 0, cardtype = 1;
uint16_t cardsize = 0;
uint8_t blocks = 0;
iso14b_card_select_t card;
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
return usage_hf_14b_dump();
case 'f':
fileNameLen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
cmdp += 2;
break;
default:
if (cmdp == 0) {
cardtype = param_get8ex(Cmd, cmdp, 1, 10);
cmdp++;
} else {
PrintAndLogEx(WARNING, "Unknown parameter '%c'\n", param_getchar(Cmd, cmdp));
errors = true;
break;
}
}
}
//Validations
if (errors) return usage_hf_14b_dump();
switch (cardtype){
case 2:
cardsize = (512/8) + 4;
blocks = 0x0F;
break;
case 1:
default:
cardsize = (4096/8) + 4;
blocks = 0x7F;
break;
}
if (!get_14b_UID(&card)) {
PrintAndLogEx(WARNING, "No tag found.");
return 1;
}
if (fileNameLen < 1) {
PrintAndLogEx(INFO, "Using UID as filename");
fptr += sprintf(fptr, "hf-14b-");
FillFileNameByUID(fptr, card.uid, "-dump", card.uidlen);
}
// detect blocksize from card :)
PrintAndLogEx(NORMAL, "Reading memory from tag UID %s", sprint_hex(card.uid, card.uidlen));
uint8_t data[cardsize];
memset(data, 0, sizeof(data));
int blocknum = 0;
uint8_t *recv = NULL;
UsbCommand resp;
UsbCommand c = {CMD_ISO_14443B_COMMAND, { ISO14B_CONNECT | ISO14B_SELECT_SR, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
//select
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
if (resp.arg[0]) {
PrintAndLogEx(INFO, "failed to select %d | %d", resp.arg[0], resp.arg[1]);
goto out;
}
}
c.arg[0] = ISO14B_APPEND_CRC | ISO14B_RAW;
c.arg[1] = 2;
uint8_t *req = c.d.asBytes;
req[0] = ISO14443B_READ_BLK;
for (int retry = 0; retry < 5; retry++) {
req[1] = blocknum;
clearCommandBuffer();
SendCommand(&c);
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
uint8_t status = resp.arg[0] & 0xFF;
if ( status > 0 ) {
continue;
}
uint16_t len = (resp.arg[1] & 0xFFFF);
recv = resp.d.asBytes;
if ( !check_crc(CRC_14443_B, recv, len) ) {
PrintAndLogEx(FAILED, "crc fail, retrying one more time");
continue;
}
memcpy(data + (blocknum * 4), resp.d.asBytes, 4);
if ( blocknum == 0xFF) {
//last read.
break;
}
retry = 0;
blocknum++;
if ( blocknum > blocks ) {
// read config block
blocknum = 0xFF;
}
printf("."); fflush(stdout);
}
}
if ( blocknum != 0xFF) {
PrintAndLogEx(NORMAL, "\n Dump failed");
goto out;
}
PrintAndLogEx(NORMAL, "\n");
PrintAndLogEx(NORMAL, "block# | data | ascii");
PrintAndLogEx(NORMAL, "---------+--------------+----------");
for (int i = 0; i <= blocks; i++) {
PrintAndLogEx(NORMAL,
"%3d/0x%02X | %s | %s",
i,
i,
sprint_hex(data + (i*4), 4 ),
sprint_ascii(data + (i*4), 4)
);
}
PrintAndLogEx(NORMAL, "\n");
size_t datalen = (blocks+1) * 4;
saveFileEML(filename, "eml", data, datalen, 4);
saveFile(filename, "bin", data, datalen);
out:
return switch_off_field_14b();
}
uint32_t srix4kEncode(uint32_t value) {
/*
// vv = value
@@ -844,6 +1091,7 @@ bool waitCmd14b(bool verbose) {
static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"},
{"dump", CmdHF14BDump, 0, "Read all memory pages of an ISO14443-B tag, save to file"},
{"info", CmdHF14Binfo, 0, "Tag information"},
{"list", CmdHF14BList, 0, "[Deprecated] List ISO 14443B history"},
{"raw", CmdHF14BCmdRaw, 0, "Send raw hex data to tag"},

View File

@@ -45,6 +45,8 @@ extern int CmdHF14BSniff(const char *Cmd);
extern int CmdHF14BWrite( const char *cmd);
extern int CmdHF14BReader(const char *Cmd);
extern int CmdHF14BDump(const char *Cmd);
extern bool HF14BInfo(bool verbose);
extern bool HF14BReader(bool verbose);
extern int CmdHF14BCmdRaw (const char *Cmd);

View File

@@ -658,12 +658,10 @@ int CmdHF15Dump(const char*Cmd) {
uint8_t uid[8] = {0,0,0,0,0,0,0,0};
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
case 'H':
return usage_15_dump();
case 'f':
case 'F':
fileNameLen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
cmdp += 2;
break;

View File

@@ -166,8 +166,8 @@ int usage_legic_wipe(void){
*/
int CmdLegicInfo(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0);
if ( cmdp == 'H' || cmdp == 'h' ) return usage_legic_info();
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' ) return usage_legic_info();
int i = 0, k = 0, segmentNum = 0, segment_len = 0, segment_flag = 0;
int crc = 0, wrp = 0, wrc = 0;
@@ -477,8 +477,8 @@ out:
// number of bytes to read
int CmdLegicRdmem(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0);
if ( cmdp == 'H' || cmdp == 'h' ) return usage_legic_rdmem();
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' ) return usage_legic_rdmem();
uint32_t offset = 0, len = 0, iv = 1;
uint16_t datalen = 0;
@@ -524,9 +524,8 @@ int CmdLegicRfWrite(const char *Cmd) {
uint32_t offset = 0, IV = 0x55;
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'd':
case 'D':
// peek at length of the input string so we can
// figure out how many elements to malloc in "data"
bg=en=0;
@@ -571,12 +570,10 @@ int CmdLegicRfWrite(const char *Cmd) {
cmdp += 2;
break;
case 'o':
case 'O':
offset = param_get32ex(Cmd, cmdp+1, 4, 16);
cmdp += 2;
break;
case 'h':
case 'H':
errors = true;
break;
default:
@@ -658,9 +655,8 @@ int CmdLegicCalcCrc(const char *Cmd){
int bg, en;
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'd':
case 'D':
// peek at length of the input string so we can
// figure out how many elements to malloc in "data"
bg=en=0;
@@ -696,17 +692,14 @@ int CmdLegicCalcCrc(const char *Cmd){
cmdp += 2;
break;
case 'u':
case 'U':
uidcrc = param_get8ex(Cmd, cmdp+1, 0, 16);
cmdp += 2;
break;
case 'c':
case 'C':
type = param_get8ex(Cmd, cmdp+1, 0, 10);
cmdp += 2;
break;
case 'h':
case 'H':
errors = true;
break;
default:
@@ -789,7 +782,7 @@ int legic_get_type(legic_card_select_t *card){
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, 500))
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500))
return 2;
uint8_t isOK = resp.arg[0] & 0xFF;
@@ -825,11 +818,10 @@ void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) {
}
}
int HFLegicReader(const char *Cmd, bool verbose) {
char cmdp = param_getchar(Cmd, 0);
if ( cmdp == 'H' || cmdp == 'h' ) return usage_legic_reader();
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' ) return usage_legic_reader();
legic_card_select_t card;
switch(legic_get_type(&card)){
@@ -864,12 +856,10 @@ int CmdLegicDump(const char *Cmd){
memset(filename, 0, sizeof(filename));
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
case 'H':
return usage_legic_dump();
case 'o':
case 'O':
fileNlen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
if (!fileNlen)
errors = true;
@@ -964,13 +954,11 @@ int CmdLegicRestore(const char *Cmd){
memset(filename, 0, sizeof(filename));
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
case 'H':
errors = true;
break;
case 'i':
case 'I':
fileNlen = param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
if (!fileNlen)
errors = true;
@@ -1079,8 +1067,8 @@ int CmdLegicELoad(const char *Cmd) {
int len, numofbytes;
int nameParamNo = 1;
char cmdp = param_getchar(Cmd, 0);
if ( cmdp == 'h' || cmdp == 'H' || cmdp == 0x00)
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' || cmdp == 0x00)
return usage_legic_eload();
switch (cmdp) {
@@ -1142,9 +1130,9 @@ int CmdLegicESave(const char *Cmd) {
memset(filename, 0, sizeof(filename));
char cmdp = param_getchar(Cmd, 0);
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' || cmdp == 'H' || cmdp == 0x00)
if ( cmdp == 'h' || cmdp == 0x00)
return usage_legic_esave();
switch (cmdp) {
@@ -1198,9 +1186,9 @@ int CmdLegicESave(const char *Cmd) {
int CmdLegicWipe(const char *Cmd){
char cmdp = param_getchar(Cmd, 0);
char cmdp = tolower(param_getchar(Cmd, 0));
if ( cmdp == 'h' || cmdp == 'H') return usage_legic_wipe();
if ( cmdp == 'h') return usage_legic_wipe();
// tagtype
legic_card_select_t card;

View File

@@ -652,29 +652,22 @@ int CmdHF14AMfDump(const char *Cmd) {
UsbCommand resp;
while(param_getchar(Cmd, cmdp) != 0x00) {
switch(param_getchar(Cmd, cmdp)) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
case 'H':
return usage_hf14_dump();
case 'k':
case 'K':
param_getstr(Cmd, cmdp+1, keyFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
case 'f':
case 'F':
param_getstr(Cmd, cmdp+1, dataFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
default:
if (cmdp==0)
{
if (cmdp == 0) {
numSectors = NumOfSectors(param_getchar(Cmd, cmdp));
cmdp++;
}
else
{
} else {
PrintAndLogEx(WARNING, "Unknown parameter '%c'\n", param_getchar(Cmd, cmdp));
return usage_hf14_dump();
}
@@ -1662,10 +1655,12 @@ int CmdHF14AMfChk(const char *Cmd) {
clen = param_getlength(Cmd, 1);
if (clen == 1) {
switch (ctmp) {
case 'a': case 'A':
case 'a':
case 'A':
keyType = 0;
break;
case 'b': case 'B':
case 'b':
case 'B':
keyType = 1;
break;
case '?':

View File

@@ -262,15 +262,17 @@ int CmdVersion(const char *Cmd) {
PrintAndLogEx(NORMAL, "\n\e[34mProxmark3 RFID instrument\e[0m\n");
#endif
char s[50] = {0};
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD)
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) || defined(WITH_FPC)
strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
#endif
#ifdef WITH_FLASH
strncat(s, "flashmem; ", sizeof(s) - strlen(s) - 1);
#endif
#ifdef WITH_SMARTCARD
strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1);
#endif
#ifdef WITH_FPC
strncat(s, "fpc; ", sizeof(s) - strlen(s) - 1);
#endif
PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
PrintAndLogEx(NORMAL, " client: iceman %s \n", s);

View File

@@ -837,12 +837,12 @@ int CheckChipType(bool getDeviceData) {
int CmdLFfind(const char *Cmd) {
int ans = 0;
size_t minLength = 2000;
char cmdp = param_getchar(Cmd, 0);
char cmdp = tolower(param_getchar(Cmd, 0));
char testRaw = param_getchar(Cmd, 1);
if (strlen(Cmd) > 3 || cmdp == 'h' || cmdp == 'H') return usage_lf_find();
if (strlen(Cmd) > 3 || cmdp == 'h') return usage_lf_find();
if (cmdp == 'u' || cmdp == 'U') testRaw = 'u';
if (cmdp == 'u') testRaw = 'u';
bool isOnline = (!offline && (cmdp != '1') );
@@ -902,7 +902,7 @@ int CmdLFfind(const char *Cmd) {
PrintAndLogEx(FAILED, "\nNo known 125/134 KHz tags Found!\n");
if (testRaw=='u' || testRaw=='U'){
if (testRaw == 'u'){
//test unknown tag formats (raw mode)
PrintAndLogEx(INFO, "\nChecking for Unknown tags:\n");
ans = AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, 4000, false, false);

View File

@@ -47,7 +47,7 @@ int usage_trace_load(){
PrintAndLogEx(NORMAL, "Load protocol data from file to trace buffer.");
PrintAndLogEx(NORMAL, "Usage: trace load <filename>");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " trace lload mytracefile.bin");
PrintAndLogEx(NORMAL, " trace load mytracefile.bin");
return 0;
}
int usage_trace_save(){
@@ -396,6 +396,7 @@ void printFelica(uint16_t traceLen, uint8_t *trace) {
}
// sanity check. Don't use proxmark if it is offline and you didn't specify useTraceBuffer
/*
static int SanityOfflineCheck( bool useTraceBuffer ){
if ( !useTraceBuffer && offline) {
PrintAndLogEx(NORMAL, "Your proxmark3 device is offline. Specify [1] to use TraceBuffer data instead");
@@ -403,6 +404,7 @@ static int SanityOfflineCheck( bool useTraceBuffer ){
}
return 1;
}
*/
int CmdTraceList(const char *Cmd) {
@@ -478,11 +480,10 @@ int CmdTraceList(const char *Cmd) {
if (errors) return usage_trace_list();
uint16_t tracepos = 0;
// reserv some space.
if (!trace) {
printf("trace pointer not allocated\n");
if (!trace)
trace = calloc(USB_CMD_DATA_SIZE, sizeof(uint8_t));
}
if ( isOnline ) {
// Query for the size of the trace, downloading USB_CMD_DATA_SIZE