Fix formatting and run make style

This commit is contained in:
AloneLiberty 2023-03-26 16:12:39 +03:00
parent 2c74b98974
commit fae8ffda44
13 changed files with 949 additions and 875 deletions

View file

@ -182,10 +182,10 @@ void MifareDesfireGetInformation(void) {
return;
}
if (len < sizeof(payload.versionHW)+1) {
if (len < sizeof(payload.versionHW) + 1) {
Dbprintf("Tag answer to MFDES_GET_VERSION was too short: data in Hardware Information is probably invalid.");
print_result("Answer", resp, len);
memset(resp+len, 0xFF, sizeof(payload.versionHW)+1 - len); // clear remaining bytes
memset(resp + len, 0xFF, sizeof(payload.versionHW) + 1 - len); // clear remaining bytes
}
memcpy(payload.versionHW, resp + 1, sizeof(payload.versionHW));
@ -201,10 +201,10 @@ void MifareDesfireGetInformation(void) {
return;
}
if (len < sizeof(payload.versionSW)+1) {
if (len < sizeof(payload.versionSW) + 1) {
Dbprintf("Tag answer to MFDES_ADDITIONAL_FRAME 1 was too short: data in Software Information is probably invalid.");
print_result("Answer", resp, len);
memset(resp+len, 0xFF, sizeof(payload.versionSW)+1 - len); // clear remaining bytes
memset(resp + len, 0xFF, sizeof(payload.versionSW) + 1 - len); // clear remaining bytes
}
memcpy(payload.versionSW, resp + 1, sizeof(payload.versionSW));
@ -219,10 +219,10 @@ void MifareDesfireGetInformation(void) {
return;
}
if (len < sizeof(payload.details)+1) {
if (len < sizeof(payload.details) + 1) {
Dbprintf("Tag answer to MFDES_ADDITIONAL_FRAME 2 was too short: data in Batch number and Production date is probably invalid");
print_result("Answer", resp, len);
memset(resp+len, 0xFF, sizeof(payload.details)+1 - len); // clear remaining bytes
memset(resp + len, 0xFF, sizeof(payload.details) + 1 - len); // clear remaining bytes
}
memcpy(payload.details, resp + 1, sizeof(payload.details));

View file

@ -36,7 +36,7 @@
#include "crypto/asn1utils.h" // ASN1 decode / print
#include "cmdflashmemspiffs.h" // SPIFFS flash memory download
#include "mbedtls/bignum.h" // big num
#include "mbedtls/entropy.h" //
#include "mbedtls/entropy.h" //
#include "mbedtls/ctr_drbg.h" // random generator
uint8_t g_DemodBuffer[MAX_DEMOD_BUF_LEN];
@ -2429,7 +2429,7 @@ static int CmdZerocrossings(const char *Cmd) {
}
static bool data_verify_hex(uint8_t *d, size_t n) {
if (d == NULL)
if (d == NULL)
return false;
for (size_t i = 0; i < n; i++) {
@ -2517,7 +2517,7 @@ static int Cmdhex2bin(const char *Cmd) {
return PM3_EINVARG;
}
if (data_verify_hex((uint8_t*)data, dlen) == false) {
if (data_verify_hex((uint8_t *)data, dlen) == false) {
return PM3_EINVARG;
}
@ -3230,7 +3230,7 @@ static int CmdNumCon(const char *Cmd) {
// hex
if (hlen > 0) {
if (data_verify_hex((uint8_t*)hex, hlen) == false) {
if (data_verify_hex((uint8_t *)hex, hlen) == false) {
return PM3_EINVARG;
}
MBEDTLS_MPI_CHK(mbedtls_mpi_read_string(&N, 16, hex));
@ -3257,22 +3257,22 @@ static int CmdNumCon(const char *Cmd) {
MBEDTLS_MPI_CHK(mbedtls_mpi_inv_mod(&N, &N, &base));
}
// printing
// printing
typedef struct {
const char* desc;
const char *desc;
uint8_t radix;
} radix_t;
radix_t radix[] = {
{"dec..... ", 10},
{"hex..... 0x", 16},
{"bin..... 0b", 2}
{"dec..... ", 10},
{"hex..... 0x", 16},
{"bin..... 0b", 2}
};
char s[600] = {0};
size_t slen = 0;
for (uint8_t i=0; i < ARRAYLEN(radix); i++) {
for (uint8_t i = 0; i < ARRAYLEN(radix); i++) {
MBEDTLS_MPI_CHK(mbedtls_mpi_write_string(&N, radix[i].radix, s, sizeof(s), &slen));
if (slen > 0) {
PrintAndLogEx(INFO, "%s%s", radix[i].desc, s);
@ -3285,9 +3285,9 @@ static int CmdNumCon(const char *Cmd) {
mbedtls_ctr_drbg_init(&ctr_drbg);
mbedtls_entropy_init(&entropy);
MBEDTLS_MPI_CHK(mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0 ));
MBEDTLS_MPI_CHK(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0));
res = mbedtls_mpi_is_prime_ext( &N, 50, mbedtls_ctr_drbg_random, &ctr_drbg );
res = mbedtls_mpi_is_prime_ext(&N, 50, mbedtls_ctr_drbg_random, &ctr_drbg);
if (res == 0) {
PrintAndLogEx(INFO, "prime... " _YELLOW_("yes"));
}

View file

@ -404,7 +404,7 @@ static void mf_analyse_acl(uint16_t n, uint8_t *d) {
Sector trailer sanity checks.
Warn if ACL is strict read-only, or invalid ACL.
*/
static int mf_analyse_st_block(uint8_t blockno, uint8_t *block, bool force){
static int mf_analyse_st_block(uint8_t blockno, uint8_t *block, bool force) {
if (mfIsSectorTrailer(blockno) == false) {
return PM3_SUCCESS;
@ -6665,10 +6665,7 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
int res = mfkey32_moebius(&data, &key64);
if (res) {
PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ "
_GREEN_("%012"
PRIX64) " ]", sprint_hex_inrow(trace_data, 4), data.sector, (data.keytype == 0x60) ? 'A'
: 'B', key64);
PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ "_GREEN_("%012" PRIX64) " ]", sprint_hex_inrow(trace_data, 4), data.sector, (data.keytype == 0x60) ? 'A' : 'B', key64);
break;
}
}
@ -6694,16 +6691,12 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
res = ExchangeAPDU14a(aCHANGE, sizeof(aCHANGE), activate_field, keep_field_on, response, sizeof(response),
&resplen);
if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Super card UID change [ "
_RED_("fail")
" ]");
PrintAndLogEx(FAILED, "Super card UID change [ " _RED_("fail") " ]");
DropField();
return res;
}
PrintAndLogEx(SUCCESS, "Super card UID change ( "
_GREEN_("ok")
" )");
PrintAndLogEx(SUCCESS, "Super card UID change ( " _GREEN_("ok") " )");
return PM3_SUCCESS;
}
@ -6717,15 +6710,11 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
res = ExchangeAPDU14a(aRESET, sizeof(aRESET), activate_field, keep_field_on, response, sizeof(response),
&resplen);
if (res != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Super card reset [ "
_RED_("fail")
" ]");
PrintAndLogEx(FAILED, "Super card reset [ " _RED_("fail") " ]");
DropField();
return res;
}
PrintAndLogEx(SUCCESS, "Super card reset ( "
_GREEN_("ok")
" )");
PrintAndLogEx(SUCCESS, "Super card reset ( " _GREEN_("ok") " )");
return PM3_SUCCESS;
}
@ -6813,13 +6802,7 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
res = mfkey32_moebius(&data, &key64);
if (res) {
PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ "
_GREEN_("%12"
PRIX64) " ]"
, sprint_hex_inrow(outA, 4)
, data.sector
, (data.keytype == 0x60) ? 'A' : 'B'
, key64);
PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ " _GREEN_("%12" PRIX64) " ]", sprint_hex_inrow(outA, 4), data.sector, (data.keytype == 0x60) ? 'A' : 'B', key64);
} else {
PrintAndLogEx(FAILED, "failed to recover any key");
}
@ -8093,7 +8076,7 @@ static command_t CommandTable[] = {
{"gsave", CmdHF14AGen4Save, IfPm3Iso14443a, "Save dump from card into file or emulator"},
{"gsetblk", CmdHF14AGen4SetBlk, IfPm3Iso14443a, "Write block to card"},
{"gview", CmdHF14AGen4View, IfPm3Iso14443a, "View card"},
{"-----------", CmdHelp, IfPm3Iso14443a, "-------------------- " _CYAN_("magic gen4 GDM") " --------------------------"},
{"-----------", CmdHelp, IfPm3Iso14443a, "-------------------- " _CYAN_("magic gen4 GDM") " --------------------------"},
{"gdmconfig", CmdHF14AGen4_GDM_ConfigBlk, IfPm3Iso14443a, "Read config block from card"},
{"gdmsetblk", CmdHF14AGen4_GDM_SetBlk, IfPm3Iso14443a, "Write block to card"},
{"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("ndef") " -----------------------"},

View file

@ -271,4 +271,4 @@ static int CmdHelp(const char *Cmd) {
int CmdHFTESLA(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
}

View file

@ -386,7 +386,7 @@ void dumpCommandsRecursive(const command_t cmds[], int markdown, bool full_help)
char currentparent[MAX_PM3_INPUT_ARGS_LENGTH] = {0};
snprintf(currentparent, sizeof currentparent, "%s%s ", parent, cmds[i].Name);
char *old_parent = parent;
parent = currentparent;
// This is what causes the recursion, since commands Parse-implementation

View file

@ -141,7 +141,7 @@ static void asn1_tag_dump_str_time(const struct tlv *tlv, const struct asn1_tag
break;
// month
PrintAndLogEx(NORMAL, "%.*s-" NOLF, 2, tlv->value + startidx );
PrintAndLogEx(NORMAL, "%.*s-" NOLF, 2, tlv->value + startidx);
if (len < startidx + 4)
break;
@ -233,16 +233,16 @@ static void asn1_tag_dump_hex(const struct tlv *tlv, const struct asn1_tag *tag,
}
static void asn1_tag_dump_octet_string(const struct tlv *tlv, const struct asn1_tag *tag, int level) {
/*
for (size_t i = 0; i < tlv->len; i++) {
if (!isspace(tlv->value[i]) && !isprint(tlv->value[i])) {
*needdump = true;
break;
/*
for (size_t i = 0; i < tlv->len; i++) {
if (!isspace(tlv->value[i]) && !isprint(tlv->value[i])) {
*needdump = true;
break;
}
}
}
*/
PrintAndLogEx(NORMAL, " " NOLF);
asn1_tag_dump_string(tlv, tag, level);
*/
PrintAndLogEx(NORMAL, " " NOLF);
asn1_tag_dump_string(tlv, tag, level);
}
static void asn1_tag_dump_boolean(const struct tlv *tlv, const struct asn1_tag *tag, int level) {
@ -262,7 +262,7 @@ static void asn1_tag_dump_integer(const struct tlv *tlv, const struct asn1_tag *
return;
}
hex_to_buffer((uint8_t*)hex, tlv->value, tlv->len, tlv->len, 0, 0, false);
hex_to_buffer((uint8_t *)hex, tlv->value, tlv->len, tlv->len, 0, 0, false);
// results for MPI actions
bool ret = false;
@ -277,7 +277,7 @@ static void asn1_tag_dump_integer(const struct tlv *tlv, const struct asn1_tag *
size_t slen = 0;
MBEDTLS_MPI_CHK(mbedtls_mpi_write_string(&N, 10, s, sizeof(s), &slen));
if (slen > 0) {
PrintAndLogEx(NORMAL, "%*s value: %s", (level ), "", s);
PrintAndLogEx(NORMAL, "%*s value: %s", (level), "", s);
}
cleanup:

View file

@ -227,7 +227,7 @@ struct tlvdb *tlvdb_parse_multi(const unsigned char *buf, size_t len) {
while (left != 0) {
struct tlvdb *db = calloc(1, sizeof(*db));
if (db == NULL ) {
if (db == NULL) {
goto err;
}

View file

@ -1512,16 +1512,16 @@ int vigik_verify(mfc_vigik_t *d) {
PrintAndLogEx(INFO, "Raw signature");
print_hex_noascii_break(d->rsa_signature, sizeof(d->rsa_signature), MFBLOCK_SIZE * 2);
}
/*
int dl = 0;
param_gethex_to_eol("1C07D46DA3849326D24B3468BD76673F4F3C41827DC413E81E4F3C7804FAC727213059B21D047510D6432448643A92EBFC67FBEDDAB468D13D948B172F5EBC79A0E3FEFDFAF4E81FC7108E070F1E3CD0", 0, signature, PUBLIC_VIGIK_KEYLEN, &dl);
param_gethex_to_eol("1AB86FE0C17FFFFE4379D5E15A4B2FAFFEFCFA0F1F3F7FA03E7DDDF1E3C78FFFB1F0E23F7FFF51584771C5C18307FEA36CA74E60AA6B0409ACA66A9EC155F4E9112345708A2B8457E722608EE1157408", 0, signature, PUBLIC_VIGIK_KEYLEN, &dl);
signature_len = dl;
*/
/*
int dl = 0;
param_gethex_to_eol("1C07D46DA3849326D24B3468BD76673F4F3C41827DC413E81E4F3C7804FAC727213059B21D047510D6432448643A92EBFC67FBEDDAB468D13D948B172F5EBC79A0E3FEFDFAF4E81FC7108E070F1E3CD0", 0, signature, PUBLIC_VIGIK_KEYLEN, &dl);
param_gethex_to_eol("1AB86FE0C17FFFFE4379D5E15A4B2FAFFEFCFA0F1F3F7FA03E7DDDF1E3C78FFFB1F0E23F7FFF51584771C5C18307FEA36CA74E60AA6B0409ACA66A9EC155F4E9112345708A2B8457E722608EE1157408", 0, signature, PUBLIC_VIGIK_KEYLEN, &dl);
signature_len = dl;
*/
uint8_t rev_sig[128];
reverse_array_copy(d->rsa_signature, sizeof(d->rsa_signature), rev_sig);

File diff suppressed because it is too large Load diff

View file

@ -126,7 +126,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
struct addrinfo info;
int iResult;
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
PrintAndLogEx(ERR, "error: WSAStartup failed with error: %d", iResult);
free(sp);
@ -231,7 +231,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
void uart_close(const serial_port sp) {
serial_port_windows_t *spw = (serial_port_windows_t *)sp;
if (spw->hSocket != INVALID_SOCKET){
if (spw->hSocket != INVALID_SOCKET) {
shutdown(spw->hSocket, SD_BOTH);
closesocket(spw->hSocket);
WSACleanup();
@ -294,8 +294,7 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
}
return PM3_ENOTTY;
}
else { // TCP
} else { // TCP
uint32_t byteCount; // FIONREAD returns size on 32b
fd_set rfds;
struct timeval tv;
@ -332,12 +331,12 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
// Retrieve the count of the incoming bytes
res = ioctlsocket(spw->hSocket, FIONREAD, (u_long *)&byteCount);
// PrintAndLogEx(ERR, "UART:: RX ioctl res %d byteCount %u", res, byteCount);
// PrintAndLogEx(ERR, "UART:: RX ioctl res %d byteCount %u", res, byteCount);
if (res == SOCKET_ERROR) return PM3_ENOTTY;
// Cap the number of bytes, so we don't overrun the buffer
if (pszMaxRxLen - (*pszRxLen) < byteCount) {
// PrintAndLogEx(ERR, "UART:: RX prevent overrun (have %u, need %u)", pszMaxRxLen - (*pszRxLen), byteCount);
// PrintAndLogEx(ERR, "UART:: RX prevent overrun (have %u, need %u)", pszMaxRxLen - (*pszRxLen), byteCount);
byteCount = pszMaxRxLen - (*pszRxLen);
}
@ -374,8 +373,7 @@ int uart_send(const serial_port sp, const uint8_t *p_tx, const uint32_t len) {
return PM3_EIO;
}
return PM3_ENOTTY;
}
else { // TCP
} else { // TCP
uint32_t pos = 0;
fd_set wfds;
struct timeval tv;

View file

@ -280,7 +280,7 @@ void reverse_array(uint8_t *d, size_t n) {
d[i] ^= d[j];
d[j] ^= d[i];
d[i] ^= d[j];
}
}
}
// reverse src array into dest array
@ -292,4 +292,4 @@ void reverse_array_copy(const uint8_t *src, int src_len, uint8_t *dest) {
for (int i = 0; i < src_len; i++) {
dest[i] = src[(src_len - 1) - i];
}
}
}

View file

@ -406,7 +406,7 @@
},
"data help": {
"command": "data help",
"description": "help This help ----------- ------------------------- Modulation------------------------- biphaserawdecode Biphase decode bin stream in DemodBuffer detectclock Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer fsktonrz Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk) manrawdecode Manchester decode binary stream in DemodBuffer modulation Identify LF signal for clock and modulation rawdemod Demodulate the data in the GraphBuffer and output binary ----------- ------------------------- Graph------------------------- askedgedetect Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave autocorr Autocorrelation over window dirthreshold Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev. decimate Decimate samples undecimate Un-decimate samples hide Hide graph window hpf Remove DC offset from trace iir Apply IIR buttersworth filter on plot data grid overlay grid on graph window ltrim Trim samples from left of trace mtrim Trim out samples from the specified start to the specified stop norm Normalize max/min to +/-128 plot Show graph window rtrim Trim samples from right of trace setgraphmarkers Set blue and orange marker in graph window shiftgraphzero Shift 0 for Graphed wave + or - shift value timescale Set a timescale to get a differential reading between the yellow and purple markers as time duration zerocrossings Count time between zero-crossings convertbitstream Convert GraphBuffer's 0/1 values to 127 / -127 getbitstream Convert GraphBuffer's >=1 values to 1 and <1 to 0 ----------- ------------------------- General------------------------- asn1 asn1 decoder bin2hex Converts binary to hexadecimal clear Clears bigbuf on deviceside and graph window diff diff of input files hex2bin Converts hexadecimal to binary load Load contents of file into graph window print Print the data in the DemodBuffer save Save signal trace data (from graph window) setdebugmode Set Debugging Level on client side",
"description": "help This help ----------- ------------------------- Modulation------------------------- biphaserawdecode Biphase decode bin stream in DemodBuffer detectclock Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer fsktonrz Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk) manrawdecode Manchester decode binary stream in DemodBuffer modulation Identify LF signal for clock and modulation rawdemod Demodulate the data in the GraphBuffer and output binary ----------- ------------------------- Graph------------------------- askedgedetect Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave autocorr Autocorrelation over window dirthreshold Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev. decimate Decimate samples undecimate Un-decimate samples hide Hide graph window hpf Remove DC offset from trace iir Apply IIR buttersworth filter on plot data grid overlay grid on graph window ltrim Trim samples from left of trace mtrim Trim out samples from the specified start to the specified stop norm Normalize max/min to +/-128 plot Show graph window rtrim Trim samples from right of trace setgraphmarkers Set blue and orange marker in graph window shiftgraphzero Shift 0 for Graphed wave + or - shift value timescale Set a timescale to get a differential reading between the yellow and purple markers as time duration zerocrossings Count time between zero-crossings convertbitstream Convert GraphBuffer's 0/1 values to 127 / -127 getbitstream Convert GraphBuffer's >=1 values to 1 and <1 to 0 ----------- ------------------------- General------------------------- asn1 asn1 decoder bin2hex Converts binary to hexadecimal clear Clears bigbuf on deviceside and graph window diff diff of input files hex2bin Converts hexadecimal to binary load Load contents of file into graph window num Converts dec/hex/bin print Print the data in the DemodBuffer save Save signal trace data (from graph window) setdebugmode Set Debugging Level on client side",
"notes": [],
"offline": true,
"options": [],
@ -557,6 +557,23 @@
],
"usage": "data norm [-h]"
},
"data num": {
"command": "data num",
"description": "Function takes a decimal or hexdecimal number and print it in decimal/hex/binary Will print message if number is a prime number",
"notes": [
"data num --dec 2023",
"data num --hex 0x1000"
],
"offline": true,
"options": [
"-h, --help This help",
"--dec <dec> decimal value",
"--hex <hex> hexadecimal value",
"--bin <bin> binary value",
"-i print inverted value"
],
"usage": "data num [-hi] [--dec <dec>] [--hex <hex>] [--bin <bin>]"
},
"data plot": {
"command": "data plot",
"description": "Show graph window hit 'h' in window for detail keystroke help available",
@ -3597,6 +3614,18 @@
],
"usage": "hf legic dump [-h] [-f <fn>] [--de]"
},
"hf legic einfo": {
"command": "hf legic einfo",
"description": "It decodes and displays emulator memory",
"notes": [
"hf legic einfo"
],
"offline": false,
"options": [
"-h, --help This help"
],
"usage": "hf legic einfo [-h]"
},
"hf legic eload": {
"command": "hf legic eload",
"description": "Loads a LEGIC Prime dump file into emulator memory",
@ -3649,7 +3678,7 @@
},
"hf legic help": {
"command": "hf legic help",
"description": "----------- --------------------- operations --------------------- help This help list List LEGIC history ----------- --------------------- simulation --------------------- ----------- --------------------- utils --------------------- crc Calculate Legic CRC over given bytes view Display content from tag dump file",
"description": "----------- --------------------- operations --------------------- help This help list List LEGIC history ----------- --------------------- simulation --------------------- ----------- --------------------- utils --------------------- crc Calculate Legic CRC over given bytes view Display deobfuscated and decoded content from tag dump file",
"notes": [],
"offline": true,
"options": [],
@ -4371,6 +4400,37 @@
],
"usage": "hf mf fchk [-h] [-k <hex>]... [--mini] [--1k] [--2k] [--4k] [--emu] [--dump] [--mem] [-f <fn>]"
},
"hf mf gdmconfig": {
"command": "hf mf gdmconfig",
"description": "Get configuration data from magic gen4 GDM card.",
"notes": [
"hf mf gdmconfig"
],
"offline": false,
"options": [
"-h, --help This help",
"-k, --key <hex> key 6 bytes"
],
"usage": "hf mf gdmconfig [-h] [-k <hex>]"
},
"hf mf gdmsetblk": {
"command": "hf mf gdmsetblk",
"description": "Set block data on a magic gen4 GDM card `--force` param is used to override warnings like bad ACL writes. if not specified, it will exit if detected",
"notes": [
"hf mf gdmsetblk --blk 1 -d 000102030405060708090a0b0c0d0e0f"
],
"offline": false,
"options": [
"-h, --help This help",
"--blk <dec> block number",
"-a input key type is key A (def)",
"-b input key type is key B",
"-d, --data <hex> bytes to write, 16 hex bytes",
"-k, --key <hex> key, 6 hex bytes",
"--force override warnings"
],
"usage": "hf mf gdmsetblk [-hab] --blk <dec> [-d <hex>] [-k <hex>] [--force]"
},
"hf mf gen3blk": {
"command": "hf mf gen3blk",
"description": "Overwrite full manufacturer block for magic Gen3 card - You can specify part of manufacturer block as 4/7-bytes for UID change only",
@ -4822,15 +4882,17 @@
"command": "hf mf supercard",
"description": "Extract info from a `super card`",
"notes": [
"hf mf supercard"
"hf mf supercard -> recover key",
"hf mf supercard -r -> reset card",
"hf mf supercard -u 11223344 -> change UID"
],
"offline": false,
"options": [
"-h, --help This help",
"-r, --reset Reset card",
"-u, --uid <hex> Change UID"
"-r, --reset reset card",
"-u, --uid <hex> New UID (4 hex bytes)"
],
"usage": "hf mf supercard [-hru]"
"usage": "hf mf supercard [-hr] [-u <hex>]"
},
"hf mf value": {
"command": "hf mf value",
@ -4958,7 +5020,7 @@
"but for APP keys crypto algorithm is set by createapp command and can't be changed wo application delete",
"",
"hf mfdes changekey --aid 123456 -> execute with default factory setup. change des key 0 in the app 123456 from 00..00 to 00..00",
"hf mfdes changekey --isoid df01 -t aes -s lrp --newkeyno 01 -> change key 01 via lrp channelhf mfdes changekey -t des --newalgo aes --newkey 11223344556677889900112233445566 --newver a5 -> change card master key to AES one",
"hf mfdes changekey --isoid df01 -t aes --schann lrp --newkeyno 01 -> change key 01 via lrp channelhf mfdes changekey -t des --newalgo aes --newkey 11223344556677889900112233445566 --newver a5 -> change card master key to AES one",
"hf mfdes changekey --aid 123456 -t aes --key 00000000000000000000000000000000 --newkey 11223344556677889900112233445566 -> change app master key",
"hf mfdes changekey --aid 123456 -t des -n 0 --newkeyno 1 --oldkey 5555555555555555 --newkey 1122334455667788 -> change key 1 with auth from key 0",
"hf mfdes changekey --aid 123456 -t 3tdea --newkey 112233445566778899001122334455667788990011223344 -> change 3tdea key 0 from default 00..00 to provided"
@ -4994,7 +5056,7 @@
"hf mfdes chfilesettings --aid 123456 --fid 01 --amode plain --rrights free --wrights free --rwrights free --chrights key0 -> change file settings app=123456, file=01 with defaults from `default` command",
"hf mfdes chfilesettings -n 0 -t des -k 0000000000000000 --kdf none --aid 123456 --fid 01 --rawdata 00EEEE -> execute with default factory setup",
"hf mfdes chfilesettings --aid 123456 --fid 01 --rawdata 810000021f112f22 -> change file settings with additional rights for keys 1 and 2",
"hf mfdes chfilesettings --isoid df01 --fid 00 --amode plain --rawrights eee0 -s lrp -t aes -> change file settings via lrp channel"
"hf mfdes chfilesettings --isoid df01 --fid 00 --amode plain --rawrights eee0 --schann lrp -t aes -> change file settings via lrp channel"
],
"offline": false,
"options": [
@ -5080,7 +5142,7 @@
"description": "Clear record file. Master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [
"hf mfdes clearrecfile --aid 123456 --fid 01 -> clear record file for: app=123456, file=01 with defaults from `default` command",
"hf mfdes clearrecfile --isoid df01 --fid 01 -s lrp -t aes -n 3 -> clear record file for lrp channel with key number 3"
"hf mfdes clearrecfile --isoid df01 --fid 01 --schann lrp -t aes -n 3 -> clear record file for lrp channel with key number 3"
],
"offline": false,
"options": [
@ -5218,8 +5280,8 @@
"hf mfdes createmacfile --aid 123456 --fid 01 --rawrights 0FF0 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file with parameters. Rights from default. Authentication with defaults from `default` command",
"hf mfdes createmacfile --aid 123456 --fid 01 --amode plain --rrights free --wrights deny --rwrights free --chrights key0 --mackey 00112233445566778899aabbccddeeff -> create file app=123456, file=01, with key, and mentioned rights with defaults from `default` command",
"hf mfdes createmacfile -n 0 -t des -k 0000000000000000 --kdf none --aid 123456 --fid 01 -> execute with default factory setup. key and keyver == 0x00..00",
"hf mfdes createmacfile --isoid df01 --fid 0f -s lrp -t aes --rawrights 0FF0 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel",
"hf mfdes createmacfile --isoid df01 --fid 0f -s lrp -t aes --rawrights 0F10 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel with CommitReaderID command enable"
"hf mfdes createmacfile --isoid df01 --fid 0f --schann lrp -t aes --rawrights 0FF0 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel",
"hf mfdes createmacfile --isoid df01 --fid 0f --schann lrp -t aes --rawrights 0F10 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel with CommitReaderID command enable"
],
"offline": false,
"options": [
@ -5375,7 +5437,7 @@
"description": "Delete file from application. Master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [
"hf mfdes deletefile --aid 123456 --fid 01 -> delete file for: app=123456, file=01 with defaults from `default` command",
"hf mfdes deletefile --isoid df01 --fid 0f -s lrp -t aes -> delete file for lrp channel"
"hf mfdes deletefile --isoid df01 --fid 0f --schann lrp -t aes -> delete file for lrp channel"
],
"offline": false,
"options": [
@ -5431,7 +5493,7 @@
"command": "hf mfdes dump",
"description": "For each application show fil list and then file content. Key needs to be provided for authentication or flag --no-auth set (depend on cards settings).",
"notes": [
"hf mfdes dump --aid 123456 -> show file dump for: app=123456 with channel defaults from `default` command/nhf mfdes dump --isoid df01 -s lrp -t aes --length 000090 -> lrp default settings with length limit"
"hf mfdes dump --aid 123456 -> show file dump for: app=123456 with channel defaults from `default` command/nhf mfdes dump --isoid df01 --schann lrp -t aes --length 000090 -> lrp default settings with length limit"
],
"offline": false,
"options": [
@ -5578,7 +5640,7 @@
"hf mfdes getfileisoids --aid 123456 -> execute with defaults from `default` command",
"hf mfdes getfileisoids -n 0 -t des -k 0000000000000000 --kdf none --aid 123456 -> execute with default factory setup",
"hf mfdes getfileisoids --isoid df01 -> get iso file ids from Desfire Light with factory card settings",
"hf mfdes getfileisoids --isoid df01 -s lrp -t aes -> get iso file ids from Desfire Light via lrp channel with default key authentication"
"hf mfdes getfileisoids --isoid df01 --schann lrp -t aes -> get iso file ids from Desfire Light via lrp channel with default key authentication"
],
"offline": false,
"options": [
@ -5686,7 +5748,7 @@
"description": "Get UID from card. Get the real UID if the random UID bit is on and get the same UID as in anticollision if not. Any card's key needs to be provided.",
"notes": [
"hf mfdes getuid -> execute with default factory setup",
"hf mfdes getuid --isoid df01 -t aes -s lrp -> for desfire lights default settings"
"hf mfdes getuid --isoid df01 -t aes --schan lrp -> for desfire lights default settings"
],
"offline": false,
"options": [
@ -5843,8 +5905,8 @@
"hf mfdes read --isoid 0102 --fileisoid 1000 --type data -c iso -> read file via ISO channel: app iso id=0102, iso id=1000, offset=0. Select via ISO commands",
"hf mfdes read --isoid 0102 --fileisoid 1100 --type record -c iso --offset 000005 --length 000001 -> get one record (number 5) from file 1100 via iso commands",
"hf mfdes read --isoid 0102 --fileisoid 1100 --type record -c iso --offset 000005 --length 000000 -> get all record (from 5 to 1) from file 1100 via iso commands",
"hf mfdes read --isoid df01 --fid 00 -s lrp -t aes --length 000010 -> read via lrp channel",
"hf mfdes read --isoid df01 --fid 00 -s ev2 -t aes --length 000010 --isochain -> read Desfire Light via ev2 channel"
"hf mfdes read --isoid df01 --fid 00 --schann lrp -t aes --length 000010 -> read via lrp channel",
"hf mfdes read --isoid df01 --fid 00 --schann ev2 -t aes --length 000010 --isochain -> read Desfire Light via ev2 channel"
],
"offline": false,
"options": [
@ -5922,9 +5984,9 @@
"",
"hf mfdes setconfig --param 03 --data 0428 -> set SAK",
"hf mfdes setconfig --param 02 --data 0875778102637264 -> set ATS (first byte - length)",
"hf mfdes setconfig --isoid df01 -t aes -s ev2 --param 05 --data 00000000020000000000 -> set LRP mode enable for Desfire Light",
"hf mfdes setconfig --isoid df01 -t aes -s ev2 --param 0a --data 00ffffffff -> Disable failed auth counters for Desfire Light",
"hf mfdes setconfig --isoid df01 -t aes -s lrp --param 0a --data 00ffffffff -> Disable failed auth counters for Desfire Light via lrp"
"hf mfdes setconfig --isoid df01 -t aes --schann ev2 --param 05 --data 00000000020000000000 -> set LRP mode enable for Desfire Light",
"hf mfdes setconfig --isoid df01 -t aes --schann ev2 --param 0a --data 00ffffffff -> Disable failed auth counters for Desfire Light",
"hf mfdes setconfig --isoid df01 -t aes --schann lrp --param 0a --data 00ffffffff -> Disable failed auth counters for Desfire Light via lrp"
],
"offline": false,
"options": [
@ -5965,8 +6027,8 @@
"hf mfdes value --aid 123456 --fid 01 -> get value app=123456, file=01 with defaults from `default` command",
"hf mfdes value --aid 123456 --fid 01 --op credit -d 00000001 -> credit value app=123456, file=01 with defaults from `default` command",
"hf mfdes value -n 0 -t des -k 0000000000000000 --kdf none --aid 123456 --fid 01 -> get value with default factory setup",
"hf mfdes val --isoid df01 --fid 03 -s lrp -t aes -n 1 --op credit --d 00000001 -m encrypt -> credit value in the lrp encrypted mode",
"hf mfdes val --isoid df01 --fid 03 -s lrp -t aes -n 1 --op get -m plain -> get value in plain (nevertheless of mode) works for desfire light (look SetConfiguration option 0x09)"
"hf mfdes val --isoid df01 --fid 03 --schann lrp -t aes -n 1 --op credit --d 00000001 -m encrypt -> credit value in the lrp encrypted mode",
"hf mfdes val --isoid df01 --fid 03 --schann lrp -t aes -n 1 --op get -m plain -> get value in plain (nevertheless of mode) works for desfire light (look SetConfiguration option 0x09)"
],
"offline": false,
"options": [
@ -6008,7 +6070,7 @@
"hf mfdes write --isoid 1234 --fileisoid 1000 --type data -c iso -d 01020304 -> write data to std/backup file via iso commandset",
"hf mfdes write --isoid 1234 --fileisoid 2000 --type record -c iso -d 01020304 -> send record to record file via iso commandset",
"hf mfdes write --aid 123456 --fid 01 -d 01020304 --readerid 010203 -> write data to file with CommitReaderID command before write and CommitTransaction after write",
"hf mfdes write --isoid df01 --fid 04 -d 01020304 --trkey 00112233445566778899aabbccddeeff --readerid 5532 -t aes -s lrp -> advanced CommitReaderID via lrp channel sample"
"hf mfdes write --isoid df01 --fid 04 -d 01020304 --trkey 00112233445566778899aabbccddeeff --readerid 5532 -t aes --schann lrp -> advanced CommitReaderID via lrp channel sample"
],
"offline": false,
"options": [
@ -6501,6 +6563,25 @@
],
"usage": "hf mfu sim [-hv] -t <1..10> [-u <hex>] [-n <dec>]"
},
"hf mfu tamper": {
"command": "hf mfu tamper",
"description": "Set the congiguration of the NTAG 213TT tamper feature Supports: NTAG 213TT",
"notes": [
"hf mfu tamper -e -> enable tamper feature",
"hf mfu tamper -d -> disable tamper feature",
"hf mfu tamper -m 0A0A0A0A -> set the tamper message to 0A0A0A0A",
"hf mfu tamper --lockmessage -> permanently lock the tamper message and mask it from memory"
],
"offline": false,
"options": [
"-h, --help This help",
"-e, --enable Enable the tamper feature",
"-d, --disable Disable the tamper feature",
"-m, --message <hex> Set the tamper message (4 bytes)",
"--lockmessage Permanently lock the tamper message and mask it from memory (does not lock tamper feature itself)"
],
"usage": "hf mfu tamper [-hed] [-m <hex>] [--lockmessage]"
},
"hf mfu view": {
"command": "hf mfu view",
"description": "Print a MIFARE Ultralight/NTAG dump file (bin/eml/json)",
@ -8447,22 +8528,23 @@
},
"lf gproxii clone": {
"command": "lf gproxii clone",
"description": "clone a Guardall tag to a T55x7, Q5/T5555 or EM4305/4469 tag. The facility-code is 8-bit and the card number is 20-bit. Larger values are truncated. Currently work only on 26 | 36 bit format",
"description": "Clone a Guardall tag to a T55x7, Q5/T5555 or EM4305/4469 tag. The facility-code is 8-bit and the card number is 20-bit. Larger values are truncated. Currently work only on 26 | 36 bit format",
"notes": [
"lf gproxii clone --fmt 26 --fc 123 --cn 1337 -> encode for T55x7 tag",
"lf gproxii clone --fmt 26 --fc 123 --cn 1337 --q5 -> encode for Q5/T5555 tag",
"lf gproxii clone --fmt 26 --fc 123 --cn 1337 --em -> encode for EM4305/4469"
"lf gproxii clone --xor 141 --fmt 26 --fc 123 --cn 1337 -> encode for T55x7 tag",
"lf gproxii clone --xor 141 --fmt 26 --fc 123 --cn 1337 --q5 -> encode for Q5/T5555 tag",
"lf gproxii clone --xor 141 --fmt 26 --fc 123 --cn 1337 --em -> encode for EM4305/4469"
],
"offline": false,
"options": [
"-h, --help This help",
"--xor <dec> 8-bit xor value (installation dependant)",
"--fmt <dec> format length 26|32|36|40",
"--fc <dec> 8-bit value facility code",
"--cn <dec> 16-bit value card number",
"--q5 optional - specify writing to Q5/T5555 tag",
"--em optional - specify writing to EM4305/4469 tag"
],
"usage": "lf gproxii clone [-h] --fmt <dec> --fc <dec> --cn <dec> [--q5] [--em]"
"usage": "lf gproxii clone [-h] --xor <dec> --fmt <dec> --fc <dec> --cn <dec> [--q5] [--em]"
},
"lf gproxii demod": {
"command": "lf gproxii demod",
@ -8503,16 +8585,17 @@
"command": "lf gproxii sim",
"description": "Enables simulation of Guardall card with specified card number. Simulation runs until the button is pressed or another USB command is issued. The facility-code is 8-bit and the card number is 16-bit. Larger values are truncated. Currently work only on 26 | 36 bit format",
"notes": [
"lf gproxii sim --fmt 26 --fc 123 --cn 1337"
"lf gproxii sim --xor 141 --fmt 26 --fc 123 --cn 1337"
],
"offline": false,
"options": [
"-h, --help This help",
"--xor <dec> 8-bit xor value (installation dependant)",
"--fmt <dec> format length 26|32|36|40",
"--fc <dec> 8-bit value facility code",
"--cn <dec> 16-bit value card number"
],
"usage": "lf gproxii sim [-h] --fmt <dec> --fc <dec> --cn <dec>"
"usage": "lf gproxii sim [-h] --xor <dec> --fmt <dec> --fc <dec> --cn <dec>"
},
"lf help": {
"command": "lf help",
@ -8524,27 +8607,28 @@
},
"lf hid brute": {
"command": "lf hid brute",
"description": "Enables bruteforce of HID readers with specified facility code. This is a attack against reader. if cardnumber is given, it starts with it and goes up / down one step if cardnumber is not given, it starts with 1 and goes up to 65535",
"description": "Enables bruteforce of HID readers with specified facility code or card number. This is an attack against the reader. If the field being bruteforced is provided, it starts with it and goes up / down one step while maintaining other supplied values. If the field being bruteforced is not provided, it will iterate through the full range while maintaining other supplied values.",
"notes": [
"lf hid brute -w H10301 --fc 224",
"lf hid brute -w H10301 --fc 21 -d 2000",
"lf hid brute -v -w H10301 --fc 21 --cn 200 -d 2000",
"lf hid brute -v -w H10301 --fc 21 --cn 200 -d 2000 --up"
"lf hid brute -w H10301 --field fc --fc 224 --cn 6278",
"lf hid brute -w H10301 --field cn --fc 21 -d 2000",
"lf hid brute -v -w H10301 --field cn --fc 21 --cn 200 -d 2000",
"lf hid brute -v -w H10301 --field fc --fc 21 --cn 200 -d 2000 --up"
],
"offline": false,
"options": [
"-h, --help This help",
"-v, --verbose verbose output",
"-w, --wiegand <format> see `wiegand list` for available formats",
"--field <fc|cn> field to bruteforce",
"--fc <dec> facility code",
"--cn <dec> card number to start with",
"--cn <dec> card number",
"-i, --issue <dec> issue level",
"-o, --oem <dec> OEM code",
"-d, --delay <dec> delay betweens attempts in ms. Default 1000ms",
"--up direction to increment card number. (default is both directions)",
"--down direction to decrement card number. (default is both directions)"
"-d, --delay <dec> delay betweens attempts in ms. (def is 1000)",
"--up direction to increment field value. (def is both directions)",
"--down direction to decrement field value. (def is both directions)"
],
"usage": "lf hid brute [-hv] -w <format> [--fc <dec>] [--cn <dec>] [-i <dec>] [-o <dec>] [-d <dec>] [--up] [--down]"
"usage": "lf hid brute [-hv] -w <format> --field <fc|cn> [--fc <dec>] [--cn <dec>] [-i <dec>] [-o <dec>] [-d <dec>] [--up] [--down]"
},
"lf hid clone": {
"command": "lf hid clone",
@ -10816,7 +10900,7 @@
"command": "msleep",
"description": "Sleep for given amount of milliseconds",
"notes": [
"msleep 100"
"msleep -t 100"
],
"offline": true,
"options": [
@ -11903,8 +11987,8 @@
}
},
"metadata": {
"commands_extracted": 749,
"commands_extracted": 754,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-02-18T20:20:19"
"extracted_on": "2023-03-26T13:11:48"
}
}

View file

@ -126,6 +126,7 @@ 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 num `|Y |`Converts dec/hex/bin`
|`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)`
@ -444,8 +445,9 @@ Check column "offline" for their availability.
|`hf legic eload `|N |`Load binary dump to emulator memory`
|`hf legic esave `|N |`Save emulator memory to binary file`
|`hf legic eview `|N |`View emulator memory`
|`hf legic einfo `|N |`Display deobfuscated and decoded emulator memory`
|`hf legic crc `|Y |`Calculate Legic CRC over given bytes`
|`hf legic view `|Y |`Display content from tag dump file`
|`hf legic view `|Y |`Display deobfuscated and decoded content from tag dump file`
### hf lto
@ -521,6 +523,8 @@ Check column "offline" for their availability.
|`hf mf gsave `|N |`Save dump from card into file or emulator`
|`hf mf gsetblk `|N |`Write block to card`
|`hf mf gview `|N |`View card`
|`hf mf gdmconfig `|N |`Read config block from card`
|`hf mf gdmsetblk `|N |`Write block to card`
|`hf mf ndefformat `|N |`Format MIFARE Classic Tag as NFC Tag`
|`hf mf ndefread `|N |`Read and print NDEF records from card`
|`hf mf ndefwrite `|N |`Write NDEF records to card`
@ -564,6 +568,7 @@ Check column "offline" for their availability.
|`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag`
|`hf mfu view `|Y |`Display content from tag dump file`
|`hf mfu wrbl `|N |`Write block`
|`hf mfu tamper `|N |`Cofigure the tamper feature on an NTAG 213TT`
|`hf mfu eload `|N |`Load Ultralight dump file into emulator memory`
|`hf mfu esave `|N |`Save Ultralight dump file from emulator memory`
|`hf mfu eview `|N |`View emulator memory`
@ -952,7 +957,7 @@ Check column "offline" for their availability.
|`lf hid reader `|N |`attempt to read and extract tag data`
|`lf hid clone `|N |`clone HID tag to T55x7`
|`lf hid sim `|N |`simulate HID tag`
|`lf hid brute `|N |`bruteforce card number against reader`
|`lf hid brute `|N |`bruteforce facility code or card number against reader`
|`lf hid watch `|N |`continuously watch for cards. Reader mode`