cmdwiegand: add option to brute-force hex input length
This commit is contained in:
1 parent
5b8bd31d17
commit
75ba4e97b1
2 files changed
+30
-1
No files matched your search
@@ -165,6 +165,7 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||
arg_str0("r", "raw", "<hex>", "raw hex to be decoded"),
|
||||
arg_str0("b", "bin", "<bin>", "binary string to be decoded"),
|
||||
arg_str0("n", "new", "<hex>", "new padded pacs as raw hex to be decoded"),
|
||||
arg_lit0("f", "force", "skip preabmle checking, brute force all possible lengths for raw hex input"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
@@ -180,6 +181,8 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||
uint8_t phex[8] = {0};
|
||||
res = CLIParamHexToBuf(arg_get_str(ctx, 3), phex, sizeof(phex), &plen);
|
||||
|
||||
bool no_preamble = arg_get_lit(ctx, 4);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (res) {
|
||||
@@ -195,6 +198,12 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||
PrintAndLogEx(ERR, "Hex string contains none hex chars");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if(no_preamble){
|
||||
// pass hex input length as is and brute force all possible lengths
|
||||
blen = -hlen;
|
||||
}
|
||||
|
||||
} else if (blen) {
|
||||
int n = binarray_to_u96(&top, &mid, &bot, binarr, blen);
|
||||
if (n != blen) {
|
||||
|
||||
Reference in new issue
Block a user