mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Renamed the calccrc8 functions and command.
This commit is contained in:
parent
d41efbf21b
commit
f6e01a3493
2 changed files with 11 additions and 17 deletions
|
@ -13,10 +13,10 @@ static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
#define MAX_LENGTH 1024
|
#define MAX_LENGTH 1024
|
||||||
|
|
||||||
int usage_legic_calccrc8(void){
|
int usage_legic_calccrc(void){
|
||||||
PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes.");
|
PrintAndLog("Calculates the legic crc8/crc16 on the input hexbytes.");
|
||||||
PrintAndLog("There must be an even number of hexsymbols as input.");
|
PrintAndLog("There must be an even number of hexsymbols as input.");
|
||||||
PrintAndLog("Usage: hf legic crc8 [h] b <hexbytes> u <uidcrc> c <crc type>");
|
PrintAndLog("Usage: hf legic crc [h] b <hexbytes> u <uidcrc> c <crc type>");
|
||||||
PrintAndLog("Options:");
|
PrintAndLog("Options:");
|
||||||
PrintAndLog(" h : this help");
|
PrintAndLog(" h : this help");
|
||||||
PrintAndLog(" b <hexbytes> : hex bytes");
|
PrintAndLog(" b <hexbytes> : hex bytes");
|
||||||
|
@ -24,8 +24,8 @@ int usage_legic_calccrc8(void){
|
||||||
PrintAndLog(" c <crc type> : 8|16 bit crc size");
|
PrintAndLog(" c <crc type> : 8|16 bit crc size");
|
||||||
PrintAndLog("");
|
PrintAndLog("");
|
||||||
PrintAndLog("Samples:");
|
PrintAndLog("Samples:");
|
||||||
PrintAndLog(" hf legic crc8 b deadbeef1122");
|
PrintAndLog(" hf legic crc b deadbeef1122");
|
||||||
PrintAndLog(" hf legic crc8 b deadbeef1122 u 9A c 16");
|
PrintAndLog(" hf legic crc b deadbeef1122 u 9A c 16");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int usage_legic_load(void){
|
int usage_legic_load(void){
|
||||||
|
@ -687,6 +687,7 @@ int CmdLegicRfWrite(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int CmdLegicRfRawWrite(const char *Cmd) {
|
int CmdLegicRfRawWrite(const char *Cmd) {
|
||||||
PrintAndLog("############# DANGER !! #############");
|
PrintAndLog("############# DANGER !! #############");
|
||||||
PrintAndLog("# changing the DCF is irreversible #");
|
PrintAndLog("# changing the DCF is irreversible #");
|
||||||
|
@ -697,11 +698,9 @@ int CmdLegicRfRawWrite(const char *Cmd) {
|
||||||
// }
|
// }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void static calc4(uint8_t *cmd, uint8_t len){
|
int CmdLegicCalcCrc(const char *Cmd){
|
||||||
}
|
|
||||||
|
|
||||||
int CmdLegicCalcCrc8(const char *Cmd){
|
|
||||||
|
|
||||||
uint8_t *data = NULL;
|
uint8_t *data = NULL;
|
||||||
uint8_t cmdp = 0, uidcrc = 0, type=0;
|
uint8_t cmdp = 0, uidcrc = 0, type=0;
|
||||||
|
@ -771,16 +770,13 @@ int CmdLegicCalcCrc8(const char *Cmd){
|
||||||
//Validations
|
//Validations
|
||||||
if (errors){
|
if (errors){
|
||||||
if (data) free(data);
|
if (data) free(data);
|
||||||
return usage_legic_calccrc8();
|
return usage_legic_calccrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type){
|
switch (type){
|
||||||
case 16:
|
case 16:
|
||||||
PrintAndLog("Legic crc16: %X", CRC16Legic(data, len, uidcrc));
|
PrintAndLog("Legic crc16: %X", CRC16Legic(data, len, uidcrc));
|
||||||
break;
|
break;
|
||||||
case 4:
|
|
||||||
calc4(data, 0);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
PrintAndLog("Legic crc8: %X", CRC8Legic(data, len) );
|
PrintAndLog("Legic crc8: %X", CRC8Legic(data, len) );
|
||||||
break;
|
break;
|
||||||
|
@ -1105,7 +1101,7 @@ static command_t CommandTable[] = {
|
||||||
{"load", CmdLegicLoad, 0, "<filename> -- Restore samples"},
|
{"load", CmdLegicLoad, 0, "<filename> -- Restore samples"},
|
||||||
{"sim", CmdLegicRfSim, 0, "[phase drift [frame drift [req/resp drift]]] Start tag simulator (use after load or read)"},
|
{"sim", CmdLegicRfSim, 0, "[phase drift [frame drift [req/resp drift]]] Start tag simulator (use after load or read)"},
|
||||||
{"write", CmdLegicRfWrite, 0, "<offset> <length> <iv> -- Write sample buffer (user after load or read)"},
|
{"write", CmdLegicRfWrite, 0, "<offset> <length> <iv> -- Write sample buffer (user after load or read)"},
|
||||||
{"crc8", CmdLegicCalcCrc8, 1, "Calculate Legic CRC8 over given hexbytes"},
|
{"crc", CmdLegicCalcCrc, 1, "Calculate Legic CRC over given hexbytes"},
|
||||||
{"eload", CmdLegicELoad, 1, "Load binary dump to emulator memory"},
|
{"eload", CmdLegicELoad, 1, "Load binary dump to emulator memory"},
|
||||||
{"esave", CmdLegicESave, 1, "Save emulator memory to binary file"},
|
{"esave", CmdLegicESave, 1, "Save emulator memory to binary file"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
|
|
|
@ -31,11 +31,9 @@ int CmdLegicLoad(const char *Cmd);
|
||||||
int CmdLegicSave(const char *Cmd);
|
int CmdLegicSave(const char *Cmd);
|
||||||
int CmdLegicRfSim(const char *Cmd);
|
int CmdLegicRfSim(const char *Cmd);
|
||||||
int CmdLegicRfWrite(const char *Cmd);
|
int CmdLegicRfWrite(const char *Cmd);
|
||||||
int CmdLegicRfRawWrite(const char *Cmd);
|
int CmdLegicCalcCrc(const char *Cmd);
|
||||||
int CmdLegicCalcCrc8(const char *Cmd);
|
|
||||||
int CmdLegicDump(const char *Cmd);
|
int CmdLegicDump(const char *Cmd);
|
||||||
int CmdLegicReader(const char *Cmd);
|
int CmdLegicReader(const char *Cmd);
|
||||||
|
|
||||||
int CmdLegicELoad(const char *Cmd);
|
int CmdLegicELoad(const char *Cmd);
|
||||||
int CmdLegicESave(const char *Cmd);
|
int CmdLegicESave(const char *Cmd);
|
||||||
|
|
||||||
|
@ -45,7 +43,7 @@ int legic_get_type(legic_card_select_t *card);
|
||||||
void legic_chk_iv(uint32_t *iv);
|
void legic_chk_iv(uint32_t *iv);
|
||||||
void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes);
|
void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes);
|
||||||
|
|
||||||
int usage_legic_calccrc8(void);
|
int usage_legic_calccrc(void);
|
||||||
int usage_legic_load(void);
|
int usage_legic_load(void);
|
||||||
int usage_legic_rdmem(void);
|
int usage_legic_rdmem(void);
|
||||||
int usage_legic_sim(void);
|
int usage_legic_sim(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue