make style

This commit is contained in:
Philippe Teuwen 2023-01-14 22:22:04 +01:00
commit 5d5d9d9be0
14 changed files with 262 additions and 529 deletions

View file

@ -46,13 +46,11 @@ static uint8_t isEven_64_63(const uint8_t *data);
static inline uint32_t bitcount32(uint32_t a); static inline uint32_t bitcount32(uint32_t a);
static void bytes_to_bytebits(const void *src, const size_t srclen, void *dest); static void bytes_to_bytebits(const void *src, const size_t srclen, void *dest);
void ModInfo(void) void ModInfo(void) {
{
DbpString(" " MODULE_LONG_NAME); DbpString(" " MODULE_LONG_NAME);
} }
void RunMod(void) void RunMod(void) {
{
int n; int n;
StandAloneMode(); StandAloneMode();
@ -62,8 +60,7 @@ void RunMod(void)
Dbprintf("[=] NEDAP (%s) - ID: " _GREEN_("%05u") " subtype: " _GREEN_("%1u") " customer code: " _GREEN_("%u / 0x%03X"), Tag.bIsLong ? "128b" : "64b", Tag.id, Tag.subType, Tag.customerCode, Tag.customerCode); Dbprintf("[=] NEDAP (%s) - ID: " _GREEN_("%05u") " subtype: " _GREEN_("%1u") " customer code: " _GREEN_("%u / 0x%03X"), Tag.bIsLong ? "128b" : "64b", Tag.id, Tag.subType, Tag.customerCode, Tag.customerCode);
n = NedapPrepareBigBuffer(&Tag); n = NedapPrepareBigBuffer(&Tag);
do do {
{
WDT_HIT(); WDT_HIT();
if (data_available()) if (data_available())
@ -78,8 +75,7 @@ void RunMod(void)
LEDsoff(); LEDsoff();
} }
static int NedapPrepareBigBuffer(const NEDAP_TAG *pTag) static int NedapPrepareBigBuffer(const NEDAP_TAG *pTag) {
{
int ret = 0; int ret = 0;
uint8_t data[16], bitStream[sizeof(data) * 8], phase = 0; uint8_t data[16], bitStream[sizeof(data) * 8], phase = 0;
uint16_t i, size = pTag->bIsLong ? sizeof(data) : (sizeof(data) / 2); uint16_t i, size = pTag->bIsLong ? sizeof(data) : (sizeof(data) / 2);
@ -88,14 +84,11 @@ static int NedapPrepareBigBuffer(const NEDAP_TAG *pTag)
bytes_to_bytebits(data, size, bitStream); bytes_to_bytebits(data, size, bitStream);
size <<= 3; size <<= 3;
for (i = 0; i < size; i++) for (i = 0; i < size; i++) {
{
biphaseSimBitInverted(!bitStream[i], &ret, &phase); biphaseSimBitInverted(!bitStream[i], &ret, &phase);
} }
if (phase == 1) //run a second set inverted to keep phase in check if (phase == 1) { //run a second set inverted to keep phase in check
{ for (i = 0; i < size; i++) {
for (i = 0; i < size; i++)
{
biphaseSimBitInverted(!bitStream[i], &ret, &phase); biphaseSimBitInverted(!bitStream[i], &ret, &phase);
} }
} }
@ -103,17 +96,13 @@ static int NedapPrepareBigBuffer(const NEDAP_TAG *pTag)
return ret; return ret;
} }
static void biphaseSimBitInverted(uint8_t c, int *n, uint8_t *phase) static void biphaseSimBitInverted(uint8_t c, int *n, uint8_t *phase) {
{
uint8_t *dest = BigBuf_get_addr(); uint8_t *dest = BigBuf_get_addr();
if (c) if (c) {
{
memset(dest + (*n), c ^ 1 ^ *phase, 32); memset(dest + (*n), c ^ 1 ^ *phase, 32);
memset(dest + (*n) + 32, c ^ *phase, 32); memset(dest + (*n) + 32, c ^ *phase, 32);
} } else {
else
{
memset(dest + (*n), c ^ *phase, 64); memset(dest + (*n), c ^ *phase, 64);
*phase ^= 1; *phase ^= 1;
} }
@ -190,13 +179,11 @@ static uint8_t isEven_64_63(const uint8_t *data) { // 8
return (bitcount32(tmp[0]) + (bitcount32(tmp[1] & 0xfeffffff))) & 1; return (bitcount32(tmp[0]) + (bitcount32(tmp[1] & 0xfeffffff))) & 1;
} }
static void bytes_to_bytebits(const void *src, const size_t srclen, void *dest) static void bytes_to_bytebits(const void *src, const size_t srclen, void *dest) {
{
uint8_t *s = (uint8_t *)src, *d = (uint8_t *)dest; uint8_t *s = (uint8_t *)src, *d = (uint8_t *)dest;
size_t i = srclen * 8, j = srclen; size_t i = srclen * 8, j = srclen;
while (j--) while (j--) {
{
uint8_t b = s[j]; uint8_t b = s[j];
d[--i] = (b >> 0) & 1; d[--i] = (b >> 0) & 1;
d[--i] = (b >> 1) & 1; d[--i] = (b >> 1) & 1;
@ -209,8 +196,7 @@ static void bytes_to_bytebits(const void *src, const size_t srclen, void *dest)
} }
} }
static inline uint32_t bitcount32(uint32_t a) static inline uint32_t bitcount32(uint32_t a) {
{
#if defined __GNUC__ #if defined __GNUC__
return __builtin_popcountl(a); return __builtin_popcountl(a);
#else #else

View file

@ -2111,7 +2111,7 @@ static int CmdHFeMRTDDump(const char *Cmd) {
if (CLIParamStrToBuf(arg_get_str(ctx, 1), docnum, 9, &slen) != 0 || slen == 0) { if (CLIParamStrToBuf(arg_get_str(ctx, 1), docnum, 9, &slen) != 0 || slen == 0) {
BAC = false; BAC = false;
} else { } else {
strn_upper((char*)docnum, slen); strn_upper((char *)docnum, slen);
if (slen != 9) { if (slen != 9) {
// Pad to 9 with < // Pad to 9 with <
memset(docnum + slen, '<', 9 - slen); memset(docnum + slen, '<', 9 - slen);
@ -2144,7 +2144,7 @@ static int CmdHFeMRTDDump(const char *Cmd) {
error = true; error = true;
} else { } else {
BAC = true; BAC = true;
strn_upper((char*)mrz, slen); strn_upper((char *)mrz, slen);
memcpy(docnum, &mrz[0], 9); memcpy(docnum, &mrz[0], 9);
memcpy(dob, &mrz[13], 6); memcpy(dob, &mrz[13], 6);
memcpy(expiry, &mrz[21], 6); memcpy(expiry, &mrz[21], 6);
@ -2213,7 +2213,7 @@ static int CmdHFeMRTDInfo(const char *Cmd) {
if (CLIParamStrToBuf(arg_get_str(ctx, 1), docnum, 9, &slen) != 0 || slen == 0) { if (CLIParamStrToBuf(arg_get_str(ctx, 1), docnum, 9, &slen) != 0 || slen == 0) {
BAC = false; BAC = false;
} else { } else {
strn_upper((char*)docnum, slen); strn_upper((char *)docnum, slen);
if (slen != 9) { if (slen != 9) {
memset(docnum + slen, '<', 9 - slen); memset(docnum + slen, '<', 9 - slen);
} }
@ -2245,7 +2245,7 @@ static int CmdHFeMRTDInfo(const char *Cmd) {
error = true; error = true;
} else { } else {
BAC = true; BAC = true;
strn_upper((char*)mrz, slen); strn_upper((char *)mrz, slen);
memcpy(docnum, &mrz[0], 9); memcpy(docnum, &mrz[0], 9);
memcpy(dob, &mrz[13], 6); memcpy(dob, &mrz[13], 6);
memcpy(expiry, &mrz[21], 6); memcpy(expiry, &mrz[21], 6);

View file

@ -284,27 +284,27 @@ static int CmdParadoxClone(const char *Cmd) {
manchester[3] = 0x55; // Leading zeros back 4 bits once we have the crc (done below) manchester[3] = 0x55; // Leading zeros back 4 bits once we have the crc (done below)
// add FC // add FC
t1 = manchesterEncode2Bytes (fc); t1 = manchesterEncode2Bytes(fc);
manchester[4] = (t1 >> 8) & 0xFF; manchester[4] = (t1 >> 8) & 0xFF;
manchester[5] = t1 & 0xFF; manchester[5] = t1 & 0xFF;
// add cn // add cn
t1 = manchesterEncode2Bytes (cn); t1 = manchesterEncode2Bytes(cn);
manchester[6] = (t1 >> 24) & 0xFF; manchester[6] = (t1 >> 24) & 0xFF;
manchester[7] = (t1 >> 16) & 0xFF; manchester[7] = (t1 >> 16) & 0xFF;
manchester[8] = (t1 >> 8) & 0xFF; manchester[8] = (t1 >> 8) & 0xFF;
manchester[9] = t1 & 0xFF; manchester[9] = t1 & 0xFF;
uint8_t crc = (CRC8Maxim(manchester+1, 9) ^ 0x6) & 0xFF; uint8_t crc = (CRC8Maxim(manchester + 1, 9) ^ 0x6) & 0xFF;
// add crc // add crc
t1 = manchesterEncode2Bytes (crc); t1 = manchesterEncode2Bytes(crc);
manchester[10] = (t1 >> 8) & 0xFF; manchester[10] = (t1 >> 8) & 0xFF;
manchester[11] = t1 & 0xFF; manchester[11] = t1 & 0xFF;
// move left 4 bits left 4 bits - Now that we have the CRC we need to re-align the data. // move left 4 bits left 4 bits - Now that we have the CRC we need to re-align the data.
for (int i = 1; i < 12; i++) for (int i = 1; i < 12; i++)
manchester[i] = (manchester[i] << 4) + (manchester[i+1] >> 4); manchester[i] = (manchester[i] << 4) + (manchester[i + 1] >> 4);
// Add trailing 1010 (11) // Add trailing 1010 (11)
manchester[11] |= (1 << 3); manchester[11] |= (1 << 3);
@ -312,7 +312,7 @@ static int CmdParadoxClone(const char *Cmd) {
// move into tag blocks // move into tag blocks
for (int i = 0; i < 12; i++) for (int i = 0; i < 12; i++)
blocks[1 + (i/4)] += (manchester[i] << (8 * (3 - i % 4))); blocks[1 + (i / 4)] += (manchester[i] << (8 * (3 - i % 4)));
} }
// Paradox - FSK2a, data rate 50, 3 data blocks // Paradox - FSK2a, data rate 50, 3 data blocks

View file

@ -66,7 +66,7 @@ static const struct piv_container PIV_CONTAINERS[] = {
{0x0100, PIV_TAG_ID("\x5F\xC1\x0A"), 3, PIV_CONDITIONAL, "X.509 Certificate for Digital Signature (key ref 9C)"}, {0x0100, PIV_TAG_ID("\x5F\xC1\x0A"), 3, PIV_CONDITIONAL, "X.509 Certificate for Digital Signature (key ref 9C)"},
{0x0102, PIV_TAG_ID("\x5F\xC1\x0B"), 3, PIV_CONDITIONAL, "X.509 Certificate for Key Management (key ref 9D)"}, {0x0102, PIV_TAG_ID("\x5F\xC1\x0B"), 3, PIV_CONDITIONAL, "X.509 Certificate for Key Management (key ref 9D)"},
{0x3001, PIV_TAG_ID("\x5F\xC1\x09"), 3, PIV_OPTIONAL, "Printed Information"}, {0x3001, PIV_TAG_ID("\x5F\xC1\x09"), 3, PIV_OPTIONAL, "Printed Information"},
{0x6050, PIV_TAG_ID( "\x7E"), 1, PIV_OPTIONAL, "Discovery Object"}, {0x6050, PIV_TAG_ID("\x7E"), 1, PIV_OPTIONAL, "Discovery Object"},
{0x6060, PIV_TAG_ID("\x5F\xC1\x0C"), 3, PIV_OPTIONAL, "Key History Object"}, {0x6060, PIV_TAG_ID("\x5F\xC1\x0C"), 3, PIV_OPTIONAL, "Key History Object"},
{0x1001, PIV_TAG_ID("\x5F\xC1\x0D"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 1 (key ref 82)"}, {0x1001, PIV_TAG_ID("\x5F\xC1\x0D"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 1 (key ref 82)"},
{0x1002, PIV_TAG_ID("\x5F\xC1\x0E"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 2 (key ref 83)"}, {0x1002, PIV_TAG_ID("\x5F\xC1\x0E"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 2 (key ref 83)"},
@ -89,7 +89,7 @@ static const struct piv_container PIV_CONTAINERS[] = {
{0x1013, PIV_TAG_ID("\x5F\xC1\x1F"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 19 (key ref 94)"}, {0x1013, PIV_TAG_ID("\x5F\xC1\x1F"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 19 (key ref 94)"},
{0x1014, PIV_TAG_ID("\x5F\xC1\x20"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 20 (key ref 95)"}, {0x1014, PIV_TAG_ID("\x5F\xC1\x20"), 3, PIV_OPTIONAL, "Retired X.509 Certificate for Key Management 20 (key ref 95)"},
{0x1015, PIV_TAG_ID("\x5F\xC1\x21"), 3, PIV_OPTIONAL, "Cardholder Iris Images"}, {0x1015, PIV_TAG_ID("\x5F\xC1\x21"), 3, PIV_OPTIONAL, "Cardholder Iris Images"},
{0x1016, PIV_TAG_ID( "\x7F\x61"), 2, PIV_OPTIONAL, "Biometric Information Templates Group Template"}, {0x1016, PIV_TAG_ID("\x7F\x61"), 2, PIV_OPTIONAL, "Biometric Information Templates Group Template"},
{0x1017, PIV_TAG_ID("\x5F\xC1\x22"), 3, PIV_OPTIONAL, "Secure Messaging Certificate Signer"}, {0x1017, PIV_TAG_ID("\x5F\xC1\x22"), 3, PIV_OPTIONAL, "Secure Messaging Certificate Signer"},
{0x1018, PIV_TAG_ID("\x5F\xC1\x23"), 3, PIV_OPTIONAL, "Pairing Code Reference Data Container"}, {0x1018, PIV_TAG_ID("\x5F\xC1\x23"), 3, PIV_OPTIONAL, "Pairing Code Reference Data Container"},
PIV_CONTAINER_FINISH, PIV_CONTAINER_FINISH,
@ -493,13 +493,13 @@ static void piv_print_cb(void *data, const struct tlv *tlv, int level, bool is_l
} }
} }
static void PrintTLV(const struct tlvdb* tlvdb) { static void PrintTLV(const struct tlvdb *tlvdb) {
if (tlvdb) { if (tlvdb) {
tlvdb_visit(tlvdb, piv_print_cb, NULL, 0); tlvdb_visit(tlvdb, piv_print_cb, NULL, 0);
} }
} }
static void PrintTLVFromBuffer(const uint8_t* buf, size_t len) { static void PrintTLVFromBuffer(const uint8_t *buf, size_t len) {
if (buf == NULL || len == 0) { if (buf == NULL || len == 0) {
return; return;
} }
@ -598,7 +598,7 @@ static int PivGetData(Iso7816CommandChannel channel, const uint8_t tag[], size_t
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int PivGetDataByCidAndPrint(Iso7816CommandChannel channel, const struct piv_container* cid, bool decodeTLV, bool verbose) { static int PivGetDataByCidAndPrint(Iso7816CommandChannel channel, const struct piv_container *cid, bool decodeTLV, bool verbose) {
struct tlvdb_root *root = NULL; struct tlvdb_root *root = NULL;
if (cid == NULL) { if (cid == NULL) {

View file

@ -258,7 +258,7 @@ static size_t path_size(savePaths_t a) {
if (a == spItemCount) { if (a == spItemCount) {
return 0; return 0;
} }
return strlen( g_session.defaultPaths[a] ); return strlen(g_session.defaultPaths[a]);
} }
char *newfilenamemcopy(const char *preferredName, const char *suffix) { char *newfilenamemcopy(const char *preferredName, const char *suffix) {

View file

@ -1563,10 +1563,10 @@ int vigik_verify(uint8_t *uid, uint8_t uidlen, uint8_t *signature, int signature
mbedtls_mpi_init(&sqr); mbedtls_mpi_init(&sqr);
mbedtls_mpi_init(&res); mbedtls_mpi_init(&res);
mbedtls_mpi_read_binary(&N, (const unsigned char*)n, PUBLIC_VIGIK_KEYLEN); mbedtls_mpi_read_binary(&N, (const unsigned char *)n, PUBLIC_VIGIK_KEYLEN);
//mbedtls_mpi_read_binary(&s, (const unsigned char*)signature, signature_len); //mbedtls_mpi_read_binary(&s, (const unsigned char*)signature, signature_len);
mbedtls_mpi_read_binary(&s, (const unsigned char*)rev_sig, signature_len); mbedtls_mpi_read_binary(&s, (const unsigned char *)rev_sig, signature_len);
// check is sign < (N/2) // check is sign < (N/2)
@ -1644,10 +1644,10 @@ int vigik_verify(uint8_t *uid, uint8_t uidlen, uint8_t *signature, int signature
PrintAndLogEx(DEBUG, "LSB............ " _GREEN_("%u"), lsb); PrintAndLogEx(DEBUG, "LSB............ " _GREEN_("%u"), lsb);
if (g_debugMode == DEBUG) { if (g_debugMode == DEBUG) {
mbedtls_mpi_write_file( "[=] N.............. ", &N, 16, NULL ); mbedtls_mpi_write_file("[=] N.............. ", &N, 16, NULL);
mbedtls_mpi_write_file( "[=] signature...... ", &s, 16, NULL ); mbedtls_mpi_write_file("[=] signature...... ", &s, 16, NULL);
mbedtls_mpi_write_file( "[=] square mod n... ", &sqr, 16, NULL ); mbedtls_mpi_write_file("[=] square mod n... ", &sqr, 16, NULL);
mbedtls_mpi_write_file( "[=] n-fs........... ", &res, 16, NULL ); mbedtls_mpi_write_file("[=] n-fs........... ", &res, 16, NULL);
} }
@ -1656,9 +1656,9 @@ int vigik_verify(uint8_t *uid, uint8_t uidlen, uint8_t *signature, int signature
// xor 0xDC01 // xor 0xDC01
int count_zero = 0; int count_zero = 0;
for (int x = 0; x < sizeof(nfs); x +=2) { for (int x = 0; x < sizeof(nfs); x += 2) {
nfs[x] ^= 0xDC; nfs[x] ^= 0xDC;
nfs[x+1] ^= 0x01; nfs[x + 1] ^= 0x01;
if (nfs[x] == 0x00) if (nfs[x] == 0x00)
count_zero++; count_zero++;
@ -1749,7 +1749,7 @@ int vigik_annotate(uint8_t *d) {
if (d == NULL) if (d == NULL)
return PM3_EINVARG; return PM3_EINVARG;
mfc_vigik_t *foo = (mfc_vigik_t*)d; mfc_vigik_t *foo = (mfc_vigik_t *)d;
PrintAndLogEx(INFO, "Manufacture......... %s", sprint_hex(foo->b0, sizeof(foo->b0))); PrintAndLogEx(INFO, "Manufacture......... %s", sprint_hex(foo->b0, sizeof(foo->b0)));
PrintAndLogEx(INFO, "MAD................. %s", sprint_hex(foo->mad, sizeof(foo->mad))); PrintAndLogEx(INFO, "MAD................. %s", sprint_hex(foo->mad, sizeof(foo->mad)));

View file

@ -244,11 +244,11 @@ const static vocabulory_t vocabulory[] = {
{ 1, "hf gallagher diversifykey" }, { 1, "hf gallagher diversifykey" },
{ 1, "hf gallagher decode" }, { 1, "hf gallagher decode" },
{ 1, "hf ksx6924 help" }, { 1, "hf ksx6924 help" },
{ 0, "hf ksx6924 select" },
{ 0, "hf ksx6924 info" },
{ 0, "hf ksx6924 balance" }, { 0, "hf ksx6924 balance" },
{ 0, "hf ksx6924 init" }, { 0, "hf ksx6924 info" },
{ 0, "hf ksx6924 initialize" },
{ 0, "hf ksx6924 prec" }, { 0, "hf ksx6924 prec" },
{ 0, "hf ksx6924 select" },
{ 1, "hf jooki help" }, { 1, "hf jooki help" },
{ 0, "hf jooki clone" }, { 0, "hf jooki clone" },
{ 1, "hf jooki decode" }, { 1, "hf jooki decode" },
@ -347,10 +347,6 @@ const static vocabulory_t vocabulory[] = {
{ 0, "hf mf gen3uid" }, { 0, "hf mf gen3uid" },
{ 0, "hf mf gen3blk" }, { 0, "hf mf gen3blk" },
{ 0, "hf mf gen3freeze" }, { 0, "hf mf gen3freeze" },
{ 0, "hf mf ggetblk" },
{ 0, "hf mf gload" },
{ 0, "hf mf gsave" },
{ 0, "hf mf gsetblk" },
{ 0, "hf mf gview" }, { 0, "hf mf gview" },
{ 0, "hf mf ndefformat" }, { 0, "hf mf ndefformat" },
{ 0, "hf mf ndefread" }, { 0, "hf mf ndefread" },
@ -380,7 +376,6 @@ const static vocabulory_t vocabulory[] = {
{ 1, "hf mfu view" }, { 1, "hf mfu view" },
{ 0, "hf mfu wrbl" }, { 0, "hf mfu wrbl" },
{ 0, "hf mfu eload" }, { 0, "hf mfu eload" },
{ 0, "hf mfu esave" },
{ 0, "hf mfu eview" }, { 0, "hf mfu eview" },
{ 0, "hf mfu sim" }, { 0, "hf mfu sim" },
{ 0, "hf mfu setpwd" }, { 0, "hf mfu setpwd" },
@ -589,7 +584,6 @@ const static vocabulory_t vocabulory[] = {
{ 0, "lf idteck clone" }, { 0, "lf idteck clone" },
{ 0, "lf idteck sim" }, { 0, "lf idteck sim" },
{ 1, "lf indala help" }, { 1, "lf indala help" },
{ 0, "lf indala brute" },
{ 1, "lf indala demod" }, { 1, "lf indala demod" },
{ 1, "lf indala altdemod" }, { 1, "lf indala altdemod" },
{ 0, "lf indala reader" }, { 0, "lf indala reader" },
@ -737,11 +731,6 @@ const static vocabulory_t vocabulory[] = {
{ 0, "nfc barcode read" }, { 0, "nfc barcode read" },
{ 0, "nfc barcode sim" }, { 0, "nfc barcode sim" },
{ 1, "nfc barcode help" }, { 1, "nfc barcode help" },
{ 1, "piv help" },
{ 0, "piv select" },
{ 0, "piv getdata" },
{ 0, "piv scan" },
{ 1, "piv list" },
{ 1, "smart help" }, { 1, "smart help" },
{ 1, "smart list" }, { 1, "smart list" },
{ 0, "smart info" }, { 0, "smart info" },

View file

@ -62,9 +62,9 @@ pthread_mutex_t g_print_lock = PTHREAD_MUTEX_INITIALIZER;
static void fPrintAndLog(FILE *stream, const char *fmt, ...); static void fPrintAndLog(FILE *stream, const char *fmt, ...);
#ifdef _WIN32 #ifdef _WIN32
#define MKDIR_CHK _mkdir(path) #define MKDIR_CHK _mkdir(path)
#else #else
#define MKDIR_CHK mkdir(path, 0700) #define MKDIR_CHK mkdir(path, 0700)
#endif #endif
@ -107,8 +107,7 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
if ((result != 0) && create_home) { if ((result != 0) && create_home) {
if (MKDIR_CHK) if (MKDIR_CHK) {
{
fprintf(stderr, "Could not create user directory %s\n", path); fprintf(stderr, "Could not create user directory %s\n", path);
free(path); free(path);
return PM3_EFILE; return PM3_EFILE;
@ -140,8 +139,7 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
if ((result != 0) && create_home) { if ((result != 0) && create_home) {
if (MKDIR_CHK) if (MKDIR_CHK) {
{
fprintf(stderr, "Could not create user directory %s\n", path); fprintf(stderr, "Could not create user directory %s\n", path);
free(path); free(path);
return PM3_EFILE; return PM3_EFILE;
@ -155,7 +153,7 @@ int searchHomeFilePath(char **foundpath, const char *subdir, const char *filenam
} }
pathlen += strlen(filename); pathlen += strlen(filename);
char *tmp = realloc(path, pathlen *sizeof(char)); char *tmp = realloc(path, pathlen * sizeof(char));
if (tmp == NULL) { if (tmp == NULL) {
//free(path); //free(path);
return PM3_EMALLOC; return PM3_EMALLOC;

File diff suppressed because it is too large Load diff

View file

@ -367,11 +367,11 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`hf ksx6924 help `|Y |`This help` |`hf ksx6924 help `|Y |`This help`
|`hf ksx6924 select `|N |`Select application, and leave field up`
|`hf ksx6924 info `|N |`Get info about a KS X 6924 (T-Money, Snapper+) transit card`
|`hf ksx6924 balance `|N |`Get current purse balance` |`hf ksx6924 balance `|N |`Get current purse balance`
|`hf ksx6924 init `|N |`Perform transaction initialization with Mpda` |`hf ksx6924 info `|N |`Get info about a KS X 6924 (T-Money, Snapper+) transit card`
|`hf ksx6924 initialize `|N |`Perform transaction initialization (Mpda)`
|`hf ksx6924 prec `|N |`Send proprietary get record command (CLA=90, INS=4C)` |`hf ksx6924 prec `|N |`Send proprietary get record command (CLA=90, INS=4C)`
|`hf ksx6924 select `|N |`Select application, and leave field up`
### hf jooki ### hf jooki
@ -510,10 +510,6 @@ Check column "offline" for their availability.
|`hf mf gen3uid `|N |`Set UID without changing manufacturer block` |`hf mf gen3uid `|N |`Set UID without changing manufacturer block`
|`hf mf gen3blk `|N |`Overwrite manufacturer block` |`hf mf gen3blk `|N |`Overwrite manufacturer block`
|`hf mf gen3freeze `|N |`Perma lock UID changes. irreversible` |`hf mf gen3freeze `|N |`Perma lock UID changes. irreversible`
|`hf mf ggetblk `|N |`Read block from card`
|`hf mf gload `|N |`Load dump to card`
|`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 gview `|N |`View card`
|`hf mf ndefformat `|N |`Format MIFARE Classic Tag as NFC Tag` |`hf mf ndefformat `|N |`Format MIFARE Classic Tag as NFC Tag`
|`hf mf ndefread `|N |`Read and print NDEF records from card` |`hf mf ndefread `|N |`Read and print NDEF records from card`
@ -558,8 +554,7 @@ Check column "offline" for their availability.
|`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag` |`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag`
|`hf mfu view `|Y |`Display content from tag dump file` |`hf mfu view `|Y |`Display content from tag dump file`
|`hf mfu wrbl `|N |`Write block` |`hf mfu wrbl `|N |`Write block`
|`hf mfu eload `|N |`Load Ultralight dump file into emulator memory` |`hf mfu eload `|N |`Load Ultralight .eml dump file into emulator memory`
|`hf mfu esave `|N |`Save Ultralight dump file from emulator memory`
|`hf mfu eview `|N |`View emulator memory` |`hf mfu eview `|N |`View emulator memory`
|`hf mfu sim `|N |`Simulate MIFARE Ultralight from emulator memory` |`hf mfu sim `|N |`Simulate MIFARE Ultralight from emulator memory`
|`hf mfu setpwd `|N |`Set 3DES key - Ultralight-C` |`hf mfu setpwd `|N |`Set 3DES key - Ultralight-C`
@ -976,7 +971,6 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`lf indala help `|Y |`This help` |`lf indala help `|Y |`This help`
|`lf indala brute `|N |`Demodulate an Indala tag (PSK1) from the GraphBuffer`
|`lf indala demod `|Y |`Demodulate an Indala tag (PSK1) from the GraphBuffer` |`lf indala demod `|Y |`Demodulate an Indala tag (PSK1) from the GraphBuffer`
|`lf indala altdemod `|Y |`Alternative method to demodulate samples for Indala 64 bit UID (option '224' for 224 bit)` |`lf indala altdemod `|Y |`Alternative method to demodulate samples for Indala 64 bit UID (option '224' for 224 bit)`
|`lf indala reader `|N |`Read an Indala tag from the antenna` |`lf indala reader `|N |`Read an Indala tag from the antenna`
@ -1334,19 +1328,6 @@ Check column "offline" for their availability.
|`nfc barcode help `|Y |`This help` |`nfc barcode help `|Y |`This help`
### piv
{ PIV commands... }
|command |offline |description
|------- |------- |-----------
|`piv help `|Y |`This help`
|`piv select `|N |`Select the PIV applet`
|`piv getdata `|N |`Gets a container on a PIV card`
|`piv scan `|N |`Scan PIV card for known containers`
|`piv list `|Y |`List ISO7816 history`
### reveng ### reveng
{ CRC calculations from RevEng software... } { CRC calculations from RevEng software... }