make style

This commit is contained in:
merlokk 2022-06-28 11:45:48 +03:00
commit 67fc919c72
5 changed files with 100 additions and 74 deletions

View file

@ -84,7 +84,7 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
uint32_t scnt = getSampleCounter(); uint32_t scnt = getSampleCounter();
reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, (uint8_t*)&scnt, 4); reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, (uint8_t *)&scnt, 4);
if (ledcontrol) LEDsoff(); if (ledcontrol) LEDsoff();
return 0; return 0;

View file

@ -106,7 +106,7 @@ static bool TexkomCorrelate(uint32_t indx, uint32_t threshold) {
); );
} }
static bool TexkomCalculateMaxMin(uint32_t* data, uint32_t len, uint32_t* dmax, uint32_t* dmin) { static bool TexkomCalculateMaxMin(uint32_t *data, uint32_t len, uint32_t *dmax, uint32_t *dmin) {
*dmax = 0; *dmax = 0;
*dmin = 0xffffffff; *dmin = 0xffffffff;
for (size_t i = 0; i < len; i++) { for (size_t i = 0; i < len; i++) {
@ -119,7 +119,7 @@ static bool TexkomCalculateMaxMin(uint32_t* data, uint32_t len, uint32_t* dmax,
return (*dmax != 0) && (*dmin != 0xffffffff) && (*dmax > *dmin); return (*dmax != 0) && (*dmin != 0xffffffff) && (*dmax > *dmin);
} }
static bool TexkomCalculateBitLengths(uint32_t* data, uint32_t len, uint32_t* hi, uint32_t* low, uint32_t* lmax, uint32_t* lmin) { static bool TexkomCalculateBitLengths(uint32_t *data, uint32_t len, uint32_t *hi, uint32_t *low, uint32_t *lmax, uint32_t *lmin) {
*hi = 0; *hi = 0;
*low = 0; *low = 0;
@ -161,7 +161,7 @@ inline bool TexcomCalculateBit(uint32_t data, uint32_t bitlen, uint32_t threshol
} }
// code from https://github.com/li0ard/crclib/blob/main/index.js // code from https://github.com/li0ard/crclib/blob/main/index.js
static uint8_t TexcomTK13CRC(uint8_t* data) { static uint8_t TexcomTK13CRC(uint8_t *data) {
uint8_t crc = 0; uint8_t crc = 0;
uint8_t indx = 0; uint8_t indx = 0;
while (indx < 4) { while (indx < 4) {
@ -177,29 +177,26 @@ static uint8_t TexcomTK13CRC(uint8_t* data) {
return crc; return crc;
} }
static unsigned char dallas_crc8(const unsigned char * data, const unsigned int size) static unsigned char dallas_crc8(const unsigned char *data, const unsigned int size) {
{
unsigned char crc = 0; unsigned char crc = 0;
for ( unsigned int i = 0; i < size; ++i ) for (unsigned int i = 0; i < size; ++i) {
{
unsigned char inbyte = data[i]; unsigned char inbyte = data[i];
for ( unsigned char j = 0; j < 8; ++j ) for (unsigned char j = 0; j < 8; ++j) {
{
unsigned char mix = (crc ^ inbyte) & 0x01; unsigned char mix = (crc ^ inbyte) & 0x01;
crc >>= 1; crc >>= 1;
if ( mix ) crc ^= 0x8C; if (mix) crc ^= 0x8C;
inbyte >>= 1; inbyte >>= 1;
} }
} }
PrintAndLogEx(WARNING, "--crc %x", crc); PrintAndLogEx(WARNING, "--crc %x", crc);
return crc; return crc;
} }
// code from https://github.com/li0ard/crclib/blob/main/index.js // code from https://github.com/li0ard/crclib/blob/main/index.js
static uint8_t TexcomTK17CRC(uint8_t* data) { static uint8_t TexcomTK17CRC(uint8_t *data) {
uint8_t ddata[8] = {0x00, 0x00, 0x00, data[0], data[1], data[2], data[3], 0x00}; uint8_t ddata[8] = {0x00, 0x00, 0x00, data[0], data[1], data[2], data[3], 0x00};
/* /*
dallas (arrby) { dallas (arrby) {
var arrby2 = []; var arrby2 = [];
if (arrby.length < 8) { if (arrby.length < 8) {
@ -236,12 +233,12 @@ static uint8_t TexcomTK17CRC(uint8_t* data) {
} }
return this.dallas( [0x00, arrby[1], arrby[2], arrby[3], arrby[4], 0x00, 0x00, 0x00] ) return this.dallas( [0x00, arrby[1], arrby[2], arrby[3], arrby[4], 0x00, 0x00, 0x00] )
} }
*/ */
return dallas_crc8(ddata, 8); return dallas_crc8(ddata, 8);
} }
static bool TexcomTK13Decode(uint32_t* implengths, uint32_t implengthslen, char* bitstring, char* cbitstring, bool verbose) { static bool TexcomTK13Decode(uint32_t *implengths, uint32_t implengthslen, char *bitstring, char *cbitstring, bool verbose) {
bitstring[0] = 0; bitstring[0] = 0;
cbitstring[0] = 0; cbitstring[0] = 0;
@ -316,7 +313,7 @@ inline int TexcomTK17Get2Bits(uint32_t len1, uint32_t len2) {
return TK17Bit11; return TK17Bit11;
} }
static bool TexcomTK17Decode(uint32_t* implengths, uint32_t implengthslen, char* bitstring, char* cbitstring, bool verbose) { static bool TexcomTK17Decode(uint32_t *implengths, uint32_t implengthslen, char *bitstring, char *cbitstring, bool verbose) {
bitstring[0] = 0; bitstring[0] = 0;
cbitstring[0] = 0; cbitstring[0] = 0;
@ -359,8 +356,7 @@ static bool TexcomTK17Decode(uint32_t* implengths, uint32_t implengthslen, char*
return (strlen(bitstring) == 64) && (strncmp(cbitstring, "1111111111111111", 16) == 0); return (strlen(bitstring) == 64) && (strncmp(cbitstring, "1111111111111111", 16) == 0);
} }
static bool TexcomGeneralDecode(uint32_t *implengths, uint32_t implengthslen, char *bitstring, bool verbose) {
static bool TexcomGeneralDecode(uint32_t* implengths, uint32_t implengthslen, char* bitstring, bool verbose) {
uint32_t hilength = 0; uint32_t hilength = 0;
uint32_t lowlength = 0; uint32_t lowlength = 0;
if (!TexkomCalculateBitLengths(implengths, implengthslen, &hilength, &lowlength, NULL, NULL)) if (!TexkomCalculateBitLengths(implengths, implengthslen, &hilength, &lowlength, NULL, NULL))
@ -400,7 +396,6 @@ static void TexcomReverseCode(const uint8_t *code, int length, uint8_t *reverse_
} }
}; };
static int CmdHFTexkomReader(const char *Cmd) { static int CmdHFTexkomReader(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf texkom reader", CLIParserInit(&ctx, "hf texkom reader",

View file

@ -2661,7 +2661,7 @@
}, },
"hf help": { "hf help": {
"command": "hf help", "command": "hf help",
"description": "-------- ----------------------- High Frequency ----------------------- 14a { ISO14443A RFIDs... } 14b { ISO14443B RFIDs... } 15 { ISO15693 RFIDs... } cipurse { Cipurse transport Cards... } epa { German Identification Card... } emrtd { Machine Readable Travel Document... } felica { ISO18092 / FeliCa RFIDs... } fido { FIDO and FIDO2 authenticators... } gallagher { Gallagher DESFire RFIDs... } ksx6924 { KS X 6924 (T-Money, Snapper+) RFIDs } jooki { Jooki RFIDs... } iclass { ICLASS RFIDs... } legic { LEGIC RFIDs... } lto { LTO Cartridge Memory RFIDs... } mf { MIFARE RFIDs... } mfp { MIFARE Plus RFIDs... } mfu { MIFARE Ultralight RFIDs... } mfdes { MIFARE Desfire RFIDs... } ntag424 { NXP NTAG 4242 DNA RFIDs... } seos { SEOS RFIDs... } st25ta { ST25TA RFIDs... } thinfilm { Thinfilm RFIDs... } topaz { TOPAZ (NFC Type 1) RFIDs... } waveshare { Waveshare NFC ePaper... } ----------- --------------------- General --------------------- help This help list List protocol data in trace buffer search Search for known HF tags", "description": "-------- ----------------------- High Frequency ----------------------- 14a { ISO14443A RFIDs... } 14b { ISO14443B RFIDs... } 15 { ISO15693 RFIDs... } cipurse { Cipurse transport Cards... } epa { German Identification Card... } emrtd { Machine Readable Travel Document... } felica { ISO18092 / FeliCa RFIDs... } fido { FIDO and FIDO2 authenticators... } gallagher { Gallagher DESFire RFIDs... } ksx6924 { KS X 6924 (T-Money, Snapper+) RFIDs } jooki { Jooki RFIDs... } iclass { ICLASS RFIDs... } legic { LEGIC RFIDs... } lto { LTO Cartridge Memory RFIDs... } mf { MIFARE RFIDs... } mfp { MIFARE Plus RFIDs... } mfu { MIFARE Ultralight RFIDs... } mfdes { MIFARE Desfire RFIDs... } ntag424 { NXP NTAG 4242 DNA RFIDs... } seos { SEOS RFIDs... } st25ta { ST25TA RFIDs... } thinfilm { Thinfilm RFIDs... } topaz { TOPAZ (NFC Type 1) RFIDs... } texkom { Texkom RFIDs... } waveshare { Waveshare NFC ePaper... } ----------- --------------------- General --------------------- help This help list List protocol data in trace buffer search Search for known HF tags",
"notes": [], "notes": [],
"offline": true, "offline": true,
"options": [], "options": [],
@ -6302,6 +6302,27 @@
], ],
"usage": "hf st25ta sim [-h] -u <hex>" "usage": "hf st25ta sim [-h] -u <hex>"
}, },
"hf texkom help": {
"command": "hf texkom help",
"description": "help This help",
"notes": [],
"offline": true,
"options": [],
"usage": ""
},
"hf texkom reader": {
"command": "hf texkom reader",
"description": "Read a texkom tag",
"notes": [
"hf texkom reader"
],
"offline": false,
"options": [
"-h, --help This help",
"-v, --verbose Verbose scan and output"
],
"usage": "hf texkom reader [-hv]"
},
"hf thinfilm help": { "hf thinfilm help": {
"command": "hf thinfilm help", "command": "hf thinfilm help",
"description": "help This help list List NFC Barcode / Thinfilm history - not correct", "description": "help This help list List NFC Barcode / Thinfilm history - not correct",
@ -6528,8 +6549,8 @@
"command": "hw connect", "command": "hw connect",
"description": "Connects to a Proxmark3 device via specified serial port. Baudrate here is only for physical UART or UART-BT, NOT for USB-CDC or blue shark add-on", "description": "Connects to a Proxmark3 device via specified serial port. Baudrate here is only for physical UART or UART-BT, NOT for USB-CDC or blue shark add-on",
"notes": [ "notes": [
"hw connect -p /dev/ttyACM0", "hw connect -p /dev/ttyacm0",
"hw connect -p /dev/ttyACM0 -b 115200" "hw connect -p /dev/ttyacm0 -b 115200"
], ],
"offline": true, "offline": true,
"options": [ "options": [
@ -10998,8 +11019,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 693, "commands_extracted": 695,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2022-06-12T09:54:12" "extracted_on": "2022-06-28T08:43:20"
} }
} }

View file

@ -646,6 +646,16 @@ Check column "offline" for their availability.
|`hf topaz raw `|N |`Send raw hex data to tag` |`hf topaz raw `|N |`Send raw hex data to tag`
### hf texkom
{ Texkom RFIDs... }
|command |offline |description
|------- |------- |-----------
|`hf texkom help `|Y |`This help`
|`hf texkom reader `|N |`Act like a Texkom reader`
### hf waveshare ### hf waveshare
{ Waveshare NFC ePaper... } { Waveshare NFC ePaper... }