mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
fixes: removal of TRUE/FALSE defines into bools
This commit is contained in:
parent
d2f79fa83f
commit
ec16d16d05
15 changed files with 128 additions and 121 deletions
|
@ -1267,28 +1267,29 @@ int CmdLFfind(const char *Cmd) {
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, 1, "This help"},
|
{"help", CmdHelp, 1, "This help"},
|
||||||
{"animal", CmdLFFdx, 1, "{ Animal RFIDs... }"},
|
{"animal", CmdLFFdx, 1, "{ Animal RFIDs... }"},
|
||||||
{"awid", CmdLFAWID, 1, "{ AWID RFIDs... }"},
|
{"awid", CmdLFAWID, 1, "{ AWID RFIDs... }"},
|
||||||
{"cotag", CmdLFCOTAG, 1, "{ COTAG RFIDs... }"},
|
{"cotag", CmdLFCOTAG, 1, "{ COTAG RFIDs... }"},
|
||||||
{"em", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
|
{"em", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
|
||||||
{"guard", CmdLFGuard, 1, "{ Guardall RFIDs... }"},
|
{"guard", CmdLFGuard, 1, "{ Guardall RFIDs... }"},
|
||||||
{"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
|
{"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
|
||||||
{"hitag", CmdLFHitag, 1, "{ HITAG RFIDs... }"},
|
{"hitag", CmdLFHitag, 1, "{ HITAG RFIDs... }"},
|
||||||
// {"indala", CmdLFIndala, 1, "{ Indala RFIDs... }"},
|
// {"indala", CmdLFIndala, 1, "{ Indala RFIDs... }"},
|
||||||
{"io", CmdLFIO, 1, "{ IOPROX RFIDs... }"},
|
{"io", CmdLFIO, 1, "{ IOPROX RFIDs... }"},
|
||||||
{"jablotron", CmdLFJablotron, 1, "{ Jablotron RFIDs... }"},
|
{"jablotron", CmdLFJablotron, 1, "{ Jablotron RFIDs... }"},
|
||||||
{"nedap", CmdLFNedap, 1, "{ Nedap RFIDs... }"},
|
{"nedap", CmdLFNedap, 1, "{ Nedap RFIDs... }"},
|
||||||
{"nexwatch", CmdLFNexWatch, 1, "{ NexWatch RFIDs... }"},
|
{"nexwatch", CmdLFNexWatch, 1, "{ NexWatch RFIDs... }"},
|
||||||
{"noralsy", CmdLFNoralsy, 1, "{ Noralsy RFIDs... }"},
|
{"noralsy", CmdLFNoralsy, 1, "{ Noralsy RFIDs... }"},
|
||||||
{"pac", CmdLFPac, 1, "{ PAC/Stanley RFIDs...}"},
|
{"pac", CmdLFPac, 1, "{ PAC/Stanley RFIDs... }"},
|
||||||
{"pcf7931", CmdLFPCF7931, 1, "{ PCF7931 RFIDs... }"},
|
{"pcf7931", CmdLFPCF7931, 1, "{ PCF7931 RFIDs... }"},
|
||||||
{"presco", CmdLFPresco, 1, "{ Presco RFIDs... }"},
|
{"presco", CmdLFPresco, 1, "{ Presco RFIDs... }"},
|
||||||
{"pyramid", CmdLFPyramid, 1, "{ Farpointe/Pyramid RFIDs... }"},
|
{"pyramid", CmdLFPyramid, 1, "{ Farpointe/Pyramid RFIDs... }"},
|
||||||
{"ti", CmdLFTI, 1, "{ TI RFIDs... }"},
|
|
||||||
{"t55xx", CmdLFT55XX, 1, "{ T55xx RFIDs... }"},
|
|
||||||
{"securakey", CmdLFSecurakey, 1, "{ Securakey RFIDs... }"},
|
{"securakey", CmdLFSecurakey, 1, "{ Securakey RFIDs... }"},
|
||||||
{"viking", CmdLFViking, 1, "{ Viking RFIDs... }"},
|
{"ti", CmdLFTI, 1, "{ TI RFIDs... }"},
|
||||||
{"visa2000", CmdLFVisa2k, 1, "{ Visa2000 RFIDs... }"},
|
{"t55xx", CmdLFT55XX, 1, "{ T55xx RFIDs... }"},
|
||||||
|
|
||||||
|
{"viking", CmdLFViking, 1, "{ Viking RFIDs... }"},
|
||||||
|
{"visa2000", CmdLFVisa2k, 1, "{ Visa2000 RFIDs... }"},
|
||||||
{"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"},
|
{"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"},
|
||||||
{"cmdread", CmdLFCommandRead, 0, "<off period> <'0' period> <'1' period> <command> ['h' 134] \n\t\t-- Modulate LF reader field to send command before read (all periods in microseconds)"},
|
{"cmdread", CmdLFCommandRead, 0, "<off period> <'0' period> <'1' period> <command> ['h' 134] \n\t\t-- Modulate LF reader field to send command before read (all periods in microseconds)"},
|
||||||
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
|
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
|
||||||
|
|
|
@ -58,14 +58,13 @@ int CmdEM410xRead(const char *Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// emulate an EM410X tag
|
// emulate an EM410X tag
|
||||||
int CmdEM410xSim(const char *Cmd)
|
int CmdEM410xSim(const char *Cmd) {
|
||||||
{
|
|
||||||
int i, n, j, binary[4], parity[4];
|
|
||||||
uint8_t uid[5] = {0x00};
|
|
||||||
|
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = param_getchar(Cmd, 0);
|
||||||
if (cmdp == 'h' || cmdp == 'H') return usage_lf_em410x_sim();
|
if (cmdp == 'h' || cmdp == 'H') return usage_lf_em410x_sim();
|
||||||
|
|
||||||
|
int i, n, j, binary[4], parity[4];
|
||||||
|
uint8_t uid[5] = {0x00};
|
||||||
|
|
||||||
/* clock is 64 in EM410x tags */
|
/* clock is 64 in EM410x tags */
|
||||||
uint8_t clock = 64;
|
uint8_t clock = 64;
|
||||||
|
|
||||||
|
@ -132,6 +131,8 @@ int CmdEM410xSim(const char *Cmd)
|
||||||
* rate gets lower, then grow the number of samples
|
* rate gets lower, then grow the number of samples
|
||||||
* Changed by martin, 4000 x 4 = 16000,
|
* Changed by martin, 4000 x 4 = 16000,
|
||||||
* see http://www.proxmark.org/forum/viewtopic.php?pid=7235#p7235
|
* see http://www.proxmark.org/forum/viewtopic.php?pid=7235#p7235
|
||||||
|
*
|
||||||
|
* EDIT -- capture enough to get 2 complete preambles at the slowest data rate known to be used (rf/64) (64*64*2+9 = 8201) marshmellow
|
||||||
*/
|
*/
|
||||||
int CmdEM410xWatch(const char *Cmd) {
|
int CmdEM410xWatch(const char *Cmd) {
|
||||||
do {
|
do {
|
||||||
|
@ -224,9 +225,9 @@ bool EM_EndParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t col
|
||||||
for (uint8_t rowNum = 0; rowNum < rows; rowNum++) {
|
for (uint8_t rowNum = 0; rowNum < rows; rowNum++) {
|
||||||
colP ^= BitStream[(rowNum*cols)+colNum];
|
colP ^= BitStream[(rowNum*cols)+colNum];
|
||||||
}
|
}
|
||||||
if (colP != pType) return FALSE;
|
if (colP != pType) return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType)
|
bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t cols, uint8_t pType)
|
||||||
|
@ -238,9 +239,9 @@ bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t co
|
||||||
for (uint8_t colNum = 0; colNum < cols; colNum++) {
|
for (uint8_t colNum = 0; colNum < cols; colNum++) {
|
||||||
rowP ^= BitStream[(rowNum*cols)+colNum];
|
rowP ^= BitStream[(rowNum*cols)+colNum];
|
||||||
}
|
}
|
||||||
if (rowP != pType) return FALSE;
|
if (rowP != pType) return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EM word parity test.
|
// EM word parity test.
|
||||||
|
@ -256,12 +257,12 @@ bool EM_ByteParityTest(uint8_t *BitStream, size_t size, uint8_t rows, uint8_t co
|
||||||
bool EMwordparitytest(uint8_t *bits){
|
bool EMwordparitytest(uint8_t *bits){
|
||||||
|
|
||||||
// last row/col parity must be 0
|
// last row/col parity must be 0
|
||||||
if (bits[44] != 0 ) return FALSE;
|
if (bits[44] != 0 ) return false;
|
||||||
|
|
||||||
// col parity check
|
// col parity check
|
||||||
uint8_t c1 = bytebits_to_byte(bits, 8) ^ bytebits_to_byte(bits+9, 8) ^ bytebits_to_byte(bits+18, 8) ^ bytebits_to_byte(bits+27, 8);
|
uint8_t c1 = bytebits_to_byte(bits, 8) ^ bytebits_to_byte(bits+9, 8) ^ bytebits_to_byte(bits+18, 8) ^ bytebits_to_byte(bits+27, 8);
|
||||||
uint8_t c2 = bytebits_to_byte(bits+36, 8);
|
uint8_t c2 = bytebits_to_byte(bits+36, 8);
|
||||||
if ( c1 != c2 ) return FALSE;
|
if ( c1 != c2 ) return false;
|
||||||
|
|
||||||
// row parity check
|
// row parity check
|
||||||
uint8_t rowP = 0;
|
uint8_t rowP = 0;
|
||||||
|
@ -271,13 +272,13 @@ bool EMwordparitytest(uint8_t *bits){
|
||||||
if ( i>0 && (i % 9) == 0) {
|
if ( i>0 && (i % 9) == 0) {
|
||||||
|
|
||||||
if ( rowP != EVEN )
|
if ( rowP != EVEN )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
rowP = 0;
|
rowP = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// all checks ok.
|
// all checks ok.
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,7 +356,6 @@ uint32_t OutputEM4x50_Block(uint8_t *BitStream, size_t size, bool verbose, bool
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read the transmitted data of an EM4x50 tag from the graphbuffer
|
/* Read the transmitted data of an EM4x50 tag from the graphbuffer
|
||||||
* Format:
|
* Format:
|
||||||
*
|
*
|
||||||
|
@ -593,10 +593,10 @@ bool downloadSamplesEM(){
|
||||||
GetFromBigBuf(got, sizeof(got), 0);
|
GetFromBigBuf(got, sizeof(got), 0);
|
||||||
if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) {
|
if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) {
|
||||||
PrintAndLog("command execution time out");
|
PrintAndLog("command execution time out");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
setGraphBuf(got, sizeof(got));
|
setGraphBuf(got, sizeof(got));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// em_demod
|
// em_demod
|
||||||
|
@ -605,7 +605,7 @@ bool doPreambleSearch(size_t *startIdx){
|
||||||
// sanity check
|
// sanity check
|
||||||
if ( DemodBufferLen < EM_PREAMBLE_LEN) {
|
if ( DemodBufferLen < EM_PREAMBLE_LEN) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 demodbuffer too small");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 demodbuffer too small");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set size to 20 to only test first 14 positions for the preamble
|
// set size to 20 to only test first 14 positions for the preamble
|
||||||
|
@ -614,73 +614,73 @@ bool doPreambleSearch(size_t *startIdx){
|
||||||
// skip first two 0 bits as they might have been missed in the demod
|
// skip first two 0 bits as they might have been missed in the demod
|
||||||
uint8_t preamble[EM_PREAMBLE_LEN] = {0,0,1,0,1,0};
|
uint8_t preamble[EM_PREAMBLE_LEN] = {0,0,1,0,1,0};
|
||||||
|
|
||||||
if ( !preambleSearchEx(DemodBuffer, preamble, EM_PREAMBLE_LEN, &size, startIdx, TRUE)) {
|
if ( !preambleSearchEx(DemodBuffer, preamble, EM_PREAMBLE_LEN, &size, startIdx, true)) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 preamble not found :: %d", *startIdx);
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM4305 preamble not found :: %d", *startIdx);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool detectFSK(){
|
bool detectFSK(){
|
||||||
// detect fsk clock
|
// detect fsk clock
|
||||||
if (!GetFskClock("", FALSE, FALSE)) {
|
if (!GetFskClock("", false, false)) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: FSK clock failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: FSK clock failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
// demod
|
// demod
|
||||||
int ans = FSKrawDemod("0 0", FALSE);
|
int ans = FSKrawDemod("0 0", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: FSK Demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: FSK Demod failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// PSK clocks should be easy to detect ( but difficult to demod a non-repeating pattern... )
|
// PSK clocks should be easy to detect ( but difficult to demod a non-repeating pattern... )
|
||||||
bool detectPSK(){
|
bool detectPSK(){
|
||||||
int ans = GetPskClock("", FALSE, FALSE);
|
int ans = GetPskClock("", false, false);
|
||||||
if (ans <= 0) {
|
if (ans <= 0) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK clock failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK clock failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
//demod
|
//demod
|
||||||
//try psk1 -- 0 0 6 (six errors?!?)
|
//try psk1 -- 0 0 6 (six errors?!?)
|
||||||
ans = PSKDemod("0 0 6", FALSE);
|
ans = PSKDemod("0 0 6", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK1 Demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK1 Demod failed");
|
||||||
|
|
||||||
//try psk1 inverted
|
//try psk1 inverted
|
||||||
ans = PSKDemod("0 1 6", FALSE);
|
ans = PSKDemod("0 1 6", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK1 inverted Demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: PSK1 inverted Demod failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// either PSK1 or PSK1 inverted is ok from here.
|
// either PSK1 or PSK1 inverted is ok from here.
|
||||||
// lets check PSK2 later.
|
// lets check PSK2 later.
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
// try manchester - NOTE: ST only applies to T55x7 tags.
|
// try manchester - NOTE: ST only applies to T55x7 tags.
|
||||||
bool detectASK_MAN(){
|
bool detectASK_MAN(){
|
||||||
bool stcheck = FALSE;
|
bool stcheck = false;
|
||||||
int ans = ASKDemod_ext("0 0 0", FALSE, FALSE, 1, &stcheck);
|
int ans = ASKDemod_ext("0 0 0", false, false, 1, &stcheck);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/Manchester Demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/Manchester Demod failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
bool detectASK_BI(){
|
bool detectASK_BI(){
|
||||||
int ans = ASKbiphaseDemod("0 0 1", FALSE);
|
int ans = ASKbiphaseDemod("0 0 1", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/biphase normal demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/biphase normal demod failed");
|
||||||
|
|
||||||
ans = ASKbiphaseDemod("0 1 1", FALSE);
|
ans = ASKbiphaseDemod("0 1 1", false);
|
||||||
if (!ans) {
|
if (!ans) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/biphase inverted demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM: ASK/biphase inverted demod failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// param: idx - start index in demoded data.
|
// param: idx - start index in demoded data.
|
||||||
|
@ -691,17 +691,17 @@ bool setDemodBufferEM(uint32_t *word, size_t idx){
|
||||||
memcpy( parity, DemodBuffer, 45);
|
memcpy( parity, DemodBuffer, 45);
|
||||||
if (!EMwordparitytest(parity) ){
|
if (!EMwordparitytest(parity) ){
|
||||||
PrintAndLog("DEBUG: Error - EM Parity tests failed");
|
PrintAndLog("DEBUG: Error - EM Parity tests failed");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test for even parity bits and remove them. (leave out the end row of parities so 36 bits)
|
// test for even parity bits and remove them. (leave out the end row of parities so 36 bits)
|
||||||
if (!removeParity(DemodBuffer, idx + EM_PREAMBLE_LEN, 9, 0, 36)) {
|
if (!removeParity(DemodBuffer, idx + EM_PREAMBLE_LEN, 9, 0, 36)) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - EM, failed removing parity");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM, failed removing parity");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, 32, 0);
|
setDemodBuf(DemodBuffer, 32, 0);
|
||||||
*word = bytebits_to_byteLSBF(DemodBuffer, 32);
|
*word = bytebits_to_byteLSBF(DemodBuffer, 32);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FSK, PSK, ASK/MANCHESTER, ASK/BIPHASE, ASK/DIPHASE
|
// FSK, PSK, ASK/MANCHESTER, ASK/BIPHASE, ASK/DIPHASE
|
||||||
|
@ -727,7 +727,7 @@ bool demodEM4x05resp(uint32_t *word) {
|
||||||
if (doPreambleSearch( &idx ))
|
if (doPreambleSearch( &idx ))
|
||||||
return setDemodBufferEM(word, idx);
|
return setDemodBufferEM(word, idx);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////// 4205 / 4305 commands
|
//////////////// 4205 / 4305 commands
|
||||||
|
@ -1011,7 +1011,7 @@ void printEM4x05ProtectionBits(uint32_t word) {
|
||||||
|
|
||||||
//quick test for EM4x05/EM4x69 tag
|
//quick test for EM4x05/EM4x69 tag
|
||||||
bool EM4x05IsBlock0(uint32_t *word) {
|
bool EM4x05IsBlock0(uint32_t *word) {
|
||||||
return EM4x05ReadWord_ext(0, 0, FALSE, word);
|
return EM4x05ReadWord_ext(0, 0, false, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdEM4x05Info(const char *Cmd) {
|
int CmdEM4x05Info(const char *Cmd) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#define CMDLFEM4X_H__
|
#define CMDLFEM4X_H__
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h> // for bool
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "proxmark3.h"
|
#include "proxmark3.h"
|
||||||
|
@ -25,17 +26,17 @@
|
||||||
#include "cmdlf.h"
|
#include "cmdlf.h"
|
||||||
#include "lfdemod.h"
|
#include "lfdemod.h"
|
||||||
|
|
||||||
int CmdEMdemodASK(const char *Cmd);
|
extern int CmdEMdemodASK(const char *Cmd);
|
||||||
int CmdEM410xRead(const char *Cmd);
|
extern int CmdEM410xRead(const char *Cmd);
|
||||||
int CmdEM410xSim(const char *Cmd);
|
extern int CmdEM410xSim(const char *Cmd);
|
||||||
int CmdEM410xWatch(const char *Cmd);
|
extern int CmdEM410xWatch(const char *Cmd);
|
||||||
int CmdEM410xWatchnSpoof(const char *Cmd);
|
extern int CmdEM410xWatchnSpoof(const char *Cmd);
|
||||||
int CmdEM410xWrite(const char *Cmd);
|
extern int CmdEM410xWrite(const char *Cmd);
|
||||||
int CmdEM4x50Read(const char *Cmd);
|
extern int CmdEM4x50Read(const char *Cmd);
|
||||||
int CmdLFEM4X(const char *Cmd);
|
extern int CmdLFEM4X(const char *Cmd);
|
||||||
int CmdReadWord(const char *Cmd);
|
extern int CmdReadWord(const char *Cmd);
|
||||||
int CmdWriteWord(const char *Cmd);
|
extern int CmdWriteWord(const char *Cmd);
|
||||||
int EM4x50Read(const char *Cmd, bool verbose);
|
extern int EM4x50Read(const char *Cmd, bool verbose);
|
||||||
|
|
||||||
bool EM4x05IsBlock0(uint32_t *word);
|
bool EM4x05IsBlock0(uint32_t *word);
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ int CmdFdxDemod(const char *Cmd) {
|
||||||
|
|
||||||
//Differential Biphase / di-phase (inverted biphase)
|
//Differential Biphase / di-phase (inverted biphase)
|
||||||
//get binary from ask wave
|
//get binary from ask wave
|
||||||
if (!ASKbiphaseDemod("0 32 1 0", FALSE)) {
|
if (!ASKbiphaseDemod("0 32 1 0", false)) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - FDX-B ASKbiphaseDemod failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency fdx-b tag commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFFDX_H__
|
#ifndef CMDLFFDX_H__
|
||||||
#define CMDLFFDX_H__
|
#define CMDLFFDX_H__
|
||||||
|
@ -19,11 +19,12 @@
|
||||||
#include "protocols.h" // for T55xx config register definitions
|
#include "protocols.h" // for T55xx config register definitions
|
||||||
#include "lfdemod.h" // parityTest
|
#include "lfdemod.h" // parityTest
|
||||||
|
|
||||||
int CmdLFFdx(const char *Cmd);
|
extern int CmdLFFdx(const char *Cmd);
|
||||||
int CmdFdxClone(const char *Cmd);
|
extern int CmdFdxClone(const char *Cmd);
|
||||||
int CmdFdxSim(const char *Cmd);
|
extern int CmdFdxSim(const char *Cmd);
|
||||||
int CmdFdxRead(const char *Cmd);
|
extern int CmdFdxRead(const char *Cmd);
|
||||||
int CmdFdxDemod(const char *Cmd);
|
extern int CmdFdxDemod(const char *Cmd);
|
||||||
|
|
||||||
int getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t isextended, uint32_t extended, uint8_t *bits);
|
int getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t isextended, uint32_t extended, uint8_t *bits);
|
||||||
int usage_lf_fdx_clone(void);
|
int usage_lf_fdx_clone(void);
|
||||||
int usage_lf_fdx_sim(void);
|
int usage_lf_fdx_sim(void);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency Jablotron tag commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFJABLOTRON_H__
|
#ifndef CMDLFJABLOTRON_H__
|
||||||
#define CMDLFJABLOTRON_H__
|
#define CMDLFJABLOTRON_H__
|
||||||
|
|
|
@ -60,7 +60,7 @@ int CmdPSKNexWatch(const char *Cmd)
|
||||||
//output
|
//output
|
||||||
PrintAndLog("NexWatch ID: %d", ID);
|
PrintAndLog("NexWatch ID: %d", ID);
|
||||||
if (invert){
|
if (invert){
|
||||||
PrintAndLog("Had to Invert - probably NexKey");
|
PrintAndLog("DEBUG: Error - NexWatch had to Invert - probably NexKey");
|
||||||
for (uint8_t idx=0; idx<size; idx++)
|
for (uint8_t idx=0; idx<size; idx++)
|
||||||
DemodBuffer[idx] ^= 1;
|
DemodBuffer[idx] ^= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency Noralsy tag commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFNORALSY_H__
|
#ifndef CMDLFNORALSY_H__
|
||||||
#define CMDLFNORALSY_H__
|
#define CMDLFNORALSY_H__
|
||||||
|
@ -21,11 +21,12 @@
|
||||||
#include "cmdlf.h"
|
#include "cmdlf.h"
|
||||||
#include "protocols.h" // for T55xx config register definitions
|
#include "protocols.h" // for T55xx config register definitions
|
||||||
#include "lfdemod.h" // parityTest
|
#include "lfdemod.h" // parityTest
|
||||||
int CmdLFNoralsy(const char *Cmd);
|
|
||||||
int CmdNoralsyClone(const char *Cmd);
|
extern int CmdLFNoralsy(const char *Cmd);
|
||||||
int CmdNoralsySim(const char *Cmd);
|
extern int CmdNoralsyClone(const char *Cmd);
|
||||||
int CmdNoralsyRead(const char *Cmd);
|
extern int CmdNoralsySim(const char *Cmd);
|
||||||
int CmdNoralsyDemod(const char *Cmd);
|
extern int CmdNoralsyRead(const char *Cmd);
|
||||||
|
extern int CmdNoralsyDemod(const char *Cmd);
|
||||||
|
|
||||||
int getnoralsyBits(uint32_t id, uint16_t year, uint8_t *bits);
|
int getnoralsyBits(uint32_t id, uint16_t year, uint8_t *bits);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency Presco tag commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFPRESCO_H__
|
#ifndef CMDLFPRESCO_H__
|
||||||
#define CMDLFPRESCO_H__
|
#define CMDLFPRESCO_H__
|
||||||
|
@ -18,11 +18,12 @@
|
||||||
#include "cmdlf.h"
|
#include "cmdlf.h"
|
||||||
#include "protocols.h" // for T55xx config register definitions
|
#include "protocols.h" // for T55xx config register definitions
|
||||||
#include "lfdemod.h" // parityTest
|
#include "lfdemod.h" // parityTest
|
||||||
int CmdLFPresco(const char *Cmd);
|
|
||||||
int CmdPrescoClone(const char *Cmd);
|
extern int CmdLFPresco(const char *Cmd);
|
||||||
int CmdPrescoSim(const char *Cmd);
|
extern int CmdPrescoClone(const char *Cmd);
|
||||||
int CmdPrescoRead(const char *Cmd);
|
extern int CmdPrescoSim(const char *Cmd);
|
||||||
int CmdPrescoDemod(const char *Cmd);
|
extern int CmdPrescoRead(const char *Cmd);
|
||||||
|
extern int CmdPrescoDemod(const char *Cmd);
|
||||||
|
|
||||||
int GetWiegandFromPresco(const char *id, uint32_t *sitecode, uint32_t *usercode, uint32_t *fullcode, bool *Q5);
|
int GetWiegandFromPresco(const char *id, uint32_t *sitecode, uint32_t *usercode, uint32_t *fullcode, bool *Q5);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency Farpoint / Pyramid commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFPYRAMID_H__
|
#ifndef CMDLFPYRAMID_H__
|
||||||
#define CMDLFPYRAMID_H__
|
#define CMDLFPYRAMID_H__
|
||||||
|
|
|
@ -55,7 +55,7 @@ int usage_t55xx_read(){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int usage_t55xx_write(){
|
int usage_t55xx_write(){
|
||||||
PrintAndLog("Usage: lf t55xx wr [b <block>] [d <data>] [p <password>] [1]");
|
PrintAndLog("Usage: lf t55xx write [b <block>] [d <data>] [p <password>] [1]");
|
||||||
PrintAndLog("Options:");
|
PrintAndLog("Options:");
|
||||||
PrintAndLog(" b <block> - block number to write. Between 0-7");
|
PrintAndLog(" b <block> - block number to write. Between 0-7");
|
||||||
PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");
|
PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency Viking tag commands
|
// Low frequency Viking tag commands (AKA FDI Matalec Transit)
|
||||||
|
// ASK/Manchester, RF/32, 64 bits (complete)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -60,7 +61,7 @@ int CmdVikingRead(const char *Cmd) {
|
||||||
// read lf silently
|
// read lf silently
|
||||||
CmdLFRead("s");
|
CmdLFRead("s");
|
||||||
// get samples silently
|
// get samples silently
|
||||||
getSamples("12000", TRUE);
|
getSamples("12000", true);
|
||||||
// demod and output viking ID
|
// demod and output viking ID
|
||||||
return CmdVikingDemod(Cmd);
|
return CmdVikingDemod(Cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency viking tag commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFVIKING_H__
|
#ifndef CMDLFVIKING_H__
|
||||||
#define CMDLFVIKING_H__
|
#define CMDLFVIKING_H__
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency Presco tag commands
|
// Low frequency visa 2000 tag commands
|
||||||
|
// by iceman
|
||||||
|
// ASK/Manchester, RF/64, STT, 96 bits (complete)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "cmdlfvisa2000.h"
|
#include "cmdlfvisa2000.h"
|
||||||
|
@ -54,14 +56,14 @@ static uint8_t visa_parity( uint32_t id) {
|
||||||
,0,1,1,0
|
,0,1,1,0
|
||||||
};
|
};
|
||||||
uint8_t par = 0;
|
uint8_t par = 0;
|
||||||
par |= par_lut[ NIBBLE_HIGH( (id >> 24) & 0xFF) ] << 7;
|
par |= par_lut[ (id >> 28) & 0xF ] << 7;
|
||||||
par |= par_lut[ NIBBLE_LOW( (id >> 24) & 0xFF) ] << 6;
|
par |= par_lut[ (id >> 24) & 0xF ] << 6;
|
||||||
par |= par_lut[ NIBBLE_HIGH( (id >> 16) & 0xFF) ] << 5;
|
par |= par_lut[ (id >> 20) & 0xF ] << 5;
|
||||||
par |= par_lut[ NIBBLE_LOW( (id >> 16) & 0xFF) ] << 4;
|
par |= par_lut[ (id >> 16) & 0xF ] << 4;
|
||||||
par |= par_lut[ NIBBLE_HIGH( (id >> 8) & 0xFF) ] << 3;
|
par |= par_lut[ (id >> 12) & 0xF ] << 3;
|
||||||
par |= par_lut[ NIBBLE_LOW( (id >> 8) & 0xFF) ] << 2;
|
par |= par_lut[ (id >> 8) & 0xF ] << 2;
|
||||||
par |= par_lut[ NIBBLE_HIGH( id & 0xFF ) ] << 1;
|
par |= par_lut[ (id >> 4) & 0xF ] << 1;
|
||||||
par |= par_lut[ NIBBLE_LOW( id & 0xFF) ];
|
par |= par_lut[ (id & 0xF) ];
|
||||||
return par;
|
return par;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +71,12 @@ static uint8_t visa_parity( uint32_t id) {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 56495332 00096ebd 00000077 —> tag id 618173
|
* 56495332 00096ebd 00000077 —> tag id 618173
|
||||||
* aaaaaaaa iiiiiiii -----..c
|
* aaaaaaaa iiiiiiii -----ppc
|
||||||
*
|
*
|
||||||
* a = fixed value ascii 'VIS2'
|
* a = fixed value ascii 'VIS2'
|
||||||
* i = card id
|
* i = card id
|
||||||
|
* p = even parity bit for each nibble in card id.
|
||||||
* c = checksum (xor of card id)
|
* c = checksum (xor of card id)
|
||||||
* . = unknown
|
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
//see ASKDemod for what args are accepted
|
//see ASKDemod for what args are accepted
|
||||||
|
@ -86,8 +88,8 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
//sCmdAskEdgeDetect("");
|
//sCmdAskEdgeDetect("");
|
||||||
|
|
||||||
//ASK / Manchester
|
//ASK / Manchester
|
||||||
bool st = TRUE;
|
bool st = true;
|
||||||
if (!ASKDemod_ext("64 0 0", FALSE, FALSE, 1, &st)) {
|
if (!ASKDemod_ext("64 0 0", false, false, 1, &st)) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: Error - Visa2k: ASK/Manchester Demod failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - Visa2k: ASK/Manchester Demod failed");
|
||||||
save_restoreGB(0);
|
save_restoreGB(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -142,7 +144,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
// 64*96*2=12288 samples just in case we just missed the first preamble we can still catch 2 of them
|
// 64*96*2=12288 samples just in case we just missed the first preamble we can still catch 2 of them
|
||||||
int CmdVisa2kRead(const char *Cmd) {
|
int CmdVisa2kRead(const char *Cmd) {
|
||||||
CmdLFRead("s");
|
CmdLFRead("s");
|
||||||
getSamples("12500",TRUE);
|
getSamples("12500",true);
|
||||||
return CmdVisa2kDemod(Cmd);
|
return CmdVisa2kDemod(Cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +164,6 @@ int CmdVisa2kClone(const char *Cmd) {
|
||||||
blocks[0] = T5555_MODULATION_MANCHESTER | ((64-2)>>1) << T5555_BITRATE_SHIFT | T5555_ST_TERMINATOR | 3 << T5555_MAXBLOCK_SHIFT;
|
blocks[0] = T5555_MODULATION_MANCHESTER | ((64-2)>>1) << T5555_BITRATE_SHIFT | T5555_ST_TERMINATOR | 3 << T5555_MAXBLOCK_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
blocks[2] = id;
|
blocks[2] = id;
|
||||||
blocks[3] = (visa_parity(id) << 4) | visa_chksum(id);
|
blocks[3] = (visa_parity(id) << 4) | visa_chksum(id);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Low frequency T55xx commands
|
// Low frequency visa 2000 commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef CMDLFVISA2000_H__
|
#ifndef CMDLFVISA2000_H__
|
||||||
#define CMDLFVISA2000_H__
|
#define CMDLFVISA2000_H__
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
#include "cmdlf.h"
|
#include "cmdlf.h"
|
||||||
#include "protocols.h" // for T55xx config register definitions
|
#include "protocols.h" // for T55xx config register definitions
|
||||||
#include "lfdemod.h" // parityTest
|
#include "lfdemod.h" // parityTest
|
||||||
int CmdLFVisa2k(const char *Cmd);
|
extern int CmdLFVisa2k(const char *Cmd);
|
||||||
int CmdVisa2kClone(const char *Cmd);
|
extern int CmdVisa2kClone(const char *Cmd);
|
||||||
int CmdVisa2kSim(const char *Cmd);
|
extern int CmdVisa2kSim(const char *Cmd);
|
||||||
int CmdVisa2kRead(const char *Cmd);
|
extern int CmdVisa2kRead(const char *Cmd);
|
||||||
int CmdVisa2kDemod(const char *Cmd);
|
extern int CmdVisa2kDemod(const char *Cmd);
|
||||||
|
|
||||||
int getvisa2kBits(uint64_t fullcode, uint8_t *bits);
|
int getvisa2kBits(uint64_t fullcode, uint8_t *bits);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue