make style

This commit is contained in:
Philippe Teuwen
2019-06-07 21:40:33 +02:00
parent 5eeb356418
commit a55e597e36
37 changed files with 193 additions and 193 deletions
+2 -2
View File
@@ -776,8 +776,8 @@ readysim:
LED_C_ON();
uint16_t flags;
switch (p_card.uidlen){
case 10:
switch (p_card.uidlen) {
case 10:
flags = FLAG_10B_UID_IN_DATA;
break;
case 7:
+2 -2
View File
@@ -388,8 +388,8 @@ void RunMod() {
LED_B_ON(); // green
// assuming arg0==0, use hardcoded uid 0xdeadbeaf
uint16_t flags;
switch (p_card.uidlen){
case 10:
switch (p_card.uidlen) {
case 10:
flags = FLAG_10B_UID_IN_DATA;
break;
case 7:
+28 -28
View File
@@ -677,40 +677,40 @@ static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrA
break;
}
uint8_t uid1 = (uid[0] << 7)
| (uid[1] << 6)
| (uid[2] << 5)
| (uid[3] << 4)
| (uid[4] << 3)
| (uid[5] << 2)
| (uid[6] << 1)
| uid[7];
| (uid[1] << 6)
| (uid[2] << 5)
| (uid[3] << 4)
| (uid[4] << 3)
| (uid[5] << 2)
| (uid[6] << 1)
| uid[7];
uint8_t uid2 = (uid[8] << 7)
| (uid[9] << 6)
| (uid[10] << 5)
| (uid[11] << 4)
| (uid[12] << 3)
| (uid[13] << 2)
| (uid[14] << 1)
| uid[15];
| (uid[9] << 6)
| (uid[10] << 5)
| (uid[11] << 4)
| (uid[12] << 3)
| (uid[13] << 2)
| (uid[14] << 1)
| uid[15];
uint8_t uid3 = (uid[16] << 7)
| (uid[17] << 6)
| (uid[18] << 5)
| (uid[19] << 4)
| (uid[20] << 3)
| (uid[21] << 2)
| (uid[22] << 1)
| uid[23];
| (uid[17] << 6)
| (uid[18] << 5)
| (uid[19] << 4)
| (uid[20] << 3)
| (uid[21] << 2)
| (uid[22] << 1)
| uid[23];
uint8_t uid4 = (uid[24] << 7)
| (uid[25] << 6)
| (uid[26] << 5)
| (uid[27] << 4)
| (uid[28] << 3)
| (uid[29] << 2)
| (uid[30] << 1)
| uid[31];
| (uid[25] << 6)
| (uid[26] << 5)
| (uid[27] << 4)
| (uid[28] << 3)
| (uid[29] << 2)
| (uid[30] << 1)
| uid[31];
if (DEBUG)
Dbprintf("UID: %02X %02X %02X %02X", uid1, uid2, uid3, uid4);
+9 -9
View File
@@ -761,8 +761,8 @@ static bool GetIso14443aCommandFromReader(uint8_t *received, uint8_t *par, int *
uint16_t check = 0;
for (;;) {
if ( check == 1000 ) {
if ( BUTTON_PRESS() || data_available() )
if (check == 1000) {
if (BUTTON_PRESS() || data_available())
return false;
check = 0;
}
@@ -1095,7 +1095,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
int order = ORDER_NONE;
int retval = PM3_SUCCESS;
// Just to allow some checks
int happened = 0;
int happened2 = 0;
@@ -1191,7 +1191,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
ar_nr_nonces[index].state = SECOND;
// send to client (one struct nonces_t)
reply_ng(CMD_SIMULATE_MIFARE_CARD, PM3_SUCCESS, (uint8_t*)&ar_nr_nonces[index], sizeof(nonces_t) );
reply_ng(CMD_SIMULATE_MIFARE_CARD, PM3_SUCCESS, (uint8_t *)&ar_nr_nonces[index], sizeof(nonces_t));
ar_nr_nonces[index].state = EMPTY;
ar_nr_nonces[index].sector = 0;
@@ -1515,7 +1515,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
Dbprintf("-[ Num of received cmd [%d]", cmdsRecvd);
Dbprintf("-[ Num of moebius tries [%d]", moebius_count);
}
reply_ng(CMD_SIMULATE_MIFARE_CARD, retval, NULL, 0);
}
@@ -1716,10 +1716,10 @@ int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
for (;;) {
WDT_HIT();
if ( check == 1000 ) {
if (BUTTON_PRESS() || data_available())
return 1;
check = 0;
if (check == 1000) {
if (BUTTON_PRESS() || data_available())
return 1;
check = 0;
}
++check;
+1 -1
View File
@@ -606,7 +606,7 @@ void SimulateTagLowFrequencyEx(int period, int gap, bool ledcontrol, int numcycl
// used as a simple detection of a reader field?
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
WDT_HIT();
if ( check == 1000) {
if (check == 1000) {
if (data_available() || BUTTON_PRESS())
goto OUT;
check = 0;
+9 -9
View File
@@ -47,7 +47,7 @@ void MifareReadBlock(uint8_t blockNo, uint8_t keyType, uint8_t *datain) {
uint8_t dataoutbuf[16] = {0x00};
uint8_t uid[10] = {0x00};
uint32_t cuid = 0, status = PM3_EOPABORTED;
struct Crypto1State mpcs = {0, 0};
struct Crypto1State *pcs;
pcs = &mpcs;
@@ -1616,7 +1616,7 @@ void MifareChkKeys(uint8_t *datain) {
void MifareEMemClr(void) {
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
emlClearMem();
emlClearMem();
}
void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain) {
@@ -1624,22 +1624,22 @@ void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_
if (blockwidth == 0)
blockwidth = 16; // backwards compat... default bytewidth
emlSetMem_xt(datain, blockno, blockcnt, blockwidth); // data, block num, blocks count, block byte width
}
void MifareEMemGet(uint8_t blockno, uint8_t blockcnt) {
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
//
//
size_t size = blockcnt * 16;
if ( size > PM3_CMD_DATA_SIZE) {
if (size > PM3_CMD_DATA_SIZE) {
reply_ng(CMD_MIFARE_EML_MEMGET, PM3_EMALLOC, NULL, 0);
return;
}
uint8_t *buf = BigBuf_malloc(size);
emlGetMem(buf, blockno, blockcnt); // data, block num, blocks count (max 4)
LED_B_ON();
@@ -1985,7 +1985,7 @@ TEST2:
};
OUT:
data[0] = isGen;
reply_ng(CMD_MIFARE_CIDENT, PM3_SUCCESS, data, sizeof(data));
// turns off
+2 -2
View File
@@ -989,7 +989,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
ar_nr_resp[i + mM].nonce2 = nonce;
ar_nr_resp[i + mM].nr2 = nr;
ar_nr_resp[i + mM].ar2 = ar;
if (!gettingMoebius) {
nonce2_count++;
// check if this was the last second nonce we need for std attack
@@ -1006,7 +1006,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
} else {
moebius_n_count++;
// if we've collected all the nonces we need - finish.
if (nonce1_count == moebius_n_count)
if (nonce1_count == moebius_n_count)
finished = true;
}
}
+2 -2
View File
@@ -345,8 +345,8 @@ void BootROM(void) {
common_area.flags.bootrom_present = 1;
if ((common_area.command == COMMON_AREA_COMMAND_ENTER_FLASH_MODE) ||
(!common_area.flags.button_pressed && BUTTON_PRESS()) ||
(_osimage_entry == 0xffffffffU)) {
(!common_area.flags.button_pressed && BUTTON_PRESS()) ||
(_osimage_entry == 0xffffffffU)) {
flash_mode();
} else {
// clear button status, even if button still pressed
+2 -2
View File
@@ -448,7 +448,7 @@ int CmdGetBitStream(const char *Cmd) {
}
int CmdConvertBitStream(const char *Cmd) {
if ( isGraphBitstream() ) {
if (isGraphBitstream()) {
convertGraphFromBitstream();
} else {
// get high, low
@@ -716,7 +716,7 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) {
setDemodBuff(BitStream, size, 0);
setClockGrid(clk, startIdx + clk * offset / 2);
if (g_debugMode || verbose) {
PrintAndLogEx(NORMAL, "Biphase Decoded using offset %d | clock %d | #errors %d | start index %d\ndata\n", offset, clk, errCnt, (startIdx + clk * offset / 2) );
PrintAndLogEx(NORMAL, "Biphase Decoded using offset %d | clock %d | #errors %d | start index %d\ndata\n", offset, clk, errCnt, (startIdx + clk * offset / 2));
printDemodBuff();
}
return PM3_SUCCESS;
+2 -2
View File
@@ -490,10 +490,10 @@ static int CmdFlashMemInfo(const char *Cmd) {
//
// public key Exponent E
#define RSA_E "010001"
#define RSA_E "010001"
// public key modulus N
#define RSA_N "E28D809BF323171D11D1ACA4C32A5B7E0A8974FD171E75AD120D60E9B76968FF4B0A6364AE50583F9555B8EE1A725F279E949246DF0EFCE4C02B9F3ACDCC623F9337F21C0C066FFB703D8BFCB5067F309E056772096642C2B1A8F50305D5EC33DB7FB5A3C8AC42EB635AE3C148C910750ABAA280CE82DC2F180F49F30A1393B5"
#define RSA_N "E28D809BF323171D11D1ACA4C32A5B7E0A8974FD171E75AD120D60E9B76968FF4B0A6364AE50583F9555B8EE1A725F279E949246DF0EFCE4C02B9F3ACDCC623F9337F21C0C066FFB703D8BFCB5067F309E056772096642C2B1A8F50305D5EC33DB7FB5A3C8AC42EB635AE3C148C910750ABAA280CE82DC2F180F49F30A1393B5"
//-------------------------------------------------------------------------------
// Example RSA-1024 keypair, for test purposes (from common/polarssl/rsa.c)
+9 -9
View File
@@ -474,15 +474,15 @@ int CmdHF14ASim(const char *Cmd) {
flags |= FLAG_UID_IN_EMUL;
struct {
uint8_t tagtype;
uint8_t flags;
uint8_t uid[10];
uint8_t tagtype;
uint8_t flags;
uint8_t uid[10];
} PACKED payload;
payload.tagtype = tagtype;
payload.flags = flags;
memcpy(payload.uid, uid, uidlen);
clearCommandBuffer();
SendCommandNG(CMD_SIMULATE_TAG_ISO_14443a, (uint8_t *)&payload, sizeof(payload));
PacketResponseNG resp;
@@ -492,13 +492,13 @@ int CmdHF14ASim(const char *Cmd) {
while (!ukbhit()) {
if (WaitForResponseTimeout(CMD_SIMULATE_MIFARE_CARD, &resp, 1500) == 0) continue;
if (resp.status != PM3_SUCCESS) break;
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK) break;
nonces_t *data = (nonces_t*)resp.data.asBytes;
nonces_t *data = (nonces_t *)resp.data.asBytes;
readerAttack(data[0], setEmulatorMem, verbose);
}
if (resp.status == PM3_EOPABORTED && ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK) )
if (resp.status == PM3_EOPABORTED && ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK))
showSectorTable();
PrintAndLogEx(INFO, "Done");
+32 -32
View File
@@ -557,9 +557,9 @@ static int CmdHF14AMfRdBl(const char *Cmd) {
payload.blockno = blockNo;
payload.keytype = keyType;
memcpy(payload.key, key, sizeof(payload.key));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t*)&payload, sizeof(mf_readblock_t));
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) {
@@ -789,15 +789,15 @@ static int CmdHF14AMfDump(const char *Cmd) {
mf_readblock_t payload;
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
printf(".");
printf(".");
fflush(NULL);
payload.blockno = FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1;
payload.keytype = 0;
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t*)&payload, sizeof(mf_readblock_t));
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
if (WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) {
@@ -830,13 +830,13 @@ static int CmdHF14AMfDump(const char *Cmd) {
for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) {
if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. At least the Access Conditions can always be read with key A.
payload.blockno = FirstBlockOfSector(sectorNo) + blockNo;
payload.keytype = 0;
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t*)&payload, sizeof(mf_readblock_t));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
} else { // data block. Check if it can be read with key A or key B
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
@@ -845,9 +845,9 @@ static int CmdHF14AMfDump(const char *Cmd) {
payload.blockno = FirstBlockOfSector(sectorNo) + blockNo;
payload.keytype = 1;
memcpy(payload.key, keyB[sectorNo], sizeof(payload.key));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t*)&payload, sizeof(mf_readblock_t));
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
} else if (rights[sectorNo][data_area] == 0x07) { // no key would work
PrintAndLogEx(WARNING, "access rights do not allow reading of sector %2d block %3d", sectorNo, blockNo);
@@ -858,9 +858,9 @@ static int CmdHF14AMfDump(const char *Cmd) {
payload.blockno = FirstBlockOfSector(sectorNo) + blockNo;
payload.keytype = 0;
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t*)&payload, sizeof(mf_readblock_t));
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
}
}
@@ -901,9 +901,9 @@ static int CmdHF14AMfDump(const char *Cmd) {
}
}
}
PrintAndLogEx(SUCCESS, "time: %" PRIu64 " seconds\n", (msclock() - t1) / 1000);
PrintAndLogEx(SUCCESS, "\nSucceded in dumping all blocks");
if (strlen(dataFilename) < 1) {
@@ -1248,9 +1248,9 @@ static int CmdHF14AMfNested(const char *Cmd) {
payload.keytype = 0;
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t) );
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
@@ -1277,13 +1277,13 @@ static int CmdHF14AMfNested(const char *Cmd) {
conn.block_after_ACK = true;
for (int i = 0; i < SectorsCnt; i++) {
mfEmlGetMem(keyBlock, FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1, 1);
if (e_sector[i].foundKey[0])
num_to_bytes(e_sector[i].Key[0], 6, keyBlock);
if (e_sector[i].foundKey[1])
num_to_bytes(e_sector[i].Key[1], 6, &keyBlock[10]);
if (i == SectorsCnt - 1) {
// Disable fast mode on last packet
conn.block_after_ACK = false;
@@ -2012,9 +2012,9 @@ static int CmdHF14AMfChk(const char *Cmd) {
payload.keytype = 0;
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t) );
SendCommandNG(CMD_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
@@ -2265,15 +2265,15 @@ static int CmdHF14AMfSim(const char *Cmd) {
, flags);
struct {
uint16_t flags;
uint8_t exitAfter;
uint8_t uid[10];
uint16_t flags;
uint8_t exitAfter;
uint8_t uid[10];
} PACKED payload;
payload.flags = flags;
payload.exitAfter = exitAfterNReads;
memcpy(payload.uid, uid, uidlen);
clearCommandBuffer();
SendCommandNG(CMD_SIMULATE_MIFARE_CARD, (uint8_t *)&payload, sizeof(payload));
PacketResponseNG resp;
@@ -2540,7 +2540,7 @@ static int CmdHF14AMfESet(const char *Cmd) {
char c = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) < 3 || c == 'h')
return usage_hf14_eset();
uint8_t memBlock[16];
memset(memBlock, 0x00, sizeof(memBlock));
@@ -2914,7 +2914,7 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
return PM3_EMALLOC;
}
size_t datalen = 0;
int res = 0;
if (fillFromBin) {
@@ -3186,7 +3186,7 @@ static int CmdHf14AMfDecryptBytes(const char *Cmd) {
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
return PM3_EMALLOC;
}
param_gethex_ex(Cmd, 3, data, &len);
len >>= 1;
tryDecryptWord(nt, ar_enc, at_enc, data, len);
@@ -3215,15 +3215,15 @@ static int CmdHf14AMfSetMod(const char *Cmd) {
uint8_t data[7];
data[0] = mod;
memcpy(data+1, key, 6);
memcpy(data + 1, key, 6);
clearCommandBuffer();
SendCommandNG(CMD_MIFARE_SETMOD, data, sizeof(data));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_MIFARE_SETMOD, &resp, 1500)) {
if (resp.status == PM3_SUCCESS)
if (resp.status == PM3_SUCCESS)
PrintAndLogEx(SUCCESS, "Success");
else
PrintAndLogEx(FAILED, "Failed");
+3 -3
View File
@@ -417,7 +417,7 @@ static int CmdLCD(const char *Cmd) {
}
static int CmdLCDReset(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
(void)Cmd; // Cmd is not used so far
clearCommandBuffer();
SendCommandNG(CMD_LCD_RESET, NULL, 0);
return PM3_SUCCESS;
@@ -532,7 +532,7 @@ static int CmdConnect(const char *Cmd) {
uint32_t baudrate = USART_BAUD_RATE;
uint8_t cmdp = 0;
char port[FILE_PATH_SIZE] = {0};
while (param_getchar(Cmd, cmdp) != 0x00) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
@@ -553,7 +553,7 @@ static int CmdConnect(const char *Cmd) {
return PM3_EINVARG;
}
}
// default back to previous used serial port
if (strlen(port) == 0) {
if (strlen((char *)conn.serial_port_name) == 0) {
+12 -12
View File
@@ -201,18 +201,18 @@ int CmdLFCommandRead(const char *Cmd) {
PrintAndLogEx(SUCCESS, "Sending");
clearCommandBuffer();
SendCommandNG(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, (uint8_t*)&payload, 8 + datalen );
SendCommandNG(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, (uint8_t *)&payload, 8 + datalen);
printf("\n");
uint8_t i = 10;
while ( !WaitForResponseTimeout(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, NULL, 2000 ) && i != 0) {
while (!WaitForResponseTimeout(CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K, NULL, 2000) && i != 0) {
printf(".");
fflush(stdout);
i--;
}
printf("\n");
if ( i ) {
if (i) {
PrintAndLogEx(SUCCESS, "Downloading response signal data");
getSamples(0, true);
return PM3_SUCCESS;
@@ -391,7 +391,7 @@ int lf_read(bool silent, uint32_t samples) {
}
// resp.oldarg[0] is bits read not bytes read.
uint32_t bits = (resp.data.asDwords[0] / 8 );
uint32_t bits = (resp.data.asDwords[0] / 8);
getSamples(bits, silent);
return PM3_SUCCESS;
@@ -449,7 +449,7 @@ static void ChkBitstream() {
for (int i = 0; i < (int)(GraphTraceLen / 2); i++) {
if (GraphBuffer[i] > 1 || GraphBuffer[i] < 0) {
CmdGetBitStream("");
PrintAndLogEx(INFO, "Converted to bitstream");
PrintAndLogEx(INFO, "Converted to bitstream");
break;
}
}
@@ -461,7 +461,7 @@ int CmdLFSim(const char *Cmd) {
if (!session.pm3_present) return PM3_ENOTTY;
// sanity check
if ( GraphTraceLen < 20 ) {
if (GraphTraceLen < 20) {
PrintAndLogEx(ERR, "No data in Graphbuffer");
return PM3_ENODATA;
}
@@ -482,8 +482,8 @@ int CmdLFSim(const char *Cmd) {
uint8_t data[PM3_CMD_DATA_SIZE - 3];
} PACKED payload_up;
// flag =
// b0 0
// flag =
// b0 0
// 1 clear bigbuff
payload_up.flag = 0x1;
@@ -497,10 +497,10 @@ int CmdLFSim(const char *Cmd) {
clearCommandBuffer();
payload_up.offset = i;
for(uint16_t j = 0; j < len; j++)
payload_up.data[j] = GraphBuffer[i+j];
for (uint16_t j = 0; j < len; j++)
payload_up.data[j] = GraphBuffer[i + j];
SendCommandNG(CMD_UPLOAD_SIM_SAMPLES_125K, (uint8_t *)&payload_up, sizeof(struct pupload));
WaitForResponse(CMD_UPLOAD_SIM_SAMPLES_125K, NULL);
printf(".");
@@ -519,7 +519,7 @@ int CmdLFSim(const char *Cmd) {
uint16_t gap;
} PACKED payload;
payload.len = GraphTraceLen;
payload.gap = gap;
payload.gap = gap;
clearCommandBuffer();
SendCommandNG(CMD_SIMULATE_TAG_125K, (uint8_t *)&payload, sizeof(payload));
+5 -5
View File
@@ -332,7 +332,7 @@ static int CmdAWIDSim(const char *Cmd) {
verify_values(&fmtlen, &fc, &cn);
if ( getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS ) {
if (getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
return PM3_ESOFT;
}
@@ -387,7 +387,7 @@ static int CmdAWIDClone(const char *Cmd) {
verify_values(&fmtlen, &fc, &cn);
if ( getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS ) {
if (getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS) {
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
return PM3_ESOFT;
}
@@ -512,12 +512,12 @@ static int CmdAWIDBrute(const char *Cmd) {
// Do one up
if (up < 0xFFFF)
if ( sendTry(fmtlen, fc, up++, delay, bits, size, verbose) != PM3_SUCCESS) return PM3_ESOFT;
if (sendTry(fmtlen, fc, up++, delay, bits, size, verbose) != PM3_SUCCESS) return PM3_ESOFT;
// Do one down (if cardnumber is given)
if (cn > 1)
if (down > 1)
if ( sendTry(fmtlen, fc, --down, delay, bits, size, verbose) != PM3_SUCCESS) return PM3_ESOFT;
if (sendTry(fmtlen, fc, --down, delay, bits, size, verbose) != PM3_SUCCESS) return PM3_ESOFT;
}
return PM3_SUCCESS;
}
@@ -590,7 +590,7 @@ int getAWIDBits(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint8_t *bits) {
// add AWID 4bit parity
size_t bitLen = addParity(pre, bits + 8, 66, 4, 1);
if (bitLen != 88)
if (bitLen != 88)
return PM3_ESOFT;
PrintAndLogEx(SUCCESS, "awid raw bits:\n %s \n", sprint_bin(bits, bitLen));
+1 -1
View File
@@ -36,7 +36,7 @@ static int CmdCOTAGDemod(const char *Cmd) {
uint8_t alignPos = 0;
uint16_t err = manrawdecode(bits, &bitlen, 1, &alignPos);
if (err > 50 ) {
if (err > 50) {
PrintAndLogEx(DEBUG, "DEBUG: Error - COTAG too many errors: %d", err);
return PM3_ESOFT;
}
+15 -15
View File
@@ -195,7 +195,7 @@ static void ConstructEM410xEmulGraph(const char *uid, const uint8_t clock) {
/* clear our graph */
ClearGraph(true);
/* write 16 zero bit sledge */
/* write 16 zero bit sledge */
for (i = 0; i < 20; i++)
AppendGraph(false, clock, 0);
@@ -387,12 +387,12 @@ int AskEm410xDemod(const char *Cmd, 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() ) {
if (isGraphBitstream()) {
convertGraphFromBitstream();
}
if (ASKDemod_ext(Cmd, false, false, 1, &st) != PM3_SUCCESS)
return PM3_ESOFT;
if (ASKDemod_ext(Cmd, false, false, 1, &st) != PM3_SUCCESS)
return PM3_ESOFT;
return AskEm410xDecode(verbose, hi, lo);
}
/*
@@ -416,8 +416,8 @@ static int CmdEM410xDemod(const char *Cmd) {
uint32_t hi = 0;
uint64_t lo = 0;
if (AskEm410xDemod(Cmd, &hi, &lo, true) != PM3_SUCCESS)
return PM3_ESOFT;
if (AskEm410xDemod(Cmd, &hi, &lo, true) != PM3_SUCCESS)
return PM3_ESOFT;
g_em410xid = lo;
return PM3_SUCCESS;
@@ -1097,7 +1097,7 @@ static int setDemodBufferEM(uint32_t *word, size_t idx) {
uint8_t parity[45] = {0};
memcpy(parity, DemodBuffer, 45);
if (!EM_EndParityTest(DemodBuffer + idx + EM_PREAMBLE_LEN, 45, 5, 9, 0)) {
PrintAndLogEx(DEBUG, "DEBUG: Error - End Parity check failed");
PrintAndLogEx(DEBUG, "DEBUG: Error - End Parity check failed");
return PM3_ESOFT;
}
@@ -1140,16 +1140,16 @@ static int demodEM4x05resp(uint32_t *word) {
//////////////// 4205 / 4305 commands
static int EM4x05ReadWord_ext(uint8_t addr, uint32_t pwd, bool usePwd, uint32_t *word) {
struct {
struct {
uint32_t password;
uint8_t address;
uint8_t usepwd;
} PACKED payload;
payload.password = pwd;
payload.address = addr;
payload.usepwd = usePwd;
clearCommandBuffer();
SendCommandNG(CMD_EM4X_READ_WORD, (uint8_t *)&payload, sizeof(payload));
PacketResponseNG resp;
@@ -1250,20 +1250,20 @@ static int CmdEM4x05Write(const char *Cmd) {
PrintAndLogEx(NORMAL, "Writing address %d data %08X using password %08X", addr, data, pwd);
}
struct {
struct {
uint32_t password;
uint32_t data;
uint8_t address;
uint8_t usepwd;
} PACKED payload;
payload.password = pwd;
payload.data = data;
payload.address = addr;
payload.usepwd = usePwd;
clearCommandBuffer();
SendCommandNG(CMD_EM4X_WRITE_WORD, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_EM4X_WRITE_WORD, (uint8_t *)&payload, sizeof(payload));
PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_EM4X_WRITE_WORD, &resp, 2000)) {
PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation.");
@@ -1493,7 +1493,7 @@ static int CmdEM4x05Info(const char *Cmd) {
}
//something went wrong
if (!(word & 0x8000))
if (!(word & 0x8000))
return PM3_ESOFT;
printEM4x05ProtectionBits(word);
+1 -1
View File
@@ -336,7 +336,7 @@ static int CmdFdxSim(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_ASK_SIM_TAG, (uint8_t *)payload, sizeof(lf_asksim_t) + sizeof(bs));
free(payload);
PacketResponseNG resp;
WaitForResponse(CMD_ASK_SIM_TAG, &resp);
+2 -2
View File
@@ -124,7 +124,7 @@ static int CmdHIDDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
// HID simulation etc uses 0/1 as signal data. This must be converted in order to demod it back again
if ( isGraphBitstream() ) {
if (isGraphBitstream()) {
convertGraphFromBitstream();
}
@@ -593,7 +593,7 @@ static int CmdHIDBrute(const char *Cmd) {
// Do one up
if (up < 0xFFFF)
if ( sendTry(fmtlen, fc, up++, delay, bits, verbose) != PM3_SUCCESS) return PM3_ESOFT;
if (sendTry(fmtlen, fc, up++, delay, bits, verbose) != PM3_SUCCESS) return PM3_ESOFT;
// Do one down (if cardnumber is given)
if (cn > 1)
+1 -1
View File
@@ -175,7 +175,7 @@ static int CmdKeriClone(const char *Cmd) {
static int CmdKeriSim(const char *Cmd) {
char cmdp = tolower(param_getchar(Cmd, 0));
if (strlen(Cmd) == 0 || cmdp == 'h')
if (strlen(Cmd) == 0 || cmdp == 'h')
return usage_lf_keri_sim();
uint64_t internalid = param_get32ex(Cmd, 0, 0, 10);

Some files were not shown because too many files have changed in this diff Show More