added Ultralight-C simulation. hf mfu sim -t 13. Use eload first. Also added support to upload UL-C dictionaries and UL-AES to spiffs memory. A lot of textual reworked across client. Unifiy texts and a bit more color ;)

This commit is contained in:
iceman1001 committed 2025-06-19 17:26:20 +02:00
1 parent 0e87f01ab9
commit 65607fc727
52 files changed
+1074 -430

No files matched your search

+35 -12
View File
@@ -126,47 +126,67 @@ uint64_t x_bytes_to_num(uint8_t *src, size_t len) {
}
void printarr(const char *name, uint8_t *arr, int len) {
if (name == NULL || arr == NULL) return;
if (name == NULL || arr == NULL) {
return;
}
int cx, i;
size_t outsize = 40 + strlen(name) + len * 5;
char *output = calloc(outsize, sizeof(char));
if (output == NULL) {
PrintAndLogEx(WARNING, "Failed to allocate memory");
return;
}
cx = snprintf(output, outsize, "uint8_t %s[] = {", name);
for (i = 0; i < len; i++) {
if (cx < outsize)
if (cx < outsize) {
cx += snprintf(output + cx, outsize - cx, "0x%02x,", *(arr + i)); //5 bytes per byte
}
}
if (cx < outsize)
if (cx < outsize) {
snprintf(output + cx, outsize - cx, "};");
}
PrintAndLogEx(INFO, output);
free(output);
}
void printarr_human_readable(const char *title, uint8_t *arr, int len) {
if (arr == NULL) return;
if (arr == NULL) {
return;
}
int cx = 0, i;
size_t outsize = 100 + strlen(title) + (len * 4);
char *output = calloc(outsize, sizeof(char));
PrintAndLogEx(INFO, "%s", title);
for (i = 0; i < len; i++) {
if (i % 16 == 0) {
if (i == 0) {
if (cx < outsize)
if (cx < outsize) {
cx += snprintf(output + cx, outsize - cx, "%02x| ", i);
}
} else {
if (cx < outsize)
if (cx < outsize) {
cx += snprintf(output + cx, outsize - cx, "\n%02x| ", i);
}
}
}
if (cx < outsize)
if (cx < outsize) {
cx += snprintf(output + cx, outsize - cx, "%02x ", *(arr + i));
}
}
PrintAndLogEx(INFO, output);
free(output);
@@ -233,11 +253,14 @@ static int testReversedBitstream(void) {
}
int testCipherUtils(void) {
PrintAndLogEx(INFO, "Testing some internals...");
int retval = testBitStream();
if (retval == PM3_SUCCESS)
retval = testReversedBitstream();
return retval;
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "---------------- " _CYAN_("Loclass selftests") " ----------------");
int res = testBitStream();
if (res == PM3_SUCCESS) {
res = testReversedBitstream();
}
return res;
}
#endif