This commit is contained in:
iceman1001
2020-01-12 17:28:12 +01:00
parent 355a7e4458
commit ed67936892
11 changed files with 177 additions and 177 deletions

View File

@@ -3421,7 +3421,7 @@ TRexBool trex_searchrange(TRex *exp, const TRexChar *text_begin, const TRexChar
if (!cur)
break;
node = exp->_nodes[node].next;
}
}
text_begin++;
} while (cur == NULL && text_begin != text_end);
@@ -3675,7 +3675,7 @@ void arg_register_error(struct arg_end *end,
* Return index of first table entry with a matching short option
* or -1 if no match was found.
*/
static int find_shortoption(struct arg_hdr** table, char shortopt) {
static int find_shortoption(struct arg_hdr **table, char shortopt) {
int tabindex;
for (tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++) {
if (table[tabindex]->shortopts &&
@@ -3708,7 +3708,7 @@ void dump_longoptions(struct longoptions *longoptions) {
}
#endif
static struct longoptions* alloc_longoptions(struct arg_hdr** table) {
static struct longoptions *alloc_longoptions(struct arg_hdr **table) {
struct longoptions *result;
size_t nbytes;
int noptions = 1;
@@ -3790,7 +3790,7 @@ static struct longoptions* alloc_longoptions(struct arg_hdr** table) {
return result;
}
static char* alloc_shortoptions(struct arg_hdr** table) {
static char *alloc_shortoptions(struct arg_hdr **table) {
char *result;
size_t len = 2;
int tabindex;
@@ -3830,7 +3830,7 @@ static char* alloc_shortoptions(struct arg_hdr** table) {
/* return index of the table terminator entry */
static int arg_endindex(struct arg_hdr** table) {
static int arg_endindex(struct arg_hdr **table) {
int tabindex = 0;
while (!(table[tabindex]->flag & ARG_TERMINATOR))
tabindex++;
@@ -3839,9 +3839,9 @@ static int arg_endindex(struct arg_hdr** table) {
static void arg_parse_tagged(int argc,
char **argv,
struct arg_hdr **table,
struct arg_end *endtable) {
char **argv,
struct arg_hdr **table,
struct arg_end *endtable) {
struct longoptions *longoptions;
char *shortoptions;
int copt;
@@ -3952,9 +3952,9 @@ static void arg_parse_tagged(int argc,
static void arg_parse_untagged(int argc,
char **argv,
struct arg_hdr **table,
struct arg_end *endtable) {
char **argv,
struct arg_hdr **table,
struct arg_end *endtable) {
int tabindex = 0;
int errorlast = 0;
const char *optarglast = NULL;
@@ -4154,11 +4154,11 @@ static void arg_cat(char **pdest, const char *src, size_t *pndest) {
static void arg_cat_option(char *dest,
size_t ndest,
const char *shortopts,
const char *longopts,
const char *datatype,
int optvalue) {
size_t ndest,
const char *shortopts,
const char *longopts,
const char *datatype,
int optvalue) {
if (shortopts) {
char option[3];
@@ -4212,12 +4212,12 @@ static void arg_cat_option(char *dest,
}
static void arg_cat_optionv(char *dest,
size_t ndest,
const char *shortopts,
const char *longopts,
const char *datatype,
int optvalue,
const char *separator) {
size_t ndest,
const char *shortopts,
const char *longopts,
const char *datatype,
int optvalue,
const char *separator) {
separator = separator ? separator : "";
if (shortopts) {

View File

@@ -230,18 +230,18 @@ int CmdHFSniff(const char *Cmd) {
}
int CmdHFPlot(const char *Cmd) {
CLIParserInit("hf plot",
"Plots HF signal after RF signal path and A/D conversion.",
"This can be used after any hf command and will show the last few milliseconds of the HF signal.\n"
"Note: If the last hf command terminated because of a timeout you will most probably see nothing.\n");
void* argtable[] = {
arg_param_begin,
arg_param_end
};
CLIExecWithReturn(Cmd, argtable, true);
CLIParserInit("hf plot",
"Plots HF signal after RF signal path and A/D conversion.",
"This can be used after any hf command and will show the last few milliseconds of the HF signal.\n"
"Note: If the last hf command terminated because of a timeout you will most probably see nothing.\n");
void *argtable[] = {
arg_param_begin,
arg_param_end
};
CLIExecWithReturn(Cmd, argtable, true);
uint8_t buf[FPGA_TRACE_SIZE];
uint8_t buf[FPGA_TRACE_SIZE];
PacketResponseNG response;
if (!GetFromDevice(FPGA_MEM, buf, FPGA_TRACE_SIZE, 0, NULL, 0, &response, 4000, true)) {
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
@@ -262,7 +262,7 @@ int CmdHFPlot(const char *Cmd) {
setClockGrid(0, 0);
DemodBufferLen = 0;
RepaintGraphWindow();
return PM3_SUCCESS;
return PM3_SUCCESS;
}
static command_t CommandTable[] = {

View File

@@ -2469,12 +2469,12 @@ static int CmdHF14AMfUGenDiverseKeys(const char *Cmd) {
PrintAndLogEx(WARNING, "iso14443a card select failed");
return PM3_ESOFT;
}
/*
if (card.uidlen != 4) {
PrintAndLogEx(WARNING, "Wrong sized UID, expected 4bytes got %d", card.uidlen);
return PM3_ESOFT;
}
*/
/*
if (card.uidlen != 4) {
PrintAndLogEx(WARNING, "Wrong sized UID, expected 4bytes got %d", card.uidlen);
return PM3_ESOFT;
}
*/
memcpy(uid, card.uid, card.uidlen);
} else {
if (param_gethex(Cmd, 0, uid, 8)) return usage_hf_mfu_gendiverse();

View File

@@ -458,9 +458,9 @@ int lf_config(sample_config *config) {
clearCommandBuffer();
if (config != NULL)
SendCommandNG(CMD_LF_SAMPLING_SET_CONFIG, (uint8_t *)config, sizeof(sample_config));
else
else
SendCommandNG(CMD_LF_SAMPLING_GET_CONFIG, NULL, 0);
return PM3_SUCCESS;
}
@@ -474,15 +474,15 @@ int CmdLFConfig(const char *Cmd) {
}
sample_config config = {
.decimation = -1,
.bits_per_sample = -1,
.averaging = -1,
.divisor = -1,
.trigger_threshold = -1,
.samples_to_skip = -1,
.verbose = true
.decimation = -1,
.bits_per_sample = -1,
.averaging = -1,
.divisor = -1,
.trigger_threshold = -1,
.samples_to_skip = -1,
.verbose = true
};
bool errors = false;
uint8_t cmdp = 0;
@@ -527,20 +527,20 @@ int CmdLFConfig(const char *Cmd) {
break;
}
case 'b': {
config.bits_per_sample = param_get8ex(Cmd, cmdp + 1, 8, 10);
config.bits_per_sample = param_get8ex(Cmd, cmdp + 1, 8, 10);
// bps is limited to 8
if (config.bits_per_sample >> 4)
if (config.bits_per_sample >> 4)
config.bits_per_sample = 8;
cmdp += 2;
break;
}
case 'd': {
config.decimation = param_get8ex(Cmd, cmdp + 1, 1, 10);
config.decimation = param_get8ex(Cmd, cmdp + 1, 1, 10);
// decimation is limited to 255
if (config.decimation >> 4)
if (config.decimation >> 4)
config.decimation = 8;
cmdp += 2;

View File

@@ -73,19 +73,19 @@ static int usage_lf_indala_sim(void) {
static void encodeHeden2L(uint8_t *dest, uint32_t cardnumber) {
uint8_t template[] = {
1,0,1,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
1,0,0,0,1,0,0,0,
1,0,0,0,0,0,0,0,
0,0,0,0,1,0,0,1,
0,0,0,0,0,0,1,0
1, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 1,
0, 0, 0, 0, 0, 0, 1, 0
};
uint8_t cardbits[32];
num_to_bytebits(cardnumber, sizeof(cardbits), cardbits);
if (cardbits[31] == 1) template[HEDEN2L_OFFSET + 8] = 0x1;
if (cardbits[30] == 1) template[HEDEN2L_OFFSET + 10] = 0x1;
if (cardbits[29] == 1) template[HEDEN2L_OFFSET + 14] = 0x1;
@@ -105,14 +105,14 @@ static void encodeHeden2L(uint8_t *dest, uint32_t cardnumber) {
// Parity
uint8_t counter = 0;
for (int i=0; i< sizeof(template) - HEDEN2L_OFFSET; i++) {
if (template[i])
counter++;
}
for (int i = 0; i < sizeof(template) - HEDEN2L_OFFSET; i++) {
if (template[i])
counter++;
}
template[63] = (counter & 0x1);
for (int i = 0; i< sizeof(template); i += 8) {
dest[i/8] = bytebits_to_byte(template + i, 8);
for (int i = 0; i < sizeof(template); i += 8) {
dest[i / 8] = bytebits_to_byte(template + i, 8);
}
PrintAndLogEx(INFO, "Heden-2L card number %u", cardnumber);
@@ -123,22 +123,22 @@ static void decodeHeden2L(uint8_t *bits) {
uint32_t cardnumber = 0;
uint8_t offset = HEDEN2L_OFFSET;
if ( bits[offset + 8] ) cardnumber += 1;
if ( bits[offset + 10] ) cardnumber += 2;
if ( bits[offset + 14] ) cardnumber += 4;
if ( bits[offset + 15] ) cardnumber += 8;
if ( bits[offset + 12] ) cardnumber += 16;
if ( bits[offset + 28] ) cardnumber += 32;
if ( bits[offset + 3] ) cardnumber += 64;
if ( bits[offset + 11] ) cardnumber += 128;
if ( bits[offset + 19] ) cardnumber += 256;
if ( bits[offset + 26] ) cardnumber += 512;
if ( bits[offset + 17] ) cardnumber += 1024;
if ( bits[offset + 18] ) cardnumber += 2048;
if ( bits[offset + 20] ) cardnumber += 4096;
if ( bits[offset + 13] ) cardnumber += 8192;
if ( bits[offset + 7] ) cardnumber += 16384;
if ( bits[offset + 23] ) cardnumber += 32768;
if (bits[offset + 8]) cardnumber += 1;
if (bits[offset + 10]) cardnumber += 2;
if (bits[offset + 14]) cardnumber += 4;
if (bits[offset + 15]) cardnumber += 8;
if (bits[offset + 12]) cardnumber += 16;
if (bits[offset + 28]) cardnumber += 32;
if (bits[offset + 3]) cardnumber += 64;
if (bits[offset + 11]) cardnumber += 128;
if (bits[offset + 19]) cardnumber += 256;
if (bits[offset + 26]) cardnumber += 512;
if (bits[offset + 17]) cardnumber += 1024;
if (bits[offset + 18]) cardnumber += 2048;
if (bits[offset + 20]) cardnumber += 4096;
if (bits[offset + 13]) cardnumber += 8192;
if (bits[offset + 7]) cardnumber += 16384;
if (bits[offset + 23]) cardnumber += 32768;
PrintAndLogEx(SUCCESS, "\tHeden-2L | %u", cardnumber);
}
@@ -576,7 +576,7 @@ static int CmdIndalaClone(const char *Cmd) {
if (got_cn == false) {
CLIGetHexWithReturn(3, data, &datalen);
}
is_t5555 = arg_get_lit(4);
CLIParserFree();
@@ -585,12 +585,12 @@ static int CmdIndalaClone(const char *Cmd) {
// 224 BIT UID
// config for Indala (RF/32;PSK2 with RF/2;Maxblock=7)
PrintAndLogEx(INFO, "Preparing to clone Indala 224bit tag with RawID %s", sprint_hex(data, datalen));
if (is_t5555)
blocks[0] = T5555_SET_BITRATE(32) | T5555_MODULATION_PSK2 | (7 << T5555_MAXBLOCK_SHIFT);
else
blocks[0] = T55x7_BITRATE_RF_32 | T55x7_MODULATION_PSK2 | (7 << T55x7_MAXBLOCK_SHIFT);
blocks[1] = bytes_to_num(data, 4);
blocks[2] = bytes_to_num(data + 4, 4);
blocks[3] = bytes_to_num(data + 8, 4);
@@ -608,12 +608,12 @@ static int CmdIndalaClone(const char *Cmd) {
// config for Indala 64 format (RF/32;PSK1 with RF/2;Maxblock=2)
PrintAndLogEx(INFO, "Preparing to clone Indala 64bit tag with RawID %s", sprint_hex(data, datalen));
if (is_t5555)
blocks[0] = T5555_SET_BITRATE(32) | T5555_MODULATION_PSK1 | (2 << T5555_MAXBLOCK_SHIFT);
else
blocks[0] = T55x7_BITRATE_RF_32 | T55x7_MODULATION_PSK1 | (2 << T55x7_MAXBLOCK_SHIFT);
blocks[1] = bytes_to_num(data, 4);
blocks[2] = bytes_to_num(data + 4, 4);
max = 3;

View File

@@ -128,8 +128,8 @@ static int CmdKeriClone(const char *Cmd) {
T55x7_MODULATION_PSK1 |
T55x7_PSKCF_RF_2 |
2 << T55x7_MAXBLOCK_SHIFT,
0,
0
0,
0
};
// dynamic bitrate used