proxmark3
proxmark3 copied to clipboard
[idea] implement json/bin everywhere
Is your feature request related to a problem? Please describe. As of now only parts of the commands has implemented BIN/JSON formats.
Describe the solution you'd like All commands that involves files, should support BIN/JSON formats.
Describe alternatives you've considered as an alternative, lua scripts can be made. No more python scripts.
Additional context All formats we support helps when other tools needs to import/export from a proxmark generated file. Today we have Chameleon Mini GUI, MCT tool interoperability, and hopefully also Project Walrus in the near future.
Need a list on which more places the client is creating files in order to cover all cases.
Some rg
magic @doegox ?
read/write:
rg fopen
write/append:
rg 'fopen.*"[aw]'
Excellent!
rg 'fopen'|egrep -v "(mbedtls|zlib|liblua|fpga|tinycbo|whereami|armsrc|hitag2crack|deprecated|fileutils|jansson|reveng)"
I don't know why but there are files created and read a little bit everywhere. In the dependencies its not much to do about it. Currently these left to convert to use fileutils.c,
// these two are the "data load" command
client/src/cmddata.c: f = fopen(path, "rb");
client/src/cmddata.c: f = fopen(path, "r");
// load UID's from a txt file
client/src/cmdlfem410x.c: if ((f = fopen(filename, "r")) == NULL) {
// load python script file
client/src/cmdscript.c: FILE *f = fopen(script_path, "r");
client/src/flash.c: fd = fopen(ctx->filename, "rb");
// open handler for each command script files
client/src/proxmark3.c: FILE *f = fopen(path, "r");
// proxmark3 client log file append writing to text file
client/src/ui.c: logfile = fopen(my_logfile_path, "a");
// load CA Public Key from text file
client/src/emv/emv_pk.c: FILE *f = fopen(fname, "r");
client/src/cmdhfmfhard.c: FILE *statesfile = fopen(path, "rb");
client/src/cmdhfmfhard.c: if ((fnonces = fopen(filename, "rb")) == NULL) {
client/src/cmdhfmfhard.c: if ((fnonces = fopen(filename, "wb")) == NULL) {
client/src/cmdhfmfhard.c: if ((fstats = fopen("hardnested_stats.txt", "a")) == NULL) {
client/deps/hardnested/hardnested_tables.c: FILE *outfile = fopen(filename, "wb");
client/deps/hardnested/hardnested_bruteforce.c: FILE *benchfile = fopen(RESOURCES_SUBDIR TEST_BENCH_FILENAME, "wb");
client/deps/hardnested/hardnested_bruteforce.c: FILE *benchfile = fopen(path, "rb");
// ignore these
client/deps/amiitool/amiitool.c: f = fopen(infile, "rb");
client/deps/amiitool/amiitool.c: f = fopen(savefile, "rb");
client/deps/amiitool/amiitool.c: f = fopen(outfile, "wb");
// ignore, inside a comment section
client/src/cmdlfhitag.c: f = fopen(filename, "wb");
TODO:
- [x] convert to use fileutils.c for load
- [x] convert to use fileutils.c for save
- [x] convert cli commands to take any bin/json files via auto detect.
I realize two different things being discussed in here.
- bin/json support in all commands that handles dumps
- read/write to be centralized into fileutils.c, instead of having custom file access across the pm3 client.
For 1, haven't checked which commands that still doesn't accept it.
For 2. some might fit into fileutils.c direct, then we have generic binary files written / saved which would demand re-writing those fcts.
MFU commands now fully support bin/json format.
all relevant Legic commands now supports bin/json