mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-21 07:46:12 +08:00
make style
This commit is contained in:
parent
323c391f4d
commit
4c44138557
|
@ -531,7 +531,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
|||
json_decref(root);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aphex && applain == false) {
|
||||
hdatalen = sizeof(hdata);
|
||||
CLIGetHexWithReturn(ctx, 12, hdata, &hdatalen);
|
||||
|
|
|
@ -1290,8 +1290,8 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
|
|||
desfire_crc32_append(data + 1, cmdcnt);
|
||||
}
|
||||
cmdcnt += 4;
|
||||
// desfire_crc32_append(data, cmdcnt);
|
||||
// cmdcnt += 4;
|
||||
// desfire_crc32_append(data, cmdcnt);
|
||||
// cmdcnt += 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1319,8 +1319,7 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
|
|||
|
||||
size_t sn = recv_len;
|
||||
|
||||
if (new_algo == MFDES_ALGO_AES)
|
||||
{
|
||||
if (new_algo == MFDES_ALGO_AES) {
|
||||
// AES expects us to Calculate CMAC for status byte : OK 0x00 (0x91 00)
|
||||
// As such if we get this far without an error, we should be good
|
||||
// Since we are dropping the field, we dont need to maintain the CMAC etc.
|
||||
|
@ -1910,7 +1909,7 @@ static int handler_desfire_readdata(mfdes_data_t *data, MFDES_FILE_TYPE_T type,
|
|||
sAPDU apdu = {0x90, MFDES_READ_DATA, 0x00, 0x00, 1 + 3 + 3, (uint8_t *)data}; // 0xBD
|
||||
if (type == MFDES_RECORD_FILE) {
|
||||
apdu.INS = MFDES_READ_RECORDS; //0xBB
|
||||
}
|
||||
}
|
||||
|
||||
// we need the CMD 0xBD <data> to calc the CMAC
|
||||
uint8_t tmp_data[8]; // Since the APDU is hardcoded to 7 bytes of payload 7+1 = 8 is enough.
|
||||
|
@ -1969,7 +1968,7 @@ static int handler_desfire_getvalue(mfdes_value_t *value, uint32_t *resplen, uin
|
|||
DropFieldDesfire();
|
||||
return res;
|
||||
}
|
||||
size_t dlen = (size_t)*resplen;
|
||||
size_t dlen = (size_t) * resplen;
|
||||
p = mifare_cryto_postprocess_data(tag, value->value, &dlen, cs | CMAC_COMMAND | CMAC_VERIFY | MAC_VERIFY);
|
||||
(void)p;
|
||||
return res;
|
||||
|
|
|
@ -4004,27 +4004,27 @@ static int CmdHF14AMfUCDecryptAmiibo(const char *Cmd){
|
|||
// Menu Stuff
|
||||
//------------------------------------
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("recovery") " -------------------------"},
|
||||
{"keygen", CmdHF14AMfUGenDiverseKeys, AlwaysAvailable, "Generate 3DES MIFARE diversified keys"},
|
||||
{"pwdgen", CmdHF14AMfUPwdGen, AlwaysAvailable, "Generate pwd from known algos"},
|
||||
{"otptear", CmdHF14AMfuOtpTearoff, IfPm3Iso14443a, "Tear-off test on OTP bits"},
|
||||
{"keygen", CmdHF14AMfUGenDiverseKeys, AlwaysAvailable, "Generate 3DES MIFARE diversified keys"},
|
||||
{"pwdgen", CmdHF14AMfUPwdGen, AlwaysAvailable, "Generate pwd from known algos"},
|
||||
{"otptear", CmdHF14AMfuOtpTearoff, IfPm3Iso14443a, "Tear-off test on OTP bits"},
|
||||
// {"tear_cnt", CmdHF14AMfuEv1CounterTearoff, IfPm3Iso14443a, "Tear-off test on Ev1/NTAG Counter bits"},
|
||||
{"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("operations") " -----------------------"},
|
||||
{"cauth", CmdHF14AMfUCAuth, IfPm3Iso14443a, "Authentication - Ultralight-C"},
|
||||
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump MIFARE Ultralight family tag to binary file"},
|
||||
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
|
||||
{"ndefread",CmdHF14MfuNDEFRead, IfPm3Iso14443a, "Prints NDEF records from card"},
|
||||
{"rdbl", CmdHF14AMfURdBl, IfPm3Iso14443a, "Read block"},
|
||||
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},
|
||||
{"wrbl", CmdHF14AMfUWrBl, IfPm3Iso14443a, "Write block"},
|
||||
{"cauth", CmdHF14AMfUCAuth, IfPm3Iso14443a, "Authentication - Ultralight-C"},
|
||||
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump MIFARE Ultralight family tag to binary file"},
|
||||
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
|
||||
{"ndefread", CmdHF14MfuNDEFRead, IfPm3Iso14443a, "Prints NDEF records from card"},
|
||||
{"rdbl", CmdHF14AMfURdBl, IfPm3Iso14443a, "Read block"},
|
||||
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},
|
||||
{"wrbl", CmdHF14AMfUWrBl, IfPm3Iso14443a, "Write block"},
|
||||
{"---------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("simulation") " -----------------------"},
|
||||
{"eload", CmdHF14AMfUeLoad, IfPm3Iso14443a, "load Ultralight .eml dump file into emulator memory"},
|
||||
{"eview", CmdHF14AMfuEView, IfPm3Iso14443a, "View emulator memory"},
|
||||
{"sim", CmdHF14AMfUSim, IfPm3Iso14443a, "Simulate MIFARE Ultralight from emulator memory"},
|
||||
{"eload", CmdHF14AMfUeLoad, IfPm3Iso14443a, "load Ultralight .eml dump file into emulator memory"},
|
||||
{"eview", CmdHF14AMfuEView, IfPm3Iso14443a, "View emulator memory"},
|
||||
{"sim", CmdHF14AMfUSim, IfPm3Iso14443a, "Simulate MIFARE Ultralight from emulator memory"},
|
||||
{"---------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("magic") " ----------------------------"},
|
||||
{"setpwd", CmdHF14AMfUCSetPwd, IfPm3Iso14443a, "Set 3DES key - Ultralight-C"},
|
||||
{"setuid", CmdHF14AMfUCSetUid, IfPm3Iso14443a, "Set UID - MAGIC tags only"},
|
||||
{"setpwd", CmdHF14AMfUCSetPwd, IfPm3Iso14443a, "Set 3DES key - Ultralight-C"},
|
||||
{"setuid", CmdHF14AMfUCSetUid, IfPm3Iso14443a, "Set UID - MAGIC tags only"},
|
||||
// {"---------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("amiibo") " ----------------------------"},
|
||||
// {"decrypt", CmdHF14AMfUCDecryptAmiibo, IfPm3Iso14443a, "Decrypt a amiibo tag"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
|
|
|
@ -792,13 +792,13 @@ static int CmdHFSTList(const char *Cmd) {
|
|||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"info", CmdHFSTInfo, IfPm3Iso14443a, "Tag information"},
|
||||
{"list", CmdHFSTList, AlwaysAvailable, "List ISO 14443A/7816 history"},
|
||||
{"ndefread",CmdHFSTNdefRead, AlwaysAvailable, "read NDEF file on tag"},
|
||||
{"protect", CmdHFSTProtect, IfPm3Iso14443a, "change protection on tag"},
|
||||
{"pwd", CmdHFSTPwd, IfPm3Iso14443a, "change password on tag"},
|
||||
{"sim", CmdHFSTSim, IfPm3Iso14443a, "Fake ISO 14443A/ST tag"},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
{"info", CmdHFSTInfo, IfPm3Iso14443a, "Tag information"},
|
||||
{"list", CmdHFSTList, AlwaysAvailable, "List ISO 14443A/7816 history"},
|
||||
{"ndefread", CmdHFSTNdefRead, AlwaysAvailable, "read NDEF file on tag"},
|
||||
{"protect", CmdHFSTProtect, IfPm3Iso14443a, "change protection on tag"},
|
||||
{"pwd", CmdHFSTPwd, IfPm3Iso14443a, "change password on tag"},
|
||||
{"sim", CmdHFSTSim, IfPm3Iso14443a, "Fake ISO 14443A/ST tag"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ int CmdLFCommandRead(const char *Cmd) {
|
|||
if (session.pm3_present == false)
|
||||
return PM3_ENOTTY;
|
||||
|
||||
#define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS))
|
||||
#define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS))
|
||||
struct p {
|
||||
uint32_t delay;
|
||||
uint16_t period_0;
|
||||
|
|
|
@ -678,7 +678,7 @@ int saveFileJSONrootEx(const char *preferredName, void *root, size_t flags, bool
|
|||
filename = filenamemcopy(preferredName, ".json");
|
||||
else
|
||||
filename = newfilenamemcopy(preferredName, ".json");
|
||||
|
||||
|
||||
if (filename == NULL)
|
||||
return PM3_EMALLOC;
|
||||
|
||||
|
|
|
@ -995,10 +995,10 @@ int main(int argc, char *argv[]) {
|
|||
session.supports_colors = false;
|
||||
session.emoji_mode = EMO_ALTTEXT;
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) //Color support on Windows has to be enabled each time and can fail, override prefs
|
||||
session.supports_colors = DetectWindowsAnsiSupport();
|
||||
session.emoji_mode = EMO_ALTTEXT;
|
||||
session.supports_colors = DetectWindowsAnsiSupport();
|
||||
session.emoji_mode = EMO_ALTTEXT;
|
||||
#endif
|
||||
|
||||
// Let's take a baudrate ok for real UART, USB-CDC & BT don't use that info anyway
|
||||
|
|
|
@ -122,7 +122,6 @@ Check column "offline" for their availability.
|
|||
|`data hexsamples `|N |`Dump big buffer as hex bytes`
|
||||
|`data hex2bin `|Y |`Converts hexadecimal to binary`
|
||||
|`data load `|Y |`Load contents of file into graph window`
|
||||
|`data ndef `|Y |`Decode NDEF records`
|
||||
|`data print `|Y |`Print the data in the DemodBuffer`
|
||||
|`data samples `|N |`Get raw samples for graph window (GraphBuffer)`
|
||||
|`data save `|Y |`Save signal trace data (from graph window)`
|
||||
|
@ -176,6 +175,7 @@ Check column "offline" for their availability.
|
|||
|`hf 14a list `|Y |`List ISO 14443-a history`
|
||||
|`hf 14a info `|N |`Tag information`
|
||||
|`hf 14a reader `|N |`Act like an ISO14443-a reader`
|
||||
|`hf 14a ndefread `|N |`Read an NDEF file from ISO 14443-A Type 4 tag`
|
||||
|`hf 14a cuids `|N |`Collect n>0 ISO14443-a UIDs in one go`
|
||||
|`hf 14a sim `|N |`Simulate ISO 14443-a tag`
|
||||
|`hf 14a sniff `|N |`sniff ISO 14443-a traffic`
|
||||
|
@ -198,7 +198,7 @@ Check column "offline" for their availability.
|
|||
|`hf 14b dump `|N |`Read all memory pages of an ISO-14443-B tag, save to file`
|
||||
|`hf 14b info `|N |`Tag information`
|
||||
|`hf 14b list `|Y |`List ISO-14443-B history`
|
||||
|`hf 14b ndef `|N |`Read NDEF file on tag`
|
||||
|`hf 14b ndefread `|N |`Read NDEF file on tag`
|
||||
|`hf 14b raw `|N |`Send raw hex data to tag`
|
||||
|`hf 14b reader `|N |`Act as a ISO-14443-B reader to identify a tag`
|
||||
|`hf 14b sim `|N |`Fake ISO ISO-14443-B tag`
|
||||
|
@ -400,7 +400,7 @@ Check column "offline" for their availability.
|
|||
|`hf mf auth4 `|N |`ISO14443-4 AES authentication`
|
||||
|`hf mf dump `|N |`Dump MIFARE Classic tag to binary file`
|
||||
|`hf mf mad `|N |`Checks and prints MAD`
|
||||
|`hf mf ndef `|N |`Prints NDEF records from card`
|
||||
|`hf mf ndefread `|N |`Prints NDEF records from card`
|
||||
|`hf mf personalize `|N |`Personalize UID (MIFARE Classic EV1 only)`
|
||||
|`hf mf rdbl `|N |`Read MIFARE Classic block`
|
||||
|`hf mf rdsc `|N |`Read MIFARE Classic sector`
|
||||
|
@ -449,7 +449,7 @@ Check column "offline" for their availability.
|
|||
|`hf mfp wrbl `|N |`Write blocks`
|
||||
|`hf mfp chk `|N |`Check keys`
|
||||
|`hf mfp mad `|N |`Checks and prints MAD`
|
||||
|`hf mfp ndef `|N |`Prints NDEF records from card`
|
||||
|`hf mfp ndefread `|N |`Prints NDEF records from card`
|
||||
|
||||
|
||||
### hf mfu
|
||||
|
@ -465,7 +465,7 @@ Check column "offline" for their availability.
|
|||
|`hf mfu cauth `|N |`Authentication - Ultralight-C`
|
||||
|`hf mfu dump `|N |`Dump MIFARE Ultralight family tag to binary file`
|
||||
|`hf mfu info `|N |`Tag information`
|
||||
|`hf mfu ndef `|N |`Prints NDEF records from card`
|
||||
|`hf mfu ndefread `|N |`Prints NDEF records from card`
|
||||
|`hf mfu rdbl `|N |`Read block`
|
||||
|`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag`
|
||||
|`hf mfu wrbl `|N |`Write block`
|
||||
|
@ -507,6 +507,17 @@ Check column "offline" for their availability.
|
|||
|`hf mfdes writedata `|N |`Write data to standard/backup/record file`
|
||||
|
||||
|
||||
### hf seos
|
||||
|
||||
{ SEOS RFIDs... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`hf seos help `|Y |`This help`
|
||||
|`hf seos info `|N |`Tag information`
|
||||
|`hf seos list `|Y |`List SEOS history`
|
||||
|
||||
|
||||
### hf st
|
||||
|
||||
{ ST Rothult RFIDs... }
|
||||
|
@ -516,7 +527,7 @@ Check column "offline" for their availability.
|
|||
|`hf st help `|Y |`This help`
|
||||
|`hf st info `|N |`Tag information`
|
||||
|`hf st list `|Y |`List ISO 14443A/7816 history`
|
||||
|`hf st ndef `|Y |`read NDEF file on tag`
|
||||
|`hf st ndefread `|Y |`read NDEF file on tag`
|
||||
|`hf st protect `|N |`change protection on tag`
|
||||
|`hf st pwd `|N |`change password on tag`
|
||||
|`hf st sim `|N |`Fake ISO 14443A/ST tag`
|
||||
|
@ -1100,6 +1111,79 @@ Check column "offline" for their availability.
|
|||
|`mem spiffs wipe `|N |`Wipe all files from SPIFFS file system * dangerous *`
|
||||
|
||||
|
||||
### nfc
|
||||
|
||||
{ NFC commands... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc help `|Y |`This help`
|
||||
|`nfc decode `|Y |`Decode NDEF records`
|
||||
|
||||
|
||||
### nfc type1
|
||||
|
||||
{ NFC Forum Tag Type 1... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc type1 read `|N |`read NFC Forum Tag Type 1`
|
||||
|`nfc type1 help `|Y |`This help`
|
||||
|
||||
|
||||
### nfc type2
|
||||
|
||||
{ NFC Forum Tag Type 2... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc type2 read `|N |`read NFC Forum Tag Type 2`
|
||||
|`nfc type2 help `|Y |`This help`
|
||||
|
||||
|
||||
### nfc type4a
|
||||
|
||||
{ NFC Forum Tag Type 4 ISO14443A... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc type4a read `|N |`read NFC Forum Tag Type 4 A`
|
||||
|`nfc type4a st25taread `|N |`read ST25TA as NFC Forum Tag Type 4`
|
||||
|`nfc type4a help `|Y |`This help`
|
||||
|
||||
|
||||
### nfc type4b
|
||||
|
||||
{ NFC Forum Tag Type 4 ISO14443B... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc type4b read `|N |`read NFC Forum Tag Type 4 B`
|
||||
|`nfc type4b help `|Y |`This help`
|
||||
|
||||
|
||||
### nfc mf
|
||||
|
||||
{ NFC Type MIFARE Classic/Plus Tag... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc mf cread `|N |`read NFC Type MIFARE Classic Tag`
|
||||
|`nfc mf pread `|N |`read NFC Type MIFARE Plus Tag`
|
||||
|`nfc mf help `|Y |`This help`
|
||||
|
||||
|
||||
### nfc barcode
|
||||
|
||||
{ NFC Barcode Tag... }
|
||||
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`nfc barcode read `|N |`read NFC Barcode`
|
||||
|`nfc barcode sim `|N |`simulate NFC Barcode`
|
||||
|`nfc barcode help `|Y |`This help`
|
||||
|
||||
|
||||
### reveng
|
||||
|
||||
{ CRC calculations from RevEng software... }
|
||||
|
|
|
@ -101,7 +101,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
|||
|
||||
memcpy(ring_buffer, fpga_config + current_in, bytes_to_copy);
|
||||
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
|
||||
if (cmp_bytes < 0 ){
|
||||
if (cmp_bytes < 0) {
|
||||
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
|
||||
free(ring_buffer);
|
||||
free(outbuf);
|
||||
|
@ -220,7 +220,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
|
|||
/* Four byte length field */
|
||||
for (int i = 0; i < 4; i++) {
|
||||
tmp = fgetc(infile);
|
||||
if (tmp < 0 ) {
|
||||
if (tmp < 0) {
|
||||
break;
|
||||
}
|
||||
current_length += tmp << (24 - (i * 8));
|
||||
|
@ -230,7 +230,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
|
|||
default: /* Fall through, two byte length field */
|
||||
for (int i = 0; i < 2; i++) {
|
||||
tmp = fgetc(infile);
|
||||
if (tmp < 0 ) {
|
||||
if (tmp < 0) {
|
||||
break;
|
||||
}
|
||||
current_length += tmp << (8 - (i * 8));
|
||||
|
|
Loading…
Reference in a new issue