mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
make style
This commit is contained in:
parent
143d0140db
commit
d46d23d079
18 changed files with 3972 additions and 4091 deletions
|
@ -19,11 +19,11 @@ void hf_field_off(void);
|
|||
int tearoff_hook(void);
|
||||
|
||||
#if defined RDV4 || defined ICOPYX
|
||||
// ADC Vref = 3300mV, and an (10000k+240k):240k voltage divider on the LF input can measure voltages up to 140800 mV
|
||||
#define MAX_ADC_HF_VOLTAGE 140800
|
||||
// ADC Vref = 3300mV, and an (10000k+240k):240k voltage divider on the LF input can measure voltages up to 140800 mV
|
||||
#define MAX_ADC_HF_VOLTAGE 140800
|
||||
#else
|
||||
// ADC Vref = 3300mV, and an (10M+1M):1M voltage divider on the HF input can measure voltages up to 36300 mV
|
||||
#define MAX_ADC_HF_VOLTAGE 36300
|
||||
// ADC Vref = 3300mV, and an (10M+1M):1M voltage divider on the HF input can measure voltages up to 36300 mV
|
||||
#define MAX_ADC_HF_VOLTAGE 36300
|
||||
#endif
|
||||
// ADC Vref = 3300mV, (240k-10M):240k voltage divider, 140800 mV
|
||||
#define MAX_ADC_LF_VOLTAGE 140800
|
||||
|
|
|
@ -444,8 +444,7 @@ static bool FpgaConfCurrentMode(int bitstream_version) {
|
|||
|
||||
if (bitstream_version == FPGA_BITSTREAM_LF) {
|
||||
LOW(GPIO_FPGA_SWITCH);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
HIGH(GPIO_FPGA_SWITCH);
|
||||
}
|
||||
// update downloaded_bitstream
|
||||
|
|
|
@ -115,41 +115,41 @@ static void UsbPacketReceived(uint8_t *packet) {
|
|||
#if defined ICOPYX
|
||||
if (c->arg[1] == 0xff && c->arg[2] == 0x1fd) {
|
||||
#endif
|
||||
for (int j = 0; j < 2; j++) {
|
||||
uint32_t flash_address = arg0 + (0x100 * j);
|
||||
AT91PS_EFC efc_bank = AT91C_BASE_EFC0;
|
||||
int offset = 0;
|
||||
uint32_t page_n = (flash_address - (uint32_t)_flash_start) / AT91C_IFLASH_PAGE_SIZE;
|
||||
if (page_n >= AT91C_IFLASH_NB_OF_PAGES / 2) {
|
||||
page_n -= AT91C_IFLASH_NB_OF_PAGES / 2;
|
||||
efc_bank = AT91C_BASE_EFC1;
|
||||
// We need to offset the writes or it will not fill the correct bank write buffer.
|
||||
offset = (AT91C_IFLASH_NB_OF_PAGES / 2) * AT91C_IFLASH_PAGE_SIZE / sizeof(uint32_t);
|
||||
}
|
||||
for (int i = 0 + (64 * j); i < 64 + (64 * j); i++) {
|
||||
_flash_start[offset + i] = c->d.asDwords[i];
|
||||
}
|
||||
for (int j = 0; j < 2; j++) {
|
||||
uint32_t flash_address = arg0 + (0x100 * j);
|
||||
AT91PS_EFC efc_bank = AT91C_BASE_EFC0;
|
||||
int offset = 0;
|
||||
uint32_t page_n = (flash_address - (uint32_t)_flash_start) / AT91C_IFLASH_PAGE_SIZE;
|
||||
if (page_n >= AT91C_IFLASH_NB_OF_PAGES / 2) {
|
||||
page_n -= AT91C_IFLASH_NB_OF_PAGES / 2;
|
||||
efc_bank = AT91C_BASE_EFC1;
|
||||
// We need to offset the writes or it will not fill the correct bank write buffer.
|
||||
offset = (AT91C_IFLASH_NB_OF_PAGES / 2) * AT91C_IFLASH_PAGE_SIZE / sizeof(uint32_t);
|
||||
}
|
||||
for (int i = 0 + (64 * j); i < 64 + (64 * j); i++) {
|
||||
_flash_start[offset + i] = c->d.asDwords[i];
|
||||
}
|
||||
|
||||
/* Check that the address that we are supposed to write to is within our allowed region */
|
||||
if (((flash_address + AT91C_IFLASH_PAGE_SIZE - 1) >= end_addr) || (flash_address < start_addr)) {
|
||||
/* Disallow write */
|
||||
ack = false;
|
||||
reply_old(CMD_NACK, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
/* Check that the address that we are supposed to write to is within our allowed region */
|
||||
if (((flash_address + AT91C_IFLASH_PAGE_SIZE - 1) >= end_addr) || (flash_address < start_addr)) {
|
||||
/* Disallow write */
|
||||
ack = false;
|
||||
reply_old(CMD_NACK, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
|
||||
efc_bank->EFC_FCR = MC_FLASH_COMMAND_KEY |
|
||||
MC_FLASH_COMMAND_PAGEN(page_n) |
|
||||
AT91C_MC_FCMD_START_PROG;
|
||||
}
|
||||
efc_bank->EFC_FCR = MC_FLASH_COMMAND_KEY |
|
||||
MC_FLASH_COMMAND_PAGEN(page_n) |
|
||||
AT91C_MC_FCMD_START_PROG;
|
||||
}
|
||||
|
||||
// Wait until flashing of page finishes
|
||||
uint32_t sr;
|
||||
while (!((sr = efc_bank->EFC_FSR) & AT91C_MC_FRDY));
|
||||
if (sr & (AT91C_MC_LOCKE | AT91C_MC_PROGE)) {
|
||||
ack = false;
|
||||
reply_old(CMD_NACK, sr, 0, 0, 0, 0);
|
||||
// Wait until flashing of page finishes
|
||||
uint32_t sr;
|
||||
while (!((sr = efc_bank->EFC_FSR) & AT91C_MC_FRDY));
|
||||
if (sr & (AT91C_MC_LOCKE | AT91C_MC_PROGE)) {
|
||||
ack = false;
|
||||
reply_old(CMD_NACK, sr, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined ICOPYX
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -164,7 +164,7 @@ uint8_t iclass_CRC_check(bool isResponse, uint8_t *d, uint8_t n) {
|
|||
|
||||
int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
|
||||
if ((gs_ntag_i2c_state == 1) && (cmdsize == 6) && (memcmp(cmd+1, "\x00\x00\x00", 3) == 0)) {
|
||||
if ((gs_ntag_i2c_state == 1) && (cmdsize == 6) && (memcmp(cmd + 1, "\x00\x00\x00", 3) == 0)) {
|
||||
snprintf(exp, size, "SECTOR(%d)", cmd[0]);
|
||||
gs_ntag_i2c_state = 0;
|
||||
return 1;
|
||||
|
@ -244,14 +244,13 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
|
||||
if (cmdsize == 4)
|
||||
// cmd0 == 0xC2 and cmd1 == 0xFF
|
||||
// high probability its SELECT SECTOR COMMAND:
|
||||
// high probability its SELECT SECTOR COMMAND:
|
||||
if (cmd[1] == 0xFF) {
|
||||
snprintf(exp, size, "SELECT SECTOR");
|
||||
gs_ntag_i2c_state = 1;
|
||||
} else {
|
||||
snprintf(exp, size, "RESTORE(%d)", cmd[1]);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return 0;
|
||||
break;
|
||||
case MIFARE_CMD_TRANSFER:
|
||||
|
@ -344,12 +343,12 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
snprintf(exp, size, "?");
|
||||
break;
|
||||
}
|
||||
case NTAG_I2C_FASTWRITE:
|
||||
case NTAG_I2C_FASTWRITE:
|
||||
if (cmdsize == 69)
|
||||
snprintf(exp, size, "FAST WRITE (%d - %d)", cmd[1], cmd[2]);
|
||||
else
|
||||
snprintf(exp, size, "?");
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
@ -683,7 +683,7 @@ static int CmdHF14ADesInfo(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, " Card doesn't support 'free mem' cmd");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cardtype == DESFIRE_LIGHT) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Desfire Light info"));
|
||||
|
|
|
@ -189,7 +189,7 @@ static int testBitStream(void) {
|
|||
uint8_t output [] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
BitstreamIn_t in = { input, sizeof(input) * 8, 0};
|
||||
BitstreamOut_t out = { output, 0, 0}
|
||||
;
|
||||
;
|
||||
while (bitsLeft(&in) > 0) {
|
||||
pushBit(&out, headBit(&in));
|
||||
//printf("Bits left: %d\n", bitsLeft(&in));
|
||||
|
|
|
@ -1590,7 +1590,7 @@ bool DesfireCheckAuthCmd(DesfireISOSelectWay way, uint32_t appID, uint8_t keyNum
|
|||
uint8_t datalen = (authcmd == MFDES_AUTHENTICATE_EV2F) ? 3 : 1;
|
||||
res = DesfireExchangeEx(false, &dctx, authcmd, data, datalen, &respcode, recv_data, &recv_len, false, 0);
|
||||
DropField();
|
||||
|
||||
|
||||
if (checklrp)
|
||||
return (res == PM3_SUCCESS && respcode == 0xaf && recv_len == 17 && recv_data[0] == 0x01);
|
||||
else
|
||||
|
|
|
@ -638,7 +638,7 @@ static int ndefDecodePayload(NDEFHeader_t *ndef) {
|
|||
break;
|
||||
}
|
||||
|
||||
char *begin = calloc(ndef->TypeLen + 1,sizeof(char));
|
||||
char *begin = calloc(ndef->TypeLen + 1, sizeof(char));
|
||||
memcpy(begin, ndef->Type, ndef->TypeLen);
|
||||
str_lower(begin);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -378,9 +378,9 @@ char *sprint_bytebits_bin(const uint8_t *data, const size_t len) {
|
|||
}
|
||||
|
||||
char *sprint_bin(const uint8_t *data, const size_t len) {
|
||||
size_t binlen = (len*8 > MAX_BIN_BREAK_LENGTH) ? MAX_BIN_BREAK_LENGTH : len*8;
|
||||
size_t binlen = (len * 8 > MAX_BIN_BREAK_LENGTH) ? MAX_BIN_BREAK_LENGTH : len * 8;
|
||||
static uint8_t buf[MAX_BIN_BREAK_LENGTH];
|
||||
bytes_to_bytebits(data, binlen/8, buf);
|
||||
bytes_to_bytebits(data, binlen / 8, buf);
|
||||
return sprint_bytebits_bin_break(buf, binlen, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
#define FPGA_BITSTREAM_FIXED_HEADER_SIZE sizeof(bitparse_fixed_header)
|
||||
#define FPGA_INTERLEAVE_SIZE 288
|
||||
#if defined XC3
|
||||
#define FPGA_CONFIG_SIZE 72864L // our current fpga_[lh]f.bit files are 72742 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE
|
||||
#define FPGA_CONFIG_SIZE 72864L // our current fpga_[lh]f.bit files are 72742 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE
|
||||
#else
|
||||
#define FPGA_CONFIG_SIZE 42336L // our current fpga_[lh]f.bit files are 42175 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE
|
||||
#define FPGA_CONFIG_SIZE 42336L // our current fpga_[lh]f.bit files are 42175 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE
|
||||
#endif
|
||||
#define FPGA_RING_BUFFER_BYTES (1024 * 39)
|
||||
#define FPGA_TRACE_SIZE 3072
|
||||
|
|
|
@ -973,7 +973,7 @@
|
|||
},
|
||||
"help": {
|
||||
"command": "help",
|
||||
"description": "help use `<command> help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log e:\\proxspace\\pm3/.proxmark3/logs/log_20210821.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save",
|
||||
"description": "help use `<command> help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log e:\\proxspace\\pm3/.proxmark3/logs/log_20210825.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save",
|
||||
"notes": [
|
||||
"auto"
|
||||
],
|
||||
|
@ -3726,9 +3726,10 @@
|
|||
"--tb target b key",
|
||||
"--emu fill simulator keys from found keys",
|
||||
"--dump dump found keys to file",
|
||||
"--single single sector (defaults to all)"
|
||||
"--single single sector (defaults to all)",
|
||||
"--mem use dictionary from flashmemory"
|
||||
],
|
||||
"usage": "hf mf nested [-hab] [-k <hex>] [--mini] [--1k] [--2k] [--4k] [--blk <dec>] [--tblk <dec>] [--ta] [--tb] [--emu] [--dump] [--single]"
|
||||
"usage": "hf mf nested [-hab] [-k <hex>] [--mini] [--1k] [--2k] [--4k] [--blk <dec>] [--tblk <dec>] [--ta] [--tb] [--emu] [--dump] [--single] [--mem]"
|
||||
},
|
||||
"hf mf personalize": {
|
||||
"command": "hf mf personalize",
|
||||
|
@ -4438,7 +4439,8 @@
|
|||
"hf mfdes detect -> detect key 0 from picc level",
|
||||
"hf mfdes detect -s d40 -> detect key 0 from picc level via secure channel d40",
|
||||
"hf mfdes detect --dict mfdes_default_keys -> detect key 0 from picc level with help of the standard dictionary",
|
||||
"hf mfdes detect --aid 123456 -n 2 --save -> detect key 2 from app 123456 and if succeed - save params to defaults (`default` command)"
|
||||
"hf mfdes detect --aid 123456 -n 2 --save -> detect key 2 from app 123456 and if succeed - save params to defaults (`default` command)",
|
||||
"hf mfdes detect --appisoid df01 --save -> detect key 0 and save to defaults with card in the lrp mode"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
|
@ -4454,10 +4456,11 @@
|
|||
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
|
||||
"-s, --schann <d40/ev1/ev2/lrp> secure channel: d40/ev1/ev2/lrp",
|
||||
"--aid <app id hex> application id (3 hex bytes, big endian)",
|
||||
"--appisoid <isoid hex> application iso id (iso df id) (2 hex bytes, big endian).",
|
||||
"--dict <file> file with keys dictionary",
|
||||
"--save save found key and parameters to defaults"
|
||||
],
|
||||
"usage": "hf mfdes detect [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2/lrp>] [--aid <app id hex>] [--dict <file>] [--save]"
|
||||
"usage": "hf mfdes detect [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2/lrp>] [--aid <app id hex>] [--appisoid <isoid hex>] [--dict <file>] [--save]"
|
||||
},
|
||||
"hf mfdes dump": {
|
||||
"command": "hf mfdes dump",
|
||||
|
@ -5468,8 +5471,8 @@
|
|||
"command": "hf mfu sim",
|
||||
"description": "simulate mifare ultralight family type based upon iso/iec 14443 type a tag with 4,7 or 10 byte uid from emulator memory. see `hf mfu eload` first. see `hf 14a sim -h` to see available types. you want 2 or 7 usually.",
|
||||
"notes": [
|
||||
"hf mfu sim -t 2 --uid 1122344556677 -> mifare ultralight",
|
||||
"hf mfu sim -t 7 --uid 1122344556677 -n 5 -> amiibo (ntag 215), pack 0x8080"
|
||||
"hf mfu sim -t 2 --uid 11223344556677 -> mifare ultralight",
|
||||
"hf mfu sim -t 7 --uid 11223344556677 -n 5 -> amiibo (ntag 215), pack 0x8080"
|
||||
],
|
||||
"offline": false,
|
||||
"options": [
|
||||
|
@ -7239,7 +7242,7 @@
|
|||
},
|
||||
"lf hitag info": {
|
||||
"command": "lf hitag info",
|
||||
"description": "sniff traffic between hitag reader and tag.",
|
||||
"description": "hitag2 tag information",
|
||||
"notes": [
|
||||
"lf hitag info"
|
||||
],
|
||||
|
@ -9997,6 +10000,6 @@
|
|||
"metadata": {
|
||||
"commands_extracted": 589,
|
||||
"extracted_by": "PM3Help2JSON v1.00",
|
||||
"extracted_on": "2021-08-21T16:13:04"
|
||||
"extracted_on": "2021-08-25T11:37:52"
|
||||
}
|
||||
}
|
|
@ -838,7 +838,7 @@ Check column "offline" for their availability.
|
|||
|`lf hitag help `|Y |`This help`
|
||||
|`lf hitag eload `|N |`Load Hitag dump file into emulator memory`
|
||||
|`lf hitag list `|Y |`List Hitag trace history`
|
||||
|`lf hitag info `|N |`Tag information`
|
||||
|`lf hitag info `|N |`Hitag2 tag information`
|
||||
|`lf hitag reader `|N |`Act like a Hitag reader`
|
||||
|`lf hitag sim `|N |`Simulate Hitag transponder`
|
||||
|`lf hitag sniff `|N |`Eavesdrop Hitag communication`
|
||||
|
|
|
@ -46,4 +46,4 @@
|
|||
//options for ISO18092 / Felica
|
||||
`define FPGA_HF_ISO18092_FLAG_NOMOD 1 // 0001 disable modulation module
|
||||
`define FPGA_HF_ISO18092_FLAG_424K 2 // 0010 should enable 414k mode (untested). No autodetect
|
||||
`define FPGA_HF_ISO18092_FLAG_READER 4 // 0100 enables antenna power, to act as a reader instead of tag
|
||||
`define FPGA_HF_ISO18092_FLAG_READER 4 // 0100 enables antenna power, to act as a reader instead of tag
|
||||
|
|
|
@ -44,9 +44,9 @@
|
|||
#define GPIO_USB_PU AT91C_PIO_PA24
|
||||
#define GPIO_RELAY AT91C_PIO_PA25
|
||||
#if defined XC3
|
||||
#define GPIO_FPGA_SWITCH AT91C_PIO_PA26
|
||||
#define GPIO_FPGA_SWITCH AT91C_PIO_PA26
|
||||
#else
|
||||
#define GPIO_FPGA_ON AT91C_PIO_PA26
|
||||
#define GPIO_FPGA_ON AT91C_PIO_PA26
|
||||
#endif
|
||||
#define GPIO_FPGA_DONE AT91C_PIO_PA27
|
||||
#define GPIO_FPGA_NPROGRAM AT91C_PIO_PA28
|
||||
|
|
|
@ -193,7 +193,7 @@ ISO 7816-4 Basic interindustry commands. For command APDU's.
|
|||
#define MIFARE_ULNANO_LOCKSIG 0xAC
|
||||
|
||||
// NTAG i2k 2K uses sector 0, and sector 1 to have access to
|
||||
// block 0x00-0xFF.
|
||||
// block 0x00-0xFF.
|
||||
#define NTAG_I2C_SELECT_SECTOR 0xC2
|
||||
#define NTAG_I2C_FASTWRITE 0xA6
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
|
||||
#define ADC_CHAN_LF 4
|
||||
#if defined RDV4 || defined ICOPYX
|
||||
#define ADC_CHAN_HF 7
|
||||
#define ADC_CHAN_HF 7
|
||||
#else
|
||||
#define ADC_CHAN_HF 5
|
||||
#define ADC_CHAN_HF 5
|
||||
#endif
|
||||
#define ADC_MODE_PRESCALE(x) ((x) << 8)
|
||||
#define ADC_MODE_STARTUP_TIME(x) ((x) << 16)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue