renamed lua scripts. minor adaptations
This commit is contained in:
1 parent
d5e6464660
commit
778ede25e7
9 files changed
+68
-140
No files matched your search
@@ -1877,14 +1877,13 @@ static int emrtd_print_ef_sod_info(uint8_t *dg_hashes_calc, uint8_t *dg_hashes_s
|
||||
PrintAndLogEx(INFO, "------------------------ " _CYAN_("EF_SOD") " ------------------------");
|
||||
PrintAndLogEx(INFO, "Document Security Object");
|
||||
PrintAndLogEx(INFO, "contains the digital signatures of the passport data");
|
||||
PrintAndLogEx(INFO, "");
|
||||
|
||||
if (hash_algo == -1) {
|
||||
PrintAndLogEx(SUCCESS, "Hash algorithm... " _YELLOW_("Unknown"));
|
||||
PrintAndLogEx(INFO, "");
|
||||
} else {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Hash algorithm... " _YELLOW_("%s"), hashalg_table[hash_algo].name);
|
||||
PrintAndLogEx(INFO, "");
|
||||
|
||||
uint8_t all_zeroes[64] = { 0x00 };
|
||||
|
||||
|
||||
@@ -2067,6 +2067,7 @@ uint64_t GetHF14AMfU_Type(void) {
|
||||
uint8_t version[10] = {0x00};
|
||||
int len = ulev1_getVersion(version, sizeof(version));
|
||||
DropField();
|
||||
|
||||
switch (len) {
|
||||
case 0x0A: {
|
||||
/*
|
||||
@@ -2158,6 +2159,7 @@ uint64_t GetHF14AMfU_Type(void) {
|
||||
tagtype = MFU_TT_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
// This is a test from cards that doesn't answer to GET_VERSION command
|
||||
// UL vs UL-C vs NTAG203 vs FUDAN FM11NT021 (which is NTAG213 compatiable)
|
||||
if (tagtype & (MFU_TT_UL | MFU_TT_UL_C | MFU_TT_NTAG_203)) {
|
||||
|
||||
@@ -107,6 +107,37 @@ int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int asn1_get_tag_length(const uint8_t *data, size_t *n, size_t *offset, size_t total_length) {
|
||||
|
||||
if (*offset >= total_length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (data[*offset] & 0x80) {
|
||||
|
||||
// Long form: number of length bytes is indicated by the lower 7 bits
|
||||
size_t len_bytes = data[*offset] & 0x7F;
|
||||
|
||||
*offset += 1;
|
||||
|
||||
if (*offset + len_bytes > total_length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*n = 0;
|
||||
for (size_t i = 0; i < len_bytes; i++) {
|
||||
*n = (*n << 8) | data[*offset];
|
||||
*offset += 1;
|
||||
}
|
||||
} else {
|
||||
// Short form: length is directly represented
|
||||
*n = data[*offset];
|
||||
*offset += 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *hex;
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent);
|
||||
int ecdsa_asn1_get_signature(uint8_t *signature, size_t signaturelen, uint8_t *rval, uint8_t *sval);
|
||||
|
||||
int asn1_get_tag_length(const uint8_t *data, size_t *n, size_t *offset, size_t total_length);
|
||||
int asn1_selftest(void);
|
||||
|
||||
#endif /* asn1utils.h */
|
||||
@@ -1105,7 +1105,9 @@ int loadFileEML_safe(const char *preferredName, void **pdata, size_t *datalen) {
|
||||
|
||||
int loadFileNFC_safe(const char *preferredName, void *data, size_t maxdatalen, size_t *datalen, nfc_df_e ft) {
|
||||
|
||||
if (data == NULL) return PM3_EINVARG;
|
||||
if (data == NULL) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
*datalen = 0;
|
||||
int retval = PM3_SUCCESS;
|
||||
@@ -1137,16 +1139,17 @@ int loadFileNFC_safe(const char *preferredName, void *data, size_t maxdatalen, s
|
||||
memset(line, 0, sizeof(line));
|
||||
|
||||
if (fgets(line, sizeof(line), f) == NULL) {
|
||||
if (feof(f))
|
||||
if (feof(f)) {
|
||||
break;
|
||||
|
||||
}
|
||||
fclose(f);
|
||||
PrintAndLogEx(FAILED, "file reading error");
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
if (line[0] == '#')
|
||||
if (line[0] == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
str_cleanrn(line, sizeof(line));
|
||||
str_lower(line);
|
||||
@@ -2626,6 +2629,7 @@ int detect_nfc_dump_format(const char *preferredName, nfc_df_e *dump_type, bool
|
||||
fclose(f);
|
||||
|
||||
if (verbose) {
|
||||
|
||||
switch (*dump_type) {
|
||||
case NFC_DF_MFU:
|
||||
PrintAndLogEx(INFO, "Detected MIFARE Ultralight / NTAG based dump format");
|
||||
@@ -3107,7 +3111,7 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
||||
break;
|
||||
}
|
||||
case FLIPPER: {
|
||||
nfc_df_e dumptype;
|
||||
nfc_df_e dumptype = NFC_DF_UNKNOWN;
|
||||
res = detect_nfc_dump_format(fn, &dumptype, true);
|
||||
if (res != PM3_SUCCESS) {
|
||||
break;
|
||||
|
||||
@@ -282,8 +282,31 @@ int loadFileDICTIONARYEx(const char *preferredName, void *data, size_t maxdatale
|
||||
*/
|
||||
int loadFileDICTIONARY_safe(const char *preferredName, void **pdata, uint8_t keylen, uint32_t *keycnt);
|
||||
|
||||
/**
|
||||
* @brief Utility function to load data safely from a DICTIONARY textfile. This method takes a preferred name.
|
||||
* E.g. mfc_default_keys.dic
|
||||
*
|
||||
* @param preferredName
|
||||
* @param suffix
|
||||
* @param pdata A pointer to a pointer (for reverencing the loaded dictionary)
|
||||
* @param keylen the number of bytes a key per row is
|
||||
* @param verbose print messages if true
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
int loadFileDICTIONARY_safe_ex(const char *preferredName, const char *suffix, void **pdata, uint8_t keylen, uint32_t *keycnt, bool verbose);
|
||||
|
||||
/**
|
||||
* @brief Utility function to load data from a XML textfile. This method takes a preferred name.
|
||||
* E.g. dumpdata-15.xml
|
||||
*
|
||||
* @param preferredName
|
||||
* @param data The data array to store the loaded bytes from file
|
||||
* @param maxdatalen maximum size of data array in bytes
|
||||
* @param datalen the number of bytes loaded from file
|
||||
* @return 0 for ok, 1 for failz
|
||||
*/
|
||||
int loadFileXML_safe(const char *preferredName, const char *suffix, void **pdata, size_t *datalen);
|
||||
|
||||
int loadFileBinaryKey(const char *preferredName, const char *suffix, void **keya, void **keyb, size_t *alen, size_t *blen);
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user