Merge pull request #49 from RfidResearchGroup/master

Update
This commit is contained in:
mwalker33 2020-09-29 20:10:43 +10:00 committed by GitHub
commit 3785adcb91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
100 changed files with 326557 additions and 1948 deletions

View file

@ -292,6 +292,12 @@ void tosend_reset(void) {
}
void tosend_stuffbit(int b) {
if (toSend.max >= TOSEND_BUFFER_SIZE - 1) {
Dbprintf(_RED_("toSend overflow"));
return;
}
if (toSend.bit >= 8) {
toSend.max++;
toSend.buf[toSend.max] = 0;
@ -299,7 +305,7 @@ void tosend_stuffbit(int b) {
}
if (b)
toSend.buf[ toSend.max] |= (1 << (7 - toSend.bit));
toSend.buf[toSend.max] |= (1 << (7 - toSend.bit));
toSend.bit++;

View file

@ -222,10 +222,9 @@ int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length) {
// since the card doesn't always care for the expected length we send it,
// we reserve 262 bytes here just to be safe (256-byte APDU + SW + ISO frame)
uint8_t response_apdu[262];
int rapdu_length = 0;
// select the file EF.CardAccess
rapdu_length = EPA_APDU((uint8_t *)apdu_select_binary_cardaccess,
int rapdu_length = EPA_APDU((uint8_t *)apdu_select_binary_cardaccess,
sizeof(apdu_select_binary_cardaccess),
response_apdu,
sizeof(response_apdu)

View file

@ -1747,7 +1747,8 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
// init as reader
lf_init(true, false);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
// Tag specific configuration settings (sof, timings, etc.)
// TODO HTS
/* if (htf <= HTS_LAST_CMD) {
@ -1780,9 +1781,10 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
size_t max_nrzs = (8 * HITAG_FRAME_LEN + 5) * 2; // up to 2 nrzs per bit
uint8_t nrz_samples[max_nrzs];
size_t nrzs = 0;
int16_t checked = 0;
uint32_t signal_size = 10000;
bool turn_on = true;
while (bStop == false && BUTTON_PRESS() == false) {
// use malloc
@ -1818,9 +1820,20 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
}
}
// Wait for t_wait_2 carrier periods after the last tag bit before transmitting,
lf_wait_periods(t_wait_2);
command_start += t_wait_2;
if (bStop) break;
if (turn_on) {
// Wait 50ms with field off to be sure the transponder gets reset
SpinDelay(50);
FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_ADC | FPGA_LF_ADC_READER_FIELD);
turn_on = false;
// 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);
command_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(t_wait_2);
command_start += t_wait_2;
}
// Transmit the reader frame
command_duration = hitag_reader_send_frame(tx, txlen);

View file

@ -253,6 +253,7 @@ set (TARGET_SOURCES
${PM3_ROOT}/client/src/cmdlfguard.c
${PM3_ROOT}/client/src/cmdlfhid.c
${PM3_ROOT}/client/src/cmdlfhitag.c
${PM3_ROOT}/client/src/cmdlfidteck.c
${PM3_ROOT}/client/src/cmdlfindala.c
${PM3_ROOT}/client/src/cmdlfio.c
${PM3_ROOT}/client/src/cmdlfjablotron.c

View file

@ -447,6 +447,7 @@ SRCS = aidsearch.c \
cmdlfgallagher.c \
cmdlfhid.c \
cmdlfhitag.c \
cmdlfidteck.c \
cmdlfindala.c \
cmdlfio.c \
cmdlfjablotron.c \

View file

@ -132,6 +132,7 @@ add_library(pm3rrg_rdv4 SHARED
${PM3_ROOT}/client/src/cmdlfguard.c
${PM3_ROOT}/client/src/cmdlfhid.c
${PM3_ROOT}/client/src/cmdlfhitag.c
${PM3_ROOT}/client/src/cmdlfidteck.c
${PM3_ROOT}/client/src/cmdlfindala.c
${PM3_ROOT}/client/src/cmdlfio.c
${PM3_ROOT}/client/src/cmdlfjablotron.c
@ -209,4 +210,4 @@ target_link_libraries(pm3rrg_rdv4
pm3rrg_rdv4_reveng
pm3rrg_rdv4_whereami
android
log)
log)

View file

@ -557,27 +557,11 @@ static int CmdConvertBitStream(const char *Cmd) {
//verbose will print results and demoding messages
//emSearch will auto search for EM410x format in bitstream
//askType switches decode: ask/raw = 0, ask/manchester = 1
int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType, bool *stCheck) {
int invert = 0;
int clk = 0;
int maxErr = 100;
size_t maxLen = 0;
int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxLen, bool amplify, bool verbose, bool emSearch, uint8_t askType, bool *stCheck) {
uint8_t askamp = 0;
char amp = tolower(param_getchar(Cmd, 0));
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &amp);
if (!maxLen) maxLen = pm3_capabilities.bigbuf_size;
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid argument: %s", Cmd);
return PM3_EINVARG;
}
if (clk == 1) {
invert = 1;
clk = 0;
}
uint8_t *bits = calloc(MAX_GRAPH_TRACE_LEN, sizeof(uint8_t));
if (bits == NULL) {
return PM3_EMALLOC;
@ -597,7 +581,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
int foundclk = 0;
//amplify signal before ST check
if (amp == 'a') {
if (amplify) {
askAmp(bits, BitLen);
}
@ -658,9 +642,9 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
free(bits);
return PM3_SUCCESS;
}
int ASKDemod(const char *Cmd, bool verbose, bool emSearch, uint8_t askType) {
int ASKDemod(int clk, int invert, int maxErr, size_t maxLen, bool amplify, bool verbose, bool emSearch, uint8_t askType) {
bool st = false;
return ASKDemod_ext(Cmd, verbose, emSearch, askType, &st);
return ASKDemod_ext(clk, invert, maxErr, maxLen, amplify, verbose, emSearch, askType, &st);
}
//by marshmellow
@ -670,19 +654,36 @@ int ASKDemod(const char *Cmd, bool verbose, bool emSearch, uint8_t askType) {
static int Cmdaskmandemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 45 || cmdp == 'h') return usage_data_rawdemod_am();
bool st = true;
if (Cmd[0] == 's')
return ASKDemod_ext(Cmd++, true, true, 1, &st);
else if (Cmd[1] == 's')
return ASKDemod_ext(Cmd += 2, true, true, 1, &st);
return ASKDemod(Cmd, true, true, 1);
bool st = false;
if (Cmd[0] == 's') {
st = true;
Cmd++;
} else if (Cmd[1] == 's') {
st = true;
Cmd+=2;
}
int clk = 0;
int invert = 0;
int maxErr = 100;
size_t maxLen = 0;
bool amplify = false;
char amp = tolower(param_getchar(Cmd, 0));
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &amp);
amplify = amp == 'a';
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid value for invert: %i", invert);
return PM3_EINVARG;
}
return ASKDemod_ext(clk, invert, maxErr, maxLen, amplify, true, true, 1, &st);
}
//by marshmellow
//manchester decode
//stricktly take 10 and 01 and convert to 0 and 1
//strictly take 10 and 01 and convert to 0 and 1
static int Cmdmandecoderaw(const char *Cmd) {
size_t size = 0;
int high = 0, low = 0;
@ -785,10 +786,8 @@ static int CmdBiphaseDecodeRaw(const char *Cmd) {
//by marshmellow
// - ASK Demod then Biphase decode GraphBuffer samples
int ASKbiphaseDemod(const char *Cmd, bool verbose) {
int ASKbiphaseDemod(int offset, int clk, int invert, int maxErr, bool verbose) {
//ask raw demod GraphBuffer first
int offset = 0, clk = 0, invert = 0, maxErr = 50;
sscanf(Cmd, "%i %i %i %i", &offset, &clk, &invert, &maxErr);
uint8_t BitStream[MAX_DEMOD_BUF_LEN];
size_t size = getFromGraphBuf(BitStream);
@ -828,16 +827,33 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) {
static int Cmdaskbiphdemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ab();
return ASKbiphaseDemod(Cmd, true);
int offset = 0, clk = 0, invert = 0, maxErr = 50;
sscanf(Cmd, "%i %i %i %i", &offset, &clk, &invert, &maxErr);
return ASKbiphaseDemod(offset, clk, invert, maxErr, true);
}
//by marshmellow - see ASKDemod
static int Cmdaskrawdemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 25 || cmdp == 'h') return usage_data_rawdemod_ar();
return ASKDemod(Cmd, true, false, 0);
bool st = false;
int clk = 0;
int invert = 0;
int maxErr = 100;
size_t maxLen = 0;
bool amplify = false;
char amp = tolower(param_getchar(Cmd, 0));
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &amp);
amplify = amp == 'a';
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid value for invert: %i", invert);
return PM3_EINVARG;
}
return ASKDemod_ext(clk, invert, maxErr, maxLen, amplify, true, false, 0, &st);
}
int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveGrph, bool verbose) {
@ -1140,24 +1156,8 @@ static char *GetFSKType(uint8_t fchigh, uint8_t fclow, uint8_t invert) {
//fsk raw demod and print binary
//takes 4 arguments - Clock, invert, fchigh, fclow
//defaults: clock = 50, invert=1, fchigh=10, fclow=8 (RF/10 RF/8 (fsk2a))
int FSKrawDemod(const char *Cmd, bool verbose) {
int FSKrawDemod(uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow, bool verbose) {
//raw fsk demod no manchester decoding no start bit finding just get binary from wave
uint8_t rfLen, invert, fchigh, fclow;
//set defaults
//set options from parameters entered with the command
rfLen = param_get8(Cmd, 0);
invert = param_get8(Cmd, 1);
fchigh = param_get8(Cmd, 2);
fclow = param_get8(Cmd, 3);
if (strlen(Cmd) > 0 && strlen(Cmd) <= 2) {
if (rfLen == 1) {
invert = 1; //if invert option only is used
rfLen = 0;
}
}
if (getSignalProperties()->isnoise)
return PM3_ESOFT;
@ -1218,26 +1218,27 @@ out:
static int CmdFSKrawdemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 20 || cmdp == 'h') return usage_data_rawdemod_fs();
uint8_t rfLen, invert, fchigh, fclow;
return FSKrawDemod(Cmd, true);
//set defaults
//set options from parameters entered with the command
rfLen = param_get8(Cmd, 0);
invert = param_get8(Cmd, 1);
fchigh = param_get8(Cmd, 2);
fclow = param_get8(Cmd, 3);
if (strlen(Cmd) > 0 && strlen(Cmd) <= 2) {
if (rfLen == 1) {
invert = 1; //if invert option only is used
rfLen = 0;
}
}
return FSKrawDemod(rfLen, invert, fchigh, fclow, true);
}
//by marshmellow
//attempt to psk1 demod graph buffer
int PSKDemod(const char *Cmd, bool verbose) {
int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
if (g_debugMode || verbose) PrintAndLogEx(WARNING, "Invalid argument: %s", Cmd);
return PM3_EINVARG;
}
int PSKDemod(int clk, int invert, int maxErr, bool verbose) {
if (getSignalProperties()->isnoise)
return PM3_ESOFT;
@ -1276,91 +1277,13 @@ int PSKDemod(const char *Cmd, bool verbose) {
return PM3_SUCCESS;
}
int demodIdteck(void) {
if (PSKDemod("", false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
return PM3_ESOFT;
}
size_t size = DemodBufferLen;
//get binary from PSK1 wave
int idx = detectIdteck(DemodBuffer, &size);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
// if didn't find preamble try again inverting
if (PSKDemod("1", false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
return PM3_ESOFT;
}
idx = detectIdteck(DemodBuffer, &size);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
return PM3_ESOFT;
}
}
setDemodBuff(DemodBuffer, 64, idx);
//got a good demod
uint32_t id = 0;
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
//parity check (TBD)
//checksum check (TBD)
//output
PrintAndLogEx(SUCCESS, "IDTECK Tag Found: Card ID %u , Raw: %08X%08X", id, raw1, raw2);
return PM3_SUCCESS;
}
/*
static int CmdIdteckDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodIdteck();
}
*/
// by marshmellow
// takes 3 arguments - clock, invert, maxErr as integers
// attempts to demodulate nrz only
// prints binary found and saves in demodbuffer for further commands
int NRZrawDemod(const char *Cmd, bool verbose) {
int NRZrawDemod(int clk, int invert, int maxErr, bool verbose) {
int errCnt = 0, clkStartIdx = 0;
int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "(NRZrawDemod) Invalid argument: %s", Cmd);
return PM3_EINVARG;
}
if (getSignalProperties()->isnoise)
return PM3_ESOFT;
@ -1409,8 +1332,18 @@ int NRZrawDemod(const char *Cmd, bool verbose) {
static int CmdNRZrawDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 16 || cmdp == 'h') return usage_data_rawdemod_nr();
int invert = 0, clk = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
}
return NRZrawDemod(Cmd, true);
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "(NRZrawDemod) Invalid argument: %s", Cmd);
return PM3_EINVARG;
}
return NRZrawDemod(clk, invert, maxErr, true);
}
// by marshmellow
@ -1420,8 +1353,17 @@ static int CmdNRZrawDemod(const char *Cmd) {
int CmdPSK1rawDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 16 || cmdp == 'h') return usage_data_rawdemod_p1();
int ans = PSKDemod(Cmd, true);
int clk = 0, invert = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid value for invert: %i", invert);
return PM3_EINVARG;
}
int ans = PSKDemod(clk, invert, maxErr, true);
//output
if (ans != PM3_SUCCESS) {
if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans);
@ -1438,8 +1380,17 @@ int CmdPSK1rawDemod(const char *Cmd) {
static int CmdPSK2rawDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 16 || cmdp == 'h') return usage_data_rawdemod_p2();
int ans = PSKDemod(Cmd, true);
int clk = 0, invert = 0, maxErr = 100;
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid value for invert: %i", invert);
return PM3_EINVARG;
}
int ans = PSKDemod(clk, invert, maxErr, true);
if (ans != PM3_SUCCESS) {
if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans);
return PM3_ESOFT;

View file

@ -59,12 +59,13 @@ int CmdNorm(const char *Cmd);
int CmdPlot(const char *Cmd); // used by cmd lf cotag
int CmdSave(const char *Cmd); // used by cmd auto
int CmdTuneSamples(const char *Cmd); // used by cmd lf hw
int ASKbiphaseDemod(const char *Cmd, bool verbose); // used by cmd lf em4x, lf fdx, lf guard, lf jablotron, lf nedap, lf t55xx
int ASKDemod(const char *Cmd, bool verbose, bool emSearch, uint8_t askType); // used by cmd lf em4x, lf t55xx, lf viking
int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType, bool *stCheck); // used by cmd lf, lf em4x, lf noralsy, le presco, lf securekey, lf t55xx, lf visa2k
int FSKrawDemod(const char *Cmd, bool verbose); // used by cmd lf, lf em4x, lf t55xx
int PSKDemod(const char *Cmd, bool verbose); // used by cmd lf em4x, lf indala, lf keri, lf nexwatch, lf t55xx
int NRZrawDemod(const char *Cmd, bool verbose); // used by cmd lf pac, lf t55xx
int ASKbiphaseDemod(int offset, int clk, int invert, int maxErr, bool verbose); // used by cmd lf em4x, lf fdx, lf guard, lf jablotron, lf nedap, lf t55xx
int ASKDemod(int clk, int invert, int maxErr, size_t maxLen, bool amplify, bool verbose, bool emSearch, uint8_t askType); // used by cmd lf em4x, lf t55xx, lf viking
int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxLen, bool amplify, bool verbose, bool emSearch, uint8_t askType, bool *stCheck); // used by cmd lf, lf em4x, lf noralsy, le presco, lf securekey, lf t55xx, lf visa2k
int FSKrawDemod(uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow, bool verbose); // used by cmd lf, lf em4x, lf t55xx
int PSKDemod(int clk, int invert, int maxErr, bool verbose); // used by cmd lf em4x, lf indala, lf keri, lf nexwatch, lf t55xx
int NRZrawDemod(int clk, int invert, int maxErr, bool verbose); // used by cmd lf pac, lf t55xx
void printDemodBuff(void);
@ -79,7 +80,6 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose);
void setClockGrid(uint32_t clk, int offset);
int directionalThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down);
int AskEdgeDetect(const int *in, int *out, int len, int threshold);
int demodIdteck(void);
#define MAX_DEMOD_BUF_LEN (1024*128)
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];

View file

