mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
style
This commit is contained in:
+2
-2
@@ -1138,7 +1138,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
}
|
||||
case CMD_LF_HITAG_SIMULATE: { // Simulate Hitag tag, args = memory content
|
||||
SimulateHitag2(true);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HITAG2_CRACK: {
|
||||
lf_hitag_data_t *payload = (lf_hitag_data_t *) packet->data.asBytes;
|
||||
@@ -1391,7 +1391,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
struct p *payload = (struct p *) packet->data.asBytes;
|
||||
SetTag15693Uid_v2(payload->uid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case CMD_HF_ISO15693_SLIX_DISABLE_EAS: {
|
||||
struct p {
|
||||
uint8_t pwd[4];
|
||||
|
||||
+13
-13
@@ -850,7 +850,7 @@ static bool hitag2_crypto(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *
|
||||
}
|
||||
|
||||
} else { // stage 2+, got data block
|
||||
|
||||
|
||||
// Store the received block
|
||||
memcpy(tag.sectors[blocknr], rx, 4);
|
||||
blocknr++;
|
||||
@@ -901,7 +901,7 @@ static bool hitag2_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, si
|
||||
if (bAuthenticating) {
|
||||
DBG DbpString("Authentication - failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DBG DbpString("Authenticating - send 0xC0");
|
||||
*txlen = 5;
|
||||
@@ -933,7 +933,7 @@ static bool hitag2_authenticate(uint8_t *rx, const size_t rxlen, uint8_t *tx, si
|
||||
}
|
||||
|
||||
} else { // stage 2+, got data block
|
||||
|
||||
|
||||
// Store the received block
|
||||
memcpy(tag.sectors[blocknr], rx, 4);
|
||||
blocknr++;
|
||||
@@ -2405,9 +2405,9 @@ out:
|
||||
|
||||
|
||||
static void ht2_send(bool turn_on, uint32_t *cmd_start
|
||||
, uint32_t *cmd_duration, uint32_t *resp_start
|
||||
, uint8_t *tx, size_t txlen, bool send_bits) {
|
||||
|
||||
, uint32_t *cmd_duration, uint32_t *resp_start
|
||||
, uint8_t *tx, size_t txlen, bool send_bits) {
|
||||
|
||||
// Tag specific configuration settings (sof, timings, etc.) HITAG2 Settings
|
||||
#define T_WAIT_1_GUARD 8
|
||||
|
||||
@@ -2419,7 +2419,7 @@ static void ht2_send(bool turn_on, uint32_t *cmd_start
|
||||
// Wait with field on to be in "Wait for START_AUTH" timeframe
|
||||
lf_wait_periods(HITAG_T_WAIT_POWERUP + HITAG_T_WAIT_START_AUTH_MAX / 4);
|
||||
*cmd_start += HITAG_T_WAIT_POWERUP + HITAG_T_WAIT_START_AUTH_MAX / 4;
|
||||
|
||||
|
||||
} else {
|
||||
// Wait for t_wait_2 carrier periods after the last tag bit before transmitting,
|
||||
lf_wait_periods(HITAG_T_WAIT_2_MIN + HITAG_T_WAIT_2_MIN);
|
||||
@@ -2611,13 +2611,13 @@ int ht2_read_uid(uint8_t *uid, bool ledcontrol, bool send_answer, bool keep_fiel
|
||||
|
||||
while (attempt_count && BUTTON_PRESS() == false) {
|
||||
|
||||
attempt_count--;
|
||||
attempt_count--;
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
uint32_t command_start = 0, command_duration = 0;
|
||||
uint32_t response_start = 0, response_duration = 0;
|
||||
|
||||
|
||||
// start AUTH command
|
||||
size_t txlen = 5;
|
||||
uint8_t tx[1] = {0xC0};
|
||||
@@ -2647,7 +2647,7 @@ int ht2_read_uid(uint8_t *uid, bool ledcontrol, bool send_answer, bool keep_fiel
|
||||
if (ht2_packbits(nrz_samples, nrzs, rx, &rxlen) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// log Receive data
|
||||
LogTraceBits(rx, rxlen, response_start, response_start + response_duration, false);
|
||||
|
||||
@@ -2661,7 +2661,7 @@ int ht2_read_uid(uint8_t *uid, bool ledcontrol, bool send_answer, bool keep_fiel
|
||||
memcpy(uid, rx, 4);
|
||||
}
|
||||
res = PM3_SUCCESS;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (keep_field_up == false) {
|
||||
@@ -2704,7 +2704,7 @@ int ht2_tx_rx(uint8_t *tx, size_t txlen, uint8_t *rx, size_t *rxlen, bool ledcon
|
||||
}
|
||||
|
||||
// decode raw samples from Manchester Encoded to bits
|
||||
if ( manrawdecode(samples, &nrzs, true, 0) ) {
|
||||
if (manrawdecode(samples, &nrzs, true, 0)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2712,7 +2712,7 @@ int ht2_tx_rx(uint8_t *tx, size_t txlen, uint8_t *rx, size_t *rxlen, bool ledcon
|
||||
if (ht2_packbits(samples, nrzs, rx, rxlen) == false) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
// log Receive data
|
||||
LogTraceBits(rx, *rxlen, response_start, response_start + response_duration, false);
|
||||
|
||||
|
||||
+11
-11
@@ -14,7 +14,7 @@
|
||||
// See LICENSE.txt for the text of the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This coode has been converted from RFIDler source code to work with Proxmark3.
|
||||
// This coode has been converted from RFIDler source code to work with Proxmark3.
|
||||
// https://github.com/AdamLaurie/RFIDler/blob/master/firmware/Pic32/RFIDler.X/src/hitag2crack.c
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
const static uint8_t ERROR_RESPONSE[] = { 0xF4, 0x02, 0x88, 0x9C };
|
||||
|
||||
// #define READP0CMD "1100000111"
|
||||
const static uint8_t read_p0_cmd[] = {1,1,0,0,0,0,0,1,1,1};
|
||||
const static uint8_t read_p0_cmd[] = {1, 1, 0, 0, 0, 0, 0, 1, 1, 1};
|
||||
|
||||
// hitag2crack_xor XORs the source with the pad to produce the target.
|
||||
// source, target and pad are binarrays of length len.
|
||||
@@ -121,7 +121,7 @@ static bool hitag2crack_read_page(uint8_t *resp, uint8_t pagenum, uint8_t *nrar,
|
||||
uint8_t response[32];
|
||||
|
||||
// convert to binarray
|
||||
hex2binarray((char*)e_response, (char*)e_resp);
|
||||
hex2binarray((char *)e_response, (char *)e_resp);
|
||||
// decrypt response
|
||||
hitag2crack_xor(response, e_response, keybits + 10, 32);
|
||||
|
||||
@@ -129,7 +129,7 @@ static bool hitag2crack_read_page(uint8_t *resp, uint8_t pagenum, uint8_t *nrar,
|
||||
binarray2hex(response, 32, resp);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -200,7 +200,7 @@ static bool hitag2crack_find_e_page0_cmd(uint8_t *keybits, uint8_t *e_firstcmd,
|
||||
// representing the inverted bit and the 3 page bits
|
||||
// in both the non-inverted and inverted parts of the
|
||||
// encrypted command.
|
||||
uint8_t guess[10];
|
||||
uint8_t guess[10];
|
||||
memcpy(guess, e_firstcmd, 10);
|
||||
if (a) {
|
||||
guess[5] = !guess[5];
|
||||
@@ -231,7 +231,7 @@ static bool hitag2crack_find_e_page0_cmd(uint8_t *keybits, uint8_t *e_firstcmd,
|
||||
|
||||
// convert response to binarray
|
||||
uint8_t e_uid[32];
|
||||
hex2binarray((char*)e_uid, (char*)resp);
|
||||
hex2binarray((char *)e_uid, (char *)resp);
|
||||
|
||||
// test if the guess was 'read page 0' command
|
||||
if (hitag2crack_test_e_p0cmd(keybits, nrar, guess, uid, e_uid)) {
|
||||
@@ -299,13 +299,13 @@ static bool hitag2crack_find_valid_e_cmd(uint8_t *e_cmd, uint8_t *nrar) {
|
||||
// hitag2_crack implements the first crack algorithm described in the paper,
|
||||
// Gone In 360 Seconds by Verdult, Garcia and Balasch.
|
||||
// response is a multi-line text response containing the 8 pages of the cracked tag
|
||||
// nrarhex is a string containing hex representations of the 32 bit nR and aR values
|
||||
// nrarhex is a string containing hex representations of the 32 bit nR and aR values
|
||||
void ht2_crack(uint8_t *nrar_hex) {
|
||||
|
||||
clear_trace();
|
||||
|
||||
lf_hitag_crack_response_t packet;
|
||||
memset((uint8_t*)&packet, 0x00, sizeof(lf_hitag_crack_response_t));
|
||||
memset((uint8_t *)&packet, 0x00, sizeof(lf_hitag_crack_response_t));
|
||||
|
||||
int res = PM3_SUCCESS;
|
||||
|
||||
@@ -319,7 +319,7 @@ void ht2_crack(uint8_t *nrar_hex) {
|
||||
|
||||
// convert to binarray
|
||||
uint8_t nrar[64] = {0};
|
||||
hex2binarray_n((char*)nrar, (char*)nrar_hex, 8);
|
||||
hex2binarray_n((char *)nrar, (char *)nrar_hex, 8);
|
||||
|
||||
// find a valid encrypted command
|
||||
uint8_t e_firstcmd[10];
|
||||
@@ -331,7 +331,7 @@ void ht2_crack(uint8_t *nrar_hex) {
|
||||
|
||||
// now we got a first encrypted command inside e_firstcmd
|
||||
uint8_t uid[32];
|
||||
hex2binarray_n((char*)uid, (char*)uid_hex, 4);
|
||||
hex2binarray_n((char *)uid, (char *)uid_hex, 4);
|
||||
|
||||
// find the 'read page 0' command and recover key stream
|
||||
uint8_t keybits[42];
|
||||
@@ -352,5 +352,5 @@ void ht2_crack(uint8_t *nrar_hex) {
|
||||
packet.status = 1;
|
||||
|
||||
out:
|
||||
reply_ng(CMD_LF_HITAG2_CRACK, res, (uint8_t*)&packet, sizeof(lf_hitag_crack_response_t));
|
||||
reply_ng(CMD_LF_HITAG2_CRACK, res, (uint8_t *)&packet, sizeof(lf_hitag_crack_response_t));
|
||||
}
|
||||
|
||||
+4
-4
@@ -91,7 +91,7 @@ int hex2binarray_n(char *target, char *source, int sourcelen) {
|
||||
|
||||
// process 4 bits (1 hex digit) at a time
|
||||
while (sourcelen--) {
|
||||
|
||||
|
||||
char x = *(source++);
|
||||
|
||||
*(target++) = (x >> 7) & 1;
|
||||
@@ -102,7 +102,7 @@ int hex2binarray_n(char *target, char *source, int sourcelen) {
|
||||
*(target++) = (x >> 2) & 1;
|
||||
*(target++) = (x >> 1) & 1;
|
||||
*(target++) = (x & 1);
|
||||
|
||||
|
||||
count += 8;
|
||||
}
|
||||
return count;
|
||||
@@ -122,9 +122,9 @@ int binarray2hex(const uint8_t *bs, int bs_len, uint8_t *hex) {
|
||||
if (bs[i] == 1) {
|
||||
hex[byte_index] |= (1 << (7 - (count % 8)));
|
||||
}
|
||||
|
||||
|
||||
count++;
|
||||
|
||||
|
||||
// Move to the next byte if 8 bits have been filled
|
||||
if (count % 8 == 0) {
|
||||
byte_index++;
|
||||
|
||||
@@ -125,4 +125,4 @@ local function main(args)
|
||||
end
|
||||
end
|
||||
|
||||
main(args)
|
||||
main(args)
|
||||
|
||||
@@ -1743,12 +1743,12 @@ static int CmdSetGraphMarkers(const char *Cmd) {
|
||||
g_MarkerC.pos = arg_get_u32_def(ctx, 4, (keep ? g_MarkerC.pos : 0));
|
||||
g_MarkerD.pos = arg_get_u32_def(ctx, 5, (keep ? g_MarkerD.pos : 0));
|
||||
CLIParserFree(ctx);
|
||||
PrintAndLogEx(INFO, "Setting markers " _BRIGHT_YELLOW_("A") "=%u, "_BRIGHT_MAGENTA_("B") "=%u, "_RED_("C") "=%u, "_BLUE_("D") "=%u",
|
||||
g_MarkerA.pos,
|
||||
g_MarkerB.pos,
|
||||
g_MarkerC.pos,
|
||||
g_MarkerD.pos
|
||||
);
|
||||
PrintAndLogEx(INFO, "Setting markers " _BRIGHT_YELLOW_("A") "=%u, "_BRIGHT_MAGENTA_("B") "=%u, "_RED_("C") "=%u, "_BLUE_("D") "=%u",
|
||||
g_MarkerA.pos,
|
||||
g_MarkerB.pos,
|
||||
g_MarkerC.pos,
|
||||
g_MarkerD.pos
|
||||
);
|
||||
RepaintGraphWindow();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -3701,7 +3701,7 @@ static command_t CommandTable[] = {
|
||||
{"save", CmdSave, AlwaysAvailable, "Save signal trace data"},
|
||||
{"setdebugmode", CmdSetDebugMode, AlwaysAvailable, "Set Debugging Level on client side"},
|
||||
{"xor", CmdXor, AlwaysAvailable, "Xor a input string"},
|
||||
|
||||
|
||||
{"-----------", 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"},
|
||||
|
||||
@@ -2737,7 +2737,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
|
||||
"Set UID for magic Chinese card (only works with such cards)\n",
|
||||
"hf 15 csetuid -u E011223344556677 -> use gen1 command\n"
|
||||
"hf 15 csetuid -u E011223344556677 --v2 -> use gen2 command"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
||||
@@ -355,7 +355,7 @@ static int CmdHFMFPInfo(const char *Cmd) {
|
||||
if (supportVersion) {
|
||||
|
||||
int cardtype = getCardType(version[1], version[3], version[4]);
|
||||
switch(cardtype) {
|
||||
switch (cardtype) {
|
||||
case PLUS_EV1: {
|
||||
if (supportSignature) {
|
||||
PrintAndLogEx(INFO, "Tech..... " _GREEN_("MIFARE Plus EV1"));
|
||||
|
||||
+34
-34
@@ -474,7 +474,7 @@ static bool ht2_check_cryptokeys(const uint64_t *keys, const uint32_t keycount,
|
||||
}
|
||||
|
||||
static int ht2_check_dictionary(uint32_t key_count, uint8_t *keys, uint8_t keylen, uint32_t *found_idx) {
|
||||
|
||||
|
||||
lf_hitag_data_t packet;
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
||||
@@ -735,10 +735,10 @@ void annotateHitag2(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize,
|
||||
if (ht2_check_cryptokeys(keys, keycount, cmd)) {
|
||||
|
||||
_ht2state.cipher_state = ht2_hitag2_init(
|
||||
_ht2state.key,
|
||||
_ht2state.uid,
|
||||
REV32((cmd[3] << 24) + (cmd[2] << 16) + (cmd[1] << 8) + cmd[0])
|
||||
);
|
||||
_ht2state.key,
|
||||
_ht2state.uid,
|
||||
REV32((cmd[3] << 24) + (cmd[2] << 16) + (cmd[1] << 8) + cmd[0])
|
||||
);
|
||||
ht2_hitag2_cipher_transcrypt(&_ht2state.cipher_state, _ht2state.plain + 4, 4, 0);
|
||||
|
||||
uint64_t key = REV64(_ht2state.key);
|
||||
@@ -1001,7 +1001,7 @@ static int CmdLFHitagReader(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (use_nrar) {
|
||||
return PM3_SUCCESS;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
uint8_t *data = resp.data.asBytes;
|
||||
@@ -1312,15 +1312,15 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf hitag dump",
|
||||
"Read all Hitag 2 card memory and save to file\n"
|
||||
"Crypto mode key format: ISK high + ISK low, 4F4E4D494B52 (ONMIKR)\n"
|
||||
"Password mode, default key 4D494B52 (MIKR)\n",
|
||||
"lf hitag dump --pwd -> use def pwd\n"
|
||||
"lf hitag dump -k 4D494B52 -> pwd mode\n"
|
||||
"lf hitag dump --crypto -> use def crypto\n"
|
||||
"lf hitag dump -k 4F4E4D494B52 -> crypto mode\n"
|
||||
"lf hitag dump --nrar 0102030411223344\n"
|
||||
);
|
||||
"Read all Hitag 2 card memory and save to file\n"
|
||||
"Crypto mode key format: ISK high + ISK low, 4F4E4D494B52 (ONMIKR)\n"
|
||||
"Password mode, default key 4D494B52 (MIKR)\n",
|
||||
"lf hitag dump --pwd -> use def pwd\n"
|
||||
"lf hitag dump -k 4D494B52 -> pwd mode\n"
|
||||
"lf hitag dump --crypto -> use def crypto\n"
|
||||
"lf hitag dump -k 4F4E4D494B52 -> crypto mode\n"
|
||||
"lf hitag dump --nrar 0102030411223344\n"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
@@ -1376,10 +1376,10 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (keylen != 0 &&
|
||||
keylen != HITAG_PASSWORD_SIZE &&
|
||||
keylen != HITAG_CRYPTOKEY_SIZE &&
|
||||
keylen != HITAG_NRAR_SIZE) {
|
||||
if (keylen != 0 &&
|
||||
keylen != HITAG_PASSWORD_SIZE &&
|
||||
keylen != HITAG_CRYPTOKEY_SIZE &&
|
||||
keylen != HITAG_NRAR_SIZE) {
|
||||
PrintAndLogEx(WARNING, "Wrong KEY len expected (0,4,6,8) got %d", keylen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
@@ -1450,9 +1450,9 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
|
||||
} else if (use_ht2 && use_nrar) {
|
||||
|
||||
|
||||
|
||||
memcpy(packet.NrAr, nrar, sizeof(packet.NrAr));
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, _YELLOW_("Hitag 2") " - Challenge mode (NrAR)");
|
||||
|
||||
uint64_t t1 = msclock();
|
||||
@@ -1464,7 +1464,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
uint8_t attempt = 30;
|
||||
do {
|
||||
|
||||
PrintAndLogEx(INPLACE, "Attack 1 running..." );
|
||||
PrintAndLogEx(INPLACE, "Attack 1 running...");
|
||||
fflush(stdout);
|
||||
|
||||
if (WaitForResponseTimeout(CMD_LF_HITAG2_CRACK, &resp, 1000) == false) {
|
||||
@@ -1472,7 +1472,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lf_hitag_crack_response_t *payload = (lf_hitag_crack_response_t*)resp.data.asBytes;
|
||||
lf_hitag_crack_response_t *payload = (lf_hitag_crack_response_t *)resp.data.asBytes;
|
||||
|
||||
if (resp.status == PM3_SUCCESS) {
|
||||
PrintAndLogEx(NORMAL, " ( %s )", _GREEN_("ok"));
|
||||
@@ -1498,7 +1498,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
case -3: {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(FAILED, "Cannot find encrypted 'read page0' command!");
|
||||
return PM3_ESOFT;
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
case -4: {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
@@ -1508,7 +1508,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
}
|
||||
|
||||
} while (attempt);
|
||||
|
||||
|
||||
if (attempt == 0) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
@@ -1539,12 +1539,12 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||
|
||||
data = resp.data.asBytes;
|
||||
|
||||
out:
|
||||
out:
|
||||
|
||||
|
||||
// block3, 1 byte
|
||||
uid = bytes_to_num(data, HITAG_UID_SIZE);
|
||||
|
||||
|
||||
if (use_ht2) {
|
||||
print_hitag2_configuration(uid, data[HITAG_BLOCK_SIZE * 3]);
|
||||
print_hitag2_blocks(data, HITAG2_MAX_BYTE_SIZE);
|
||||
@@ -1915,7 +1915,7 @@ static int CmdLFHitag2Chk(const char *Cmd) {
|
||||
|
||||
uint64_t t1 = msclock();
|
||||
|
||||
// just loop twice at max. Starting with 4 or 6.
|
||||
// just loop twice at max. Starting with 4 or 6.
|
||||
for (; keylen < 7; keylen += 2) {
|
||||
// load keys
|
||||
uint8_t *keys = NULL;
|
||||
@@ -1934,7 +1934,7 @@ static int CmdLFHitag2Chk(const char *Cmd) {
|
||||
int status = ht2_check_dictionary(key_count, keys, keylen, &found_idx);
|
||||
|
||||
if (status == PM3_SUCCESS) {
|
||||
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
if (keylen == 6) {
|
||||
PrintAndLogEx(SUCCESS, "found valid key [ " _GREEN_("%s") " ]", sprint_hex_inrow(keys + (found_idx * keylen), keylen));
|
||||
@@ -2037,17 +2037,17 @@ static int CmdLFHitag2Lookup(const char *Cmd) {
|
||||
// - crypto stream generated is in BE/MSB order in Pm3 code.
|
||||
// - crypto state is in ?
|
||||
// - lfsr state is in ?
|
||||
//
|
||||
//
|
||||
// Different implementations handles internally the state either in MSB or LSB.
|
||||
// Something to keep an eye for when looking at code.
|
||||
//
|
||||
//
|
||||
// Termology:
|
||||
// cs / hstate.shiftregister / crypto state = same
|
||||
// lsfr = some implementations mixes cs and lsfr into one and only use the state. Some differentiate between them.
|
||||
// usually the key recovery functions under /tools/hitag2crack
|
||||
// IV / Nonce Reader 1 / Nr1 = same (clear text), always 00 00 00 00 in PM3 code when acting as reader.
|
||||
// Answer Reader 1 / Ar1 = encrypted and BE/MSB, +32, the clear text is always FF FF FF FF.
|
||||
// Answer Tag 1 / At1 = encrypted and BE/MSB, +32,
|
||||
// IV / Nonce Reader 1 / Nr1 = same (clear text), always 00 00 00 00 in PM3 code when acting as reader.
|
||||
// Answer Reader 1 / Ar1 = encrypted and BE/MSB, +32, the clear text is always FF FF FF FF.
|
||||
// Answer Tag 1 / At1 = encrypted and BE/MSB, +32,
|
||||
|
||||
/*
|
||||
When initializer the crypto engine
|
||||
|
||||
+10
-10
@@ -736,9 +736,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
|
||||
// mark short bytes (less than 8 Bit + Parity)
|
||||
if (protocol == ISO_14443A ||
|
||||
protocol == PROTO_MIFARE ||
|
||||
protocol == PROTO_MFPLUS ||
|
||||
protocol == THINFILM) {
|
||||
protocol == PROTO_MIFARE ||
|
||||
protocol == PROTO_MFPLUS ||
|
||||
protocol == THINFILM) {
|
||||
|
||||
// approximated with 128 * (9 * data_len);
|
||||
uint16_t bitime = 1056 + 32;
|
||||
@@ -978,14 +978,14 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
}
|
||||
}
|
||||
|
||||
if (protocol == PROTO_HITAG2) {
|
||||
if (protocol == PROTO_HITAG2) {
|
||||
|
||||
uint8_t ht2plain[9] = {0};
|
||||
uint8_t n = 0;
|
||||
if (hitag2_get_plain(ht2plain, &n)) {
|
||||
|
||||
memset(explanation, 0x00, sizeof(explanation));
|
||||
|
||||
|
||||
// handle partial bytes. The parity array[0] is used to store number of left over bits from NBYTES
|
||||
// This part prints the number of bits in the trace entry for hitag.
|
||||
uint8_t nbits = parityBytes[0];
|
||||
@@ -1019,7 +1019,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
|
||||
} else {
|
||||
snprintf(line[j / 18] + ((j % 18) * 4) + offset, 120, "%02X ", ht2plain[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
num_lines = MIN((n - 1) / TRACE_MAX_HEX_BYTES + 1, TRACE_MAX_HEX_BYTES);
|
||||
@@ -1041,7 +1041,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_last_record(tracepos, traceLen)) {
|
||||
return traceLen;
|
||||
@@ -1480,7 +1480,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
if (diclen > 0) {
|
||||
uint8_t *keyBlock = NULL;
|
||||
int res = loadFileDICTIONARY_safe(dictionary, (void **) &keyBlock, 6, &dicKeysCount);
|
||||
if (res != PM3_SUCCESS || dicKeysCount == 0 || keyBlock == NULL) {
|
||||
if (res != PM3_SUCCESS || dicKeysCount == 0 || keyBlock == NULL) {
|
||||
PrintAndLogEx(FAILED, "An error occurred while loading the dictionary! (we will use the default keys now)");
|
||||
} else {
|
||||
dicKeys = calloc(dicKeysCount, sizeof(uint64_t));
|
||||
@@ -1500,8 +1500,8 @@ int CmdTraceList(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( protocol == PROTO_HITAG2) {
|
||||
|
||||
if (protocol == PROTO_HITAG2) {
|
||||
|
||||
if (strlen(dictionary) == 0) {
|
||||
snprintf(dictionary, sizeof(dictionary), HITAG_DICTIONARY);
|
||||
}
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ size_t getFromGraphBufferEx(uint8_t *dest, size_t maxLen) {
|
||||
}
|
||||
|
||||
//TODO: In progress function to get chunks of data from the GB w/o modifying the GB
|
||||
//Currently seems like it doesn't work correctly?
|
||||
//Currently seems like it doesn't work correctly?
|
||||
size_t getGraphBufferChunk(uint8_t *dest, size_t start, size_t end) {
|
||||
if (dest == NULL) return 0;
|
||||
if (g_GraphTraceLen == 0) return 0;
|
||||
|
||||
@@ -742,7 +742,7 @@ static int DesfireExchangeISONative(bool activate_field, DesfireContext_t *ctx,
|
||||
pos += buflen;
|
||||
if (enable_chaining == false) {
|
||||
if (sw == DESFIRE_GET_ISO_STATUS(MFDES_S_OPERATION_OK) ||
|
||||
sw == DESFIRE_GET_ISO_STATUS(MFDES_ADDITIONAL_FRAME)) {
|
||||
sw == DESFIRE_GET_ISO_STATUS(MFDES_ADDITIONAL_FRAME)) {
|
||||
|
||||
if (resplen) {
|
||||
*resplen = pos;
|
||||
|
||||
@@ -626,13 +626,13 @@ static void DesfireSecureChannelDecodeEV1(DesfireContext_t *ctx, uint8_t *srcdat
|
||||
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, DesfireGetMACLength(ctx)));
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (GetAPDULogging()) {
|
||||
PrintAndLogEx(INFO, "Received MAC OK");
|
||||
}
|
||||
}
|
||||
|
||||
} else if (ctx->commMode == DCMEncrypted || ctx->commMode == DCMEncryptedWithPadding) {
|
||||
} else if (ctx->commMode == DCMEncrypted || ctx->commMode == DCMEncryptedWithPadding) {
|
||||
|
||||
if (srcdatalen < desfire_get_key_block_length(ctx->keyType)) {
|
||||
memcpy(dstdata, srcdata, srcdatalen);
|
||||
|
||||
+1763
-1839
File diff suppressed because it is too large
Load Diff
+2275
-2320
File diff suppressed because it is too large
Load Diff
@@ -75,6 +75,15 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 1, "analyse foo" },
|
||||
{ 1, "analyse units" },
|
||||
{ 1, "data help" },
|
||||
{ 1, "data clear" },
|
||||
{ 1, "data hide" },
|
||||
{ 1, "data load" },
|
||||
{ 1, "data num" },
|
||||
{ 1, "data plot" },
|
||||
{ 1, "data print" },
|
||||
{ 1, "data save" },
|
||||
{ 1, "data setdebugmode" },
|
||||
{ 1, "data xor" },
|
||||
{ 1, "data biphaserawdecode" },
|
||||
{ 1, "data detectclock" },
|
||||
{ 1, "data fsktonrz" },
|
||||
@@ -83,43 +92,32 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 1, "data rawdemod" },
|
||||
{ 1, "data askedgedetect" },
|
||||
{ 1, "data autocorr" },
|
||||
{ 1, "data convertbitstream" },
|
||||
{ 1, "data cthreshold" },
|
||||
{ 1, "data dirthreshold" },
|
||||
{ 1, "data decimate" },
|
||||
{ 1, "data envelope" },
|
||||
{ 1, "data undecimate" },
|
||||
{ 1, "data hide" },
|
||||
{ 1, "data grid" },
|
||||
{ 1, "data getbitstream" },
|
||||
{ 1, "data hpf" },
|
||||
{ 1, "data iir" },
|
||||
{ 1, "data grid" },
|
||||
{ 1, "data ltrim" },
|
||||
{ 1, "data mtrim" },
|
||||
{ 1, "data norm" },
|
||||
{ 1, "data plot" },
|
||||
{ 1, "data cthreshold" },
|
||||
{ 1, "data rtrim" },
|
||||
{ 1, "data setgraphmarkers" },
|
||||
{ 1, "data shiftgraphzero" },
|
||||
{ 1, "data timescale" },
|
||||
{ 1, "data undecimate" },
|
||||
{ 1, "data zerocrossings" },
|
||||
{ 1, "data convertbitstream" },
|
||||
{ 1, "data getbitstream" },
|
||||
{ 1, "data asn1" },
|
||||
{ 1, "data atr" },
|
||||
{ 1, "data bin2hex" },
|
||||
{ 0, "data bitsamples" },
|
||||
{ 1, "data bmap" },
|
||||
{ 1, "data clear" },
|
||||
{ 1, "data crypto" },
|
||||
{ 1, "data diff" },
|
||||
{ 0, "data hexsamples" },
|
||||
{ 1, "data hex2bin" },
|
||||
{ 1, "data load" },
|
||||
{ 1, "data num" },
|
||||
{ 1, "data print" },
|
||||
{ 0, "data samples" },
|
||||
{ 1, "data save" },
|
||||
{ 1, "data setdebugmode" },
|
||||
{ 1, "data xor" },
|
||||
{ 1, "emv help" },
|
||||
{ 1, "emv list" },
|
||||
{ 1, "emv test" },
|
||||
@@ -558,11 +556,11 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 0, "lf sniff" },
|
||||
{ 0, "lf tune" },
|
||||
{ 1, "lf awid help" },
|
||||
{ 0, "lf awid brute" },
|
||||
{ 0, "lf awid clone" },
|
||||
{ 1, "lf awid demod" },
|
||||
{ 0, "lf awid reader" },
|
||||
{ 0, "lf awid clone" },
|
||||
{ 0, "lf awid sim" },
|
||||
{ 0, "lf awid brute" },
|
||||
{ 0, "lf awid watch" },
|
||||
{ 1, "lf cotag help" },
|
||||
{ 1, "lf cotag demod" },
|
||||
@@ -647,16 +645,19 @@ const static vocabulary_t vocabulary[] = {
|
||||
{ 1, "lf hitag help" },
|
||||
{ 1, "lf hitag list" },
|
||||
{ 0, "lf hitag info" },
|
||||
{ 1, "lf hitag selftest" },
|
||||
{ 0, "lf hitag dump" },
|
||||
{ 0, "lf hitag read" },
|
||||
{ 0, "lf hitag sniff" },
|
||||
{ 1, "lf hitag view" },
|
||||
{ 0, "lf hitag wrbl" },
|
||||
{ 0, "lf hitag sniff" },
|
||||
{ 0, "lf hitag cc" },
|
||||
{ 0, "lf hitag ta" },
|
||||
{ 0, "lf hitag eload" },
|
||||
{ 0, "lf hitag eview" },
|
||||
{ 0, "lf hitag sim" },
|
||||
{ 0, "lf hitag cc" },
|
||||
{ 0, "lf hitag chk" },
|
||||
{ 1, "lf hitag lookup" },
|
||||
{ 0, "lf hitag ta" },
|
||||
{ 1, "lf idteck help" },
|
||||
{ 1, "lf idteck demod" },
|
||||
{ 0, "lf idteck reader" },
|
||||
|
||||
@@ -138,12 +138,12 @@ extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char
|
||||
}
|
||||
|
||||
void add_temporary_marker(uint32_t position, const char *label) {
|
||||
if(g_TempMarkerSize == 0) { //Initialize the marker array
|
||||
g_TempMarkers = (marker_t*)calloc(1, sizeof(marker_t));
|
||||
if (g_TempMarkerSize == 0) { //Initialize the marker array
|
||||
g_TempMarkers = (marker_t *)calloc(1, sizeof(marker_t));
|
||||
} else { //add more space to the marker array using realloc()
|
||||
marker_t *temp = (marker_t*)realloc(g_TempMarkers, ((g_TempMarkerSize + 1) * sizeof(marker_t)));
|
||||
marker_t *temp = (marker_t *)realloc(g_TempMarkers, ((g_TempMarkerSize + 1) * sizeof(marker_t)));
|
||||
|
||||
if(temp == NULL) { //Unable to reallocate memory for a new marker
|
||||
if (temp == NULL) { //Unable to reallocate memory for a new marker
|
||||
PrintAndLogEx(FAILED, "Unable to allocate memory for a new temporary marker!");
|
||||
free(temp);
|
||||
return;
|
||||
@@ -155,10 +155,10 @@ void add_temporary_marker(uint32_t position, const char *label) {
|
||||
|
||||
g_TempMarkers[g_TempMarkerSize].pos = position;
|
||||
|
||||
char *markerLabel = (char*)calloc(1, strlen(label) + 1);
|
||||
char *markerLabel = (char *)calloc(1, strlen(label) + 1);
|
||||
strcpy(markerLabel, label);
|
||||
|
||||
if(strlen(markerLabel) > 30) {
|
||||
if (strlen(markerLabel) > 30) {
|
||||
PrintAndLogEx(WARNING, "Label for temporary marker too long! Trunicating...");
|
||||
markerLabel[30] = '\0';
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void add_temporary_marker(uint32_t position, const char *label) {
|
||||
}
|
||||
|
||||
void remove_temporary_markers(void) {
|
||||
if(g_TempMarkerSize == 0) return;
|
||||
if (g_TempMarkerSize == 0) return;
|
||||
|
||||
memset(g_TempMarkers, 0x00, (g_TempMarkerSize * sizeof(marker_t)));
|
||||
free(g_TempMarkers);
|
||||
|
||||
+89
-89
@@ -598,7 +598,7 @@ void Plot::setMaxAndStart(int *buffer, size_t len, QRect plotRect) {
|
||||
}
|
||||
|
||||
void Plot::appendMax(int *buffer, size_t len, QRect plotRect) {
|
||||
if(len == 0) {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -750,12 +750,12 @@ void Plot::PlotGraph(int *buffer, size_t len, QRect plotRect, QRect annotationRe
|
||||
painter->drawPath(penPath);
|
||||
char str[200];
|
||||
snprintf(str, sizeof(str), "max=%d min=%d mean=%" PRId64 " n=%u/%zu",
|
||||
vMax,
|
||||
vMin,
|
||||
vMean,
|
||||
g_GraphStop - g_GraphStart,
|
||||
len
|
||||
);
|
||||
vMax,
|
||||
vMin,
|
||||
vMean,
|
||||
g_GraphStop - g_GraphStart,
|
||||
len
|
||||
);
|
||||
|
||||
painter->drawText(20, annotationRect.bottom() - (48 - (12 * graphNum)), str);
|
||||
}
|
||||
@@ -781,37 +781,37 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
||||
|
||||
//Print the Graph Information
|
||||
char graphText[] = "@%u..%u dt=%i %s zoom=%2.3f";
|
||||
length = ((sizeof(graphText))+(sizeof(uint32_t)*3)+sizeof(scalestr)+sizeof(float_t));
|
||||
length = ((sizeof(graphText)) + (sizeof(uint32_t) * 3) + sizeof(scalestr) + sizeof(float_t));
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, graphText,
|
||||
g_GraphStart,
|
||||
g_GraphStop,
|
||||
g_MarkerB.pos - g_MarkerA.pos,
|
||||
scalestr,
|
||||
g_GraphPixelsPerPoint
|
||||
);
|
||||
g_GraphStart,
|
||||
g_GraphStop,
|
||||
g_MarkerB.pos - g_MarkerA.pos,
|
||||
scalestr,
|
||||
g_GraphPixelsPerPoint
|
||||
);
|
||||
|
||||
painter->setPen(GREEN);
|
||||
painter->drawText(82, annotationRect.bottom() - 62, annotation);
|
||||
|
||||
//Print Grid Information if the grid is enabled
|
||||
if(g_PlotGridX > 0) {
|
||||
if (g_PlotGridX > 0) {
|
||||
free(annotation);
|
||||
|
||||
const char *gridLocked = (g_GridLocked ? "Locked" : "Unlocked");
|
||||
char gridText[] = "GridX=%lf GridY=%lf (%s) GridXoffset=%lf";
|
||||
length = (sizeof(gridText) + (sizeof(double)*3) + sizeof(gridLocked));
|
||||
length = (sizeof(gridText) + (sizeof(double) * 3) + sizeof(gridLocked));
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, gridText,
|
||||
g_DefaultGridX,
|
||||
g_DefaultGridY,
|
||||
gridLocked,
|
||||
g_GridOffset
|
||||
);
|
||||
g_DefaultGridX,
|
||||
g_DefaultGridY,
|
||||
gridLocked,
|
||||
g_GridOffset
|
||||
);
|
||||
|
||||
painter->setPen(WHITE);
|
||||
painter->drawText(800, annotationRect.bottom() - 62, annotation);
|
||||
@@ -822,21 +822,21 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
||||
uint32_t pos = 0, loc = 375;
|
||||
painter->setPen(WHITE);
|
||||
|
||||
if(g_MarkerA.pos > 0) {
|
||||
if (g_MarkerA.pos > 0) {
|
||||
free(annotation);
|
||||
|
||||
length = (sizeof(markerText) + (sizeof(uint32_t)*3) + sizeof(" ") + 1);
|
||||
length = (sizeof(markerText) + (sizeof(uint32_t) * 3) + sizeof(" ") + 1);
|
||||
pos = g_MarkerA.pos;
|
||||
bool flag = false;
|
||||
size_t value;
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
char *textA = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
char *textA = (char *)calloc(1, length);
|
||||
|
||||
strcat(textA, markerText);
|
||||
strcat(textA, " (%s%u)");
|
||||
|
||||
if(g_GraphBuffer[pos] <= g_OperationBuffer[pos]) {
|
||||
if (g_GraphBuffer[pos] <= g_OperationBuffer[pos]) {
|
||||
flag = true;
|
||||
value = (g_OperationBuffer[pos] - g_GraphBuffer[pos]);
|
||||
} else {
|
||||
@@ -844,65 +844,65 @@ void Plot::drawAnnotations(QRect annotationRect, QPainter *painter) {
|
||||
}
|
||||
|
||||
snprintf(annotation, length, textA,
|
||||
"A",
|
||||
pos,
|
||||
g_GraphBuffer[pos],
|
||||
flag ? "+" : "-",
|
||||
value
|
||||
);
|
||||
"A",
|
||||
pos,
|
||||
g_GraphBuffer[pos],
|
||||
flag ? "+" : "-",
|
||||
value
|
||||
);
|
||||
|
||||
painter->drawText(loc, annotationRect.bottom() - 48, annotation);
|
||||
|
||||
free(textA);
|
||||
}
|
||||
|
||||
if(g_MarkerB.pos > 0) {
|
||||
if (g_MarkerB.pos > 0) {
|
||||
free(annotation);
|
||||
|
||||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
length = ((sizeof(markerText)) + (sizeof(uint32_t) * 2) + 1);
|
||||
pos = g_MarkerB.pos;
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"B",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
"B",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
|
||||
painter->drawText(loc, annotationRect.bottom() - 36, annotation);
|
||||
}
|
||||
|
||||
if(g_MarkerC.pos > 0) {
|
||||
if (g_MarkerC.pos > 0) {
|
||||
free(annotation);
|
||||
|
||||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
length = ((sizeof(markerText)) + (sizeof(uint32_t) * 2) + 1);
|
||||
pos = g_MarkerC.pos;
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"C",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
"C",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
|
||||
painter->drawText(loc, annotationRect.bottom() - 24, annotation);
|
||||
}
|
||||
|
||||
if(g_MarkerD.pos > 0) {
|
||||
if (g_MarkerD.pos > 0) {
|
||||
free(annotation);
|
||||
|
||||
length = ((sizeof(markerText))+(sizeof(uint32_t)*2)+1);
|
||||
length = ((sizeof(markerText)) + (sizeof(uint32_t) * 2) + 1);
|
||||
pos = g_MarkerD.pos;
|
||||
|
||||
annotation = (char*)calloc(1, length);
|
||||
annotation = (char *)calloc(1, length);
|
||||
|
||||
snprintf(annotation, length, markerText,
|
||||
"D",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
"D",
|
||||
pos,
|
||||
g_GraphBuffer[pos]
|
||||
);
|
||||
|
||||
painter->drawText(loc, annotationRect.bottom() - 12, annotation);
|
||||
}
|
||||
@@ -951,7 +951,7 @@ void Plot::plotGridLines(QPainter *painter, QRect r) {
|
||||
}
|
||||
|
||||
void Plot::plotOperations(int *buffer, size_t len, QPainter *painter, QRect plotRect) {
|
||||
if(len == 0) {
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -973,10 +973,10 @@ void Plot::plotOperations(int *buffer, size_t len, QPainter *painter, QRect plot
|
||||
y = yCoordOf(current, plotRect, gs_absVMax);
|
||||
|
||||
//We only want to graph changes between the Graph Buffer and the Operation Buffer
|
||||
if(current == g_GraphBuffer[pos]) {
|
||||
if (current == g_GraphBuffer[pos]) {
|
||||
//If this point is the same, but the last point is different, we want to plot that line
|
||||
//as well
|
||||
if((pos == 0) || (prev == g_GraphBuffer[pos - 1])) {
|
||||
if ((pos == 0) || (prev == g_GraphBuffer[pos - 1])) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -1045,8 +1045,8 @@ void Plot::paintEvent(QPaintEvent *event) {
|
||||
// End graph drawing
|
||||
|
||||
//Draw the markers
|
||||
if(g_TempMarkerSize > 0) {
|
||||
for(int i = 0; i < g_TempMarkerSize; i++) {
|
||||
if (g_TempMarkerSize > 0) {
|
||||
for (int i = 0; i < g_TempMarkerSize; i++) {
|
||||
draw_marker(g_TempMarkers[i], plotRect, GRAY100, &painter);
|
||||
}
|
||||
}
|
||||
@@ -1074,15 +1074,15 @@ void Plot::draw_marker(marker_t marker, QRect plotRect, QColor color, QPainter *
|
||||
painter->setPen(color);
|
||||
|
||||
//If the marker is outside the buffer length, reset
|
||||
if(marker.pos > g_GraphTraceLen) {
|
||||
if (marker.pos > g_GraphTraceLen) {
|
||||
marker.pos = 0;
|
||||
}
|
||||
|
||||
//Make sure the marker is inside the current plot view to render
|
||||
if(marker.pos > g_GraphStart && xCoordOf(marker.pos, plotRect) < plotRect.right()) {
|
||||
if (marker.pos > g_GraphStart && xCoordOf(marker.pos, plotRect) < plotRect.right()) {
|
||||
painter->drawLine(xCoordOf(marker.pos, plotRect), plotRect.top(), xCoordOf(marker.pos, plotRect), plotRect.bottom());
|
||||
|
||||
if(strlen(marker.label) > 0) {
|
||||
if (strlen(marker.label) > 0) {
|
||||
painter->drawText(xCoordOf(marker.pos, plotRect) + 1, plotRect.top() + 12, marker.label);
|
||||
}
|
||||
}
|
||||
@@ -1295,7 +1295,7 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
offset = 1;
|
||||
} else {
|
||||
offset = int(ZOOM_LIMIT / g_GraphPixelsPerPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (event->key()) {
|
||||
@@ -1393,9 +1393,9 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("[ ") "/" _RED_(" ]"), "Move yellow marker left/right by 1 sample");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("{ ") "/" _RED_(" }"), "Move pink marker left/right by 1 sample");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Ctrl"), "... by 5 samples");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 +9, _RED_("= ") "/" _RED_(" -"), "Add/Subtract to the plot point (Operation Buffer) over the yellow marker by 1");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("= ") "/" _RED_(" -"), "Add/Subtract to the plot point (Operation Buffer) over the yellow marker by 1");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Ctrl"), "... by 5");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 +9, _RED_("+ ") "/" _RED_(" _"), "Add/Subtract to the plot point (Graph Buffer) over the yellow marker by 1");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("+ ") "/" _RED_(" _"), "Add/Subtract to the plot point (Graph Buffer) over the yellow marker by 1");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Ctrl"), "... by 5");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("h"), "Show this help");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("q"), "Close plot window");
|
||||
@@ -1441,9 +1441,9 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
if (g_GraphStart > startMax)
|
||||
g_GraphStart = startMax;
|
||||
break;
|
||||
|
||||
|
||||
case Qt::Key_Equal:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_OperationBuffer[g_MarkerA.pos] += 5;
|
||||
} else {
|
||||
g_OperationBuffer[g_MarkerA.pos] += 1;
|
||||
@@ -1451,9 +1451,9 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
|
||||
RepaintGraphWindow();
|
||||
break;
|
||||
|
||||
|
||||
case Qt::Key_Minus:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_OperationBuffer[g_MarkerA.pos] -= 5;
|
||||
} else {
|
||||
g_OperationBuffer[g_MarkerA.pos] -= 1;
|
||||
@@ -1463,7 +1463,7 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
break;
|
||||
|
||||
case Qt::Key_Plus:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_GraphBuffer[g_MarkerA.pos] += 5;
|
||||
} else {
|
||||
g_GraphBuffer[g_MarkerA.pos] += 1;
|
||||
@@ -1471,9 +1471,9 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
|
||||
RepaintGraphWindow();
|
||||
break;
|
||||
|
||||
|
||||
case Qt::Key_Underscore:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_GraphBuffer[g_MarkerA.pos] -= 5;
|
||||
} else {
|
||||
g_GraphBuffer[g_MarkerA.pos] -= 1;
|
||||
@@ -1483,77 +1483,77 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||
break;
|
||||
|
||||
case Qt::Key_BracketLeft: {
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_MarkerA.pos -= 5;
|
||||
} else {
|
||||
g_MarkerA.pos -= 1;
|
||||
}
|
||||
|
||||
if((g_MarkerA.pos >= g_GraphStop) || (g_MarkerA.pos <= g_GraphStart)) {
|
||||
if ((g_MarkerA.pos >= g_GraphStop) || (g_MarkerA.pos <= g_GraphStart)) {
|
||||
uint32_t halfway = PageWidth / 2;
|
||||
|
||||
if((g_MarkerA.pos - halfway) > g_GraphTraceLen) {
|
||||
if ((g_MarkerA.pos - halfway) > g_GraphTraceLen) {
|
||||
g_GraphStart = 0;
|
||||
} else {
|
||||
g_GraphStart = g_MarkerA.pos - halfway;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_MarkerA.pos < g_GraphStart) {
|
||||
if (g_MarkerA.pos < g_GraphStart) {
|
||||
g_MarkerA.pos = g_GraphStart;
|
||||
}
|
||||
|
||||
RepaintGraphWindow();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case Qt::Key_BracketRight: {
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_MarkerA.pos += 5;
|
||||
} else {
|
||||
g_MarkerA.pos += 1;
|
||||
}
|
||||
|
||||
if((g_MarkerA.pos >= g_GraphStop) || (g_MarkerA.pos <= g_GraphStart)) {
|
||||
if ((g_MarkerA.pos >= g_GraphStop) || (g_MarkerA.pos <= g_GraphStart)) {
|
||||
uint32_t halfway = PageWidth / 2;
|
||||
|
||||
if((g_MarkerA.pos + halfway) >= g_GraphTraceLen) {
|
||||
if ((g_MarkerA.pos + halfway) >= g_GraphTraceLen) {
|
||||
g_GraphStart = g_GraphTraceLen - halfway;
|
||||
} else {
|
||||
g_GraphStart = g_MarkerA.pos - halfway;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_MarkerA.pos >= g_GraphTraceLen) {
|
||||
if (g_MarkerA.pos >= g_GraphTraceLen) {
|
||||
g_MarkerA.pos = g_GraphTraceLen;
|
||||
}
|
||||
|
||||
RepaintGraphWindow();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case Qt::Key_BraceLeft:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_MarkerB.pos -= 5;
|
||||
} else {
|
||||
g_MarkerB.pos -= 1;
|
||||
}
|
||||
|
||||
if(g_MarkerB.pos < g_GraphStart) {
|
||||
if (g_MarkerB.pos < g_GraphStart) {
|
||||
g_MarkerB.pos = g_GraphStart;
|
||||
}
|
||||
|
||||
|
||||
RepaintGraphWindow();
|
||||
break;
|
||||
|
||||
|
||||
case Qt::Key_BraceRight:
|
||||
if(event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
g_MarkerB.pos += 5;
|
||||
} else {
|
||||
g_MarkerB.pos += 1;
|
||||
}
|
||||
|
||||
if(g_MarkerB.pos >= g_GraphTraceLen) {
|
||||
if (g_MarkerB.pos >= g_GraphTraceLen) {
|
||||
g_MarkerB.pos = g_GraphTraceLen;
|
||||
}
|
||||
|
||||
|
||||
+137
-110
File diff suppressed because one or more lines are too long
+26
-24
@@ -94,6 +94,15 @@ Check column "offline" for their availability.
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`data help `|Y |`This help`
|
||||
|`data clear `|Y |`Clears various buffers used by the graph window`
|
||||
|`data hide `|Y |`Hide the graph window`
|
||||
|`data load `|Y |`Load contents of file into graph window`
|
||||
|`data num `|Y |`Converts dec/hex/bin`
|
||||
|`data plot `|Y |`Show the graph window`
|
||||
|`data print `|Y |`Print the data in the DemodBuffer`
|
||||
|`data save `|Y |`Save signal trace data`
|
||||
|`data setdebugmode `|Y |`Set Debugging Level on client side`
|
||||
|`data xor `|Y |`Xor a input string`
|
||||
|`data biphaserawdecode `|Y |`Biphase decode bin stream in DemodBuffer`
|
||||
|`data detectclock `|Y |`Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer`
|
||||
|`data fsktonrz `|Y |`Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk)`
|
||||
@@ -102,43 +111,32 @@ Check column "offline" for their availability.
|
||||
|`data rawdemod `|Y |`Demodulate the data in the GraphBuffer and output binary`
|
||||
|`data askedgedetect `|Y |`Adjust Graph for manual ASK demod`
|
||||
|`data autocorr `|Y |`Autocorrelation over window`
|
||||
|`data convertbitstream `|Y |`Convert GraphBuffer's 0/1 values to 127 / -127`
|
||||
|`data cthreshold `|Y |`Average out all values between`
|
||||
|`data dirthreshold `|Y |`Max rising higher up-thres/ Min falling lower down-thres`
|
||||
|`data decimate `|Y |`Decimate samples`
|
||||
|`data envelope `|Y |`Generate square envelope of samples`
|
||||
|`data undecimate `|Y |`Un-decimate samples`
|
||||
|`data hide `|Y |`Hide graph window`
|
||||
|`data grid `|Y |`overlay grid on graph window`
|
||||
|`data getbitstream `|Y |`Convert GraphBuffer's >=1 values to 1 and <1 to 0`
|
||||
|`data hpf `|Y |`Remove DC offset from trace`
|
||||
|`data iir `|Y |`Apply IIR buttersworth filter on plot data`
|
||||
|`data grid `|Y |`overlay grid on graph window`
|
||||
|`data ltrim `|Y |`Trim samples from left of trace`
|
||||
|`data mtrim `|Y |`Trim out samples from the specified start to the specified stop`
|
||||
|`data norm `|Y |`Normalize max/min to +/-128`
|
||||
|`data plot `|Y |`Show graph window`
|
||||
|`data cthreshold `|Y |`Average out all values between`
|
||||
|`data rtrim `|Y |`Trim samples from right of trace`
|
||||
|`data setgraphmarkers `|Y |`Set blue and orange marker in graph window`
|
||||
|`data setgraphmarkers `|Y |`Set the markers in the graph window`
|
||||
|`data shiftgraphzero `|Y |`Shift 0 for Graphed wave + or - shift value`
|
||||
|`data timescale `|Y |`Set cursor display timescale`
|
||||
|`data undecimate `|Y |`Un-decimate samples`
|
||||
|`data zerocrossings `|Y |`Count time between zero-crossings`
|
||||
|`data convertbitstream `|Y |`Convert GraphBuffer's 0/1 values to 127 / -127`
|
||||
|`data getbitstream `|Y |`Convert GraphBuffer's >=1 values to 1 and <1 to 0`
|
||||
|`data asn1 `|Y |`ASN1 decoder`
|
||||
|`data atr `|Y |`ATR lookup`
|
||||
|`data bin2hex `|Y |`Converts binary to hexadecimal`
|
||||
|`data bitsamples `|N |`Get raw samples as bitstring`
|
||||
|`data bmap `|Y |`Convert hex value according a binary template`
|
||||
|`data clear `|Y |`Clears bigbuf on deviceside and graph window`
|
||||
|`data crypto `|Y |`Encrypt and decrypt data`
|
||||
|`data diff `|Y |`Diff of input files`
|
||||
|`data hexsamples `|N |`Dump big buffer as hex bytes`
|
||||
|`data hex2bin `|Y |`Converts hexadecimal to binary`
|
||||
|`data load `|Y |`Load contents of file into graph window`
|
||||
|`data num `|Y |`Converts dec/hex/bin`
|
||||
|`data print `|Y |`Print the data in the DemodBuffer`
|
||||
|`data samples `|N |`Get raw samples for graph window ( GraphBuffer )`
|
||||
|`data save `|Y |`Save signal trace data ( GraphBuffer )`
|
||||
|`data setdebugmode `|Y |`Set Debugging Level on client side`
|
||||
|`data xor `|Y |`Xor a input string`
|
||||
|
||||
|
||||
### emv
|
||||
@@ -857,9 +855,10 @@ Check column "offline" for their availability.
|
||||
|command |offline |description
|
||||
|------- |------- |-----------
|
||||
|`lf awid help `|Y |`this help`
|
||||
|`lf awid brute `|N |`bruteforce card number against reader`
|
||||
|`lf awid clone `|N |`clone AWID tag to T55x7, Q5/T5555 or EM4305/4469`
|
||||
|`lf awid demod `|Y |`demodulate an AWID FSK tag from the GraphBuffer`
|
||||
|`lf awid reader `|N |`attempt to read and extract tag data`
|
||||
|`lf awid clone `|N |`clone AWID tag to T55x7, Q5/T5555 or EM4305/4469`
|
||||
|`lf awid sim `|N |`simulate AWID tag`
|
||||
|`lf awid brute `|N |`bruteforce card number against reader`
|
||||
|`lf awid watch `|N |`continuously watch for cards. Reader mode`
|
||||
@@ -923,7 +922,7 @@ Check column "offline" for their availability.
|
||||
|`lf em 4x05 help `|Y |`This help`
|
||||
|`lf em 4x05 clonehelp `|N |`Shows the available clone commands`
|
||||
|`lf em 4x05 brute `|N |`Bruteforce password`
|
||||
|`lf em 4x05 chk `|N |`Check passwords from dictionary`
|
||||
|`lf em 4x05 chk `|N |`Check passwords`
|
||||
|`lf em 4x05 config `|Y |`Create common configuration words`
|
||||
|`lf em 4x05 demod `|Y |`Demodulate a EM4x05/EM4x69 tag from the GraphBuffer`
|
||||
|`lf em 4x05 dump `|N |`Dump EM4x05/EM4x69 tag`
|
||||
@@ -944,7 +943,7 @@ Check column "offline" for their availability.
|
||||
|------- |------- |-----------
|
||||
|`lf em 4x50 help `|Y |`This help`
|
||||
|`lf em 4x50 brute `|N |`Bruteforce attack to find password`
|
||||
|`lf em 4x50 chk `|N |`Check passwords from dictionary`
|
||||
|`lf em 4x50 chk `|N |`Check passwords`
|
||||
|`lf em 4x50 dump `|N |`Dump EM4x50 tag`
|
||||
|`lf em 4x50 info `|N |`Tag information`
|
||||
|`lf em 4x50 login `|N |`Login into EM4x50 tag`
|
||||
@@ -1042,16 +1041,19 @@ Check column "offline" for their availability.
|
||||
|`lf hitag help `|Y |`This help`
|
||||
|`lf hitag list `|Y |`List Hitag trace history`
|
||||
|`lf hitag info `|N |`Hitag 2 tag information`
|
||||
|`lf hitag selftest `|Y |`Perform self test`
|
||||
|`lf hitag dump `|N |`Dump Hitag 2 tag`
|
||||
|`lf hitag read `|N |`Read Hitag memory`
|
||||
|`lf hitag sniff `|N |`Eavesdrop Hitag communication`
|
||||
|`lf hitag view `|Y |`Display content from tag dump file`
|
||||
|`lf hitag wrbl `|N |`Write a block (page) in Hitag memory`
|
||||
|`lf hitag sniff `|N |`Eavesdrop Hitag communication`
|
||||
|`lf hitag cc `|N |`Hitag S: test all provided challenges`
|
||||
|`lf hitag ta `|N |`Hitag 2: test all recorded authentications`
|
||||
|`lf hitag eload `|N |`Upload file into emulator memory`
|
||||
|`lf hitag eview `|N |`View emulator memory`
|
||||
|`lf hitag sim `|N |`Simulate Hitag transponder`
|
||||
|`lf hitag cc `|N |`Hitag S: test all provided challenges`
|
||||
|`lf hitag chk `|N |`Check keys`
|
||||
|`lf hitag lookup `|Y |`Uses authentication trace to check for key in dictionary file`
|
||||
|`lf hitag ta `|N |`Hitag 2: test all recorded authentications`
|
||||
|
||||
|
||||
### lf idteck
|
||||
@@ -1285,7 +1287,7 @@ Check column "offline" for their availability.
|
||||
|`lf t55xx wakeup `|N |`Send AOR wakeup command`
|
||||
|`lf t55xx write `|N |`Write T55xx block data`
|
||||
|`lf t55xx bruteforce `|N |`Simple bruteforce attack to find password`
|
||||
|`lf t55xx chk `|N |`Check passwords from dictionary/flash`
|
||||
|`lf t55xx chk `|N |`Check passwords`
|
||||
|`lf t55xx protect `|N |`Password protect tag`
|
||||
|`lf t55xx recoverpw `|N |`Try to recover from bad password write from a cloner`
|
||||
|`lf t55xx sniff `|Y |`Attempt to recover T55xx commands from sample buffer`
|
||||
|
||||
Reference in New Issue
Block a user