mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
style
This commit is contained in:
parent
cb8bb8d520
commit
2597c7576e
50 changed files with 135 additions and 99 deletions
|
@ -452,6 +452,7 @@ endif
|
||||||
ifeq ($(SWIG_LUA_FOUND),1)
|
ifeq ($(SWIG_LUA_FOUND),1)
|
||||||
PM3CFLAGS += -DHAVE_LUA_SWIG
|
PM3CFLAGS += -DHAVE_LUA_SWIG
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SWIG_PYTHON_FOUND),1)
|
ifeq ($(SWIG_PYTHON_FOUND),1)
|
||||||
PM3CFLAGS += -DHAVE_PYTHON_SWIG
|
PM3CFLAGS += -DHAVE_PYTHON_SWIG
|
||||||
endif
|
endif
|
||||||
|
@ -594,6 +595,7 @@ endif
|
||||||
ifeq ($(SWIG_LUA_FOUND),1)
|
ifeq ($(SWIG_LUA_FOUND),1)
|
||||||
$(info Lua SWIG: wrapper found)
|
$(info Lua SWIG: wrapper found)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(SWIG_PYTHON_FOUND),1)
|
ifeq ($(SWIG_PYTHON_FOUND),1)
|
||||||
$(info Python SWIG: wrapper found)
|
$(info Python SWIG: wrapper found)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -2542,7 +2542,7 @@ FAB943906E9C
|
||||||
# R.A.T.T transport card key A/B
|
# R.A.T.T transport card key A/B
|
||||||
AA034F342A55
|
AA034F342A55
|
||||||
456776908C48
|
456776908C48
|
||||||
|
#
|
||||||
# BusFacil - Brazilian public transport card for some cities
|
# BusFacil - Brazilian public transport card for some cities
|
||||||
fae9b14365a9
|
fae9b14365a9
|
||||||
c567dd4a6004
|
c567dd4a6004
|
||||||
|
|
|
@ -145,7 +145,7 @@ local function readfile()
|
||||||
local f = io.open(ID_STATUS, "r")
|
local f = io.open(ID_STATUS, "r")
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
id = line:match"^(%x+)"
|
id = line:match"^(%x+)"
|
||||||
if id then break end
|
if id then break end
|
||||||
end
|
end
|
||||||
f:close()
|
f:close()
|
||||||
if not id then
|
if not id then
|
||||||
|
|
|
@ -18,7 +18,7 @@ desc = [[
|
||||||
is found, it uses the wipe command to erase the T5577. Then the reanimation
|
is found, it uses the wipe command to erase the T5577. Then the reanimation
|
||||||
procedure is applied. If the password is not found or doesn't exist the script
|
procedure is applied. If the password is not found or doesn't exist the script
|
||||||
only performs the reanimation procedure. The script revives 99% of blocked tags.
|
only performs the reanimation procedure. The script revives 99% of blocked tags.
|
||||||
]]
|
]]
|
||||||
usage = [[
|
usage = [[
|
||||||
script run lf_t55xx_fix
|
script run lf_t55xx_fix
|
||||||
]]
|
]]
|
||||||
|
@ -87,7 +87,7 @@ local function reanimate_t5577(password)
|
||||||
p:console('lf t55 wipe -p ' .. password)
|
p:console('lf t55 wipe -p ' .. password)
|
||||||
print("T5577 wiped using a password: " ..ac.green.. password ..ac.reset)
|
print("T5577 wiped using a password: " ..ac.green.. password ..ac.reset)
|
||||||
else
|
else
|
||||||
print(ac.yellow.."No valid password found, proceeding with reanimation."..ac.reset)
|
print(ac.yellow.." No valid password found, proceeding with reanimation."..ac.reset)
|
||||||
end
|
end
|
||||||
|
|
||||||
p:console('lf t55 write -b 0 -d 000880E8 -p 00000000')
|
p:console('lf t55 write -b 0 -d 000880E8 -p 00000000')
|
||||||
|
|
|
@ -3073,7 +3073,7 @@ plot:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
if (verbose && found == false) {
|
if (verbose && found == false) {
|
||||||
PrintAndLogEx(FAILED, "no ISO 14443-B tag found");
|
PrintAndLogEx(FAILED, "no ISO 14443-B tag found");
|
||||||
|
|
|
@ -232,8 +232,7 @@ int readHFCryptoRF(bool loop, bool verbose) {
|
||||||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex_inrow(card.uid, card.uidlen));
|
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex_inrow(card.uid, card.uidlen));
|
||||||
set_last_known_card(card);
|
set_last_known_card(card);
|
||||||
}
|
}
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
DropField();
|
DropField();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ int read_felica_uid(bool loop, bool verbose) {
|
||||||
res = PM3_SUCCESS;
|
res = PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
DropField();
|
DropField();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -199,7 +199,7 @@ int read_fudan_uid(bool loop, bool verbose) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
@ -438,7 +438,7 @@ int reader_lto(bool loop, bool verbose) {
|
||||||
PrintAndLogEx(INFO, "UID......... " _GREEN_("%s"), sprint_hex_inrow(serial, sizeof(serial)));
|
PrintAndLogEx(INFO, "UID......... " _GREEN_("%s"), sprint_hex_inrow(serial, sizeof(serial)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
lto_switch_off_field();
|
lto_switch_off_field();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -623,7 +623,7 @@ int read_texkom_uid(bool loop, bool verbose) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ static int topaz_select(uint8_t *atqa, uint8_t atqa_len, uint8_t *rid_response,
|
||||||
}
|
}
|
||||||
|
|
||||||
// read all of the static memory of a selected Topaz tag.
|
// read all of the static memory of a selected Topaz tag.
|
||||||
static int topaz_rall(uint8_t *uid, uint8_t *response) {
|
static int topaz_rall(const uint8_t *uid, uint8_t *response) {
|
||||||
|
|
||||||
uint16_t resp_len = 124;
|
uint16_t resp_len = 124;
|
||||||
uint8_t rall_cmd[] = {TOPAZ_RALL, 0, 0, 0, 0, 0, 0, 0, 0};
|
uint8_t rall_cmd[] = {TOPAZ_RALL, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
@ -1180,7 +1180,7 @@ int readTopazUid(bool loop, bool verbose) {
|
||||||
topaz_tag.HR01[0] = rid_response[0];
|
topaz_tag.HR01[0] = rid_response[0];
|
||||||
topaz_tag.HR01[1] = rid_response[1];
|
topaz_tag.HR01[1] = rid_response[1];
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
topaz_switch_off_field();
|
topaz_switch_off_field();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -593,7 +593,7 @@ int read_xerox_uid(bool loop, bool verbose) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop && kbd_enter_pressed() == false);
|
} while (loop && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int CmdDestronReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 16000);
|
lf_read(false, 16000);
|
||||||
demodDestron(!cm);
|
demodDestron(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -692,7 +692,7 @@ static int CmdFdxBReader(const char *Cmd) {
|
||||||
lf_read(false, 10000);
|
lf_read(false, 10000);
|
||||||
ret = demodFDXB(!cm); // be verbose only if not in continuous mode
|
ret = demodFDXB(!cm); // be verbose only if not in continuous mode
|
||||||
|
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
|
|
||||||
if (old_div != curr_div) {
|
if (old_div != curr_div) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ static int CmdGallagherReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 4096 * 2 + 20);
|
lf_read(false, 4096 * 2 + 20);
|
||||||
demodGallagher(!cm);
|
demodGallagher(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -968,7 +968,7 @@ static int CmdLFHitagSReader(const char *Cmd) {
|
||||||
if (hts_get_uid(&uid)) {
|
if (hts_get_uid(&uid)) {
|
||||||
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
|
PrintAndLogEx(SUCCESS, "UID.... " _GREEN_("%08X"), uid);
|
||||||
}
|
}
|
||||||
} while (cm && kbd_enter_pressed() == false);
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,7 @@ static int CmdIdteckReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 5000);
|
lf_read(false, 5000);
|
||||||
demodIdteck(NULL, !cm);
|
demodIdteck(NULL, !cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -632,7 +632,7 @@ static int CmdIndalaReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 30000);
|
lf_read(false, 30000);
|
||||||
demodIndalaEx(clk, invert, max_err, !cm);
|
demodIndalaEx(clk, invert, max_err, !cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm & (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ static int CmdIOProxReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 12000);
|
lf_read(false, 12000);
|
||||||
demodIOProx(!cm);
|
demodIOProx(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ static int CmdJablotronReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 16000);
|
lf_read(false, 16000);
|
||||||
demodJablotron(!cm);
|
demodJablotron(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ static int CmdKeriReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 10000);
|
lf_read(false, 10000);
|
||||||
demodKeri(!cm);
|
demodKeri(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ static int CmdMotorolaReader(const char *Cmd) {
|
||||||
// 64 * 32 * 2 * n-ish
|
// 64 * 32 * 2 * n-ish
|
||||||
lf_read(false, 5000);
|
lf_read(false, 5000);
|
||||||
res = demodMotorola(!cm);
|
res = demodMotorola(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
// reset back to 125 kHz
|
// reset back to 125 kHz
|
||||||
sc.divisor = LF_DIVISOR_125;
|
sc.divisor = LF_DIVISOR_125;
|
||||||
|
|
|
@ -296,7 +296,7 @@ static int CmdLFNedapReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 16000);
|
lf_read(false, 16000);
|
||||||
demodNedap(!cm);
|
demodNedap(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,7 +287,7 @@ static int CmdNexWatchReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 20000);
|
lf_read(false, 20000);
|
||||||
demodNexWatch(!cm);
|
demodNexWatch(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ static int CmdNoralsyReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 8000);
|
lf_read(false, 8000);
|
||||||
demodNoralsy(!cm);
|
demodNoralsy(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ static int CmdPacReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 4096 * 2 + 20);
|
lf_read(false, 4096 * 2 + 20);
|
||||||
demodPac(!cm);
|
demodPac(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ static int CmdParadoxReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 10000);
|
lf_read(false, 10000);
|
||||||
demodParadox(!cm, old);
|
demodParadox(!cm, old);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ static int CmdLFPCF7931Reader(const char *Cmd) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ static int CmdPrescoReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 12000);
|
lf_read(false, 12000);
|
||||||
demodPresco(!cm);
|
demodPresco(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ static int CmdPyramidReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 15000);
|
lf_read(false, 15000);
|
||||||
demodPyramid(true);
|
demodPyramid(true);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ static int CmdSecurakeyReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 8000);
|
lf_read(false, 8000);
|
||||||
demodSecurakey(!cm);
|
demodSecurakey(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ static int CmdTIReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_TI_READ, NULL, 0);
|
SendCommandNG(CMD_LF_TI_READ, NULL, 0);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ static int CmdVikingReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 10000);
|
lf_read(false, 10000);
|
||||||
demodViking(true);
|
demodViking(true);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ static int CmdVisa2kReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_read(false, 20000);
|
lf_read(false, 20000);
|
||||||
demodVisa2k(!cm);
|
demodVisa2k(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ static int CmdzxReader(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
lf_Zx_read();
|
lf_Zx_read();
|
||||||
demodzx(!cm);
|
demodzx(!cm);
|
||||||
} while (cm && !kbd_enter_pressed());
|
} while (cm && (kbd_enter_pressed() == false));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,17 @@
|
||||||
#include "util_posix.h" // time
|
#include "util_posix.h" // time
|
||||||
#include "fileutils.h"
|
#include "fileutils.h"
|
||||||
|
|
||||||
|
|
||||||
#define MQTT_BUFFER_SIZE ( 1 << 16 )
|
#define MQTT_BUFFER_SIZE ( 1 << 16 )
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static void mqtt_publish_callback(void **unused, struct mqtt_response_publish *published) {
|
static void mqtt_publish_callback(void **unused, struct mqtt_response_publish *published) {
|
||||||
|
|
||||||
|
if (published == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// note that published->topic_name is NOT null-terminated (here we'll change it to a c-string)
|
// note that published->topic_name is NOT null-terminated (here we'll change it to a c-string)
|
||||||
char *topic_name = (char *) calloc(published->topic_name_size + 1, 1);
|
char *topic_name = (char *) calloc(published->topic_name_size + 1, 1);
|
||||||
memcpy(topic_name, published->topic_name, published->topic_name_size);
|
memcpy(topic_name, published->topic_name, published->topic_name_size);
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ static int CmdPCSC(const char *Cmd) {
|
||||||
msleep(300);
|
msleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (!kbd_enter_pressed());
|
} while (kbd_enter_pressed() == false);
|
||||||
|
|
||||||
mbedtls_net_close(&netCtx);
|
mbedtls_net_close(&netCtx);
|
||||||
mbedtls_net_free(&netCtx);
|
mbedtls_net_free(&netCtx);
|
||||||
|
|
|
@ -89,6 +89,8 @@ DumpFileType_t get_filetype(const char *filename) {
|
||||||
o = FLIPPER;
|
o = FLIPPER;
|
||||||
} else if (str_endswith(s, "picopass")) {
|
} else if (str_endswith(s, "picopass")) {
|
||||||
o = FLIPPER;
|
o = FLIPPER;
|
||||||
|
} else if (str_endswith(s, "xml")) {
|
||||||
|
o = TAGINFO;
|
||||||
} else {
|
} else {
|
||||||
// mfd, trc, trace is binary
|
// mfd, trc, trace is binary
|
||||||
o = BIN;
|
o = BIN;
|
||||||
|
@ -3323,6 +3325,10 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TAGINFO: {
|
||||||
|
//res = loadFileXML_safe(fn, ".xml", pdump, dumplen);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ typedef enum {
|
||||||
DICTIONARY,
|
DICTIONARY,
|
||||||
MCT,
|
MCT,
|
||||||
FLIPPER,
|
FLIPPER,
|
||||||
|
TAGINFO,
|
||||||
} DumpFileType_t;
|
} DumpFileType_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -39,31 +39,36 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool uart_bind(void *socket, const char *bindAddrStr, const char *bindPortStr, bool isBindingIPv6) {
|
bool uart_bind(void *socket, const char *bindAddrStr, const char *bindPortStr, bool isBindingIPv6) {
|
||||||
if (bindAddrStr == NULL && bindPortStr == NULL)
|
if (bindAddrStr == NULL && bindPortStr == NULL) {
|
||||||
return true; // no need to bind
|
return true; // no need to bind
|
||||||
|
}
|
||||||
|
|
||||||
struct sockaddr_storage bindSockaddr;
|
struct sockaddr_storage bindSockaddr;
|
||||||
memset(&bindSockaddr, 0, sizeof(bindSockaddr));
|
memset(&bindSockaddr, 0, sizeof(bindSockaddr));
|
||||||
int bindPort = 0; // 0: port unspecified
|
int bindPort = 0; // 0: port unspecified
|
||||||
if (bindPortStr != NULL)
|
if (bindPortStr != NULL) {
|
||||||
bindPort = atoi(bindPortStr);
|
bindPort = atoi(bindPortStr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isBindingIPv6) {
|
if (isBindingIPv6 == false) {
|
||||||
struct sockaddr_in *bindSockaddr4 = (struct sockaddr_in *)&bindSockaddr;
|
struct sockaddr_in *bindSockaddr4 = (struct sockaddr_in *)&bindSockaddr;
|
||||||
bindSockaddr4->sin_family = AF_INET;
|
bindSockaddr4->sin_family = AF_INET;
|
||||||
bindSockaddr4->sin_port = htons(bindPort);
|
bindSockaddr4->sin_port = htons(bindPort);
|
||||||
if (bindAddrStr == NULL)
|
if (bindAddrStr == NULL) {
|
||||||
bindSockaddr4->sin_addr.s_addr = INADDR_ANY;
|
bindSockaddr4->sin_addr.s_addr = INADDR_ANY;
|
||||||
else
|
} else {
|
||||||
bindSockaddr4->sin_addr.s_addr = inet_addr(bindAddrStr);
|
bindSockaddr4->sin_addr.s_addr = inet_addr(bindAddrStr);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
struct sockaddr_in6 *bindSockaddr6 = (struct sockaddr_in6 *)&bindSockaddr;
|
struct sockaddr_in6 *bindSockaddr6 = (struct sockaddr_in6 *)&bindSockaddr;
|
||||||
bindSockaddr6->sin6_family = AF_INET6;
|
bindSockaddr6->sin6_family = AF_INET6;
|
||||||
bindSockaddr6->sin6_port = htons(bindPort);
|
bindSockaddr6->sin6_port = htons(bindPort);
|
||||||
if (bindAddrStr == NULL)
|
if (bindAddrStr == NULL) {
|
||||||
bindSockaddr6->sin6_addr = in6addr_any;
|
bindSockaddr6->sin6_addr = in6addr_any;
|
||||||
else
|
} else {
|
||||||
inet_pton(AF_INET6, bindAddrStr, &(bindSockaddr6->sin6_addr));
|
inet_pton(AF_INET6, bindAddrStr, &(bindSockaddr6->sin6_addr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int res = bind(*(SOCKET *)socket, (struct sockaddr *)&bindSockaddr, sizeof(bindSockaddr));
|
int res = bind(*(SOCKET *)socket, (struct sockaddr *)&bindSockaddr, sizeof(bindSockaddr));
|
||||||
|
|
|
@ -73,6 +73,7 @@ int kbd_enter_pressed(void) {
|
||||||
c = getchar();
|
c = getchar();
|
||||||
ret |= c == '\n';
|
ret |= c == '\n';
|
||||||
} while (c != EOF);
|
} while (c != EOF);
|
||||||
|
|
||||||
//blocking
|
//blocking
|
||||||
flags &= ~O_NONBLOCK;
|
flags &= ~O_NONBLOCK;
|
||||||
if (fcntl(STDIN_FILENO, F_SETFL, flags) < 0) {
|
if (fcntl(STDIN_FILENO, F_SETFL, flags) < 0) {
|
||||||
|
|
|
@ -27,12 +27,14 @@ static CrcType_t current_crc_type = CRC_NONE;
|
||||||
void init_table(CrcType_t crctype) {
|
void init_table(CrcType_t crctype) {
|
||||||
|
|
||||||
// same crc algo, and initialised already
|
// same crc algo, and initialised already
|
||||||
if (crctype == current_crc_type && crc_table_init)
|
if (crctype == current_crc_type && crc_table_init) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// not the same crc algo. reset table.
|
// not the same crc algo. reset table.
|
||||||
if (crctype != current_crc_type)
|
if (crctype != current_crc_type) {
|
||||||
reset_table();
|
reset_table();
|
||||||
|
}
|
||||||
|
|
||||||
current_crc_type = crctype;
|
current_crc_type = crctype;
|
||||||
|
|
||||||
|
@ -68,23 +70,29 @@ void init_table(CrcType_t crctype) {
|
||||||
void generate_table(uint16_t polynomial, bool refin) {
|
void generate_table(uint16_t polynomial, bool refin) {
|
||||||
|
|
||||||
for (uint16_t i = 0; i < 256; i++) {
|
for (uint16_t i = 0; i < 256; i++) {
|
||||||
|
|
||||||
uint16_t c, crc = 0;
|
uint16_t c, crc = 0;
|
||||||
if (refin)
|
|
||||||
|
if (refin) {
|
||||||
c = reflect8(i) << 8;
|
c = reflect8(i) << 8;
|
||||||
else
|
} else {
|
||||||
c = i << 8;
|
c = i << 8;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint16_t j = 0; j < 8; j++) {
|
for (uint16_t j = 0; j < 8; j++) {
|
||||||
|
|
||||||
if ((crc ^ c) & 0x8000)
|
if ((crc ^ c) & 0x8000) {
|
||||||
crc = (crc << 1) ^ polynomial;
|
crc = (crc << 1) ^ polynomial;
|
||||||
else
|
} else {
|
||||||
crc = crc << 1;
|
crc = crc << 1;
|
||||||
|
}
|
||||||
|
|
||||||
c = c << 1;
|
c = c << 1;
|
||||||
}
|
}
|
||||||
if (refin)
|
|
||||||
|
if (refin) {
|
||||||
crc = reflect16(crc);
|
crc = reflect16(crc);
|
||||||
|
}
|
||||||
|
|
||||||
crc_table[i] = crc;
|
crc_table[i] = crc;
|
||||||
}
|
}
|
||||||
|
@ -102,21 +110,25 @@ uint16_t crc16_fast(uint8_t const *d, size_t n, uint16_t initval, bool refin, bo
|
||||||
|
|
||||||
// fast lookup table algorithm without augmented zero bytes, e.g. used in pkzip.
|
// fast lookup table algorithm without augmented zero bytes, e.g. used in pkzip.
|
||||||
// only usable with polynom orders of 8, 16, 24 or 32.
|
// only usable with polynom orders of 8, 16, 24 or 32.
|
||||||
if (n == 0)
|
if (n == 0) {
|
||||||
return (~initval);
|
return (~initval);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t crc = initval;
|
uint16_t crc = initval;
|
||||||
|
|
||||||
if (refin)
|
if (refin) {
|
||||||
crc = reflect16(crc);
|
crc = reflect16(crc);
|
||||||
|
}
|
||||||
|
|
||||||
if (!refin)
|
if (refin == false) {
|
||||||
while (n--) crc = (crc << 8) ^ crc_table[((crc >> 8) ^ *d++) & 0xFF ];
|
while (n--) crc = (crc << 8) ^ crc_table[((crc >> 8) ^ *d++) & 0xFF ];
|
||||||
else
|
} else {
|
||||||
while (n--) crc = (crc >> 8) ^ crc_table[(crc & 0xFF) ^ *d++];
|
while (n--) crc = (crc >> 8) ^ crc_table[(crc & 0xFF) ^ *d++];
|
||||||
|
}
|
||||||
|
|
||||||
if (refout ^ refin)
|
if (refout ^ refin) {
|
||||||
crc = reflect16(crc);
|
crc = reflect16(crc);
|
||||||
|
}
|
||||||
|
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
@ -143,8 +155,9 @@ uint16_t update_crc16(uint16_t crc, uint8_t c) {
|
||||||
|
|
||||||
// two ways. msb or lsb loop.
|
// two ways. msb or lsb loop.
|
||||||
uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t polynomial, bool refin, bool refout) {
|
uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t polynomial, bool refin, bool refout) {
|
||||||
if (bitlength == 0)
|
if (bitlength == 0) {
|
||||||
return (~remainder);
|
return (~remainder);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t offset = 8 - (bitlength % 8);
|
uint8_t offset = 8 - (bitlength % 8);
|
||||||
// front padding with 0s won't change the CRC result
|
// front padding with 0s won't change the CRC result
|
||||||
|
@ -153,7 +166,9 @@ uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t
|
||||||
uint8_t c = prebits | d[i] >> offset;
|
uint8_t c = prebits | d[i] >> offset;
|
||||||
prebits = d[i] << (8 - offset);
|
prebits = d[i] << (8 - offset);
|
||||||
|
|
||||||
if (refin) c = reflect8(c);
|
if (refin) {
|
||||||
|
c = reflect8(c);
|
||||||
|
}
|
||||||
|
|
||||||
// xor in at msb
|
// xor in at msb
|
||||||
remainder ^= (c << 8);
|
remainder ^= (c << 8);
|
||||||
|
@ -167,8 +182,10 @@ uint16_t Crc16(uint8_t const *d, size_t bitlength, uint16_t remainder, uint16_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refout)
|
|
||||||
|
if (refout) {
|
||||||
remainder = reflect16(remainder);
|
remainder = reflect16(remainder);
|
||||||
|
}
|
||||||
|
|
||||||
return remainder;
|
return remainder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12363,7 +12363,7 @@
|
||||||
"--addr <str> MQTT server address",
|
"--addr <str> MQTT server address",
|
||||||
"-p, --port <str> MQTT server port",
|
"-p, --port <str> MQTT server port",
|
||||||
"--topic <str> MQTT topic",
|
"--topic <str> MQTT topic",
|
||||||
"-f, --file <fn> file to send"
|
"-f, --file <fn> file name to use for received files"
|
||||||
],
|
],
|
||||||
"usage": "mqtt receive [-h] [--addr <str>] [-p <str>] [--topic <str>] [-f <fn>]"
|
"usage": "mqtt receive [-h] [--addr <str>] [-p <str>] [--topic <str>] [-f <fn>]"
|
||||||
},
|
},
|
||||||
|
@ -13413,6 +13413,6 @@
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"commands_extracted": 770,
|
"commands_extracted": 770,
|
||||||
"extracted_by": "PM3Help2JSON v1.00",
|
"extracted_by": "PM3Help2JSON v1.00",
|
||||||
"extracted_on": "2025-07-08T19:08:23"
|
"extracted_on": "2025-07-10T05:07:28"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue