mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 17:49:32 +08:00
make style
This commit is contained in:
parent
02f2318326
commit
eb3c48cd25
5 changed files with 23 additions and 21 deletions
|
@ -1288,24 +1288,24 @@ void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol) {
|
|||
bStop = !false;
|
||||
}
|
||||
|
||||
unsigned char response_bytes[ARRAYLEN(response_bit)/8] = {0};
|
||||
unsigned char response_bytes[ARRAYLEN(response_bit) / 8] = {0};
|
||||
k = 0;
|
||||
// Check if frame was captured and store it
|
||||
if (rxlen > 0) {
|
||||
for (i = 0; i < rxlen; i++) {
|
||||
response_bit[i] = (rx[i/8] >> (7 - (i % 8))) & 1;
|
||||
response_bit[i] = (rx[i / 8] >> (7 - (i % 8))) & 1;
|
||||
}
|
||||
if (tag.pstate == HT_INIT) {
|
||||
// Tag Response is AC encoded
|
||||
for (i = 5; i < rxlen; i += 2) {
|
||||
response_bytes[k/8] |= response_bit[i] << (7 - (k % 8));
|
||||
response_bytes[k / 8] |= response_bit[i] << (7 - (k % 8));
|
||||
k++;
|
||||
if (k >= 8*ARRAYLEN(response_bytes))
|
||||
if (k >= 8 * ARRAYLEN(response_bytes))
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (i = 4; i < rxlen; i++) { // ignore first 4 bits: SOF (actually 1 or 6 depending on response protocol)
|
||||
response_bytes[k/8] |= response_bit[i] << (7 - (k % 8));
|
||||
response_bytes[k / 8] |= response_bit[i] << (7 - (k % 8));
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
@ -1531,22 +1531,22 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page, bool ledcont
|
|||
// Check if frame was captured and store it
|
||||
if (rxlen > 0) {
|
||||
for (i = 0; i < rxlen; i++) {
|
||||
response_bit[i] = (rx[i/8] >> (7 - (i % 8))) & 1;
|
||||
response_bit[i] = (rx[i / 8] >> (7 - (i % 8))) & 1;
|
||||
}
|
||||
unsigned char response_bytes[ARRAYLEN(response_bit)/8] = {0};
|
||||
unsigned char response_bytes[ARRAYLEN(response_bit) / 8] = {0};
|
||||
if (tag.pstate == HT_INIT) {
|
||||
// Tag Response is AC encoded
|
||||
k = 0;
|
||||
for (i = 5; i < rxlen; i += 2) {
|
||||
response_bytes[k/8] |= response_bit[i] << (7 - (k % 8));
|
||||
response_bytes[k / 8] |= response_bit[i] << (7 - (k % 8));
|
||||
k++;
|
||||
if (k >= 8*ARRAYLEN(response_bytes))
|
||||
if (k >= 8 * ARRAYLEN(response_bytes))
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
k = 0;
|
||||
for (i = 4; i < rxlen; i++) { // ignore first 4 bits: SOF (actually 1 or 6 depending on response protocol)
|
||||
response_bytes[k/8] |= response_bit[i] << (7 - (k % 8));
|
||||
response_bytes[k / 8] |= response_bit[i] << (7 - (k % 8));
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -972,7 +972,7 @@ int readHitagUid(void) {
|
|||
return (CmdLFHitagReader("--26") == PM3_SUCCESS);
|
||||
}
|
||||
|
||||
uint8_t hitag1_CRC_check(uint8_t *d, uint32_t nbit){
|
||||
uint8_t hitag1_CRC_check(uint8_t *d, uint32_t nbit) {
|
||||
if (nbit < 9) return 2;
|
||||
return (CRC8Hitag1Bits(d, nbit) == 0);
|
||||
}
|
||||
|
|
|
@ -272,10 +272,10 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
|||
snprintf(line[j / 18] + ((j % 18) * 4), 120, "%02x! ", frame[j]);
|
||||
}
|
||||
|
||||
} else if (((protocol == PROTO_HITAG1) || (protocol == PROTO_HITAG2) || (protocol == PROTO_HITAGS)) && (parityBytes[0] > 0)){
|
||||
} else if (((protocol == PROTO_HITAG1) || (protocol == PROTO_HITAG2) || (protocol == PROTO_HITAGS)) && (parityBytes[0] > 0)) {
|
||||
// handle partial bytes
|
||||
uint8_t nbits = parityBytes[0];
|
||||
if (j==0) {
|
||||
if (j == 0) {
|
||||
partialbytebuff = frame[0] << nbits;
|
||||
snprintf(line[0], 120, "%02x(%i) ", frame[0] >> (8 - nbits), nbits);
|
||||
offset = 2;
|
||||
|
|
|
@ -156,7 +156,7 @@ uint32_t CRC8Hitag1Bits(uint8_t *buff, size_t bitsize) {
|
|||
uint8_t i;
|
||||
for (i = 0; i < bitsize; i++) {
|
||||
data <<= 1;
|
||||
data += (buff[i/8] >> (7 - (i % 8))) & 1;
|
||||
data += (buff[i / 8] >> (7 - (i % 8))) & 1;
|
||||
n += 1;
|
||||
if (n == 8) {
|
||||
crc_update2(&crc, data, n);
|
||||
|
@ -168,4 +168,4 @@ uint32_t CRC8Hitag1Bits(uint8_t *buff, size_t bitsize) {
|
|||
crc_update2(&crc, data, n);
|
||||
}
|
||||
return crc_finish(&crc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3859,7 +3859,7 @@
|
|||
"description": "read mifare classic block",
|
||||
"notes": [
|
||||
"hf mf rdbl --blk 0 -k ffffffffffff",
|
||||
"hf mf rdbl -b 3 -v -> get block 3, decode sector trailer"
|
||||
"hf mf rdbl --blk 3 -v -> get block 3, decode sector trailer"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
|
@ -5520,9 +5520,10 @@
|
|||
"-h, --help this help",
|
||||
"-k, --key <hex> key for authentication (ul-c 16 bytes, ev1/ntag 4 bytes)",
|
||||
"-l swap entered key's endianness",
|
||||
"-b, --block <dec> block number to read"
|
||||
"-b, --block <dec> block number to read",
|
||||
"--force force operation even if address is out of range"
|
||||
],
|
||||
"usage": "hf mfu rdbl [-hl] [-k <hex>] -b <dec>"
|
||||
"usage": "hf mfu rdbl [-hl] [-k <hex>] -b <dec> [--force]"
|
||||
},
|
||||
"hf mfu restore": {
|
||||
"command": "hf mfu restore",
|
||||
|
@ -5602,9 +5603,10 @@
|
|||
"-k, --key <hex> key for authentication (ul-c 16 bytes, ev1/ntag 4 bytes)",
|
||||
"-l swap entered key's endianness",
|
||||
"-b, --block <dec> block number to write",
|
||||
"-d, --data <hex> block data (4 or 16 hex bytes, 16 hex bytes will do a compatibility write)"
|
||||
"-d, --data <hex> block data (4 or 16 hex bytes, 16 hex bytes will do a compatibility write)",
|
||||
"--force force operation even if address is out of range"
|
||||
],
|
||||
"usage": "hf mfu wrbl [-hl] [-k <hex>] -b <dec> -d <hex>"
|
||||
"usage": "hf mfu wrbl [-hl] [-k <hex>] -b <dec> -d <hex> [--force]"
|
||||
},
|
||||
"hf plot": {
|
||||
"command": "hf plot",
|
||||
|
@ -10151,6 +10153,6 @@
|
|||
"metadata": {
|
||||
"commands_extracted": 597,
|
||||
"extracted_by": "PM3Help2JSON v1.00",
|
||||
"extracted_on": "2021-12-29T15:28:13"
|
||||
"extracted_on": "2021-12-30T11:40:54"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue