mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
style
This commit is contained in:
parent
02d861d304
commit
c55b4d5aac
3 changed files with 45 additions and 45 deletions
|
|
@ -167,8 +167,8 @@ static int CmdHIDWatch(const char *Cmd) {
|
||||||
"Enables HID compatible reader mode printing details.\n"
|
"Enables HID compatible reader mode printing details.\n"
|
||||||
"By default, values are printed and logged until the button is pressed or another USB command is issued.\n",
|
"By default, values are printed and logged until the button is pressed or another USB command is issued.\n",
|
||||||
"lf hid watch"
|
"lf hid watch"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_param_end
|
arg_param_end
|
||||||
|
|
@ -198,8 +198,8 @@ static int CmdHIDSim(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "lf hid sim",
|
CLIParserInit(&ctx, "lf hid sim",
|
||||||
"Enables simulation of HID card with card number.",
|
"Enables simulation of HID card with card number.",
|
||||||
"lf hid sim 2006ec0c86"
|
"lf hid sim 2006ec0c86"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("l", "long", "Simulate HID tag with long ID"),
|
arg_lit0("l", "long", "Simulate HID tag with long ID"),
|
||||||
|
|
@ -215,7 +215,7 @@ static int CmdHIDSim(const char *Cmd) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if (long_id) {
|
if (long_id) {
|
||||||
for (i=0; i < idlen; ++i) {
|
for (i = 0; i < idlen; ++i) {
|
||||||
hi2 = (hi2 << 4) | (hi >> 28);
|
hi2 = (hi2 << 4) | (hi >> 28);
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
||||||
|
|
@ -227,7 +227,7 @@ static int CmdHIDSim(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Simulating HID tag with long ID: " _GREEN_("%x%08x%08x"), hi2, hi, lo);
|
PrintAndLogEx(INFO, "Simulating HID tag with long ID: " _GREEN_("%x%08x%08x"), hi2, hi, lo);
|
||||||
payload.longFMT = 1;
|
payload.longFMT = 1;
|
||||||
} else {
|
} else {
|
||||||
for (i=0; i < idlen; ++i) {
|
for (i = 0; i < idlen; ++i) {
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
||||||
|
|
||||||
|
|
@ -266,8 +266,8 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
"Clone HID to T55x7. Tag must be on antenna!",
|
"Clone HID to T55x7. Tag must be on antenna!",
|
||||||
"lf hid clone 2006ec0c86\n"
|
"lf hid clone 2006ec0c86\n"
|
||||||
"lf hid clone -l 2006ec0c86"
|
"lf hid clone -l 2006ec0c86"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("l", "long", "84bit HID long ID"),
|
arg_lit0("l", "long", "84bit HID long ID"),
|
||||||
|
|
@ -285,7 +285,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
uint8_t longid[1] = {0};
|
uint8_t longid[1] = {0};
|
||||||
|
|
||||||
if (long_id) {
|
if (long_id) {
|
||||||
for (i=0; i < idlen; ++i) {
|
for (i = 0; i < idlen; ++i) {
|
||||||
hi2 = (hi2 << 4) | (hi >> 28);
|
hi2 = (hi2 << 4) | (hi >> 28);
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
||||||
|
|
@ -298,7 +298,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
|
|
||||||
longid[0] = 1;
|
longid[0] = 1;
|
||||||
} else {
|
} else {
|
||||||
for (i=0; i < idlen; ++i) {
|
for (i = 0; i < idlen; ++i) {
|
||||||
hi = (hi << 4) | (lo >> 28);
|
hi = (hi << 4) | (lo >> 28);
|
||||||
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
lo = (lo << 4) | (id[i] >> 4); //get first 4 bits
|
||||||
|
|
||||||
|
|
@ -350,8 +350,8 @@ static int CmdHIDBrute(const char *Cmd) {
|
||||||
"lf hid brute -w H10301 -f 224\n"
|
"lf hid brute -w H10301 -f 224\n"
|
||||||
"lf hid brute -w H10301 -f 21 -d 2000\n"
|
"lf hid brute -w H10301 -f 21 -d 2000\n"
|
||||||
"lf hid brute -v -w H10301 -f 21 -c 200 -d 2000\n"
|
"lf hid brute -v -w H10301 -f 21 -c 200 -d 2000\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("v", "verbose", "verbose logging, show all tries"),
|
arg_lit0("v", "verbose", "verbose logging, show all tries"),
|
||||||
|
|
@ -360,18 +360,18 @@ static int CmdHIDBrute(const char *Cmd) {
|
||||||
arg_int0("c", "cn", "dec", "card number to start with"),
|
arg_int0("c", "cn", "dec", "card number to start with"),
|
||||||
arg_int0("i", NULL, "dec", "issue level"),
|
arg_int0("i", NULL, "dec", "issue level"),
|
||||||
arg_int0("o", "oem", "dec", "OEM code"),
|
arg_int0("o", "oem", "dec", "OEM code"),
|
||||||
arg_int0("d", "delay", "dec", "delay betweens attempts in ms. Default 1000ms"),
|
arg_int0("d", "delay", "dec", "delay betweens attempts in ms. Default 1000ms"),
|
||||||
arg_lit0(NULL, "up", "direction to increment card number. (default is both directions)"),
|
arg_lit0(NULL, "up", "direction to increment card number. (default is both directions)"),
|
||||||
arg_lit0(NULL, "down", "direction to decrement card number. (default is both directions)"),
|
arg_lit0(NULL, "down", "direction to decrement card number. (default is both directions)"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
|
||||||
bool verbose = arg_get_lit(ctx, 1);
|
bool verbose = arg_get_lit(ctx, 1);
|
||||||
|
|
||||||
CLIGetStrWithReturn(ctx, 2, format, &formatLen);
|
CLIGetStrWithReturn(ctx, 2, format, &formatLen);
|
||||||
|
|
||||||
format_idx = HIDFindCardFormat((char*) format);
|
format_idx = HIDFindCardFormat((char *) format);
|
||||||
if (format_idx == -1) {
|
if (format_idx == -1) {
|
||||||
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
|
PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ static int CmdKeriRead(const char *Cmd) {
|
||||||
static int CmdKeriClone(const char *Cmd) {
|
static int CmdKeriClone(const char *Cmd) {
|
||||||
|
|
||||||
bool q5 = false;
|
bool q5 = false;
|
||||||
|
|
||||||
uint8_t keritype[2] = {'i'}; // default to internalid
|
uint8_t keritype[2] = {'i'}; // default to internalid
|
||||||
int typeLen = 0;
|
int typeLen = 0;
|
||||||
uint32_t fc = 0;
|
uint32_t fc = 0;
|
||||||
|
|
@ -213,14 +213,14 @@ static int CmdKeriClone(const char *Cmd) {
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("q", "q5", "specify writing to Q5/T5555 tag"),
|
arg_lit0("q", "q5", "specify writing to Q5/T5555 tag"),
|
||||||
arg_str0("t", "type", "<m|i>", "Type m - MS, i - Internal ID"),
|
arg_str0("t", "type", "<m|i>", "Type m - MS, i - Internal ID"),
|
||||||
arg_int0(NULL, "fc", "<dec>", "Facility Code"),
|
arg_int0(NULL, "fc", "<dec>", "Facility Code"),
|
||||||
arg_int1(NULL, "id", "<dec>", "Keri ID"),
|
arg_int1(NULL, "id", "<dec>", "Keri ID"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
|
||||||
if (arg_get_lit(ctx, 1)) {
|
if (arg_get_lit(ctx, 1)) {
|
||||||
blocks[0] = T5555_FIXED | T5555_MODULATION_PSK1 | T5555_SET_BITRATE(32) | T5555_PSK_RF_2 | 2 << T5555_MAXBLOCK_SHIFT;
|
blocks[0] = T5555_FIXED | T5555_MODULATION_PSK1 | T5555_SET_BITRATE(32) | T5555_PSK_RF_2 | 2 << T5555_MAXBLOCK_SHIFT;
|
||||||
q5 = true;
|
q5 = true;
|
||||||
|
|
@ -268,8 +268,8 @@ static int CmdKeriSim(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "lf keri sim",
|
CLIParserInit(&ctx, "lf keri sim",
|
||||||
"Enables simulation of KERI card with card number.",
|
"Enables simulation of KERI card with card number.",
|
||||||
"lf keri sim --id 112233"
|
"lf keri sim --id 112233"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_int1(NULL, "id", "<dec>", "KERI Internal ID"),
|
arg_int1(NULL, "id", "<dec>", "KERI Internal ID"),
|
||||||
|
|
@ -280,7 +280,7 @@ static int CmdKeriSim(const char *Cmd) {
|
||||||
uint64_t internalid = arg_get_int_def(ctx, 1, 0);
|
uint64_t internalid = arg_get_int_def(ctx, 1, 0);
|
||||||
|
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
internalid |= 0x80000000;
|
internalid |= 0x80000000;
|
||||||
internalid <<= 3;
|
internalid <<= 3;
|
||||||
internalid += 7;
|
internalid += 7;
|
||||||
|
|
|
||||||
|
|
@ -26,30 +26,30 @@
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
static void print_wiegand_code(wiegand_message_t *packed) {
|
static void print_wiegand_code(wiegand_message_t *packed) {
|
||||||
const char* s = "Encoded wiegand: ";
|
const char *s = "Encoded wiegand: ";
|
||||||
if (packed->Top != 0) {
|
if (packed->Top != 0) {
|
||||||
PrintAndLogEx(SUCCESS, "%s" _GREEN_("%X%08X%08X"),
|
PrintAndLogEx(SUCCESS, "%s" _GREEN_("%X%08X%08X"),
|
||||||
s,
|
s,
|
||||||
(uint32_t)packed->Top,
|
(uint32_t)packed->Top,
|
||||||
(uint32_t)packed->Mid,
|
(uint32_t)packed->Mid,
|
||||||
(uint32_t)packed->Bot
|
(uint32_t)packed->Bot
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(SUCCESS, "%s" _YELLOW_("%X%08X"),
|
PrintAndLogEx(SUCCESS, "%s" _YELLOW_("%X%08X"),
|
||||||
s,
|
s,
|
||||||
(uint32_t)packed->Mid,
|
(uint32_t)packed->Mid,
|
||||||
(uint32_t)packed->Bot
|
(uint32_t)packed->Bot
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdWiegandList(const char *Cmd) {
|
int CmdWiegandList(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "wiegand info",
|
CLIParserInit(&ctx, "wiegand info",
|
||||||
"List available wiegand formats",
|
"List available wiegand formats",
|
||||||
"wiegand list"
|
"wiegand list"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
|
@ -68,7 +68,7 @@ int CmdWiegandEncode(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "wiegand encode",
|
CLIParserInit(&ctx, "wiegand encode",
|
||||||
"Encode wiegand formatted number to raw hex",
|
"Encode wiegand formatted number to raw hex",
|
||||||
"wiegand encode -w H10301 --fc 101 --cn 1337"
|
"wiegand encode -w H10301 --fc 101 --cn 1337"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
|
@ -76,22 +76,22 @@ int CmdWiegandEncode(const char *Cmd) {
|
||||||
arg_u64_1(NULL, "cn", "<dec>", "card number"),
|
arg_u64_1(NULL, "cn", "<dec>", "card number"),
|
||||||
arg_u64_0(NULL, "issue", "<dec>", "issue level"),
|
arg_u64_0(NULL, "issue", "<dec>", "issue level"),
|
||||||
arg_u64_0(NULL, "oem", "<dec>", "OEM code"),
|
arg_u64_0(NULL, "oem", "<dec>", "OEM code"),
|
||||||
arg_str1("w", "wiegand", "<format>", "see `wiegand list` for available formats"),
|
arg_str1("w", "wiegand", "<format>", "see `wiegand list` for available formats"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
|
||||||
wiegand_card_t data;
|
wiegand_card_t data;
|
||||||
memset(&data, 0, sizeof(wiegand_card_t));
|
memset(&data, 0, sizeof(wiegand_card_t));
|
||||||
|
|
||||||
data.FacilityCode = arg_get_u32_def(ctx, 1, 0);
|
data.FacilityCode = arg_get_u32_def(ctx, 1, 0);
|
||||||
data.CardNumber = arg_get_u64_def(ctx, 2, 0);
|
data.CardNumber = arg_get_u64_def(ctx, 2, 0);
|
||||||
data.IssueLevel = arg_get_u32_def(ctx, 3, 0);
|
data.IssueLevel = arg_get_u32_def(ctx, 3, 0);
|
||||||
data.OEM = arg_get_u32_def(ctx, 4, 0);
|
data.OEM = arg_get_u32_def(ctx, 4, 0);
|
||||||
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char format[16] = {0};
|
char format[16] = {0};
|
||||||
CLIParamStrToBuf(arg_get_str(ctx, 5), (uint8_t*)format, sizeof(format), &len);
|
CLIParamStrToBuf(arg_get_str(ctx, 5), (uint8_t *)format, sizeof(format), &len);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
int idx = HIDFindCardFormat(format);
|
int idx = HIDFindCardFormat(format);
|
||||||
|
|
@ -118,7 +118,7 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "wiegand decode",
|
CLIParserInit(&ctx, "wiegand decode",
|
||||||
"Decode raw hex to wiegand format",
|
"Decode raw hex to wiegand format",
|
||||||
"wiegand decode --raw 2006f623ae"
|
"wiegand decode --raw 2006f623ae"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
|
@ -128,19 +128,19 @@ int CmdWiegandDecode(const char *Cmd) {
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
|
||||||
bool ignore_parity = arg_get_lit(ctx, 1);
|
bool ignore_parity = arg_get_lit(ctx, 1);
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char hex[40] = {0};
|
char hex[40] = {0};
|
||||||
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t*)hex, sizeof(hex), &len);
|
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)hex, sizeof(hex), &len);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
PrintAndLogEx(ERR, "empty input");
|
PrintAndLogEx(ERR, "empty input");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t top = 0, mid = 0, bot = 0;
|
uint32_t top = 0, mid = 0, bot = 0;
|
||||||
hexstring_to_u96(&top, &mid, &bot, hex);
|
hexstring_to_u96(&top, &mid, &bot, hex);
|
||||||
|
|
||||||
wiegand_message_t packed = initialize_message_object(top, mid, bot);
|
wiegand_message_t packed = initialize_message_object(top, mid, bot);
|
||||||
HIDTryUnpack(&packed, ignore_parity);
|
HIDTryUnpack(&packed, ignore_parity);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue