21 lines
702 B
C
21 lines
702 B
C
#include <stdio.h>
|
|
|
|
#include "colors.h"
|
|
|
|
void getSize(FILE *file, int argc, char *argv[]) {
|
|
fseek(file, 0L, SEEK_END);
|
|
long bytes = ftell(file);
|
|
rewind(file); // <== Same as `fseek(file, 0L, SEEK_SET)`;
|
|
if (bytes == 1024) {
|
|
printf("Bytes of %s: %ld\n", argv[argc - 1], bytes);
|
|
puts("This looks like a Mifare Classic 1K dump file");
|
|
} else if (bytes == 4096) {
|
|
printf("Bytes of %s: %ld\n", argv[argc - 1], bytes);
|
|
puts("This lokks like a Mifare Classic 4K dump file");
|
|
} else {
|
|
printf("Bytes of %s: %ld\n", argv[argc - 1], bytes);
|
|
printf(ANSI_COLOR_RED "This doesn't look like a Mifare Classic 1K or 4K at "
|
|
"all\n" ANSI_COLOR_RESET);
|
|
}
|
|
}
|