Merge remote-tracking branch 'origin/master' into emrtd
This commit is contained in:
@@ -704,12 +704,31 @@ function writeFile(bytes, filename)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function getRandomTempName()
|
||||||
|
local upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
local lowerCase = "abcdefghijklmnopqrstuvwxyz"
|
||||||
|
|
||||||
|
local characterSet = upperCase .. lowerCase
|
||||||
|
|
||||||
|
local keyLength = 8
|
||||||
|
local output = ""
|
||||||
|
|
||||||
|
for i = 1, keyLength do
|
||||||
|
local rand = math.random(#characterSet)
|
||||||
|
output = output .. string.sub(characterSet, rand, rand)
|
||||||
|
end
|
||||||
|
|
||||||
|
output = "hf-legic-temp-" .. output
|
||||||
|
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
-- read from pm3 into virtual-tag
|
-- read from pm3 into virtual-tag
|
||||||
function readFromPM3()
|
function readFromPM3()
|
||||||
local tag, bytes, infile
|
local tag, bytes, infile
|
||||||
--infile="legic.temp"
|
--infile="legic.temp"
|
||||||
infile=os.tmpname()
|
infile=getRandomTempName()
|
||||||
core.console("hf legic dump -f "..infile)
|
core.console("hf legic dump -f "..infile)
|
||||||
tag=readFile(infile..".bin")
|
tag=readFile(infile..".bin")
|
||||||
os.remove(infile)
|
os.remove(infile)
|
||||||
|
|||||||
@@ -52,13 +52,15 @@ int CmdHFSearch(const char *Cmd) {
|
|||||||
CLIParserInit(&ctx, "hf search",
|
CLIParserInit(&ctx, "hf search",
|
||||||
"Will try to find a HF read out of the unknown tag.\n"
|
"Will try to find a HF read out of the unknown tag.\n"
|
||||||
"Continues to search for all different HF protocols.",
|
"Continues to search for all different HF protocols.",
|
||||||
"hf sniff"
|
"hf search"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
int res = PM3_ESOFT;
|
int res = PM3_ESOFT;
|
||||||
|
|
||||||
PROMPT_CLEARLINE;
|
PROMPT_CLEARLINE;
|
||||||
|
|||||||
@@ -657,7 +657,8 @@ void print_progress(size_t count, uint64_t max, barMode_t style) {
|
|||||||
"\xe2\x96\x88",
|
"\xe2\x96\x88",
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t mode = session.emoji_mode == EMOJI;
|
uint8_t mode = session.supports_colors;
|
||||||
|
|
||||||
const char *block[] = {"#", "\xe2\x96\x88"};
|
const char *block[] = {"#", "\xe2\x96\x88"};
|
||||||
// use a 3-byte space in emoji mode to ease computations
|
// use a 3-byte space in emoji mode to ease computations
|
||||||
const char *space[] = {" ", "\xe2\x80\x80"};
|
const char *space[] = {" ", "\xe2\x80\x80"};
|
||||||
@@ -704,12 +705,12 @@ void print_progress(size_t count, uint64_t max, barMode_t style) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STYLE_MIXED: {
|
case STYLE_MIXED: {
|
||||||
sprintf(buffer, "%s [ %zu mV / %3u V ]", cbar, count, (uint32_t)(count / 1000));
|
sprintf(buffer, "%s [ %zu mV / %2u V / %2u Vmax ]", cbar, count, (uint32_t)(count / 1000), (uint32_t)(max / 1000));
|
||||||
printf("\b%c[2K\r[" _YELLOW_("=")"] %s ", 27, buffer);
|
printf("\b%c[2K\r[" _YELLOW_("=")"] %s ", 27, buffer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STYLE_VALUE: {
|
case STYLE_VALUE: {
|
||||||
printf("[" _YELLOW_("=")"] %zu mV / %3u V \r", count, (uint32_t)(count / 1000));
|
printf("[" _YELLOW_("=")"] %zu mV / %2u V / %2u Vmax\r", count, (uint32_t)(count / 1000), (uint32_t)(max / 1000));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user