@ -13,16 +13,17 @@
#include <ctype.h>
#include "fileutils.h"
#include "cmdparser.h" // command_t
#include "comms.h" // clearCommandBuffer
#include "cmdparser.h" // command_t
#include "comms.h" // clearCommandBuffer
#include "cmdtrace.h"
#include "crc16.h"
#include "cmdhf14a.h"
#include "protocols.h" // definitions of ISO14B protocol
#include "protocols.h" // definitions of ISO14B/7816 protocol
#include "emv/apduinfo.h" // GetAPDUCodeDescription
#include "mifare/ndef.h" // NDEFRecordsDecodeAndPrint
#define TIMEOUT 2000
static int CmdHelp(const char *Cmd);
static int usage_hf_14b_info(void) {
@ -117,6 +118,15 @@ static int usage_hf_14b_dump(void) {
);
return PM3_SUCCESS;
}
static int usage_hf_14b_ndef(void) {
PrintAndLogEx(NORMAL, "\n Print NFC Data Exchange Format (NDEF)\n");
PrintAndLogEx(NORMAL, "Usage: hf 14b ndef [h]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" hf 14b ndef"));
return PM3_SUCCESS;
}
static int switch_off_field_14b(void) {
clearCommandBuffer();
@ -124,6 +134,14 @@ static int switch_off_field_14b(void) {
return PM3_SUCCESS;
}
static uint16_t get_sw(uint8_t *d, uint8_t n) {
if (n < 2)
return 0;
n -= 2;
return d[n] * 0x0100 + d[n + 1];
}
static bool waitCmd14b(bool verbose) {
PacketResponseNG resp;
@ -1249,11 +1267,93 @@ static int srix4kValid(const char *Cmd) {
return 0;
}
*/
static int CmdHF14BNdef(const char *Cmd) {
char c = tolower(param_getchar(Cmd, 0));
if (c == 'h' || c == 0x00) return usage_hf_14b_ndef();
// bool activate_field = true;
// bool keep_field_on = true;
uint8_t response[PM3_CMD_DATA_SIZE];
int resplen = 0;
// --------------- Select NDEF Tag application ----------------
uint8_t aSELECT_AID[80];
int aSELECT_AID_n = 0;
param_gethex_to_eol("00a4040007d276000085010100", 0, aSELECT_AID, sizeof(aSELECT_AID), &aSELECT_AID_n);
int res = 0;
// int res = ExchangeAPDU14a(aSELECT_AID, aSELECT_AID_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res)
return res;
if (resplen < 2)
return PM3_ESOFT;
uint16_t sw = get_sw(response, resplen);
if (sw != 0x9000) {
PrintAndLogEx(ERR, "Selecting NDEF aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return PM3_ESOFT;
}
// activate_field = false;
// keep_field_on = true;
// --------------- Send CC select ----------------
// --------------- Read binary ----------------
// --------------- NDEF file reading ----------------
uint8_t aSELECT_FILE_NDEF[30];
int aSELECT_FILE_NDEF_n = 0;
param_gethex_to_eol("00a4000c020001", 0, aSELECT_FILE_NDEF, sizeof(aSELECT_FILE_NDEF), &aSELECT_FILE_NDEF_n);
// res = ExchangeAPDU14a(aSELECT_FILE_NDEF, aSELECT_FILE_NDEF_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res)
return res;
sw = get_sw(response, resplen);
if (sw != 0x9000) {
PrintAndLogEx(ERR, "Selecting NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return PM3_ESOFT;
}
// --------------- Read binary ----------------
uint8_t aREAD_NDEF[30];
int aREAD_NDEF_n = 0;
param_gethex_to_eol("00b0000002", 0, aREAD_NDEF, sizeof(aREAD_NDEF), &aREAD_NDEF_n);
// res = ExchangeAPDU14a(aREAD_NDEF, aREAD_NDEF_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res)
return res;
sw = get_sw(response, resplen);
if (sw != 0x9000) {
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return PM3_ESOFT;
}
// take offset from response
uint8_t offset = response[1];
// --------------- Read binary w offset ----------------
// keep_field_on = false;
aREAD_NDEF_n = 0;
param_gethex_to_eol("00b00002", 0, aREAD_NDEF, sizeof(aREAD_NDEF), &aREAD_NDEF_n);
aREAD_NDEF[4] = offset;
// res = ExchangeAPDU14a(aREAD_NDEF, aREAD_NDEF_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res)
return res;
sw = get_sw(response, resplen);
if (sw != 0x9000) {
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return PM3_ESOFT;
}
return NDEFRecordsDecodeAndPrint(response + 2, resplen - 4);
}
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"dump", CmdHF14BDump, IfPm3Iso14443b, "Read all memory pages of an ISO14443-B tag, save to file"},
{"info", CmdHF14Binfo, IfPm3Iso14443b, "Tag information"},
{"list", CmdHF14BList, AlwaysAvailable, "List ISO 14443B history"},
{"list", CmdHF14BList, AlwaysAvailable, "List ISO 14443B history"},
{"ndef", CmdHF14BNdef, IfPm3Iso14443b, "Read NDEF file on tag"},
{"raw", CmdHF14BCmdRaw, IfPm3Iso14443b, "Send raw hex data to tag"},
{"reader", CmdHF14BReader, IfPm3Iso14443b, "Act as a 14443B reader to identify a tag"},
{"sim", CmdHF14BSim, IfPm3Iso14443b, "Fake ISO 14443B tag"},

View file

@ -33,28 +33,29 @@
#include "cmdlfem4x50.h" // for em4x50
#include "cmdlfhid.h" // for hid menu
#include "cmdlfhitag.h" // for hitag menu
#include "cmdlfidteck.h" // for idteck menu
#include "cmdlfio.h" // for ioprox menu
#include "cmdlft55xx.h" // for t55xx menu
#include "cmdlfti.h" // for ti menu
#include "cmdlfpresco.h" // for presco menu
#include "cmdlfpcf7931.h" // for pcf7931 menu
#include "cmdlfpyramid.h" // for pyramid menu
#include "cmdlfviking.h" // for viking menu
#include "cmdlfnedap.h" // for NEDAP menu
#include "cmdlfjablotron.h" // for JABLOTRON menu
#include "cmdlfvisa2000.h" // for VISA2000 menu
#include "cmdlfnoralsy.h" // for NORALSY meny
#include "cmdlfcotag.h" // for COTAG meny
#include "cmdlfindala.h" // for indala menu
#include "cmdlfguard.h" // for gproxii menu
#include "cmdlffdx.h" // for fdx-b menu
#include "cmdlfparadox.h" // for paradox menu
#include "cmdlfnexwatch.h" // for nexwatch menu
#include "cmdlfsecurakey.h" // for securakey menu
#include "cmdlfpac.h" // for pac menu
#include "cmdlfgallagher.h" // for GALLAGHER menu
#include "cmdlfguard.h" // for gproxii menu
#include "cmdlfindala.h" // for indala menu
#include "cmdlfjablotron.h" // for JABLOTRON menu
#include "cmdlfkeri.h" // for keri menu
#include "cmdlfmotorola.h" // for Motorola menu
#include "cmdlfgallagher.h" // for GALLAGHER menu
#include "cmdlfnedap.h" // for NEDAP menu
#include "cmdlfnexwatch.h" // for nexwatch menu
#include "cmdlfnoralsy.h" // for NORALSY meny
#include "cmdlfpac.h" // for pac menu
#include "cmdlfparadox.h" // for paradox menu
#include "cmdlfpcf7931.h" // for pcf7931 menu
#include "cmdlfpresco.h" // for presco menu
#include "cmdlfpyramid.h" // for pyramid menu
#include "cmdlfsecurakey.h" // for securakey menu
#include "cmdlft55xx.h" // for t55xx menu
#include "cmdlfti.h" // for ti menu
#include "cmdlfviking.h" // for viking menu
#include "cmdlfvisa2000.h" // for VISA2000 menu
#define LF_CMDREAD_MAX_EXTRA_SYMBOLS 4
static bool g_lf_threshold_set = false;
@ -77,14 +78,14 @@ static int usage_lf_cmdread(void) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, " ************* " _YELLOW_("All periods in decimal and in microseconds (us)"));
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, "- probing for Hitag 1/Hitag S:");
PrintAndLogEx(NORMAL, _CYAN_(" probing for Hitag 1/Hitag S") ":");
PrintAndLogEx(NORMAL, _YELLOW_(" lf cmdread d 50 z 116 o 166 e W 3000 c W00110"));
PrintAndLogEx(NORMAL, "- probing for Hitag 2:");
PrintAndLogEx(NORMAL, _CYAN_(" probing for Hitag 2") ":");
PrintAndLogEx(NORMAL, _YELLOW_(" lf cmdread d 50 z 116 o 166 e W 3000 c W11000"));
PrintAndLogEx(NORMAL, "- probing for Hitag 2, oscilloscope style:");
PrintAndLogEx(NORMAL, _CYAN_(" probing for Hitag 2, oscilloscope style") ":");
PrintAndLogEx(NORMAL, _YELLOW_(" data plot"));
PrintAndLogEx(NORMAL, _YELLOW_(" lf cmdread d 50 z 116 o 166 e W 3000 c W11000 q s 2000 @"));
PrintAndLogEx(NORMAL, "- probing for Hitag (us):");
PrintAndLogEx(NORMAL, _CYAN_(" probing for Hitag (us)") ":");
PrintAndLogEx(NORMAL, _YELLOW_(" lf cmdread d 48 z 112 o 176 e W 3000 e S 240 e E 336 c W0S00000010000E"));
PrintAndLogEx(NORMAL, "Extras:");
PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters.");
@ -116,8 +117,8 @@ static int usage_lf_sim(void) {
PrintAndLogEx(NORMAL, " h This help");
PrintAndLogEx(NORMAL, " <gap> Start gap (in microseconds)");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf sim 240 - start simulating with 240ms gap");
PrintAndLogEx(NORMAL, " lf sim");
PrintAndLogEx(NORMAL, _YELLOW_(" lf sim 240") " - start simulating with 240ms gap");
PrintAndLogEx(NORMAL, _YELLOW_(" lf sim"));
PrintAndLogEx(NORMAL, "Extras:");
PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters.");
return PM3_SUCCESS;
@ -132,9 +133,9 @@ static int usage_lf_sniff(void) {
PrintAndLogEx(NORMAL, " @ run continuously until a key is pressed (optional)");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf sniff");
PrintAndLogEx(NORMAL, "- oscilloscope style:");
PrintAndLogEx(NORMAL, " data plot");
PrintAndLogEx(NORMAL, " lf sniff q s 3000 @");
PrintAndLogEx(NORMAL, _CYAN_(" oscilloscope style") ":");
PrintAndLogEx(NORMAL, _YELLOW_(" data plot"));
PrintAndLogEx(NORMAL, _YELLOW_(" lf sniff q s 3000 @"));
PrintAndLogEx(NORMAL, "Extras:");
PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters.");
PrintAndLogEx(NORMAL, " use " _YELLOW_("'data plot'")" to look at it");
@ -154,12 +155,12 @@ static int usage_lf_config(void) {
PrintAndLogEx(NORMAL, " t <threshold> Sets trigger threshold. 0 means no threshold (range: 0-128)");
PrintAndLogEx(NORMAL, " s <samplestoskip> Sets a number of samples to skip before capture. Default: 0");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf config - shows current config");
PrintAndLogEx(NORMAL, " lf config b 8 L - samples at 125 kHz, 8bps.");
PrintAndLogEx(NORMAL, " lf config H b 4 d 3 - samples at 134 kHz, averages three samples into one, stored with ");
PrintAndLogEx(NORMAL, _YELLOW_(" lf config") " - shows current config");
PrintAndLogEx(NORMAL, _YELLOW_(" lf config b 8 L") " - samples at 125 kHz, 8bps.");
PrintAndLogEx(NORMAL, _YELLOW_(" lf config H b 4 d 3") " - samples at 134 kHz, averages three samples into one, stored with ");
PrintAndLogEx(NORMAL, " a resolution of 4 bits per sample.");
PrintAndLogEx(NORMAL, " lf read - performs a read (active field)");
PrintAndLogEx(NORMAL, " lf sniff - performs a sniff (no active field)");
PrintAndLogEx(NORMAL, _YELLOW_(" lf read") " - performs a read (active field)");
PrintAndLogEx(NORMAL, _YELLOW_(" lf sniff") " - performs a sniff (no active field)");
return PM3_SUCCESS;
}
static int usage_lf_simfsk(void) {
@ -180,10 +181,10 @@ static int usage_lf_simfsk(void) {
PrintAndLogEx(NORMAL, "\n NOTE: if you set one clock manually set them all manually");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf simfsk c 40 H 8 L 5 d 010203 - FSK1 rf/40 data 010203");
PrintAndLogEx(NORMAL, " lf simfsk c 40 H 5 L 8 d 010203 - FSK1a rf/40 data 010203");
PrintAndLogEx(NORMAL, " lf simfsk c 64 H 10 L 8 d 010203 - FSK2 rf/64 data 010203");
PrintAndLogEx(NORMAL, " lf simfsk c 64 H 8 L 10 d 010203 - FSK2a rf/64 data 010203");
PrintAndLogEx(NORMAL, _YELLOW_(" lf simfsk c 40 H 8 L 5 d 010203") " - FSK1 rf/40 data 010203");
PrintAndLogEx(NORMAL, _YELLOW_(" lf simfsk c 40 H 5 L 8 d 010203") " - FSK1a rf/40 data 010203");
PrintAndLogEx(NORMAL, _YELLOW_(" lf simfsk c 64 H 10 L 8 d 010203") " - FSK2 rf/64 data 010203");
PrintAndLogEx(NORMAL, _YELLOW_(" lf simfsk c 64 H 8 L 10 d 010203") " - FSK2a rf/64 data 010203");
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS;
}
@ -221,10 +222,10 @@ static int usage_lf_find(void) {
PrintAndLogEx(NORMAL, " <0|1> Use data from Graphbuffer, if not set, try reading data from tag.");
PrintAndLogEx(NORMAL, " u Search for Unknown tags, if not set, reads only known tags.");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf search = try reading data from tag & search for known tags");
PrintAndLogEx(NORMAL, " lf search 1 = use data from GraphBuffer & search for known tags");
PrintAndLogEx(NORMAL, " lf search u = try reading data from tag & search for known and unknown tags");
PrintAndLogEx(NORMAL, " lf search 1 u = use data from GraphBuffer & search for known and unknown tags");
PrintAndLogEx(NORMAL, _YELLOW_(" lf search") " - try reading data from tag & search for known tags");
PrintAndLogEx(NORMAL, _YELLOW_(" lf search 1") " - use data from GraphBuffer & search for known tags");
PrintAndLogEx(NORMAL, _YELLOW_(" lf search u") " - try reading data from tag & search for known and unknown tags");
PrintAndLogEx(NORMAL, _YELLOW_(" lf search 1 u") " - use data from GraphBuffer & search for known and unknown tags");
return PM3_SUCCESS;
}
static int usage_lf_tune(void) {
@ -1445,27 +1446,27 @@ int CmdLFfind(const char *Cmd) {
}
}
if (demodVisa2k() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Visa2000 ID") " found!"); goto out;}
if (demodHID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") " found!"); goto out;}
if (demodAWID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") " found!"); goto out;}
if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;}
if (demodParadox() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;}
if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;}
if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;}
if (demodEM410x() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") " found!"); goto out;}
if (demodVisa2k(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Visa2000 ID") " found!"); goto out;}
if (demodHID(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") " found!"); goto out;}
if (demodAWID(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") " found!"); goto out;}
if (demodIOProx(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;}
if (demodParadox(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;}
if (demodNexWatch(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;}
if (demodIndala(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;}
if (demodEM410x(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") " found!"); goto out;}
if (demodFDX(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("FDX-B ID") " found!"); goto out;}
if (demodGuard() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") " found!"); goto out; }
if (demodIdteck() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;}
if (demodJablotron() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") " found!"); goto out;}
if (demodNedap() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") " found!"); goto out;}
if (demodNoralsy() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Noralsy ID") " found!"); goto out;}
if (demodKeri() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;}
if (demodPac() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") " found!"); goto out;}
if (demodPresco() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Presco ID") " found!"); goto out;}
if (demodPyramid() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") " found!"); goto out;}
if (demodSecurakey() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Securakey ID") " found!"); goto out;}
if (demodViking() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Viking ID") " found!"); goto out;}
if (demodGallagher() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("GALLAGHER ID") " found!"); goto out;}
if (demodGuard(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") " found!"); goto out; }
if (demodIdteck(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;}
if (demodJablotron(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") " found!"); goto out;}
if (demodNedap(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") " found!"); goto out;}
if (demodNoralsy(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Noralsy ID") " found!"); goto out;}
if (demodKeri(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;}
if (demodPac(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") " found!"); goto out;}
if (demodPresco(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Presco ID") " found!"); goto out;}
if (demodPyramid(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") " found!"); goto out;}
if (demodSecurakey(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Securakey ID") " found!"); goto out;}
if (demodViking(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Viking ID") " found!"); goto out;}
if (demodGallagher(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("GALLAGHER ID") " found!"); goto out;}
// if (demodTI() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Texas Instrument ID") " found!"); goto out;}
// if (demodFermax() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Fermax ID") " found!"); goto out;}
@ -1486,14 +1487,14 @@ int CmdLFfind(const char *Cmd) {
//fsk
if (GetFskClock("", false)) {
if (FSKrawDemod("", true) == PM3_SUCCESS) {
if (FSKrawDemod(0, 0, 0, 0, true) == PM3_SUCCESS) {
PrintAndLogEx(NORMAL, "\nUnknown FSK Modulated Tag found!");
goto out;
}
}
bool st = true;
if (ASKDemod_ext("0 0 0", true, false, 1, &st) == PM3_SUCCESS) {
if (ASKDemod_ext(0, 0, 0, 0, false, true, false, 1, &st) == PM3_SUCCESS) {
PrintAndLogEx(NORMAL, "\nUnknown ASK Modulated and Manchester encoded Tag found!");
PrintAndLogEx(NORMAL, "if it does not look right it could instead be ASK/Biphase - try " _YELLOW_("'data rawdemod ab'"));
goto out;
@ -1531,6 +1532,7 @@ static command_t CommandTable[] = {
{"gproxii", CmdLFGuard, AlwaysAvailable, "{ Guardall Prox II RFIDs... }"},
{"hid", CmdLFHID, AlwaysAvailable, "{ HID Prox RFIDs... }"},
{"hitag", CmdLFHitag, AlwaysAvailable, "{ Hitag CHIPs... }"},
{"idteck", CmdLFIdteck, AlwaysAvailable, "{ Idteck RFIDs... }"},
{"indala", CmdLFINDALA, AlwaysAvailable, "{ Indala RFIDs... }"},
{"io", CmdLFIO, AlwaysAvailable, "{ ioProx RFIDs... }"},
{"jablotron", CmdLFJablotron, AlwaysAvailable, "{ Jablotron RFIDs... }"},

View file

@ -196,9 +196,8 @@ static int CmdAWIDWatch(const char *Cmd) {
//by marshmellow
//AWID Prox demod - FSK2a RF/50 with preamble of 00000001 (always a 96 bit data stream)
//print full AWID Prox ID and some bit format details if found
static int CmdAWIDDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodAWID(bool verbose) {
(void) verbose; // unused so far
uint8_t *bits = calloc(MAX_GRAPH_TRACE_LEN, sizeof(uint8_t));
if (bits == NULL) {
PrintAndLogEx(DEBUG, "DEBUG: Error - AWID failed to allocate memory");
@ -337,10 +336,16 @@ static int CmdAWIDDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdAWIDDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodAWID(true);
}
// this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdAWIDRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 12000);
return CmdAWIDDemod(Cmd);
return demodAWID(true);
}
static int CmdAWIDSim(const char *Cmd) {
@ -605,7 +610,3 @@ int getAWIDBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *bits) {
return PM3_SUCCESS;
}
int demodAWID(void) {
return CmdAWIDDemod("");
}

View file

@ -15,7 +15,7 @@
int CmdLFAWID(const char *Cmd);
int demodAWID(void);
int demodAWID(bool verbose);
int getAWIDBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *bits);
#endif

View file

@ -37,7 +37,8 @@ static int usage_lf_cotag_read(void) {
// COTAG demod should be able to use GraphBuffer,
// when data load samples
int demodCOTAG(void) {
int demodCOTAG(bool verbose) {
(void) verbose; // unused so far
uint8_t bits[COTAG_BITS] = {0};
size_t bitlen = COTAG_BITS;
@ -73,8 +74,8 @@ int demodCOTAG(void) {
}
static int CmdCOTAGDemod(const char *Cmd) {
(void)Cmd;
return demodCOTAG();
(void)Cmd; // Cmd is not used so far
return demodCOTAG(true);
}
// When reading a COTAG.
// 0 = HIGH/LOW signal - maxlength bigbuff
@ -118,7 +119,7 @@ static int CmdCOTAGRead(const char *Cmd) {
case 1: {
memcpy(DemodBuffer, resp.data.asBytes, resp.length);
DemodBufferLen = resp.length;
return demodCOTAG();
return demodCOTAG(true);
}
}
return PM3_SUCCESS;

View file

@ -18,6 +18,6 @@
#endif
int CmdLFCOTAG(const char *Cmd);
int demodCOTAG(void);
int demodCOTAG(bool verbose);
int readCOTAGUid(void);
#endif

View file

@ -63,17 +63,17 @@ static int usage_lf_em410x_watch(void) {
return PM3_SUCCESS;
}
static int usage_lf_em410x_write(void) {
static int usage_lf_em410x_clone(void) {
PrintAndLogEx(NORMAL, "Writes EM410x ID to a T55x7 or Q5/T5555 tag");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Usage: lf em 410x_write [h] <id> <card> [clock]");
PrintAndLogEx(NORMAL, "Usage: lf em 410x_clone [h] <id> <card> [clock]");
PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h - this help");
PrintAndLogEx(NORMAL, " <id> - ID number");
PrintAndLogEx(NORMAL, " <card> - 0|1 0 = Q5/T5555, 1 = T55x7");
PrintAndLogEx(NORMAL, " <clock> - 16|32|40|64, optional, set R/F clock rate, defaults to 64");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_write 0F0368568B 1") " = write ID to t55x7 card");
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_clone 0F0368568B 1") " = write ID to t55x7 card");
return PM3_SUCCESS;
}
static int usage_lf_em410x_ws(void) {
@ -390,15 +390,14 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) {
return PM3_SUCCESS;
}
int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose) {
int AskEm410xDemod(int clk, int invert, int maxErr, size_t maxLen, bool amplify, uint32_t *hi, uint64_t *lo, bool verbose) {
bool st = true;
// em410x simulation etc uses 0/1 as signal data. This must be converted in order to demod it back again
if (isGraphBitstream()) {
convertGraphFromBitstream();
}
if (ASKDemod_ext(Cmd, false, false, 1, &st) != PM3_SUCCESS)
if (ASKDemod_ext(clk, invert, maxErr, maxLen, amplify, false, false, 1, &st) != PM3_SUCCESS)
return PM3_ESOFT;
return AskEm410xDecode(verbose, hi, lo);
}
@ -423,14 +422,27 @@ static int CmdEM410xWatch(const char *Cmd) {
//takes 3 arguments - clock, invert and maxErr as integers
//attempts to demodulate ask while decoding manchester
//prints binary found and saves in graphbuffer for further commands
int demodEM410x(bool verbose) {
(void) verbose; // unused so far
uint32_t hi = 0;
uint64_t lo = 0;
return AskEm410xDemod(0, 0, 100, 0, false, &hi, &lo, true);
}
static int CmdEM410xDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 10 || cmdp == 'h') return usage_lf_em410x_demod();
uint32_t hi = 0;
uint64_t lo = 0;
if (AskEm410xDemod(Cmd, &hi, &lo, true) != PM3_SUCCESS)
int clk = 0;
int invert = 0;
int maxErr = 100;
size_t maxLen = 0;
char amp = tolower(param_getchar(Cmd, 0));
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &amp);
bool amplify = amp == 'a';
if (AskEm410xDemod(clk, invert, maxErr, maxLen, amplify, &hi, &lo, true) != PM3_SUCCESS)
return PM3_ESOFT;
g_em410xid = lo;
@ -439,8 +451,20 @@ static int CmdEM410xDemod(const char *Cmd) {
// this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdEM410xRead(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) > 10 || cmdp == 'h') return usage_lf_em410x_demod();
uint32_t hi = 0;
uint64_t lo = 0;
int clk = 0;
int invert = 0;
int maxErr = 100;
size_t maxLen = 0;
char amp = tolower(param_getchar(Cmd, 0));
sscanf(Cmd, "%i %i %i %zu %c", &clk, &invert, &maxErr, &maxLen, &amp);
bool amplify = amp == 'a';
lf_read(false, 12288);
return CmdEM410xDemod(Cmd);
return AskEm410xDemod(clk, invert, maxErr, maxLen, amplify, &hi, &lo, true);
}
// emulate an EM410X tag
@ -591,9 +615,9 @@ static int CmdEM410xWatchnSpoof(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdEM410xWrite(const char *Cmd) {
static int CmdEM410xClone(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 0x00 || cmdp == 'h') return usage_lf_em410x_write();
if (cmdp == 0x00 || cmdp == 'h') return usage_lf_em410x_clone();
uint64_t id = param_get64ex(Cmd, 0, -1, 16);
uint8_t card = param_get8ex(Cmd, 1, 0xFF, 10);
@ -602,19 +626,19 @@ static int CmdEM410xWrite(const char *Cmd) {
// Check ID
if (id == 0xFFFFFFFFFFFFFFFF) {
PrintAndLogEx(ERR, "error, ID is required\n");
usage_lf_em410x_write();
usage_lf_em410x_clone();
return PM3_EINVARG;
}
if (id >= 0x10000000000) {
PrintAndLogEx(ERR, "error, given EM410x ID is longer than 40 bits\n");
usage_lf_em410x_write();
usage_lf_em410x_clone();
return PM3_EINVARG;
}
// Check Card
if (card > 1) {
PrintAndLogEx(FAILED, "error, bad card type selected\n");
usage_lf_em410x_write();
usage_lf_em410x_clone();
return PM3_EINVARG;
}
@ -626,7 +650,7 @@ static int CmdEM410xWrite(const char *Cmd) {
if ((clock1 != 16) && (clock1 != 32) && (clock1 != 64) && (clock1 != 40)) {
PrintAndLogEx(FAILED, "error, clock rate" _RED_("%d")" not valid", clock1);
PrintAndLogEx(INFO, "supported clock rates: " _YELLOW_("16, 32, 40, 60") "\n");
usage_lf_em410x_write();
usage_lf_em410x_clone();
return PM3_EINVARG;
}
@ -735,7 +759,7 @@ static bool detectFSK(void) {
return false;
}
// demod
int ans = FSKrawDemod("0 0", false);
int ans = FSKrawDemod(0, 0, 0, 0, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: FSK Demod failed");
return false;
@ -751,12 +775,12 @@ static bool detectPSK(void) {
}
//demod
//try psk1 -- 0 0 6 (six errors?!?)
ans = PSKDemod("0 0 6", false);
ans = PSKDemod(0, 0, 6, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: PSK1 Demod failed");
//try psk1 inverted
ans = PSKDemod("0 1 6", false);
ans = PSKDemod(0, 1, 6, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: PSK1 inverted Demod failed");
return false;
@ -769,7 +793,7 @@ static bool detectPSK(void) {
// try manchester - NOTE: ST only applies to T55x7 tags.
static bool detectASK_MAN(void) {
bool stcheck = false;
if (ASKDemod_ext("0 0 0", false, false, 1, &stcheck) != PM3_SUCCESS) {
if (ASKDemod_ext(0, 0, 0, 0, false, false, false, 1, &stcheck) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/Manchester Demod failed");
return false;
}
@ -777,11 +801,11 @@ static bool detectASK_MAN(void) {
}
static bool detectASK_BI(void) {
int ans = ASKbiphaseDemod("0 0 1", false);
int ans = ASKbiphaseDemod(0, 0, 1, 50, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase normal demod failed");
ans = ASKbiphaseDemod("0 1 1", false);
ans = ASKbiphaseDemod(0, 1, 1, 50, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: ASK/biphase inverted demod failed");
return false;
@ -790,11 +814,11 @@ static bool detectASK_BI(void) {
return true;
}
static bool detectNRZ(void) {
int ans = NRZrawDemod("0 0 1", false);
int ans = NRZrawDemod(0, 0, 1, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: NRZ normal demod failed");
ans = NRZrawDemod("0 1 1", false);
ans = NRZrawDemod(0, 1, 1, false);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - EM: NRZ inverted demod failed");
return false;
@ -1383,7 +1407,7 @@ static command_t CommandTable[] = {
{"410x_brute", CmdEM410xBrute, IfPm3Lf, "reader bruteforce attack by simulating EM410x tags"},
{"410x_watch", CmdEM410xWatch, IfPm3Lf, "watches for EM410x 125/134 kHz tags (option 'h' for 134)"},
{"410x_spoof", CmdEM410xWatchnSpoof, IfPm3Lf, "watches for EM410x 125/134 kHz tags, and replays them. (option 'h' for 134)" },
{"410x_write", CmdEM410xWrite, IfPm3Lf, "write EM410x UID to T55x7 or Q5/T5555 tag"},
{"410x_clone", CmdEM410xClone, IfPm3Lf, "write EM410x UID to T55x7 or Q5/T5555 tag"},
{"----------", CmdHelp, AlwaysAvailable, "-------------------- " _CYAN_("EM 4x05 / 4x69") " -------------------"},
{"4x05_demod", CmdEM4x05Demod, AlwaysAvailable, "demodulate a EM4x05/EM4x69 tag from the GraphBuffer"},
{"4x05_dump", CmdEM4x05Dump, IfPm3Lf, "dump EM4x05/EM4x69 tag"},
@ -1411,7 +1435,3 @@ int CmdLFEM4X(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
int demodEM410x(void) {
return CmdEM410xDemod("");
}

View file

@ -15,11 +15,11 @@
int CmdLFEM4X(const char *Cmd);
int demodEM410x(void);
int demodEM410x(bool verbose);
bool EM4x05IsBlock0(uint32_t *word);
void printEM410x(uint32_t hi, uint64_t id);
int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo);
int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose);
int AskEm410xDemod(int clk, int invert, int maxErr, size_t maxLen, bool amplify, uint32_t *hi, uint64_t *lo, bool verbose);
#endif

View file

@ -220,7 +220,7 @@ static int CmdFDXBdemodBI(const char *Cmd) {
int demodFDX(bool verbose) {
//Differential Biphase / di-phase (inverted biphase)
//get binary from ask wave
if (ASKbiphaseDemod("0 32 1 100", false) != PM3_SUCCESS) {
if (ASKbiphaseDemod(0, 32, 1, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - FDX-B ASKbiphaseDemod failed");
return PM3_ESOFT;
}

View file

@ -67,11 +67,10 @@ static void descramble(uint8_t *arr, uint8_t len) {
}
//see ASK/MAN Demod for what args are accepted
static int CmdGallagherDemod(const char *Cmd) {
(void)Cmd;
int demodGallagher(bool verbose) {
(void) verbose; // unused so far
bool st = true;
if (ASKDemod_ext("32 0 0 0", false, false, 1, &st) != PM3_SUCCESS) {
if (ASKDemod_ext(32, 0, 100, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - GALLAGHER: ASKDemod failed");
return PM3_ESOFT;
}
@ -134,9 +133,15 @@ static int CmdGallagherDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdGallagherDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodGallagher(true);
}
static int CmdGallagherRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 4096 * 2 + 20);
return CmdGallagherDemod(Cmd);
return demodGallagher(true);
}
static int CmdGallagherClone(const char *Cmd) {
@ -222,8 +227,3 @@ int detectGallagher(uint8_t *dest, size_t *size) {
//return start position
return (int)startIdx;
}
int demodGallagher(void) {
return CmdGallagherDemod("");
}

View file

@ -14,7 +14,7 @@
int CmdLFGallagher(const char *Cmd);
int demodGallagher(void);
int demodGallagher(bool verbose);
int detectGallagher(uint8_t *dest, size_t *size);
#endif

View file

@ -65,12 +65,11 @@ static int usage_lf_guard_sim(void) {
//WARNING: if it fails during some points it will destroy the DemodBuffer data
// but will leave the GraphBuffer intact.
//if successful it will push askraw data back to demod buffer ready for emulation
static int CmdGuardDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodGuard(bool verbose) {
(void) verbose; // unused so far
//Differential Biphase
//get binary from ask wave
if (ASKbiphaseDemod("0 64 0 0", false) != PM3_SUCCESS) {
if (ASKbiphaseDemod(0, 64, 0, 0, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - gProxII ASKbiphaseDemod failed");
return PM3_ESOFT;
}
@ -150,9 +149,15 @@ static int CmdGuardDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdGuardDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodGuard(true);
}
static int CmdGuardRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 10000);
return CmdGuardDemod(Cmd);
return demodGuard(true);
}
static int CmdGuardClone(const char *Cmd) {
@ -290,10 +295,6 @@ int detectGProxII(uint8_t *bits, size_t *size) {
return -5; //spacer bits not found - not a valid gproxII
}
int demodGuard(void) {
return CmdGuardDemod("");
}
// Works for 26bits.
int getGuardBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *guardBits) {

View file

@ -13,6 +13,6 @@
int CmdLFGuard(const char *Cmd);
int detectGProxII(uint8_t *bits, size_t *size);
int demodGuard(void);
int demodGuard(bool verbose);
int getGuardBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *guardBits);
#endif

View file

@ -152,8 +152,8 @@ static int sendTry(uint8_t format_idx, wiegand_card_t *card, uint32_t delay, boo
//by marshmellow (based on existing demod + holiman's refactor)
//HID Prox demod - FSK RF/50 with preamble of 00011101 (then manchester encoded)
//print full HID Prox ID and some bit format details if found
static int CmdHIDDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodHID(bool verbose) {
(void) verbose; // unused so far
// HID simulation etc uses 0/1 as signal data. This must be converted in order to demod it back again
if (isGraphBitstream()) {
@ -261,10 +261,16 @@ static int CmdHIDDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdHIDDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodHID(true);
}
// this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdHIDRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 12000);
return CmdHIDDemod(Cmd);
return demodHID(true);
}
// this read loops on device side.
@ -562,7 +568,3 @@ int CmdLFHID(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
int demodHID(void) {
return CmdHIDDemod("");
}

View file

@ -15,6 +15,6 @@
int CmdLFHID(const char *Cmd);
int demodHID(void);
int demodHID(bool verbose);
#endif

136
client/src/cmdlfidteck.c Normal file
View file

@ -0,0 +1,136 @@
//-----------------------------------------------------------------------------
// Iceman,
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// Low frequency Idteck tag commands
// PSK
//-----------------------------------------------------------------------------
#include "cmdlfidteck.h"
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "common.h"
#include "cmdparser.h" // command_t
#include "comms.h"
#include "ui.h"
#include "cmddata.h"
#include "cmdlf.h"
#include "lfdemod.h"
#include "commonutil.h" // num_to_bytes
static int CmdHelp(const char *Cmd);
int demodIdteck(bool verbose) {
(void) verbose; // unused so far
if (PSKDemod(0, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
return PM3_ESOFT;
}
size_t size = DemodBufferLen;
//get binary from PSK1 wave
int idx = detectIdteck(DemodBuffer, &size);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
// if didn't find preamble try again inverting
if (PSKDemod(0, 1, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck PSKDemod failed");
return PM3_ESOFT;
}
idx = detectIdteck(DemodBuffer, &size);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: not enough samples");
else if (idx == -2)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: just noise");
else if (idx == -3)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: preamble not found");
else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: size not correct: %zu", size);
else
PrintAndLogEx(DEBUG, "DEBUG: Error - Idteck: idx: %d", idx);
return PM3_ESOFT;
}
}
setDemodBuff(DemodBuffer, 64, idx);
//got a good demod
uint32_t id = 0;
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
uint32_t raw2 = bytebits_to_byte(DemodBuffer + 32, 32);
//parity check (TBD)
//checksum check (TBD)
//output
PrintAndLogEx(SUCCESS, "IDTECK Tag Found: Card ID %u , Raw: %08X%08X", id, raw1, raw2);
return PM3_SUCCESS;
}
static int CmdIdteckDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodIdteck(true);
}
static int CmdIdteckRead(const char *Cmd) {
(void)Cmd;
lf_read(false, 5000);
return demodIdteck(true);
}
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"demod", CmdIdteckDemod, AlwaysAvailable, "Demodulate an Idteck tag from the GraphBuffer"},
{"read", CmdIdteckRead, IfPm3Lf, "Attempt to read and Extract tag data from the antenna"},
{NULL, NULL, NULL, NULL}
};
static int CmdHelp(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdsHelp(CommandTable);
return PM3_SUCCESS;
}
int CmdLFIdteck(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
// Find IDTEC PSK1, RF Preamble == 0x4944544B, Demodsize 64bits
// by iceman
int detectIdteck(uint8_t *dest, size_t *size) {
//make sure buffer has data
if (*size < 64 * 2) return -1;
if (getSignalProperties()->isnoise) return -2;
size_t start_idx = 0;
uint8_t preamble[] = {0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1};
//preamble not found
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &start_idx))
return -3;
// wrong demoded size
if (*size != 64) return -4;
return (int)start_idx;
}

19
client/src/cmdlfidteck.h Normal file
View file

@ -0,0 +1,19 @@
//-----------------------------------------------------------------------------
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// Low frequency Idteck tag commands
//-----------------------------------------------------------------------------
#ifndef CMDLFIDTECK_H__
#define CMDLFIDTECK_H__
#include "common.h"
int CmdLFIdteck(const char *Cmd);
int demodIdteck(bool verbose);
int detectIdteck(uint8_t *dest, size_t *size);
#endif

View file

@ -151,25 +151,17 @@ static void decodeHeden2L(uint8_t *bits) {
// Indala 26 bit decode
// by marshmellow, martinbeier
// optional arguments - same as PSKDemod (clock & invert & maxerr)
static int CmdIndalaDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_lf_indala_demod();
int ans;
if (strlen(Cmd) > 0)
ans = PSKDemod(Cmd, true);
else
ans = PSKDemod("32", true);
int demodIndalaEx(int clk, int invert, int maxErr, bool verbose) {
(void) verbose; // unused so far
int ans = PSKDemod(clk, invert, maxErr, true);
if (ans != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala can't demod signal: %d", ans);
return PM3_ESOFT;
}
uint8_t invert = 0;
uint8_t inv = 0;
size_t size = DemodBufferLen;
int idx = detectIndala(DemodBuffer, &size, &invert);
int idx = detectIndala(DemodBuffer, &size, &inv);
if (idx < 0) {
if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Indala: not enough samples");
@ -281,6 +273,29 @@ static int CmdIndalaDemod(const char *Cmd) {
return PM3_SUCCESS;
}
int demodIndala(bool verbose) {
return demodIndalaEx(32, 0, 100, verbose);
}
static int CmdIndalaDemod(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_lf_indala_demod();
int clk = 32, invert = 0, maxErr = 100;
if (strlen(Cmd) > 0) {
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
}
if (clk == 1) {
invert = 1;
clk = 0;
}
if (invert != 0 && invert != 1) {
PrintAndLogEx(WARNING, "Invalid value for invert: %i", invert);
return PM3_EINVARG;
}
return demodIndalaEx(clk, invert, maxErr, true);
}
// older alternative indala demodulate (has some positives and negatives)
// returns false positives more often - but runs against more sets of samples
// poor psk signal can be difficult to demod this approach might succeed when the other fails
@ -485,8 +500,15 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
// this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdIndalaRead(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (cmdp == 'h') return usage_lf_indala_demod();
int clk = 32, invert = 0, maxErr = 100;
if (strlen(Cmd) > 0) {
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
}
lf_read(false, 30000);
return CmdIndalaDemod(Cmd);
return demodIndalaEx(clk, invert, maxErr, true);
}
static int CmdIndalaSim(const char *Cmd) {
@ -865,7 +887,3 @@ out:
return (int) idx;
}
int demodIndala(void) {
return CmdIndalaDemod("");
}

View file

@ -15,10 +15,11 @@
int CmdLFINDALA(const char *Cmd);
int detectIndala(uint8_t *dest, size_t *size, uint8_t *invert);
int detectIndala26(uint8_t *bitStream, size_t *size, uint8_t *invert);
int detectIndala64(uint8_t *bitStream, size_t *size, uint8_t *invert);
int detectIndala224(uint8_t *bitStream, size_t *size, uint8_t *invert);
int demodIndala(void);
//int detectIndala26(uint8_t *bitStream, size_t *size, uint8_t *invert);
//int detectIndala64(uint8_t *bitStream, size_t *size, uint8_t *invert);
//int detectIndala224(uint8_t *bitStream, size_t *size, uint8_t *invert);
int demodIndalaEx(int clk, int invert, int maxErr, bool verbose);
int demodIndala(bool verbose);
int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits);
#endif

View file

@ -95,8 +95,8 @@ static int CmdIOProxWatch(const char *Cmd) {
//by marshmellow
//IO-Prox demod - FSK RF/64 with preamble of 000000001
//print ioprox ID and some format details
static int CmdIOProxDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodIOProx(bool verbose) {
(void) verbose; // unused so far
int idx = 0, retval = PM3_SUCCESS;
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t size = getFromGraphBuf(bits);
@ -190,10 +190,15 @@ static int CmdIOProxDemod(const char *Cmd) {
return retval;
}
static int CmdIOProxDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodIOProx(true);
}
// this read is the "normal" read, which download lf signal and tries to demod here.
static int CmdIOProxRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 12000);
return CmdIOProxDemod(Cmd);
return demodIOProx(true);
}
static int CmdIOProxSim(const char *Cmd) {
uint16_t cn = 0;
@ -311,10 +316,6 @@ int CmdLFIO(const char *Cmd) {
return CmdsParse(CommandTable, Cmd);
}
int demodIOProx(void) {
return CmdIOProxDemod("");
}
//Index map
//0 10 20 30 40 50 60
//| | | | | | |

View file

@ -8,7 +8,7 @@
int CmdLFIO(const char *Cmd);
int demodIOProx(void);
int demodIOProx(bool verbose);
int getIOProxBits(uint8_t version, uint8_t fc, uint16_t cn, uint8_t *bits);
#endif

View file

@ -78,16 +78,11 @@ static uint64_t getJablontronCardId(uint64_t rawcode) {
return id;
}
//see ASKDemod for what args are accepted
static int CmdJablotronDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodJablotron();
}
int demodJablotron(void) {
int demodJablotron(bool verbose) {
(void) verbose; // unused so far
//Differential Biphase / di-phase (inverted biphase)
//get binary from ask wave
if (ASKbiphaseDemod("0 64 1 0", false) != PM3_SUCCESS) {
if (ASKbiphaseDemod(0, 64, 1, 0, false) != PM3_SUCCESS) {
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - Jablotron ASKbiphaseDemod failed");
return PM3_ESOFT;
}
@ -137,9 +132,16 @@ int demodJablotron(void) {
return PM3_SUCCESS;
}
//see ASKDemod for what args are accepted
static int CmdJablotronDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodJablotron(true);
}
static int CmdJablotronRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 16000);
return demodJablotron();
return demodJablotron(true);
}
static int CmdJablotronClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFJablotron(const char *Cmd);
int demodJablotron(void);
int demodJablotron(bool verbose);
int detectJablotron(uint8_t *bits, size_t *size);
int getJablotronBits(uint64_t fullcode, uint8_t *bits);

View file

@ -135,14 +135,10 @@ static int CmdKeriMSScramble(KeriMSScramble_t Action, uint32_t *FC, uint32_t *ID
return PM3_SUCCESS;
}
static int CmdKeriDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodKeri();
}
int demodKeri(bool verbose) {
(void) verbose; // unused so far
int demodKeri(void) {
if (PSKDemod("", false) != PM3_SUCCESS) {
if (PSKDemod(0, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - KERI: PSK1 Demod failed");
return PM3_ESOFT;
}
@ -212,9 +208,15 @@ int demodKeri(void) {
return PM3_SUCCESS;
}
static int CmdKeriDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodKeri(true);
}
static int CmdKeriRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 10000);
return CmdKeriDemod(Cmd);
return demodKeri(true);
}
static int CmdKeriClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFKeri(const char *Cmd);
int demodKeri(void);
int demodKeri(bool verbose);
int detectKeri(uint8_t *dest, size_t *size, bool *invert);
#endif

View file

@ -28,16 +28,10 @@
static int CmdHelp(const char *Cmd);
//see PSKDemod for what args are accepted
static int CmdMotorolaDemod(const char *Cmd) {
(void)Cmd;
return demodMotorola();
}
int demodMotorola(void) {
int demodMotorola(bool verbose) {
(void) verbose; // unused so far
//PSK1
if (PSKDemod("32 1", true) != PM3_SUCCESS) {
if (PSKDemod(32, 1, 100, true) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Motorola: PSK Demod failed");
return PM3_ESOFT;
}
@ -124,6 +118,12 @@ int demodMotorola(void) {
return PM3_SUCCESS;
}
//see PSKDemod for what args are accepted
static int CmdMotorolaDemod(const char *Cmd) {
(void)Cmd;
return demodMotorola(true);
}
static int CmdMotorolaRead(const char *Cmd) {
// Motorola Flexpass seem to work at 74 kHz
// and take about 4400 samples to befor modulating
@ -145,7 +145,7 @@ static int CmdMotorolaRead(const char *Cmd) {
sc.divisor = LF_DIVISOR_125;
sc.samples_to_skip = 0;
lf_config(&sc);
return demodMotorola();
return demodMotorola(true);
}
static int CmdMotorolaClone(const char *Cmd) {

View file

@ -14,7 +14,7 @@
int CmdLFMotorola(const char *Cmd);
int demodMotorola(void);
int demodMotorola(bool verbose);
int detectMotorola(uint8_t *dest, size_t *size);
int readMotorolaUid(void);
#endif

View file

@ -107,15 +107,14 @@ static uint8_t isEven_64_63(const uint8_t *data) { // 8
}
//NEDAP demod - ASK/Biphase (or Diphase), RF/64 with preamble of 1111111110 (always a 128 bit data stream)
static int CmdLFNedapDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodNedap(bool verbose) {
(void) verbose; // unused so far
uint8_t data[16], buffer[7], r0, r1, r2, r3, r4, r5, idxC1, idxC2, idxC3, idxC4, idxC5, fixed0, fixed1, unk1, unk2, subtype; // 4 bits
size_t size, offset = 0;
uint16_t checksum, customerCode; // 12 bits
uint32_t badgeId; // max 99999
if (ASKbiphaseDemod("0 64 1 0", false) != PM3_SUCCESS) {
if (ASKbiphaseDemod(0, 64, 1, 0, false) != PM3_SUCCESS) {
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - NEDAP: ASK/Biphase Demod failed");
return PM3_ESOFT;
}
@ -262,6 +261,10 @@ static int CmdLFNedapDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdLFNedapDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodNedap(true);
}
/* Index map E E
preamble enc tag type encrypted uid P d 33 d 90 d 04 d 71 d 40 d 45 d E7 P
1111111110 00101101000001011010001100100100001011010100110101100 1 0 00110011 0 10010000 0 00000100 0 01110001 0 01000000 0 01000101 0 11100111 1
@ -307,8 +310,9 @@ lf t55xx wr b 4 d 4c0003ff
*/
static int CmdLFNedapRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 16000);
return CmdLFNedapDemod(Cmd);
return demodNedap(true);
}
static void NedapGen(uint8_t subType, uint16_t customerCode, uint32_t id, bool isLong, uint8_t *data) { // 8 or 16
@ -554,8 +558,3 @@ int CmdLFNedap(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
int demodNedap(void) {
return CmdLFNedapDemod("");
}

View file

@ -13,7 +13,7 @@
int CmdLFNedap(const char *Cmd);
int demodNedap(void);
int demodNedap(bool verbose);
int detectNedap(uint8_t *dest, size_t *size);
int getNedapBits(uint32_t cn, uint8_t *nedapBits);

View file

@ -150,8 +150,9 @@ static int nexwatch_scamble(NexWatchScramble_t action, uint32_t *id, uint32_t *s
return PM3_SUCCESS;
}
int demodNexWatch(void) {
if (PSKDemod("", false) != PM3_SUCCESS) {
int demodNexWatch(bool verbose) {
(void) verbose; // unused so far
if (PSKDemod(0, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - NexWatch can't demod signal");
return PM3_ESOFT;
}
@ -259,14 +260,15 @@ int demodNexWatch(void) {
static int CmdNexWatchDemod(const char *Cmd) {
(void)Cmd;
return demodNexWatch();
return demodNexWatch(true);
}
//by marshmellow
//see ASKDemod for what args are accepted
static int CmdNexWatchRead(const char *Cmd) {
(void)Cmd;
lf_read(false, 20000);
return CmdNexWatchDemod(Cmd);
return demodNexWatch(true);
}
static int CmdNexWatchClone(const char *Cmd) {

View file

@ -13,6 +13,6 @@
int CmdLFNEXWATCH(const char *Cmd);
int demodNexWatch(void);
int demodNexWatch(bool verbose);
int detectNexWatch(uint8_t *dest, size_t *size, bool *invert);
#endif

View file

@ -62,12 +62,11 @@ static uint8_t noralsy_chksum(uint8_t *bits, uint8_t len) {
}
//see ASKDemod for what args are accepted
static int CmdNoralsyDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodNoralsy(bool verbose) {
(void) verbose; // unused so far
//ASK / Manchester
bool st = true;
if (ASKDemod_ext("32 0 0", false, false, 1, &st) != PM3_SUCCESS) {
if (ASKDemod_ext(32, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
if (g_debugMode) PrintAndLogEx(DEBUG, "DEBUG: Error - Noralsy: ASK/Manchester Demod failed");
return PM3_ESOFT;
}
@ -132,9 +131,15 @@ static int CmdNoralsyDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdNoralsyDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodNoralsy(true);
}
static int CmdNoralsyRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 8000);
return CmdNoralsyDemod(Cmd);
return demodNoralsy(true);
}
static int CmdNoralsyClone(const char *Cmd) {
@ -291,7 +296,3 @@ int detectNoralsy(uint8_t *dest, size_t *size) {
* * = unknown
*
**/
int demodNoralsy(void) {
return CmdNoralsyDemod("");
}

View file

@ -13,7 +13,7 @@
int CmdLFNoralsy(const char *Cmd);
int demodNoralsy(void);
int demodNoralsy(bool verbose);
int detectNoralsy(uint8_t *dest, size_t *size);
int getnoralsyBits(uint32_t id, uint16_t year, uint8_t *bits);

View file

@ -144,14 +144,10 @@ static void pacCardIdToRaw(uint8_t *outRawBytes, const char *cardId) {
}
//see NRZDemod for what args are accepted
static int CmdPacDemod(const char *Cmd) {
(void)Cmd;
return demodPac();
}
int demodPac(void) {
int demodPac(bool verbose) {
(void) verbose; // unused so far
//NRZ
if (NRZrawDemod("", false) != PM3_SUCCESS) {
if (NRZrawDemod(0, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - PAC: NRZ Demod failed");
return PM3_ESOFT;
}
@ -188,9 +184,15 @@ int demodPac(void) {
return retval;
}
static int CmdPacDemod(const char *Cmd) {
(void)Cmd;
return demodPac(true);
}
static int CmdPacRead(const char *Cmd) {
(void)Cmd;
lf_read(false, 4096 * 2 + 20);
return CmdPacDemod(Cmd);
return demodPac(true);
}
static int CmdPacClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFPac(const char *Cmd);
int demodPac(void);
int demodPac(bool verbose);
int detectPac(uint8_t *dest, size_t *size);
#endif

View file

@ -71,16 +71,12 @@ const uint8_t paradox_lut[] = {
#define PARADOX_PREAMBLE_LEN 8
static int CmdParadoxDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodParadox();
}
//by marshmellow
//Paradox Prox demod - FSK2a RF/50 with preamble of 00001111 (then manchester encoded)
//print full Paradox Prox ID and some bit format details if found
int demodParadox(void) {
int demodParadox(bool verbose) {
(void) verbose; // unused so far
//raw fsk demod no manchester decoding no start bit finding just get binary from wave
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t size = getFromGraphBuf(bits);
@ -201,11 +197,18 @@ int demodParadox(void) {
return PM3_SUCCESS;
}
static int CmdParadoxDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodParadox(true);
}
//by marshmellow
//see ASKDemod for what args are accepted
static int CmdParadoxRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 10000);
return CmdParadoxDemod(Cmd);
return demodParadox(true);
}
static int CmdParadoxClone(const char *Cmd) {

View file

@ -13,6 +13,6 @@
int CmdLFParadox(const char *Cmd);
int demodParadox(void);
int demodParadox(bool verbose);
int detectParadox(uint8_t *dest, size_t *size, int *wave_start_idx);
#endif

View file

@ -57,10 +57,10 @@ static int usage_lf_presco_sim(void) {
}
//see ASKDemod for what args are accepted
static int CmdPrescoDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodPresco(bool verbose) {
(void) verbose; // unused so far
bool st = true;
if (ASKDemod_ext("32 0 0 0 0 a", false, false, 1, &st) != PM3_SUCCESS) {
if (ASKDemod_ext(32, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error Presco ASKDemod failed");
return PM3_ESOFT;
}
@ -97,11 +97,17 @@ static int CmdPrescoDemod(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdPrescoDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodPresco(true);
}
//see ASKDemod for what args are accepted
static int CmdPrescoRead(const char *Cmd) {
// Presco Number: 123456789 --> Sitecode 30 | usercode 8665
(void)Cmd; // Cmd is not used so far
lf_read(false, 12000);
return CmdPrescoDemod(Cmd);
return demodPresco(true);
}
// takes base 12 ID converts to hex
@ -178,6 +184,7 @@ static int CmdPrescoSim(const char *Cmd) {
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"demod", CmdPrescoDemod, AlwaysAvailable, "demodulate Presco tag from the GraphBuffer"},
{"read", CmdPrescoRead, IfPm3Lf, "Attempt to read and Extract tag data"},
{"clone", CmdPrescoClone, IfPm3Lf, "clone presco tag to T55x7 or Q5/T5555"},
{"sim", CmdPrescoSim, IfPm3Lf, "simulate presco tag"},
@ -277,8 +284,3 @@ int getPrescoBits(uint32_t fullcode, uint8_t *prescoBits) {
num_to_bytebits(fullcode, 32, prescoBits + 96);
return PM3_SUCCESS;
}
int demodPresco(void) {
return CmdPrescoDemod("");
}

View file

@ -13,7 +13,7 @@
int CmdLFPresco(const char *Cmd);
int demodPresco(void);
int demodPresco(bool verbose);
int detectPresco(uint8_t *dest, size_t *size);
int getPrescoBits(uint32_t fullcode, uint8_t *prescoBits);
int getWiegandFromPresco(const char *Cmd, uint32_t *sitecode, uint32_t *usercode, uint32_t *fullcode, bool *Q5);

View file

@ -64,14 +64,10 @@ static int usage_lf_pyramid_sim(void) {
return PM3_SUCCESS;
}
static int CmdPyramidDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodPyramid();
}
//Pyramid Prox demod - FSK RF/50 with preamble of 0000000000000001 (always a 128 bit data stream)
//print full Farpointe Data/Pyramid Prox ID and some bit format details if found
int demodPyramid(void) {
int demodPyramid(bool verbose) {
(void) verbose; // unused so far
//raw fsk demod no manchester decoding no start bit finding just get binary from wave
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t size = getFromGraphBuf(bits);
@ -213,9 +209,15 @@ int demodPyramid(void) {
return PM3_SUCCESS;
}
static int CmdPyramidDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodPyramid(true);
}
static int CmdPyramidRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 15000);
return CmdPyramidDemod(Cmd);
return demodPyramid(true);
}
static int CmdPyramidClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFPyramid(const char *Cmd);
int demodPyramid(void);
int demodPyramid(bool verbose);
int detectPyramid(uint8_t *dest, size_t *size, int *waveStartIdx);
int getPyramidBits(uint32_t fc, uint32_t cn, uint8_t *pyramidBits);
#endif

View file

@ -38,17 +38,13 @@ static int usage_lf_securakey_clone(void) {
return PM3_SUCCESS;
}
static int CmdSecurakeyDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodSecurakey();
}
//see ASKDemod for what args are accepted
int demodSecurakey(void) {
int demodSecurakey(bool verbose) {
(void) verbose; // unused so far
//ASK / Manchester
bool st = false;
if (ASKDemod_ext("40 0 0", false, false, 1, &st) != PM3_SUCCESS) {
if (ASKDemod_ext(40, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Securakey: ASK/Manchester Demod failed");
return PM3_ESOFT;
}
@ -128,9 +124,15 @@ int demodSecurakey(void) {
return PM3_SUCCESS;
}
static int CmdSecurakeyDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodSecurakey(true);
}
static int CmdSecurakeyRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 8000);
return CmdSecurakeyDemod(Cmd);
return demodSecurakey(true);
}
static int CmdSecurakeyClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFSecurakey(const char *Cmd);
int demodSecurakey(void);
int demodSecurakey(bool verbose);
int detectSecurakey(uint8_t *dest, size_t *size);
#endif

View file

@ -354,8 +354,8 @@ static int usage_t55xx_protect(void) {
print_usage_t55xx_downloadlink(T55XX_DLMODE_SINGLE, config.downlink_mode);
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf t55xx protect n 01020304") " - sets new password to 01020304");
PrintAndLogEx(NORMAL, _YELLOW_(" lf t55xx protect p 11223344") " - use pwd 11223344 to set newpwd to 00000000");
PrintAndLogEx(NORMAL, _YELLOW_(" lf t55xx protect n 01020304") " - sets new password to 01020304");
PrintAndLogEx(NORMAL, _YELLOW_(" lf t55xx protect p 11223344 n 00000000") " - use pwd 11223344 to set newpwd to 00000000");
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS;
}
@ -379,7 +379,7 @@ static int usage_t55xx_clonehelp(void) {
PrintAndLogEx(NORMAL, "For cloning specific techs on T55xx tags, see commands available in corresponding LF sub-menus, e.g.:");
PrintAndLogEx(NORMAL, _GREEN_("lf awid clone"));
// todo: rename to clone
PrintAndLogEx(NORMAL, _GREEN_("lf em 410x_write"));
PrintAndLogEx(NORMAL, _GREEN_("lf em 410x_clone"));
// todo: implement restore
// PrintAndLogEx(NORMAL, _GREEN_("lf em 4x05_write"));
// PrintAndLogEx(NORMAL, _GREEN_("lf em 4x50_write"));
@ -944,8 +944,6 @@ static int CmdT55xxReadBlock(const char *Cmd) {
bool DecodeT55xxBlock(void) {
char buf[30] = {0x00};
char *cmdStr = buf;
int ans = 0;
bool ST = config.ST;
uint8_t bitRate[8] = {8, 16, 32, 40, 50, 64, 100, 128};
@ -953,41 +951,33 @@ bool DecodeT55xxBlock(void) {
switch (config.modulation) {
case DEMOD_FSK:
snprintf(cmdStr, sizeof(buf), "%d %d", bitRate[config.bitrate], config.inverted);
ans = FSKrawDemod(cmdStr, false);
ans = FSKrawDemod(bitRate[config.bitrate], config.inverted, 0, 0, false);
break;
case DEMOD_FSK1:
case DEMOD_FSK1a:
snprintf(cmdStr, sizeof(buf), "%d %d 8 5", bitRate[config.bitrate], config.inverted);
ans = FSKrawDemod(cmdStr, false);
ans = FSKrawDemod(bitRate[config.bitrate], config.inverted, 8, 5, false);
break;
case DEMOD_FSK2:
case DEMOD_FSK2a:
snprintf(cmdStr, sizeof(buf), "%d %d 10 8", bitRate[config.bitrate], config.inverted);
ans = FSKrawDemod(cmdStr, false);
ans = FSKrawDemod(bitRate[config.bitrate], config.inverted, 10, 8, false);
break;
case DEMOD_ASK:
snprintf(cmdStr, sizeof(buf), "%d %d 1", bitRate[config.bitrate], config.inverted);
ans = ASKDemod_ext(cmdStr, false, false, 1, &ST);
ans = ASKDemod_ext(bitRate[config.bitrate], config.inverted, 1, 0, false, false, false, 1, &ST);
break;
case DEMOD_PSK1:
snprintf(cmdStr, sizeof(buf), "%d %d 6", bitRate[config.bitrate], config.inverted);
ans = PSKDemod(cmdStr, false);
ans = PSKDemod(bitRate[config.bitrate], config.inverted, 6, false);
break;
case DEMOD_PSK2: //inverted won't affect this
case DEMOD_PSK3: //not fully implemented
snprintf(cmdStr, sizeof(buf), "%d 0 6", bitRate[config.bitrate]);
ans = PSKDemod(cmdStr, false);
ans = PSKDemod(bitRate[config.bitrate], 0, 6, false);
psk1TOpsk2(DemodBuffer, DemodBufferLen);
break;
case DEMOD_NRZ:
snprintf(cmdStr, sizeof(buf), "%d %d 1", bitRate[config.bitrate], config.inverted);
ans = NRZrawDemod(cmdStr, false);
ans = NRZrawDemod(bitRate[config.bitrate], config.inverted, 1, false);
break;
case DEMOD_BI:
case DEMOD_BIa:
snprintf(cmdStr, sizeof(buf), "0 %d %d 1", bitRate[config.bitrate], config.inverted);
ans = ASKbiphaseDemod(cmdStr, false);
ans = ASKbiphaseDemod(0, bitRate[config.bitrate], config.inverted, 1, false);
break;
default:
return false;
@ -999,7 +989,8 @@ static bool DecodeT5555TraceBlock(void) {
DemodBufferLen = 0x00;
// According to datasheet. Always: RF/64, not inverted, Manchester
return (ASKDemod("64 0 1", false, false, 1) == PM3_SUCCESS);
bool st = false;
return (ASKDemod_ext(64, 0, 1, 0, false, false, false, 1, &st) == PM3_SUCCESS);
}
// sanity check. Don't use proxmark if it is offline and you didn't specify useGraphbuf
@ -1139,7 +1130,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
ans = fskClocks(&fc1, &fc2, (uint8_t *)&clk, &firstClockEdge);
if (ans && ((fc1 == 10 && fc2 == 8) || (fc1 == 8 && fc2 == 5))) {
if ((FSKrawDemod("0 0", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((FSKrawDemod(0, 0, 0, 0, false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_FSK;
if (fc1 == 8 && fc2 == 5)
tests[hits].modulation = DEMOD_FSK1a;
@ -1152,7 +1143,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
tests[hits].downlink_mode = downlink_mode;
++hits;
}
if ((FSKrawDemod("0 1", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((FSKrawDemod(0, 1, 0, 0, false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_FSK;
if (fc1 == 8 && fc2 == 5)
tests[hits].modulation = DEMOD_FSK1;
@ -1174,7 +1165,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
// false = no emSearch
// 1 = Ask/Man
// st = true
if ((ASKDemod_ext("0 0 1", false, false, 1, &tests[hits].ST) == PM3_SUCCESS) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((ASKDemod_ext(0, 0, 1, 0, false, false, false, 1, &tests[hits].ST) == PM3_SUCCESS) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_ASK;
tests[hits].bitrate = bitRate;
tests[hits].inverted = false;
@ -1188,7 +1179,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
// false = no emSearch
// 1 = Ask/Man
// st = true
if ((ASKDemod_ext("0 1 1", false, false, 1, &tests[hits].ST) == PM3_SUCCESS) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((ASKDemod_ext(0, 1, 1, 0, false, false, false, 1, &tests[hits].ST) == PM3_SUCCESS) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_ASK;
tests[hits].bitrate = bitRate;
tests[hits].inverted = true;
@ -1196,7 +1187,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
tests[hits].downlink_mode = downlink_mode;
++hits;
}
if ((ASKbiphaseDemod("0 0 0 2", false) == PM3_SUCCESS) && test(DEMOD_BI, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((ASKbiphaseDemod(0, 0, 0, 2, false) == PM3_SUCCESS) && test(DEMOD_BI, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_BI;
tests[hits].bitrate = bitRate;
tests[hits].inverted = false;
@ -1205,7 +1196,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
tests[hits].downlink_mode = downlink_mode;
++hits;
}
if ((ASKbiphaseDemod("0 0 1 2", false) == PM3_SUCCESS) && test(DEMOD_BIa, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((ASKbiphaseDemod(0, 0, 1, 2, false) == PM3_SUCCESS) && test(DEMOD_BIa, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_BIa;
tests[hits].bitrate = bitRate;
tests[hits].inverted = true;
@ -1217,7 +1208,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
}
clk = GetNrzClock("", false);
if (clk > 8) { //clock of rf/8 is likely a false positive, so don't use it.
if ((NRZrawDemod("0 0 1", false) == PM3_SUCCESS) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((NRZrawDemod(0, 0, 1, false) == PM3_SUCCESS) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_NRZ;
tests[hits].bitrate = bitRate;
tests[hits].inverted = false;
@ -1227,7 +1218,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
++hits;
}
if ((NRZrawDemod("0 1 1", false) == PM3_SUCCESS) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((NRZrawDemod(0, 1, 1, false) == PM3_SUCCESS) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_NRZ;
tests[hits].bitrate = bitRate;
tests[hits].inverted = true;
@ -1244,7 +1235,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
save_restoreGB(GRAPH_SAVE);
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)
CmdLtrim("160");
if ((PSKDemod("0 0 6", false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((PSKDemod(0, 0, 6, false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_PSK1;
tests[hits].bitrate = bitRate;
tests[hits].inverted = false;
@ -1253,7 +1244,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
tests[hits].downlink_mode = downlink_mode;
++hits;
}
if ((PSKDemod("0 1 6", false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
if ((PSKDemod(0, 1, 6, false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_PSK1;
tests[hits].bitrate = bitRate;
tests[hits].inverted = true;
@ -1264,7 +1255,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
}
//ICEMAN: are these PSKDemod calls needed?
// PSK2 - needs a call to psk1TOpsk2.
if (PSKDemod("0 0 6", false) == PM3_SUCCESS) {
if (PSKDemod(0, 0, 6, false) == PM3_SUCCESS) {
psk1TOpsk2(DemodBuffer, DemodBufferLen);
if (test(DEMOD_PSK2, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_PSK2;
@ -1277,7 +1268,7 @@ bool tryDetectModulationEx(uint8_t downlink_mode, bool print_config, uint32_t wa
}
} // inverse waves does not affect this demod
// PSK3 - needs a call to psk1TOpsk2.
if (PSKDemod("0 0 6", false) == PM3_SUCCESS) {
if (PSKDemod(0, 0, 6, false) == PM3_SUCCESS) {
psk1TOpsk2(DemodBuffer, DemodBufferLen);
if (test(DEMOD_PSK3, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
tests[hits].modulation = DEMOD_PSK3;
@ -3414,12 +3405,12 @@ bool tryDetectP1(bool getData) {
// try fsk clock detect. if successful it cannot be any other type of modulation... (in theory...)
ans = fskClocks(&fc1, &fc2, (uint8_t *)&clk, &firstClockEdge);
if (ans && ((fc1 == 10 && fc2 == 8) || (fc1 == 8 && fc2 == 5))) {
if ((FSKrawDemod("0 0", false) == PM3_SUCCESS) &&
if ((FSKrawDemod(0, 0, 0, 0, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
if ((FSKrawDemod("0 1", false) == PM3_SUCCESS) &&
if ((FSKrawDemod(0, 1, 0, 0, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
@ -3430,26 +3421,26 @@ bool tryDetectP1(bool getData) {
// try ask clock detect. it could be another type even if successful.
clk = GetAskClock("", false);
if (clk > 0) {
if ((ASKDemod_ext("0 0 1", false, false, 1, &st) == PM3_SUCCESS) &&
if ((ASKDemod_ext(0, 0, 1, 0, false, false, false, 1, &st) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
st = true;
if ((ASKDemod_ext("0 1 1", false, false, 1, &st) == PM3_SUCCESS) &&
if ((ASKDemod_ext(0, 1, 1, 0, false, false, false, 1, &st) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
if ((ASKbiphaseDemod("0 0 0 2", false) == PM3_SUCCESS) &&
if ((ASKbiphaseDemod(0, 0, 0, 2, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
if ((ASKbiphaseDemod("0 0 1 2", false) == PM3_SUCCESS) &&
if ((ASKbiphaseDemod(0, 0, 1, 2, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
@ -3459,12 +3450,12 @@ bool tryDetectP1(bool getData) {
// try NRZ clock detect. it could be another type even if successful.
clk = GetNrzClock("", false); //has the most false positives :(
if (clk > 0) {
if ((NRZrawDemod("0 0 1", false) == PM3_SUCCESS) &&
if ((NRZrawDemod(0, 0, 1, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
}
if ((NRZrawDemod("0 1 1", false) == PM3_SUCCESS) &&
if ((NRZrawDemod(0, 1, 1, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
return true;
@ -3479,20 +3470,20 @@ bool tryDetectP1(bool getData) {
// save_restoreGB(GRAPH_SAVE);
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)
//CmdLtrim("160");
if ((PSKDemod("0 0 6", false) == PM3_SUCCESS) &&
if ((PSKDemod(0, 0, 6, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
//save_restoreGB(GRAPH_RESTORE);
return true;
}
if ((PSKDemod("0 1 6", false) == PM3_SUCCESS) &&
if ((PSKDemod(0, 1, 6, false) == PM3_SUCCESS) &&
preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
//save_restoreGB(GRAPH_RESTORE);
return true;
}
// PSK2 - needs a call to psk1TOpsk2.
if (PSKDemod("0 0 6", false) == PM3_SUCCESS) {
if (PSKDemod(0, 0, 6, false) == PM3_SUCCESS) {
psk1TOpsk2(DemodBuffer, DemodBufferLen);
if (preambleSearchEx(DemodBuffer, preamble, sizeof(preamble), &DemodBufferLen, &startIdx, false) &&
(DemodBufferLen == 32 || DemodBufferLen == 64)) {
@ -3964,7 +3955,7 @@ static int CmdT55xxSniff(const char *Cmd) {
// Long leading 0
if (haveData == false && (approxEq(pulseBuffer[0],136+minWidth,tolerance) && approxEq(pulseBuffer[1],maxWidth,tolerance))) {
printf ("Long Leading 0 - not yet hanled | have 1 Fisrt bit | Min : %-3d - Max : %-3d : diff : %d\n",minWidth,maxWidth, maxWidth-minWidth);
// printf ("Long Leading 0 - not yet hanled | have 1 Fisrt bit | Min : %-3d - Max : %-3d : diff : %d\n",minWidth,maxWidth, maxWidth-minWidth);
continue;
}

View file

@ -23,8 +23,8 @@
static int CmdHelp(const char *Cmd);
static int CmdTIDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
int demodTI(bool verbose) {
(void) verbose; // unused so far
/* MATLAB as follows:
f_s = 2000000; % sampling frequency
f_l = 123200; % low FSK tone
@ -271,6 +271,11 @@ out:
return retval;
}
static int CmdTIDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodTI(true);
}
// read a TI tag and return its ID
static int CmdTIRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
@ -317,8 +322,3 @@ int CmdLFTI(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}
int demodTI(void) {
return CmdTIDemod("");
}

View file

@ -15,5 +15,5 @@
int CmdLFTI(const char *Cmd);
int demodTI(void);
int demodTI(bool verbose);
#endif

View file

@ -38,14 +38,10 @@ static int usage_lf_verichip_clone(void) {
}
//see NRZDemod for what args are accepted
static int CmdVerichipDemod(const char *Cmd) {
(void)Cmd;
return demodVerichip();
}
int demodVerichip(void) {
int demodVerichip(bool verbose) {
(void) verbose; // unused so far
//NRZ
if (NRZrawDemod("", false) != PM3_SUCCESS) {
if (NRZrawDemod(0, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - VERICHIP: NRZ Demod failed");
return PM3_ESOFT;
}
@ -81,9 +77,15 @@ int demodVerichip(void) {
return PM3_SUCCESS;
}
static int CmdVerichipDemod(const char *Cmd) {
(void)Cmd;
return demodVerichip(true);
}
static int CmdVerichipRead(const char *Cmd) {
(void)Cmd;
lf_read(false, 4096 * 2 + 20);
return CmdVerichipDemod(Cmd);
return demodVerichip(true);
}
static int CmdVerichipClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFVerichip(const char *Cmd);
int demodVerichip(void);
int demodVerichip(bool verbose);
int detectVerichip(uint8_t *dest, size_t *size);
#endif

View file

@ -53,14 +53,12 @@ static int usage_lf_viking_sim(void) {
return PM3_SUCCESS;
}
static int CmdVikingDemod(const char *Cmd) {
return demodViking();
}
//see ASKDemod for what args are accepted
int demodViking(void) {
int demodViking(bool verbose) {
(void) verbose; // unused so far
if (ASKDemod("", false, false, 1) != PM3_SUCCESS) {
bool st = false;
if (ASKDemod_ext(0, 0, 100, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Viking ASKDemod failed");
return PM3_ESOFT;
}
@ -84,10 +82,16 @@ int demodViking(void) {
return PM3_SUCCESS;
}
static int CmdVikingDemod(const char *Cmd) {
(void)Cmd;
return demodViking(true);
}
//see ASKDemod for what args are accepted
static int CmdVikingRead(const char *Cmd) {
(void)Cmd;
lf_read(false, 10000);
return CmdVikingDemod(Cmd);
return demodViking(true);
}
static int CmdVikingClone(const char *Cmd) {

View file

@ -13,7 +13,7 @@
int CmdLFViking(const char *Cmd);
int demodViking(void);
int demodViking(bool verbose);
int detectViking(uint8_t *src, size_t *size);
uint64_t getVikingBits(uint32_t id);

View file

@ -87,10 +87,6 @@ static uint8_t visa_parity(uint32_t id) {
return par;
}
static int CmdVisa2kDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodVisa2k();
}
/**
*
* 56495332 00096ebd 00000077 > tag id 618173
@ -103,14 +99,15 @@ static int CmdVisa2kDemod(const char *Cmd) {
*
**/
//see ASKDemod for what args are accepted
int demodVisa2k(void) {
int demodVisa2k(bool verbose) {
(void) verbose; // unused so far
save_restoreGB(GRAPH_SAVE);
//CmdAskEdgeDetect("");
//ASK / Manchester
bool st = true;
if (ASKDemod_ext("64 0 0", false, false, 1, &st) != PM3_SUCCESS) {
if (ASKDemod_ext(64, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ASK/Manchester Demod failed");
save_restoreGB(GRAPH_RESTORE);
return PM3_ESOFT;
@ -160,10 +157,16 @@ int demodVisa2k(void) {
return PM3_SUCCESS;
}
static int CmdVisa2kDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return demodVisa2k(true);
}
// 64*96*2=12288 samples just in case we just missed the first preamble we can still catch 2 of them
static int CmdVisa2kRead(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
lf_read(false, 20000);
return CmdVisa2kDemod(Cmd);
return demodVisa2k(true);
}
static int CmdVisa2kClone(const char *Cmd) {

View file

@ -14,7 +14,7 @@
int CmdLFVisa2k(const char *Cmd);
int getvisa2kBits(uint64_t fullcode, uint8_t *bits);
int demodVisa2k(void);
int demodVisa2k(bool verbose);
int detectVisa2k(uint8_t *dest, size_t *size);
#endif

View file

@ -2168,26 +2168,6 @@ int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32
return (int)start_idx;
}
// Find IDTEC PSK1, RF Preamble == 0x4944544B, Demodsize 64bits
// by iceman
int detectIdteck(uint8_t *dest, size_t *size) {
//make sure buffer has data
if (*size < 64 * 2) return -1;
if (signalprop.isnoise) return -2;
size_t start_idx = 0;
uint8_t preamble[] = {0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1};
//preamble not found
if (!preambleSearch(dest, preamble, sizeof(preamble), size, &start_idx))
return -3;
// wrong demoded size
if (*size != 64) return -4;
return (int)start_idx;
}
int detectIOProx(uint8_t *dest, size_t *size, int *waveStartIdx) {
//make sure buffer has data
if (*size < 66 * 64) return -1;

View file

@ -78,7 +78,6 @@ size_t removeParity(uint8_t *bits, size_t startIdx, uint8_t pLen, uint8_t pTyp
int detectAWID(uint8_t *dest, size_t *size, int *waveStartIdx);
int Em410xDecode(uint8_t *bits, size_t *size, size_t *start_idx, uint32_t *hi, uint64_t *lo);
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo, int *waveStartIdx);
int detectIdteck(uint8_t *dest, size_t *size);
int detectIOProx(uint8_t *dest, size_t *size, int *waveStartIdx);
#endif

File diff suppressed because it is too large Load diff

View file

@ -109,8 +109,8 @@ extern "C" {
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
LZ4LIB_API int LZ4_versionNumber(void); /**< library version number; useful to check dll version */
LZ4LIB_API const char *LZ4_versionString(void); /**< library version string; useful to check dll version */
LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */
LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version */
/*-************************************
@ -145,7 +145,7 @@ LZ4LIB_API const char *LZ4_versionString(void); /**< library version string;
* or 0 if compression fails
* Note : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).
*/
LZ4LIB_API int LZ4_compress_default(const char *src, char *dst, int srcSize, int dstCapacity);
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
/*! LZ4_decompress_safe() :
* compressedSize : is the exact complete size of the compressed block.
@ -161,7 +161,7 @@ LZ4LIB_API int LZ4_compress_default(const char *src, char *dst, int srcSize, int
* The implementation is free to send / store / derive this information in whichever way is most beneficial.
* If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead.
*/
LZ4LIB_API int LZ4_decompress_safe(const char *src, char *dst, int compressedSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
/*-************************************
@ -186,9 +186,10 @@ LZ4LIB_API int LZ4_compressBound(int inputSize);
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
An acceleration value of "1" is the same as regular LZ4_compress_default()
Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c).
Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c).
Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c).
*/
LZ4LIB_API int LZ4_compress_fast(const char *src, char *dst, int srcSize, int dstCapacity, int acceleration);
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_compress_fast_extState() :
@ -198,7 +199,7 @@ LZ4LIB_API int LZ4_compress_fast(const char *src, char *dst, int srcSize, int ds
* Then, provide this buffer as `void* state` to compression function.
*/
LZ4LIB_API int LZ4_sizeofState(void);
LZ4LIB_API int LZ4_compress_fast_extState(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration);
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_compress_destSize() :
@ -212,35 +213,56 @@ LZ4LIB_API int LZ4_compress_fast_extState(void *state, const char *src, char *ds
* New value is necessarily <= input value.
* @return : Nb bytes written into 'dst' (necessarily <= targetDestSize)
* or 0 if compression fails.
*/
LZ4LIB_API int LZ4_compress_destSize(const char *src, char *dst, int *srcSizePtr, int targetDstSize);
*
* Note : from v1.8.2 to v1.9.1, this function had a bug (fixed un v1.9.2+):
* the produced compressed content could, in specific circumstances,
* require to be decompressed into a destination buffer larger
* by at least 1 byte than the content to decompress.
* If an application uses `LZ4_compress_destSize()`,
* it's highly recommended to update liblz4 to v1.9.2 or better.
* If this can't be done or ensured,
* the receiving decompression function should provide
* a dstCapacity which is > decompressedSize, by at least 1 byte.
* See https://github.com/lz4/lz4/issues/859 for details
*/
LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);
/*! LZ4_decompress_safe_partial() :
* Decompress an LZ4 compressed block, of size 'srcSize' at position 'src',
* into destination buffer 'dst' of size 'dstCapacity'.
* Up to 'targetOutputSize' bytes will be decoded.
* The function stops decoding on reaching this objective,
* which can boost performance when only the beginning of a block is required.
* The function stops decoding on reaching this objective.
* This can be useful to boost performance
* whenever only the beginning of a block is required.
*
* @return : the number of bytes decoded in `dst` (necessarily <= dstCapacity)
* @return : the number of bytes decoded in `dst` (necessarily <= targetOutputSize)
* If source stream is detected malformed, function returns a negative result.
*
* Note : @return can be < targetOutputSize, if compressed block contains less data.
* Note 1 : @return can be < targetOutputSize, if compressed block contains less data.
*
* Note 2 : this function features 2 parameters, targetOutputSize and dstCapacity,
* and expects targetOutputSize <= dstCapacity.
* It effectively stops decoding on reaching targetOutputSize,
* Note 2 : targetOutputSize must be <= dstCapacity
*
* Note 3 : this function effectively stops decoding on reaching targetOutputSize,
* so dstCapacity is kind of redundant.
* This is because in a previous version of this function,
* decoding operation would not "break" a sequence in the middle.
* As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize,
* This is because in older versions of this function,
* decoding operation would still write complete sequences.
* Therefore, there was no guarantee that it would stop writing at exactly targetOutputSize,
* it could write more bytes, though only up to dstCapacity.
* Some "margin" used to be required for this operation to work properly.
* This is no longer necessary.
* The function nonetheless keeps its signature, in an effort to not break API.
* Thankfully, this is no longer necessary.
* The function nonetheless keeps the same signature, in an effort to preserve API compatibility.
*
* Note 4 : If srcSize is the exact size of the block,
* then targetOutputSize can be any value,
* including larger than the block's decompressed size.
* The function will, at most, generate block's decompressed size.
*
* Note 5 : If srcSize is _larger_ than block's compressed size,
* then targetOutputSize **MUST** be <= block's decompressed size.
* Otherwise, *silent corruption will occur*.
*/
LZ4LIB_API int LZ4_decompress_safe_partial(const char *src, char *dst, int srcSize, int targetOutputSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
/*-*********************************************
@ -248,8 +270,8 @@ LZ4LIB_API int LZ4_decompress_safe_partial(const char *src, char *dst, int srcSi
***********************************************/
typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
LZ4LIB_API LZ4_stream_t *LZ4_createStream(void);
LZ4LIB_API int LZ4_freeStream(LZ4_stream_t *streamPtr);
LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
/*! LZ4_resetStream_fast() : v1.9.0+
* Use this to prepare an LZ4_stream_t for a new chain of dependent blocks
@ -273,7 +295,7 @@ LZ4LIB_API int LZ4_freeStream(LZ4_stream_t *streamPtr);
* The *extState* functions perform their own resets.
* Invoking LZ4_resetStream_fast() before is redundant, and even counterproductive.
*/
LZ4LIB_API void LZ4_resetStream_fast(LZ4_stream_t *streamPtr);
LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
/*! LZ4_loadDict() :
* Use this function to reference a static dictionary into LZ4_stream_t.
@ -286,7 +308,7 @@ LZ4LIB_API void LZ4_resetStream_fast(LZ4_stream_t *streamPtr);
* Loading a size of 0 is allowed, and is the same as reset.
* @return : loaded dictionary size, in bytes (necessarily <= 64 KB)
*/
LZ4LIB_API int LZ4_loadDict(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize);
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
/*! LZ4_compress_fast_continue() :
* Compress 'src' content using data from previously compressed blocks, for better compression ratio.
@ -311,7 +333,7 @@ LZ4LIB_API int LZ4_loadDict(LZ4_stream_t *streamPtr, const char *dictionary, int
*
* Note 5 : After an error, the stream status is undefined (invalid), it can only be reset or freed.
*/
LZ4LIB_API int LZ4_compress_fast_continue(LZ4_stream_t *streamPtr, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration);
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_saveDict() :
* If last 64KB data cannot be guaranteed to remain available at its current memory location,
@ -320,7 +342,7 @@ LZ4LIB_API int LZ4_compress_fast_continue(LZ4_stream_t *streamPtr, const char *s
* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
*/
LZ4LIB_API int LZ4_saveDict(LZ4_stream_t *streamPtr, char *safeBuffer, int maxDictSize);
LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
/*-**********************************************
@ -333,8 +355,8 @@ typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */
* creation / destruction of streaming decompression tracking context.
* A tracking context can be re-used multiple times.
*/
LZ4LIB_API LZ4_streamDecode_t *LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode(LZ4_streamDecode_t *LZ4_stream);
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*! LZ4_setStreamDecode() :
* An LZ4_streamDecode_t context can be allocated once and re-used multiple times.
@ -343,7 +365,7 @@ LZ4LIB_API int LZ4_freeStreamDecode(LZ4_streamDecode_t *LZ4_stre
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
* @return : 1 if OK, 0 if error
*/
LZ4LIB_API int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize);
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*! LZ4_decoderRingBufferSize() : v1.8.2+
* Note : in a ring buffer scenario (optional),
@ -384,7 +406,7 @@ LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize);
* save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression,
* then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.
*/
LZ4LIB_API int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int srcSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);
/*! LZ4_decompress_*_usingDict() :
@ -395,7 +417,7 @@ LZ4LIB_API int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode
* Performance tip : Decompression speed can be substantially increased
* when dst == dictStart + dictSize.
*/
LZ4LIB_API int LZ4_decompress_safe_usingDict(const char *src, char *dst, int srcSize, int dstCapcity, const char *dictStart, int dictSize);
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
#endif /* LZ4_H_2983827168210 */
@ -446,7 +468,7 @@ LZ4LIB_API int LZ4_decompress_safe_usingDict(const char *src, char *dst, int src
* this function initializes the provided state with a call to something like LZ4_resetStream_fast()
* while LZ4_compress_fast_extState() starts with a call to LZ4_resetStream().
*/
LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration);
LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_attach_dictionary() :
* This is an experimental API that allows
@ -474,7 +496,7 @@ LZ4LIB_STATIC_API int LZ4_compress_fast_extState_fastReset(void *state, const ch
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the completion of the first compression call on the stream.
*/
LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t *workingStream, const LZ4_stream_t *dictionaryStream);
LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const LZ4_stream_t* dictionaryStream);
/*! In-place compression and decompression
@ -564,17 +586,16 @@ typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset;
uint16_t dirty;
uint16_t tableType;
const uint8_t *dictionary;
const LZ4_stream_t_internal *dictCtx;
uint32_t tableType;
const uint8_t* dictionary;
const LZ4_stream_t_internal* dictCtx;
uint32_t dictSize;
};
typedef struct {
const uint8_t *externalDict;
const uint8_t* externalDict;
size_t extDictSize;
const uint8_t *prefixEnd;
const uint8_t* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
@ -584,16 +605,15 @@ typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
unsigned int hashTable[LZ4_HASH_SIZE_U32];
unsigned int currentOffset;
unsigned short dirty;
unsigned short tableType;
const unsigned char *dictionary;
const LZ4_stream_t_internal *dictCtx;
unsigned int tableType;
const unsigned char* dictionary;
const LZ4_stream_t_internal* dictCtx;
unsigned int dictSize;
};
typedef struct {
const unsigned char *externalDict;
const unsigned char *prefixEnd;
const unsigned char* externalDict;
const unsigned char* prefixEnd;
size_t extDictSize;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
@ -630,7 +650,7 @@ union LZ4_stream_u {
* Note2: An LZ4_stream_t structure guarantees correct alignment and size.
* Note3: Before v1.9.0, use LZ4_resetStream() instead
*/
LZ4LIB_API LZ4_stream_t *LZ4_initStream(void *buffer, size_t size);
LZ4LIB_API LZ4_stream_t* LZ4_initStream (void* buffer, size_t size);
/*! LZ4_streamDecode_t :
@ -667,32 +687,31 @@ union LZ4_streamDecode_u {
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
#else
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
# define LZ4_DEPRECATED(message) [[deprecated(message)]]
# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# elif defined(_MSC_VER)
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
# elif defined(__clang__) || (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45))
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# else
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# pragma message("WARNING: LZ4_DEPRECATED needs custom implementation for this compiler")
# define LZ4_DEPRECATED(message) /* disabled */
# endif
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
/* Obsolete compression functions */
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress(const char *src, char *dest, int srcSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput(const char *src, char *dest, int srcSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState(void *state, const char *source, char *dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState(void *state, const char *source, char *dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* src, char* dest, int srcSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* src, char* dest, int srcSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete decompression functions */
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress(const char *source, char *dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
/* Obsolete streaming functions; degraded functionality; do not use!
*
@ -703,14 +722,14 @@ LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompres
* achieved will therefore be no better than compressing each chunk
* independently.
*/
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void *LZ4_create(char *inputBuffer);
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void *state, char *inputBuffer);
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char *LZ4_slideInputBuffer(void *state);
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k(const char *src, char *dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k(const char *src, char *dst, int originalSize);
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
/*! LZ4_decompress_fast() : **unsafe!**
* These functions used to be faster than LZ4_decompress_safe(),
@ -741,11 +760,11 @@ LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4
*/
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe() instead")
LZ4LIB_API int LZ4_decompress_fast(const char *src, char *dst, int originalSize);
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_continue() instead")
LZ4LIB_API int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int originalSize);
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decompress_safe_usingDict() instead")
LZ4LIB_API int LZ4_decompress_fast_usingDict(const char *src, char *dst, int originalSize, const char *dictStart, int dictSize);
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
/*! LZ4_resetStream() :
* An LZ4_stream_t structure must be initialized at least once.
@ -753,7 +772,7 @@ LZ4LIB_API int LZ4_decompress_fast_usingDict(const char *src, char *dst, int ori
* Consider switching to LZ4_initStream(),
* invoking LZ4_resetStream() will trigger deprecation warnings in the future.
*/
LZ4LIB_API void LZ4_resetStream(LZ4_stream_t *streamPtr);
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
#endif /* LZ4_H_98237428734687 */

File diff suppressed because it is too large Load diff

View file

@ -63,7 +63,7 @@ extern "C" {
* @return : the number of bytes written into 'dst'
* or 0 if compression fails.
*/
LZ4LIB_API int LZ4_compress_HC(const char *src, char *dst, int srcSize, int dstCapacity, int compressionLevel);
LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel);
/* Note :
@ -77,7 +77,7 @@ LZ4LIB_API int LZ4_compress_HC(const char *src, char *dst, int srcSize, int dstC
* Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly).
*/
LZ4LIB_API int LZ4_sizeofStateHC(void);
LZ4LIB_API int LZ4_compress_HC_extStateHC(void *stateHC, const char *src, char *dst, int srcSize, int maxDstSize, int compressionLevel);
LZ4LIB_API int LZ4_compress_HC_extStateHC(void* stateHC, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel);
/*! LZ4_compress_HC_destSize() : v1.9.0+
@ -88,9 +88,9 @@ LZ4LIB_API int LZ4_compress_HC_extStateHC(void *stateHC, const char *src, char *
* or 0 if compression fails.
* `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src`
*/
LZ4LIB_API int LZ4_compress_HC_destSize(void *stateHC,
const char *src, char *dst,
int *srcSizePtr, int targetDstSize,
LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC,
const char* src, char* dst,
int* srcSizePtr, int targetDstSize,
int compressionLevel);
@ -98,7 +98,7 @@ LZ4LIB_API int LZ4_compress_HC_destSize(void *stateHC,
* Streaming Compression
* Bufferless synchronous API
**************************************/
typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */
typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */
/*! LZ4_createStreamHC() and LZ4_freeStreamHC() :
* These functions create and release memory for LZ4 HC streaming state.
@ -106,8 +106,8 @@ typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later
* A same state can be used multiple times consecutively,
* starting with LZ4_resetStreamHC_fast() to start a new stream of blocks.
*/
LZ4LIB_API LZ4_streamHC_t *LZ4_createStreamHC(void);
LZ4LIB_API int LZ4_freeStreamHC(LZ4_streamHC_t *streamHCPtr);
LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void);
LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
/*
These functions compress data in successive blocks of any size,
@ -152,12 +152,12 @@ LZ4LIB_API int LZ4_freeStreamHC(LZ4_streamHC_t *streamHCPtr);
just by resetting it, using LZ4_resetStreamHC_fast().
*/
LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t *streamHCPtr, int compressionLevel); /* v1.9.0+ */
LZ4LIB_API int LZ4_loadDictHC(LZ4_streamHC_t *streamHCPtr, const char *dictionary, int dictSize);
LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */
LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize);
LZ4LIB_API int LZ4_compress_HC_continue(LZ4_streamHC_t *streamHCPtr,
const char *src, char *dst,
int srcSize, int maxDstSize);
LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr,
const char* src, char* dst,
int srcSize, int maxDstSize);
/*! LZ4_compress_HC_continue_destSize() : v1.9.0+
* Similar to LZ4_compress_HC_continue(),
@ -169,11 +169,11 @@ LZ4LIB_API int LZ4_compress_HC_continue(LZ4_streamHC_t *streamHCPtr,
* `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`.
* Note that this function may not consume the entire input.
*/
LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t *LZ4_streamHCPtr,
const char *src, char *dst,
int *srcSizePtr, int targetDstSize);
LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr,
const char* src, char* dst,
int* srcSizePtr, int targetDstSize);
LZ4LIB_API int LZ4_saveDictHC(LZ4_streamHC_t *streamHCPtr, char *safeBuffer, int maxDictSize);
LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize);
@ -202,12 +202,13 @@ LZ4LIB_API int LZ4_saveDictHC(LZ4_streamHC_t *streamHCPtr, char *safeBuffer, int
#include <stdint.h>
typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
struct LZ4HC_CCtx_internal {
struct LZ4HC_CCtx_internal
{
uint32_t hashTable[LZ4HC_HASHTABLESIZE];
uint16_t chainTable[LZ4HC_MAXD];
const uint8_t *end; /* next block here to continue on current prefix */
const uint8_t *base; /* All index relative to this position */
const uint8_t *dictBase; /* alternate base for extDict */
const uint8_t* end; /* next block here to continue on current prefix */
const uint8_t* base; /* All index relative to this position */
const uint8_t* dictBase; /* alternate base for extDict */
uint32_t dictLimit; /* below that point, need extDict */
uint32_t lowLimit; /* below that point, no more dict */
uint32_t nextToUpdate; /* index from which to continue dictionary update */
@ -215,18 +216,19 @@ struct LZ4HC_CCtx_internal {
int8_t favorDecSpeed; /* favor decompression speed if this flag set,
otherwise, favor compression ratio */
int8_t dirty; /* stream has to be fully reset if this flag is set */
const LZ4HC_CCtx_internal *dictCtx;
const LZ4HC_CCtx_internal* dictCtx;
};
#else
typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
struct LZ4HC_CCtx_internal {
struct LZ4HC_CCtx_internal
{
unsigned int hashTable[LZ4HC_HASHTABLESIZE];
unsigned short chainTable[LZ4HC_MAXD];
const unsigned char *end; /* next block here to continue on current prefix */
const unsigned char *base; /* All index relative to this position */
const unsigned char *dictBase; /* alternate base for extDict */
const unsigned char* end; /* next block here to continue on current prefix */
const unsigned char* base; /* All index relative to this position */
const unsigned char* dictBase; /* alternate base for extDict */
unsigned int dictLimit; /* below that point, need extDict */
unsigned int lowLimit; /* below that point, no more dict */
unsigned int nextToUpdate; /* index from which to continue dictionary update */
@ -234,7 +236,7 @@ struct LZ4HC_CCtx_internal {
char favorDecSpeed; /* favor decompression speed if this flag set,
otherwise, favor compression ratio */
char dirty; /* stream has to be fully reset if this flag is set */
const LZ4HC_CCtx_internal *dictCtx;
const LZ4HC_CCtx_internal* dictCtx;
};
#endif
@ -267,7 +269,7 @@ union LZ4_streamHC_u {
* Required before first use of a statically allocated LZ4_streamHC_t.
* Before v1.9.0 : use LZ4_resetStreamHC() instead
*/
LZ4LIB_API LZ4_streamHC_t *LZ4_initStreamHC(void *buffer, size_t size);
LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size);
/*-************************************
@ -276,16 +278,16 @@ LZ4LIB_API LZ4_streamHC_t *LZ4_initStreamHC(void *buffer, size_t size);
/* see lz4.h LZ4_DISABLE_DEPRECATE_WARNINGS to turn off deprecation warnings */
/* deprecated compression functions */
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC(const char *source, char *dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput(const char *source, char *dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2(const char *source, char *dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput(const char *source, char *dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_withStateHC(void *state, const char *source, char *dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_withStateHC(void *state, const char *source, char *dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC(void *state, const char *source, char *dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_withStateHC(void *state, const char *source, char *dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_continue(LZ4_streamHC_t *LZ4_streamHCPtr, const char *source, char *dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_continue(LZ4_streamHC_t *LZ4_streamHCPtr, const char *source, char *dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC (const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete streaming functions; degraded functionality; do not use!
*
@ -295,13 +297,13 @@ LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_comp
* LZ4_slideInputBufferHC() will truncate the history of the stream, rather
* than preserve a window-sized chunk of history.
*/
LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API void *LZ4_createHC(const char *inputBuffer);
LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char *LZ4_slideInputBufferHC(void *LZ4HC_Data);
LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") LZ4LIB_API int LZ4_freeHC(void *LZ4HC_Data);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue(void *LZ4HC_Data, const char *source, char *dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_continue(void *LZ4HC_Data, const char *source, char *dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API void* LZ4_createHC (const char* inputBuffer);
LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") LZ4LIB_API int LZ4_freeHC (void* LZ4HC_Data);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API int LZ4_sizeofStreamStateHC(void);
LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void *state, char *inputBuffer);
LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void* state, char* inputBuffer);
/* LZ4_resetStreamHC() is now replaced by LZ4_initStreamHC().
@ -312,7 +314,7 @@ LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStre
* It is recommended to switch to LZ4_initStreamHC().
* LZ4_resetStreamHC() will generate deprecation warnings in a future version.
*/
LZ4LIB_API void LZ4_resetStreamHC(LZ4_streamHC_t *streamHCPtr, int compressionLevel);
LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel);
#if defined (__cplusplus)
@ -347,14 +349,14 @@ extern "C" {
* for dynamic adaptation.
*/
LZ4LIB_STATIC_API void LZ4_setCompressionLevel(
LZ4_streamHC_t *LZ4_streamHCPtr, int compressionLevel);
LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
/*! LZ4_favorDecompressionSpeed() : v1.8.2+ (experimental)
* Opt. Parser will favor decompression speed over compression ratio.
* Only applicable to levels >= LZ4HC_CLEVEL_OPT_MIN.
*/
LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed(
LZ4_streamHC_t *LZ4_streamHCPtr, int favor);
LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
/*! LZ4_resetStreamHC_fast() : v1.9.0+
* When an LZ4_streamHC_t is known to be in a internally coherent state,
@ -380,7 +382,7 @@ LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed(
* clear any existing history and settings from the context.
*/
LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast(
LZ4_streamHC_t *LZ4_streamHCPtr, int compressionLevel);
LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
/*! LZ4_compress_HC_extStateHC_fastReset() :
* A variant of LZ4_compress_HC_extStateHC().
@ -393,9 +395,9 @@ LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast(
* LZ4_resetStreamHC_fast() while LZ4_compress_HC_extStateHC() starts with a
* call to LZ4_resetStreamHC().
*/
LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset(
void *state,
const char *src, char *dst,
LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset (
void* state,
const char* src, char* dst,
int srcSize, int dstCapacity,
int compressionLevel);
@ -425,7 +427,7 @@ LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset(
* through the lifetime of the stream session.
*/
LZ4LIB_STATIC_API void LZ4_attach_HC_dictionary(
LZ4_streamHC_t *working_stream,
LZ4_streamHC_t *working_stream,
const LZ4_streamHC_t *dictionary_stream);
#if defined (__cplusplus)

View file

@ -490,7 +490,7 @@ Check column "offline" for their availability.
|`lf em 410x_brute `|N |`reader bruteforce attack by simulating EM410x tags`
|`lf em 410x_watch `|N |`watches for EM410x 125/134 kHz tags (option 'h' for 134)`
|`lf em 410x_spoof `|N |`watches for EM410x 125/134 kHz tags, and replays them. (option 'h' for 134)`
|`lf em 410x_write `|N |`write EM410x UID to T5555(Q5) or T55x7 tag`
|`lf em 410x_clone `|N |`write EM410x UID to T5555(Q5) or T55x7 tag`
|`lf em 4x05_demod `|Y |`demodulate a EM4x05/EM4x69 tag from the GraphBuffer`
|`lf em 4x05_dump `|N |`dump EM4x05/EM4x69 tag`
|`lf em 4x05_wipe `|N |`wipe EM4x05/EM4x69 tag`

View file

@ -495,6 +495,9 @@ Computing BCC1 on UID 04112233445566: `analyse lcr 33445566` = `44`
Int is internal, typically 0x48
Anticol shortcut (CL1/3000) is supported for UL, ULC, NTAG except NTAG I2C
## MIFARE Ultralight Gen1A
### Identify
@ -561,11 +564,13 @@ Issue three regular MFU write commands in a row to write first three blocks.
* BCC: computed
* ATS: 0A78008102DBA0C119402AB5
* Anticol shortcut (CL1/3000): fails
#### MIFARE Ultralight DirectWrite flavour 2
* BCC: play blindly the block0 BCC0 and block2 BCC1 bytes, beware!
* ATS: 850000A00A000AB00000000000000000184D
* Anticol shortcut (CL1/3000): succeeds
### Proxmark3 commands
@ -672,6 +677,7 @@ hf 14a info
* BCC: computed
* ATS: 0A78008102DBA0C119402AB5
* Anticol shortcut (CL1/3000): fails
# NTAG
@ -703,6 +709,7 @@ hf 14a info
* BCC: play blindly the block0 BCC0 and block2 BCC1 bytes, beware!
* ATS: 0A78008102DBA0C119402AB5
* Anticol shortcut (CL1/3000): succeeds
## NTAG21x
@ -720,6 +727,8 @@ Emulates fully NTAG213, 213F, 215, 216, 216F
Emulates partially UL EV1 48k/128k, NTAG210, NTAG212, NTAGI2C 1K/2K, NTAGI2C 1K/2K PLUS
Anticol shortcut (CL1/3000): fails
### Proxmark3 commands
```

View file

@ -353,6 +353,97 @@ while true; do
if ! CheckExecute "lf GPROXII test" "$CLIENTBIN -c 'data load traces/lf_gprox_36_30_14489.pm3; lf search 1'" "Guardall G-Prox II ID found"; then break; fi
if ! CheckExecute "lf IDTECK test" "$CLIENTBIN -c 'data load traces/lf_idteck_4944544BAC40E069.pm3; lf search 1'" "Idteck ID found"; then break; fi
if ! CheckExecute slow "lf T55 awid 26 test" "$CLIENTBIN -c 'data load traces/lf_t5577_awid_26.pm3; lf search 1'" "AWID ID found"; then break; fi
if ! CheckExecute slow "lf T55 awid 26 test2" "$CLIENTBIN -c 'data load traces/lf_t5577_awid_26.pm3; lf awid demod'" \
"AWID - len: 26 FC: 224 Card: 1337 - Wiegand: 3c00a73"; then break; fi
if ! CheckExecute slow "lf T55 awid 50 test" "$CLIENTBIN -c 'data load traces/lf_t5577_awid_50.pm3; lf search 1'" "AWID ID found"; then break; fi
if ! CheckExecute slow "lf T55 awid 50 test2" "$CLIENTBIN -c 'data load traces/lf_t5577_awid_50.pm3; lf awid demod'" \
"AWID - len: 50 FC: 2001 Card: 13371337 - Wiegand: 20fa201980f92, Raw: 0128b12eb1811d7117e22111"; then break; fi
if ! CheckExecute slow "lf T55 em410x test" "$CLIENTBIN -c 'data load traces/lf_t5577_em410x.pm3; lf search 1'" "EM410x ID found"; then break; fi
if ! CheckExecute slow "lf T55 em410x test2" "$CLIENTBIN -c 'data load traces/lf_t5577_em410x.pm3; lf em 410x_demod demod'" \
"EM TAG ID : 0F0368568B"; then break; fi
if ! CheckExecute slow "lf T55 fdx_animal test" "$CLIENTBIN -c 'data load traces/lf_t5577_fdx_animal.pm3; lf search 1'" "FDX-B ID found"; then break; fi
if ! CheckExecute slow "lf T55 fdx_animal test2" "$CLIENTBIN -c 'data load traces/lf_t5577_fdx_animal.pm3; lf fdx demod'" \
"Animal ID 0999-000000112233"; then break; fi
if ! CheckExecute slow "lf T55 fdx_extended test" "$CLIENTBIN -c 'data load traces/lf_t5577_fdx_extended.pm3; lf search 1'" "FDX-B ID found"; then break; fi
if ! CheckExecute slow "lf T55 fdx_extended test2" "$CLIENTBIN -c 'data load traces/lf_t5577_fdx_extended.pm3; lf fdx demod'" \
"temperature 95.2 F / 35.1 C"; then break; fi
if ! CheckExecute slow "lf T55 gallagher test" "$CLIENTBIN -c 'data load traces/lf_t5577_gallagher.pm3; lf search 1'" "GALLAGHER ID found"; then break; fi
if ! CheckExecute slow "lf T55 gallagher test2" "$CLIENTBIN -c 'data load traces/lf_t5577_gallagher.pm3; lf gallagher demod'" \
"GALLAGHER - Region: 0 FC: 27865 CN: 682758 Issue Level: 13"; then break; fi
if ! CheckExecute slow "lf T55 gproxii test" "$CLIENTBIN -c 'data load traces/lf_t5577_gproxii.pm3; lf search 1'" "Guardall G-Prox II ID found"; then break; fi
if ! CheckExecute slow "lf T55 gproxii test2" "$CLIENTBIN -c 'data load traces/lf_t5577_gproxii.pm3; lf gproxii demod'" \
"G-Prox-II - len: 26 FC: 123 Card: 11223, Raw: f98c7038c63356c7ac26398c"; then break; fi
if ! CheckExecute slow "lf T55 hid test" "$CLIENTBIN -c 'data load traces/lf_t5577_hid.pm3; lf search 1'" "HID Prox ID found"; then break; fi
if ! CheckExecute slow "lf T55 hid test2" "$CLIENTBIN -c 'data load traces/lf_t5577_hid.pm3; lf hid demod'" \
"HID Prox - 2006ec0c86 (1603) - len: 26 bit - OEM: 000 FC: 118 Card: 1603"; then break; fi
if ! CheckExecute slow "lf T55 hid_84 test" "$CLIENTBIN -c 'data load traces/lf_t5577_hid_84.pm3; lf search 1'" "HID Prox ID found"; then break; fi
if ! CheckExecute slow "lf T55 hid_84 test2" "$CLIENTBIN -c 'data load traces/lf_t5577_hid_84.pm3; lf hid demod'" \
"HID Prox - 9e000000000022006ec0c86 (1603)"; then break; fi
if ! CheckExecute slow "lf T55 indala_hedem test" "$CLIENTBIN -c 'data load traces/lf_t5577_indala_hedem.pm3; lf search 1'" "Indala ID found"; then break; fi
if ! CheckExecute slow "lf T55 indala_hedem test2" "$CLIENTBIN -c 'data load traces/lf_t5577_indala_hedem.pm3; lf indala demod'" \
"Heden-2L \| 888"; then break; fi
if ! CheckExecute slow "lf T55 indala test" "$CLIENTBIN -c 'data load traces/lf_t5577_indala.pm3; lf search 1'" "Indala ID found"; then break; fi
if ! CheckExecute slow "lf T55 indala test2" "$CLIENTBIN -c 'data load traces/lf_t5577_indala.pm3; lf indala demod'" \
"Fmt 26 FC: 123 Card: 1337 checksum: 10"; then break; fi
if ! CheckExecute slow "lf T55 indala_224 test" "$CLIENTBIN -c 'data load traces/lf_t5577_indala_224.pm3; lf search 1'" "Indala ID found"; then break; fi
if ! CheckExecute slow "lf T55 indala_224 test2" "$CLIENTBIN -c 'data load traces/lf_t5577_indala_224.pm3; lf indala demod'" \
"Indala - len 224, Raw: 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"; then break; fi
if ! CheckExecute slow "lf T55 io test" "$CLIENTBIN -c 'data load traces/lf_t5577_io.pm3; lf search 1'" "IO Prox ID found"; then break; fi
if ! CheckExecute slow "lf T55 io test2" "$CLIENTBIN -c 'data load traces/lf_t5577_io.pm3; lf io demod'" \
"IO Prox - XSF(01)01:01337, Raw: 007840603059cf3f (ok)"; then break; fi
if ! CheckExecute slow "lf T55 jablotron test" "$CLIENTBIN -c 'data load traces/lf_t5577_jablotron.pm3; lf search 1'" "Jablotron ID found"; then break; fi
if ! CheckExecute slow "lf T55 jablotron test2" "$CLIENTBIN -c 'data load traces/lf_t5577_jablotron.pm3; lf jablotron demod'" \
"Printed: 1410-00-0011-2233"; then break; fi
if ! CheckExecute slow "lf T55 keri test" "$CLIENTBIN -c 'data load traces/lf_t5577_keri.pm3; lf search 1'" "KERI ID found"; then break; fi
if ! CheckExecute slow "lf T55 keri test2" "$CLIENTBIN -c 'data load traces/lf_t5577_keri.pm3; lf keri demod'" \
"KERI - Internal ID: 112233, Raw: E00000008001B669"; then break; fi
if ! CheckExecute slow "lf T55 keri_internalid test" "$CLIENTBIN -c 'data load traces/lf_t5577_keri_internalid.pm3; lf search 1'" "KERI ID found"; then break; fi
if ! CheckExecute slow "lf T55 keri_internalid test2" "$CLIENTBIN -c 'data load traces/lf_t5577_keri_internalid.pm3; lf keri demod'" \
"KERI - Internal ID: 12345, Raw: E000000080003039"; then break; fi
if ! CheckExecute slow "lf T55 keri_msid test" "$CLIENTBIN -c 'data load traces/lf_t5577_keri_msid.pm3; lf search 1'" "KERI ID found"; then break; fi
if ! CheckExecute slow "lf T55 keri_msid test2" "$CLIENTBIN -c 'data load traces/lf_t5577_keri_msid.pm3; lf keri demod'" \
"Descrambled MS - FC: 6 Card: 12345"; then break; fi
# if ! CheckExecute slow "lf T55 motorola test" "$CLIENTBIN -c 'data load traces/lf_t5577_motorola.pm3; lf search 1'" "Indala ID found"; then break; fi
if ! CheckExecute slow "lf T55 motorola test2" "$CLIENTBIN -c 'data load traces/lf_t5577_motorola.pm3; lf motorola demod'" \
"Motorola - fmt: 26 FC: 258 Card: 2, Raw: A0000000A0002021"; then break; fi
if ! CheckExecute slow "lf T55 nedap test" "$CLIENTBIN -c 'data load traces/lf_t5577_nedap.pm3; lf search 1'" "NEDAP ID found"; then break; fi
if ! CheckExecute slow "lf T55 nedap test2" "$CLIENTBIN -c 'data load traces/lf_t5577_nedap.pm3; lf nedap demod'" \
"NEDAP - Card: 12345 subtype: 1 customer code: 123, Raw: FF 82 24 65 08 20 99 53"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch test" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch.pm3; lf search 1'" "NexWatch ID found"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch test2" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch.pm3; lf nexwatch demod'" \
"Raw : 56000000213C9F8F150C00"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch_nexkey test" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch_nexkey.pm3; lf search 1'" "NexWatch ID found"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch_nexkey test2" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch_nexkey.pm3; lf nexwatch demod'" \
"88bit id : 521512301 (0x1f15a56d)"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch_quadrakey test" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch_quadrakey.pm3; lf search 1'" "NexWatch ID found"; then break; fi
if ! CheckExecute slow "lf T55 nexwatch_quadrakey test2" "$CLIENTBIN -c 'data load traces/lf_t5577_nexwatch_quadrakey.pm3; lf nexwatch demod'" \
"88bit id : 521512301 (0x1f15a56d)"; then break; fi
if ! CheckExecute slow "lf T55 noralsy test" "$CLIENTBIN -c 'data load traces/lf_t5577_noralsy.pm3; lf search 1'" "Noralsy ID found"; then break; fi
if ! CheckExecute slow "lf T55 noralsy test2" "$CLIENTBIN -c 'data load traces/lf_t5577_noralsy.pm3; lf noralsy demod'" \
"Noralsy - Card: 112233, Year: 2000, Raw: BB0214FF0110002233070000"; then break; fi
if ! CheckExecute slow "lf T55 pac test" "$CLIENTBIN -c 'data load traces/lf_t5577_pac.pm3; lf search 1'" "PAC/Stanley ID found"; then break; fi
if ! CheckExecute slow "lf T55 pac test2" "$CLIENTBIN -c 'data load traces/lf_t5577_pac.pm3; lf pac demod'" \
"PAC/Stanley - Card: CD4F5552, Raw: FF2049906D8511C593155B56D5B2649F"; then break; fi
if ! CheckExecute slow "lf T55 paradox test" "$CLIENTBIN -c 'data load traces/lf_t5577_paradox.pm3; lf search 1'" "Paradox ID found"; then break; fi
if ! CheckExecute slow "lf T55 paradox test2" "$CLIENTBIN -c 'data load traces/lf_t5577_paradox.pm3; lf paradox demod'" \
"Paradox - ID: 004209dea FC: 96 Card: 40426, Checksum: b2, Raw: 0f55555695596a6a9999a59a"; then break; fi
if ! CheckExecute slow "lf T55 presco test" "$CLIENTBIN -c 'data load traces/lf_t5577_presco.pm3; lf search 1'" "Presco ID found"; then break; fi
if ! CheckExecute slow "lf T55 presco test2" "$CLIENTBIN -c 'data load traces/lf_t5577_presco.pm3; lf presco demod'" \
"Presco - Card: 1E8021D9, Raw: 10D0000000000000000000001E8021D9"; then break; fi
if ! CheckExecute slow "lf T55 pyramid test" "$CLIENTBIN -c 'data load traces/lf_t5577_pyramid.pm3; lf search 1'" "Pyramid ID found"; then break; fi
if ! CheckExecute slow "lf T55 pyramid test2" "$CLIENTBIN -c 'data load traces/lf_t5577_pyramid.pm3; lf pyramid demod'" \
"Pyramid - len: 26, FC: 123 Card: 11223 - Wiegand: 2f657ae, Raw: 00010101010101010101016eb35e5da4"; then break; fi
if ! CheckExecute slow "lf T55 securakey test" "$CLIENTBIN -c 'data load traces/lf_t5577_securakey.pm3; lf search 1'" "Securakey ID found"; then break; fi
if ! CheckExecute slow "lf T55 securakey test2" "$CLIENTBIN -c 'data load traces/lf_t5577_securakey.pm3; lf securakey demod'" \
"Securakey - len: 26 FC: 0x35 Card: 64169, Raw: 7FCB400001ADEA5344300000"; then break; fi
if ! CheckExecute slow "lf T55 viking test" "$CLIENTBIN -c 'data load traces/lf_t5577_viking.pm3; lf search 1'" "Viking ID found"; then break; fi
if ! CheckExecute slow "lf T55 viking test2" "$CLIENTBIN -c 'data load traces/lf_t5577_viking.pm3; lf viking demod'" \
"Viking - Card 0001A337, Raw: F200000001A337CF"; then break; fi
if ! CheckExecute slow "lf T55 visa2000 test" "$CLIENTBIN -c 'data load traces/lf_t5577_visa2000.pm3; lf search 1'" "Visa2000 ID found"; then break; fi
if ! CheckExecute slow "lf T55 visa2000 test2" "$CLIENTBIN -c 'data load traces/lf_t5577_visa2000.pm3; lf visa2000 demod'" \
"Visa2000 - Card 112233, Raw: 564953320001B66900000183"; then break; fi
echo -e "\n${C_BLUE}Testing HF:${C_NC}"
if ! CheckExecute "hf mf offline text" "$CLIENTBIN -c 'hf mf'" "at_enc"; then break; fi
if ! CheckExecute slow retry ignore "hf mf hardnested long test" "$CLIENTBIN -c 'hf mf hardnested t 1 000000000000'" "found:"; then break; fi

121
traces/lf_t5577.txt Normal file
View file

@ -0,0 +1,121 @@
These traces have been generated with a T5577:
lf awid clone 26 224 1337
lf read s 10000
data save f lf_t5577_awid_26
lf awid clone 50 2001 13371337
lf read s 10000
data save f lf_t5577_awid_50
lf em 410x_write 0F0368568B 1
lf read s 10000
data save f lf_t5577_em410x
lf fdx clone c 999 n 112233 s
lf read s 10000
data save f lf_t5577_fdx_animal
lf fdx clone c 999 n 112233 e 16a
lf read s 10000
data save f lf_t5577_fdx_extended
lf gallagher clone b 0FFD5461A9DA1346B2D1AC32
lf read s 10000
data save f lf_t5577_gallagher
lf gproxii clone 26 123 11223
lf read s 10000
data save f lf_t5577_gproxii
lf hid clone 2006ec0c86
lf read s 10000
data save f lf_t5577_hid
lf hid clone l 2006ec0c86
lf read s 20000
data save f lf_t5577_hid_84
lf indala clone --heden 888
lf read s 10000
data save f lf_t5577_indala_hedem
lf indala clone --fc 123 --cn 1337
lf read s 10000
data save f lf_t5577_indala
lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5
lf read s 10000
data save f lf_t5577_indala_224
lf io clone 01 101 1337
lf read s 10000
data save f lf_t5577_io
lf jablotron clone 112233
lf read s 16000
data save f lf_t5577_jablotron
lf keri clone 112233
lf read s 10000
data save f lf_t5577_keri
lf keri clone t i fc 6 cn 12345
lf read s 10000
data save f lf_t5577_keri_internalid
lf keri clone t m f 6 c 12345
lf read s 10000
data save f lf_t5577_keri_msid
lf motorola clone a0000000a0002021
lf read s 10000
data save f lf_t5577_motorola
lf nedap clone s 1 c 123 i 12345
lf read s 16000
data save f lf_t5577_nedap
lf nexwatch clone r 5600000000213C9F8F150C
lf read s 10000
data save f lf_t5577_nexwatch
lf nexwatch clone c 521512301 m 1 n
lf read s 10000
data save f lf_t5577_nexwatch_nexkey
lf nexwatch clone c 521512301 m 1 q
lf read s 10000
data save f lf_t5577_nexwatch_quadrakey
lf noralsy clone 112233
lf read s 10000
data save f lf_t5577_noralsy
lf pac clone c CD4F5552
lf read s 10000
data save f lf_t5577_pac
lf paradox clone b 0f55555695596a6a9999a59a
lf read s 10000
data save f lf_t5577_paradox
lf presco clone d 123456789
lf read s 12000
data save f lf_t5577_presco
lf pyramid clone 123 11223
lf read s 10000
data save f lf_t5577_pyramid
lf securakey clone b 7FCB400001ADEA5344300000
lf read s 10000
data save f lf_t5577_securakey
lf viking clone 1A337
lf read s 10000
data save f lf_t5577_viking
lf visa2000 clone 112233
lf read s 10000
data save f lf_t5577_visa2000

10000
traces/lf_t5577_awid_26.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_awid_50.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_em410x.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_fdx_animal.pm3 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_gallagher.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_gproxii.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_hid.pm3 Normal file

File diff suppressed because it is too large Load diff

20000
traces/lf_t5577_hid_84.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_indala.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_indala_224.pm3 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_io.pm3 Normal file

File diff suppressed because it is too large Load diff

16000
traces/lf_t5577_jablotron.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_keri.pm3 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_keri_msid.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_motorola.pm3 Normal file

File diff suppressed because it is too large Load diff

16000
traces/lf_t5577_nedap.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_nexwatch.pm3 Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_noralsy.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_pac.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_paradox.pm3 Normal file

File diff suppressed because it is too large Load diff

12000
traces/lf_t5577_presco.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_pyramid.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_securakey.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_viking.pm3 Normal file

File diff suppressed because it is too large Load diff

10000
traces/lf_t5577_visa2000.pm3 Normal file

File diff suppressed because it is too large Load diff