mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
move oid.json to resources/
This commit is contained in:
parent
af65beb987
commit
5b6af929ab
2 changed files with 7 additions and 13 deletions
|
@ -25,6 +25,8 @@
|
||||||
#include "emv/emvjson.h"
|
#include "emv/emvjson.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "proxmark3.h"
|
#include "proxmark3.h"
|
||||||
|
#include "fileutils.h"
|
||||||
|
#include "pm3_cmd.h"
|
||||||
|
|
||||||
#ifndef PRINT_INDENT
|
#ifndef PRINT_INDENT
|
||||||
# define PRINT_INDENT(level) {for (int myi = 0; myi < (level); myi++) fprintf(f, " ");}
|
# define PRINT_INDENT(level) {for (int myi = 0; myi < (level); myi++) fprintf(f, " ");}
|
||||||
|
@ -235,25 +237,17 @@ static void asn1_tag_dump_integer(const struct tlv *tlv, const struct asn1_tag *
|
||||||
static char *asn1_oid_description(const char *oid, bool with_group_desc) {
|
static char *asn1_oid_description(const char *oid, bool with_group_desc) {
|
||||||
json_error_t error;
|
json_error_t error;
|
||||||
json_t *root = NULL;
|
json_t *root = NULL;
|
||||||
char fname[300] = {0};
|
|
||||||
static char res[300];
|
static char res[300];
|
||||||
memset(res, 0x00, sizeof(res));
|
memset(res, 0x00, sizeof(res));
|
||||||
|
|
||||||
size_t len = strlen(get_my_executable_directory());
|
char *path;
|
||||||
if (len >= 300) len = 299;
|
if (searchFile(&path, RESOURCES_SUBDIR, "oids", ".json") != PM3_SUCCESS) {
|
||||||
|
return NULL;
|
||||||
strncpy(fname, get_my_executable_directory(), len);
|
|
||||||
strcat(fname, "crypto/oids.json");
|
|
||||||
if (access(fname, F_OK) < 0) {
|
|
||||||
strncpy(fname, get_my_executable_directory(), len);
|
|
||||||
strcat(fname, "oids.json");
|
|
||||||
if (access(fname, F_OK) < 0) {
|
|
||||||
goto error; // file not found
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load `oids.json`
|
// load `oids.json`
|
||||||
root = json_load_file(fname, 0, &error);
|
root = json_load_file(path, 0, &error);
|
||||||
|
free(path);
|
||||||
|
|
||||||
if (!root || !json_is_object(root)) {
|
if (!root || !json_is_object(root)) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue