make style
This commit is contained in:
@@ -635,7 +635,7 @@ static int Cmdaskmandemod(const char *Cmd) {
|
||||
st = true;
|
||||
Cmd += 2;
|
||||
}
|
||||
|
||||
|
||||
char amp = tolower(param_getchar(Cmd, 0));
|
||||
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &);
|
||||
|
||||
@@ -992,7 +992,7 @@ static int CmdDecimate(const char *Cmd) {
|
||||
"Performs decimation, by reducing samples N times in the grapbuf. Good for PSK\n",
|
||||
"data decimate\n"
|
||||
"data decimate 4"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
@@ -1001,11 +1001,11 @@ static int CmdDecimate(const char *Cmd) {
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
int n = arg_get_int_def(ctx, 1, 2);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
for (size_t i = 0; i < (GraphTraceLen / n); ++i)
|
||||
GraphBuffer[i] = GraphBuffer[i * n];
|
||||
|
||||
|
||||
GraphTraceLen /= n;
|
||||
PrintAndLogEx(SUCCESS, "decimated by " _GREEN_("%u"), n);
|
||||
RepaintGraphWindow();
|
||||
@@ -1024,7 +1024,7 @@ static int CmdUndecimate(const char *Cmd) {
|
||||
"Performs un-decimation, by repeating each sample N times in the graphbuf",
|
||||
"data undecimate\n"
|
||||
"data undecimate 4\n"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
@@ -1033,7 +1033,7 @@ static int CmdUndecimate(const char *Cmd) {
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
int factor = arg_get_int_def(ctx, 1, 2);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
//We have memory, don't we?
|
||||
int swap[MAX_GRAPH_TRACE_LEN] = {0};
|
||||
@@ -1042,9 +1042,9 @@ static int CmdUndecimate(const char *Cmd) {
|
||||
int count = 0;
|
||||
for (count = 0; count < factor && s_index + count < MAX_GRAPH_TRACE_LEN; count++) {
|
||||
swap[s_index + count] = (
|
||||
(double)(factor - count) / (factor - 1)) * GraphBuffer[g_index] +
|
||||
((double)count / factor) * GraphBuffer[g_index + 1]
|
||||
;
|
||||
(double)(factor - count) / (factor - 1)) * GraphBuffer[g_index] +
|
||||
((double)count / factor) * GraphBuffer[g_index + 1]
|
||||
;
|
||||
}
|
||||
s_index += count;
|
||||
g_index++;
|
||||
@@ -1701,7 +1701,7 @@ int CmdTuneSamples(const char *Cmd) {
|
||||
|
||||
// Q measure with Q=f/delta_f
|
||||
double v_3db_scaled = (double)(package->peak_v * 0.707) / 512; // /512 == >>9
|
||||
uint32_t s2=0, s4=0;
|
||||
uint32_t s2 = 0, s4 = 0;
|
||||
for (int i = 1; i < 256; i++) {
|
||||
if ((s2 == 0) && (package->results[i] > v_3db_scaled)) {
|
||||
s2 = i;
|
||||
@@ -1715,10 +1715,10 @@ int CmdTuneSamples(const char *Cmd) {
|
||||
if (s4 != 0) { // we got all our points of interest
|
||||
double a = package->results[s2 - 1];
|
||||
double b = package->results[s2];
|
||||
double f1 = LF_DIV2FREQ(s2 - 1 + (v_3db_scaled - a)/(b-a));
|
||||
double f1 = LF_DIV2FREQ(s2 - 1 + (v_3db_scaled - a) / (b - a));
|
||||
double c = package->results[s4 - 1];
|
||||
double d = package->results[s4];
|
||||
double f2 = LF_DIV2FREQ(s4 - 1 + (c - v_3db_scaled)/(c-d));
|
||||
double f2 = LF_DIV2FREQ(s4 - 1 + (c - v_3db_scaled) / (c - d));
|
||||
lfq1 = LF_DIV2FREQ(package->peak_f) / (f1 - f2);
|
||||
PrintAndLogEx(SUCCESS, "Approx. Q factor (*): %.1lf by frequency bandwidth measurement", lfq1);
|
||||
}
|
||||
@@ -1955,10 +1955,10 @@ int CmdSave(const char *Cmd) {
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool as_wave = arg_get_lit(ctx, 1);
|
||||
|
||||
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
CLIGetStrWithReturn(ctx, 2, (uint8_t*)filename, &fnlen);
|
||||
CLIGetStrWithReturn(ctx, 2, (uint8_t *)filename, &fnlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (as_wave)
|
||||
@@ -2432,10 +2432,10 @@ static int try_detect_modulation(void) {
|
||||
clk = GetAskClock("", false);
|
||||
if (clk > 0) {
|
||||
// 0 = auto clock
|
||||
// 0 = no invert
|
||||
// 0 = no invert
|
||||
// 1 = maxError 1
|
||||
// 0 = max len
|
||||
// false = no amplify
|
||||
// false = no amplify
|
||||
// false = no verbose
|
||||
// false = no emSearch
|
||||
// 1 = Ask/Man
|
||||
@@ -2450,7 +2450,7 @@ static int try_detect_modulation(void) {
|
||||
// false = no emSearch
|
||||
// 1 = Ask/Man
|
||||
// st = true
|
||||
|
||||
|
||||
// ASK / biphase
|
||||
if ((ASKbiphaseDemod(0, 0, 0, 2, false) == PM3_SUCCESS)) {
|
||||
tests[hits].modulation = DEMOD_BI;
|
||||
@@ -2465,11 +2465,11 @@ static int try_detect_modulation(void) {
|
||||
}
|
||||
}
|
||||
clk = GetNrzClock("", false);
|
||||
if ((NRZrawDemod(0, 0, 1, false) == PM3_SUCCESS)) {
|
||||
tests[hits].modulation = DEMOD_NRZ;
|
||||
tests[hits].bitrate = clk;
|
||||
++hits;
|
||||
}
|
||||
if ((NRZrawDemod(0, 0, 1, false) == PM3_SUCCESS)) {
|
||||
tests[hits].modulation = DEMOD_NRZ;
|
||||
tests[hits].bitrate = clk;
|
||||
++hits;
|
||||
}
|
||||
|
||||
clk = GetPskClock("", false);
|
||||
if (clk > 0) {
|
||||
@@ -2481,7 +2481,7 @@ static int try_detect_modulation(void) {
|
||||
tests[hits].modulation = DEMOD_PSK1;
|
||||
tests[hits].bitrate = clk;
|
||||
++hits;
|
||||
|
||||
|
||||
// get psk carrier
|
||||
tests[hits].carrier = GetPskCarrier(false);
|
||||
}
|
||||
@@ -2493,8 +2493,8 @@ static int try_detect_modulation(void) {
|
||||
if (hits) {
|
||||
PrintAndLogEx(SUCCESS, "Found [%d] possible matches for modulation.", hits);
|
||||
for (int i = 0; i < hits; ++i) {
|
||||
PrintAndLogEx(INFO, "--[%d]---------------", i + 1);
|
||||
print_modulation(tests[i]);
|
||||
PrintAndLogEx(INFO, "--[%d]---------------", i + 1);
|
||||
print_modulation(tests[i]);
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
} else {
|
||||
@@ -2508,20 +2508,20 @@ static int CmdDataModulationSearch(const char *Cmd) {
|
||||
CLIParserInit(&ctx, "data modulation",
|
||||
"search LF signal after clock and modulation\n",
|
||||
"data modulation"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
return try_detect_modulation();
|
||||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||
|
||||
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Modulation") "-------------------------"},
|
||||
{"biphaserawdecode", CmdBiphaseDecodeRaw, AlwaysAvailable, "Biphase decode bin stream in DemodBuffer"},
|
||||
{"detectclock", CmdDetectClockRate, AlwaysAvailable, "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer"},
|
||||
@@ -2529,7 +2529,7 @@ static command_t CommandTable[] = {
|
||||
{"manrawdecode", Cmdmandecoderaw, AlwaysAvailable, "Manchester decode binary stream in DemodBuffer"},
|
||||
{"modulation", CmdDataModulationSearch, AlwaysAvailable, "Identify LF signal for clock and modulation"},
|
||||
{"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"},
|
||||
|
||||
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Graph") "-------------------------"},
|
||||
{"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "[threshold] Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave (use 20-45, def:25)"},
|
||||
{"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"},
|
||||
@@ -2552,7 +2552,7 @@ static command_t CommandTable[] = {
|
||||
|
||||
{"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"},
|
||||
{"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"},
|
||||
|
||||
|
||||
|
||||
{"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"},
|
||||
{"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"},
|
||||
|
||||
@@ -914,7 +914,7 @@ static int cmd_hf_fido_2get_assertion(const char *cmd) {
|
||||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help."},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help."},
|
||||
{"info", cmd_hf_fido_list, IfPm3Iso14443a, "List ISO 14443A history"},
|
||||
{"info", cmd_hf_fido_info, IfPm3Iso14443a, "Info about FIDO tag."},
|
||||
{"reg", cmd_hf_fido_register, IfPm3Iso14443a, "FIDO U2F Registration Message."},
|
||||
|
||||
@@ -173,11 +173,11 @@ static inline uint32_t next_state(uint32_t *bitarray, uint32_t state) {
|
||||
line <<= 1;
|
||||
}
|
||||
index++;
|
||||
while (state < (1 << 24) && bitarray[index] == 0x00000000 ) {
|
||||
while (state < (1 << 24) && bitarray[index] == 0x00000000) {
|
||||
index++;
|
||||
state += 0x20;
|
||||
}
|
||||
|
||||
|
||||
if (state >= (1 << 24)) {
|
||||
return (1 << 24);
|
||||
}
|
||||
|
||||
@@ -2402,13 +2402,13 @@ static int CmdHF14AMfUCAuth(const char *Cmd) {
|
||||
}
|
||||
|
||||
uint8_t key_buf[16];
|
||||
uint8_t * key;
|
||||
uint8_t *key;
|
||||
int succeeded;
|
||||
|
||||
// If no hex key is specified, try all known ones
|
||||
if (strlen(Cmd) == 0) {
|
||||
succeeded = try_default_3des_keys(&key);
|
||||
// Else try user-supplied
|
||||
// Else try user-supplied
|
||||
} else {
|
||||
if (param_gethex(Cmd, 0, key_buf, 32)) {
|
||||
PrintAndLogEx(WARNING, "Password must include 32 HEX symbols");
|
||||
@@ -2840,7 +2840,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
interval = param_get32ex(Cmd, cmdp + 1, interval, 10);
|
||||
//if (interval == 0) {
|
||||
// PrintAndLogEx(WARNING, "Wrong interval number");
|
||||
//errors = true;
|
||||
//errors = true;
|
||||
//}
|
||||
cmdp += 2;
|
||||
break;
|
||||
@@ -2940,7 +2940,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
if (isOK) {
|
||||
memcpy(post, resp.data.asBytes, sizeof(post));
|
||||
got_post = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (got_pre && got_post) {
|
||||
@@ -2949,27 +2949,27 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
snprintf(prestr, sizeof(prestr), "%s", sprint_hex_inrow(pre, sizeof(pre)));
|
||||
char poststr[20] = {0};
|
||||
snprintf(poststr, sizeof(poststr), "%s", sprint_hex_inrow(post, sizeof(post)));
|
||||
|
||||
|
||||
if (memcmp(pre, post, sizeof(pre)) == 0) {
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, "Current %02d (0x%02X) %s"
|
||||
, blockNoUint
|
||||
, blockNoUint
|
||||
, poststr
|
||||
);
|
||||
, blockNoUint
|
||||
, blockNoUint
|
||||
, poststr
|
||||
);
|
||||
} else {
|
||||
|
||||
// skip first message, since its the reset write.
|
||||
if ( actualTime == startTime ) {
|
||||
if (actualTime == startTime) {
|
||||
PrintAndLogEx(INFO, "Inital write");
|
||||
} else {
|
||||
PrintAndLogEx(INFO, _CYAN_("Tear off occured") " : %02d (0x%02X) %s vs " _RED_("%s")
|
||||
, blockNoUint
|
||||
, blockNoUint
|
||||
, prestr
|
||||
, poststr
|
||||
);
|
||||
|
||||
, blockNoUint
|
||||
, blockNoUint
|
||||
, prestr
|
||||
, poststr
|
||||
);
|
||||
|
||||
lock_on = true;
|
||||
|
||||
if (phase_clear == -1)
|
||||
@@ -3017,10 +3017,10 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(INFO, "----------------------------------------------------");
|
||||
if (phase_clear > - 1) {
|
||||
PrintAndLogEx(INFO, "phase 1 (erase eeprom) could be " _YELLOW_("%d") " us" , phase_clear);
|
||||
PrintAndLogEx(INFO, "phase 1 (erase eeprom) could be " _YELLOW_("%d") " us", phase_clear);
|
||||
}
|
||||
if (phase_newwr > - 1) {
|
||||
PrintAndLogEx(INFO, "phase 2 (new write) could be " _YELLOW_("%d") " us" , phase_newwr);
|
||||
PrintAndLogEx(INFO, "phase 2 (new write) could be " _YELLOW_("%d") " us", phase_newwr);
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
|
||||
@@ -641,10 +641,10 @@ static int start_drawing(uint8_t model_nr, uint8_t *black, uint8_t *red) {
|
||||
uint8_t progress = 0;
|
||||
uint8_t step0[2] = {0xcd, 0x0d};
|
||||
uint8_t step1[3] = {0xcd, 0x00, 10}; // select e-paper type and reset e-paper
|
||||
// 4 :2.13inch e-Paper
|
||||
// 7 :2.9inch e-Paper
|
||||
// 10 :4.2inch e-Paper
|
||||
// 14 :7.5inch e-Paper
|
||||
// 4 :2.13inch e-Paper
|
||||
// 7 :2.9inch e-Paper
|
||||
// 10 :4.2inch e-Paper
|
||||
// 14 :7.5inch e-Paper
|
||||
uint8_t step2[2] = {0xcd, 0x01}; // e-paper normal mode type:
|
||||
uint8_t step3[2] = {0xcd, 0x02}; // e-paper config1
|
||||
uint8_t step4[2] = {0xcd, 0x03}; // e-paper power on
|
||||
@@ -652,11 +652,11 @@ static int start_drawing(uint8_t model_nr, uint8_t *black, uint8_t *red) {
|
||||
uint8_t step6[2] = {0xcd, 0x06}; // EDP load to main
|
||||
uint8_t step7[2] = {0xcd, 0x07}; // Data preparation
|
||||
|
||||
uint8_t step8[123] = {0xcd, 0x08, 0x64}; // Data start command
|
||||
// 2.13inch(0x10:Send 16 data at a time)
|
||||
// 2.9inch(0x10:Send 16 data at a time)
|
||||
// 4.2inch(0x64:Send 100 data at a time)
|
||||
// 7.5inch(0x78:Send 120 data at a time)
|
||||
uint8_t step8[123] = {0xcd, 0x08, 0x64}; // Data start command
|
||||
// 2.13inch(0x10:Send 16 data at a time)
|
||||
// 2.9inch(0x10:Send 16 data at a time)
|
||||
// 4.2inch(0x64:Send 100 data at a time)
|
||||
// 7.5inch(0x78:Send 120 data at a time)
|
||||
uint8_t step9[2] = {0xcd, 0x18}; // e-paper power on
|
||||
uint8_t step10[2] = {0xcd, 0x09}; // Refresh e-paper
|
||||
uint8_t step11[2] = {0xcd, 0x0a}; // wait for ready
|
||||
|
||||
@@ -202,7 +202,7 @@ static int CmdHIDSim(const char *Cmd) {
|
||||
arg_param_begin,
|
||||
arg_str0("w", "wiegand", "<format>", "see " _YELLOW_("`wiegand list`") " for available formats"),
|
||||
arg_u64_0(NULL, "fc", "<dec>", "facility code"),
|
||||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||
arg_int0("i", NULL, "<dec>", "issue level"),
|
||||
arg_int0("o", "oem", "<dec>", "OEM code"),
|
||||
arg_strx0("r", "raw", "<hex>", "raw bytes"),
|
||||
@@ -214,24 +214,24 @@ static int CmdHIDSim(const char *Cmd) {
|
||||
char format[16] = {0};
|
||||
int format_len = 0;
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)format, sizeof(format), &format_len);
|
||||
|
||||
|
||||
wiegand_card_t card;
|
||||
memset(&card, 0, sizeof(wiegand_card_t));
|
||||
card.FacilityCode = arg_get_u32_def(ctx, 2, 0);
|
||||
card.CardNumber = arg_get_u32_def(ctx, 3, 0);
|
||||
card.IssueLevel = arg_get_u32_def(ctx, 4, 0);
|
||||
card.OEM = arg_get_u32_def(ctx, 5, 0);
|
||||
|
||||
|
||||
int raw_len = 0;
|
||||
char raw[40] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 6), (uint8_t *)raw, sizeof(raw), &raw_len);
|
||||
|
||||
//bool q5 = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
wiegand_message_t packed;
|
||||
memset(&packed, 0, sizeof(wiegand_message_t));
|
||||
|
||||
|
||||
// format validation
|
||||
int format_idx = HIDFindCardFormat((char *)format);
|
||||
if (format_idx == -1 && raw_len == 0) {
|
||||
@@ -253,10 +253,10 @@ static int CmdHIDSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (raw_len == 0) {
|
||||
PrintAndLogEx(INFO, "Simulating HID tag");
|
||||
PrintAndLogEx(INFO, "Simulating HID tag");
|
||||
HIDTryUnpack(&packed, false);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "Simulating HID tag using raw " _GREEN_("%s"), raw);
|
||||
PrintAndLogEx(INFO, "Simulating HID tag using raw " _GREEN_("%s"), raw);
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "Press pm3-button to abort simulation");
|
||||
@@ -295,7 +295,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||
arg_param_begin,
|
||||
arg_str0("w", "wiegand", "<format>", "see " _YELLOW_("`wiegand list`") " for available formats"),
|
||||
arg_u64_0(NULL, "fc", "<dec>", "facility code"),
|
||||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||
arg_int0("i", NULL, "<dec>", "issue level"),
|
||||
arg_int0("o", "oem", "<dec>", "OEM code"),
|
||||
arg_strx0("r", "raw", "<hex>", "raw bytes"),
|
||||
@@ -307,24 +307,24 @@ static int CmdHIDClone(const char *Cmd) {
|
||||
char format[16] = {0};
|
||||
int format_len = 0;
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)format, sizeof(format), &format_len);
|
||||
|
||||
|
||||
wiegand_card_t card;
|
||||
memset(&card, 0, sizeof(wiegand_card_t));
|
||||
card.FacilityCode = arg_get_u32_def(ctx, 2, 0);
|
||||
card.CardNumber = arg_get_u32_def(ctx, 3, 0);
|
||||
card.IssueLevel = arg_get_u32_def(ctx, 4, 0);
|
||||
card.OEM = arg_get_u32_def(ctx, 5, 0);
|
||||
|
||||
|
||||
int raw_len = 0;
|
||||
char raw[40] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 6), (uint8_t *)raw, sizeof(raw), &raw_len);
|
||||
|
||||
//bool q5 = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
wiegand_message_t packed;
|
||||
memset(&packed, 0, sizeof(wiegand_message_t));
|
||||
|
||||
|
||||
// format validation
|
||||
int format_idx = HIDFindCardFormat((char *)format);
|
||||
if (format_idx == -1 && raw_len == 0) {
|
||||
@@ -346,10 +346,10 @@ static int CmdHIDClone(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (raw_len == 0) {
|
||||
PrintAndLogEx(INFO, "Preparing to clone HID tag");
|
||||
PrintAndLogEx(INFO, "Preparing to clone HID tag");
|
||||
HIDTryUnpack(&packed, false);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "Preparing to clone HID tag using raw " _YELLOW_("%s"), raw);
|
||||
PrintAndLogEx(INFO, "Preparing to clone HID tag using raw " _YELLOW_("%s"), raw);
|
||||
}
|
||||
|
||||
lf_hidsim_t payload;
|
||||
|
||||
@@ -106,18 +106,18 @@ typedef struct {
|
||||
} t5555_tracedata_t;
|
||||
|
||||
typedef enum {
|
||||
DEMOD_NRZ = 0x00,
|
||||
DEMOD_PSK1 = 0x01,
|
||||
DEMOD_PSK2 = 0x02,
|
||||
DEMOD_PSK3 = 0x03,
|
||||
DEMOD_FSK1 = 0x04,
|
||||
DEMOD_FSK1a = 0x05,
|
||||
DEMOD_FSK2 = 0x06,
|
||||
DEMOD_FSK2a = 0x07,
|
||||
DEMOD_FSK = 0xF0, //generic FSK (auto detect FCs)
|
||||
DEMOD_ASK = 0x08,
|
||||
DEMOD_BI = 0x10,
|
||||
DEMOD_BIa = 0x18,
|
||||
DEMOD_NRZ = 0x00,
|
||||
DEMOD_PSK1 = 0x01,
|
||||
DEMOD_PSK2 = 0x02,
|
||||
DEMOD_PSK3 = 0x03,
|
||||
DEMOD_FSK1 = 0x04,
|
||||
DEMOD_FSK1a = 0x05,
|
||||
DEMOD_FSK2 = 0x06,
|
||||
DEMOD_FSK2a = 0x07,
|
||||
DEMOD_FSK = 0xF0, //generic FSK (auto detect FCs)
|
||||
DEMOD_ASK = 0x08,
|
||||
DEMOD_BI = 0x10,
|
||||
DEMOD_BIa = 0x18,
|
||||
} t55xx_modulation;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -587,28 +587,28 @@ static int CmdTraceSave(const char *Cmd) {
|
||||
int CmdTraceList(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "trace list",
|
||||
"Annotate trace buffer with selected protocol data\n"
|
||||
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n",
|
||||
"trace list -t raw -> just show raw data without annotations\n"
|
||||
"trace list -t 14a -> interpret as " _YELLOW_("ISO14443-A") " communications\n"
|
||||
"trace list -t thinfilm -> interpret as " _YELLOW_("Thinfilm") " communications\n"
|
||||
"trace list -t topaz -> interpret as " _YELLOW_("Topaz") " communications\n"
|
||||
"trace list -t mf -> interpret as " _YELLOW_("MIFARE Classic") " communications and decrypt crypto1 stream\n"
|
||||
"trace list -t des -> interpret as " _YELLOW_("MIFARE DESFire") " communications\n"
|
||||
"trace list -t 14b -> interpret as " _YELLOW_("ISO14443-B") " communications\n"
|
||||
"trace list -t 7816 -> interpret as " _YELLOW_("ISO7816-4") " communications\n"
|
||||
"trace list -t 15 -> interpret as " _YELLOW_("ISO15693") " communications\n"
|
||||
"trace list -t iclass -> interpret as " _YELLOW_("iCLASS") " communications\n"
|
||||
"trace list -t legic -> interpret as " _YELLOW_("LEGIC") " communications\n"
|
||||
"trace list -t felica -> interpret as " _YELLOW_("ISO18092 / FeliCa") " communications\n"
|
||||
"trace list -t hitag1 -> interpret as " _YELLOW_("Hitag1") " communications\n"
|
||||
"trace list -t hitag2 -> interpret as " _YELLOW_("Hitag2") " communications\n"
|
||||
"trace list -t hitags -> interpret as " _YELLOW_("HitagS") " communications\n"
|
||||
"trace list -t lto -> interpret as " _YELLOW_("LTO-CM") " communications\n"
|
||||
"trace list -t cryptorf -> interpret as " _YELLOW_("CryptoRF") " communitcations\n"
|
||||
"trace list -t 14a f -> show frame delay times\n"
|
||||
"trace list -t 14a 1 -> use trace buffer "
|
||||
);
|
||||
"Annotate trace buffer with selected protocol data\n"
|
||||
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n",
|
||||
"trace list -t raw -> just show raw data without annotations\n"
|
||||
"trace list -t 14a -> interpret as " _YELLOW_("ISO14443-A") " communications\n"
|
||||
"trace list -t thinfilm -> interpret as " _YELLOW_("Thinfilm") " communications\n"
|
||||
"trace list -t topaz -> interpret as " _YELLOW_("Topaz") " communications\n"
|
||||
"trace list -t mf -> interpret as " _YELLOW_("MIFARE Classic") " communications and decrypt crypto1 stream\n"
|
||||
"trace list -t des -> interpret as " _YELLOW_("MIFARE DESFire") " communications\n"
|
||||
"trace list -t 14b -> interpret as " _YELLOW_("ISO14443-B") " communications\n"
|
||||
"trace list -t 7816 -> interpret as " _YELLOW_("ISO7816-4") " communications\n"
|
||||
"trace list -t 15 -> interpret as " _YELLOW_("ISO15693") " communications\n"
|
||||
"trace list -t iclass -> interpret as " _YELLOW_("iCLASS") " communications\n"
|
||||
"trace list -t legic -> interpret as " _YELLOW_("LEGIC") " communications\n"
|
||||
"trace list -t felica -> interpret as " _YELLOW_("ISO18092 / FeliCa") " communications\n"
|
||||
"trace list -t hitag1 -> interpret as " _YELLOW_("Hitag1") " communications\n"
|
||||
"trace list -t hitag2 -> interpret as " _YELLOW_("Hitag2") " communications\n"
|
||||
"trace list -t hitags -> interpret as " _YELLOW_("HitagS") " communications\n"
|
||||
"trace list -t lto -> interpret as " _YELLOW_("LTO-CM") " communications\n"
|
||||
"trace list -t cryptorf -> interpret as " _YELLOW_("CryptoRF") " communitcations\n"
|
||||
"trace list -t 14a f -> show frame delay times\n"
|
||||
"trace list -t 14a 1 -> use trace buffer "
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
@@ -618,24 +618,24 @@ int CmdTraceList(const char *Cmd) {
|
||||
arg_lit0("r", NULL, "show relative times (gap and duration)"),
|
||||
arg_lit0("u", NULL, "display times in microseconds instead of clock cycles"),
|
||||
arg_lit0("x", NULL, "show hexdump to convert to pcap(ng)\n"
|
||||
" or to import into Wireshark using encapsulation type \"ISO 14443\""),
|
||||
" or to import into Wireshark using encapsulation type \"ISO 14443\""),
|
||||
arg_strx0("t", "type", NULL, "protocol to annotate the trace"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
|
||||
bool use_buffer = arg_get_lit(ctx, 1);
|
||||
bool show_wait_cycles = arg_get_lit(ctx, 2);
|
||||
bool mark_crc = arg_get_lit(ctx, 3);
|
||||
bool use_relative = arg_get_lit(ctx, 4);
|
||||
bool use_us = arg_get_lit(ctx, 5);
|
||||
bool use_us = arg_get_lit(ctx, 5);
|
||||
bool show_hex = arg_get_lit(ctx, 6);
|
||||
|
||||
int tlen = 0;
|
||||
char type[10] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 7), (uint8_t *)type, sizeof(type), &tlen);
|
||||
str_lower(type);
|
||||
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
clearCommandBuffer();
|
||||
@@ -660,9 +660,9 @@ int CmdTraceList(const char *Cmd) {
|
||||
else if (strcmp(type, "thinfilm") == 0) protocol = THINFILM;
|
||||
else if (strcmp(type, "lto") == 0) protocol = LTO;
|
||||
else if (strcmp(type, "cryptorf") == 0) protocol = PROTO_CRYPTORF;
|
||||
else if (strcmp(type, "raw") == 0) protocol = -1;
|
||||
else if (strcmp(type, "raw") == 0) protocol = -1;
|
||||
|
||||
if (use_buffer == false || (g_traceLen == 0) ) {
|
||||
if (use_buffer == false || (g_traceLen == 0)) {
|
||||
download_trace();
|
||||
}
|
||||
|
||||
@@ -761,7 +761,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (show_hex)
|
||||
PrintAndLogEx(HINT, "syntax to use: " _YELLOW_("`text2pcap -t \"%%S.\" -l 264 -n <input-text-file> <output-pcapng-file>`"));
|
||||
|
||||
|
||||
@@ -818,7 +818,7 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt
|
||||
|
||||
size_t paylen = sizeof(struct p) + size;
|
||||
struct p *payload = calloc(1, paylen);
|
||||
|
||||
|
||||
payload->blockno = blockNum;
|
||||
payload->blockcnt = blocksCount;
|
||||
payload->blockwidth = blockBtWidth;
|
||||
|
||||
@@ -1121,9 +1121,9 @@ static int l_em4x05_read(lua_State *L) {
|
||||
uint32_t word = 0;
|
||||
int res = EM4x05ReadWord_ext(addr, password, use_pwd, &word);
|
||||
if (res != PM3_SUCCESS) {
|
||||
return returnToLuaWithError(L, "Failed to read EM4x05 data");
|
||||
return returnToLuaWithError(L, "Failed to read EM4x05 data");
|
||||
}
|
||||
|
||||
|
||||
lua_pushinteger(L, word);
|
||||
return 1;
|
||||
}
|
||||
@@ -1244,10 +1244,10 @@ static int l_cwd(lua_State *L) {
|
||||
// ref: https://github.com/RfidResearchGroup/proxmark3/issues/891
|
||||
// redirect LUA's print to Proxmark3 PrintAndLogEx
|
||||
static int l_printandlogex(lua_State *L) {
|
||||
int n = lua_gettop(L);
|
||||
int n = lua_gettop(L);
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (lua_isstring(L, i)) {
|
||||
PrintAndLogEx(NORMAL, "%s\t" NOLF, lua_tostring(L, i) );
|
||||
PrintAndLogEx(NORMAL, "%s\t" NOLF, lua_tostring(L, i));
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
Reference in New Issue
Block a user