mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
make style
This commit is contained in:
parent
5eeb356418
commit
a55e597e36
37 changed files with 193 additions and 193 deletions
|
|
@ -776,7 +776,7 @@ readysim:
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
|
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
switch (p_card.uidlen){
|
switch (p_card.uidlen) {
|
||||||
case 10:
|
case 10:
|
||||||
flags = FLAG_10B_UID_IN_DATA;
|
flags = FLAG_10B_UID_IN_DATA;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ void RunMod() {
|
||||||
LED_B_ON(); // green
|
LED_B_ON(); // green
|
||||||
// assuming arg0==0, use hardcoded uid 0xdeadbeaf
|
// assuming arg0==0, use hardcoded uid 0xdeadbeaf
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
switch (p_card.uidlen){
|
switch (p_card.uidlen) {
|
||||||
case 10:
|
case 10:
|
||||||
flags = FLAG_10B_UID_IN_DATA;
|
flags = FLAG_10B_UID_IN_DATA;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -761,8 +761,8 @@ static bool GetIso14443aCommandFromReader(uint8_t *received, uint8_t *par, int *
|
||||||
uint16_t check = 0;
|
uint16_t check = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ( check == 1000 ) {
|
if (check == 1000) {
|
||||||
if ( BUTTON_PRESS() || data_available() )
|
if (BUTTON_PRESS() || data_available())
|
||||||
return false;
|
return false;
|
||||||
check = 0;
|
check = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1191,7 +1191,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data) {
|
||||||
ar_nr_nonces[index].state = SECOND;
|
ar_nr_nonces[index].state = SECOND;
|
||||||
|
|
||||||
// send to client (one struct nonces_t)
|
// 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].state = EMPTY;
|
||||||
ar_nr_nonces[index].sector = 0;
|
ar_nr_nonces[index].sector = 0;
|
||||||
|
|
@ -1716,7 +1716,7 @@ int EmGetCmd(uint8_t *received, uint16_t *len, uint8_t *par) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
|
|
||||||
if ( check == 1000 ) {
|
if (check == 1000) {
|
||||||
if (BUTTON_PRESS() || data_available())
|
if (BUTTON_PRESS() || data_available())
|
||||||
return 1;
|
return 1;
|
||||||
check = 0;
|
check = 0;
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,7 @@ void SimulateTagLowFrequencyEx(int period, int gap, bool ledcontrol, int numcycl
|
||||||
// used as a simple detection of a reader field?
|
// used as a simple detection of a reader field?
|
||||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
|
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)) {
|
||||||
WDT_HIT();
|
WDT_HIT();
|
||||||
if ( check == 1000) {
|
if (check == 1000) {
|
||||||
if (data_available() || BUTTON_PRESS())
|
if (data_available() || BUTTON_PRESS())
|
||||||
goto OUT;
|
goto OUT;
|
||||||
check = 0;
|
check = 0;
|
||||||
|
|
|
||||||
|
|
@ -1633,7 +1633,7 @@ void MifareEMemGet(uint8_t blockno, uint8_t blockcnt) {
|
||||||
|
|
||||||
//
|
//
|
||||||
size_t size = blockcnt * 16;
|
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);
|
reply_ng(CMD_MIFARE_EML_MEMGET, PM3_EMALLOC, NULL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ int CmdGetBitStream(const char *Cmd) {
|
||||||
}
|
}
|
||||||
int CmdConvertBitStream(const char *Cmd) {
|
int CmdConvertBitStream(const char *Cmd) {
|
||||||
|
|
||||||
if ( isGraphBitstream() ) {
|
if (isGraphBitstream()) {
|
||||||
convertGraphFromBitstream();
|
convertGraphFromBitstream();
|
||||||
} else {
|
} else {
|
||||||
// get high, low
|
// get high, low
|
||||||
|
|
@ -716,7 +716,7 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose) {
|
||||||
setDemodBuff(BitStream, size, 0);
|
setDemodBuff(BitStream, size, 0);
|
||||||
setClockGrid(clk, startIdx + clk * offset / 2);
|
setClockGrid(clk, startIdx + clk * offset / 2);
|
||||||
if (g_debugMode || verbose) {
|
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();
|
printDemodBuff();
|
||||||
}
|
}
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -495,10 +495,10 @@ int CmdHF14ASim(const char *Cmd) {
|
||||||
|
|
||||||
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK) 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);
|
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();
|
showSectorTable();
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Done");
|
PrintAndLogEx(INFO, "Done");
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ static int CmdHF14AMfRdBl(const char *Cmd) {
|
||||||
memcpy(payload.key, key, sizeof(payload.key));
|
memcpy(payload.key, key, sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
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;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) {
|
if (WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) {
|
||||||
|
|
@ -797,7 +797,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
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)) {
|
if (WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) {
|
||||||
|
|
||||||
|
|
@ -836,7 +836,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
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);
|
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
|
||||||
} else { // data block. Check if it can be read with key A or key B
|
} else { // data block. Check if it can be read with key A or key B
|
||||||
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
|
uint8_t data_area = (sectorNo < 32) ? blockNo : blockNo / 5;
|
||||||
|
|
@ -847,7 +847,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
memcpy(payload.key, keyB[sectorNo], sizeof(payload.key));
|
memcpy(payload.key, keyB[sectorNo], sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
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);
|
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
|
||||||
} else if (rights[sectorNo][data_area] == 0x07) { // no key would work
|
} 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);
|
PrintAndLogEx(WARNING, "access rights do not allow reading of sector %2d block %3d", sectorNo, blockNo);
|
||||||
|
|
@ -860,7 +860,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||||
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
memcpy(payload.key, keyA[sectorNo], sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
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);
|
received = WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1250,7 +1250,7 @@ static int CmdHF14AMfNested(const char *Cmd) {
|
||||||
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
|
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
|
||||||
|
|
||||||
clearCommandBuffer();
|
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;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
|
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
|
||||||
|
|
@ -2014,7 +2014,7 @@ static int CmdHF14AMfChk(const char *Cmd) {
|
||||||
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
|
num_to_bytes(e_sector[i].Key[0], 6, payload.key); // KEY A
|
||||||
|
|
||||||
clearCommandBuffer();
|
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;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
|
if (!WaitForResponseTimeout(CMD_MIFARE_READBL, &resp, 1500)) continue;
|
||||||
|
|
@ -3215,7 +3215,7 @@ static int CmdHf14AMfSetMod(const char *Cmd) {
|
||||||
|
|
||||||
uint8_t data[7];
|
uint8_t data[7];
|
||||||
data[0] = mod;
|
data[0] = mod;
|
||||||
memcpy(data+1, key, 6);
|
memcpy(data + 1, key, 6);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_MIFARE_SETMOD, data, sizeof(data));
|
SendCommandNG(CMD_MIFARE_SETMOD, data, sizeof(data));
|
||||||
|
|
|
||||||
|
|
@ -201,18 +201,18 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Sending");
|
PrintAndLogEx(SUCCESS, "Sending");
|
||||||
clearCommandBuffer();
|
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");
|
printf("\n");
|
||||||
uint8_t i = 10;
|
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(".");
|
printf(".");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if ( i ) {
|
if (i) {
|
||||||
PrintAndLogEx(SUCCESS, "Downloading response signal data");
|
PrintAndLogEx(SUCCESS, "Downloading response signal data");
|
||||||
getSamples(0, true);
|
getSamples(0, true);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
@ -391,7 +391,7 @@ int lf_read(bool silent, uint32_t samples) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// resp.oldarg[0] is bits read not bytes read.
|
// 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);
|
getSamples(bits, silent);
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
@ -461,7 +461,7 @@ int CmdLFSim(const char *Cmd) {
|
||||||
if (!session.pm3_present) return PM3_ENOTTY;
|
if (!session.pm3_present) return PM3_ENOTTY;
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if ( GraphTraceLen < 20 ) {
|
if (GraphTraceLen < 20) {
|
||||||
PrintAndLogEx(ERR, "No data in Graphbuffer");
|
PrintAndLogEx(ERR, "No data in Graphbuffer");
|
||||||
return PM3_ENODATA;
|
return PM3_ENODATA;
|
||||||
}
|
}
|
||||||
|
|
@ -497,8 +497,8 @@ int CmdLFSim(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
payload_up.offset = i;
|
payload_up.offset = i;
|
||||||
|
|
||||||
for(uint16_t j = 0; j < len; j++)
|
for (uint16_t j = 0; j < len; j++)
|
||||||
payload_up.data[j] = GraphBuffer[i+j];
|
payload_up.data[j] = GraphBuffer[i + j];
|
||||||
|
|
||||||
|
|
||||||
SendCommandNG(CMD_UPLOAD_SIM_SAMPLES_125K, (uint8_t *)&payload_up, sizeof(struct pupload));
|
SendCommandNG(CMD_UPLOAD_SIM_SAMPLES_125K, (uint8_t *)&payload_up, sizeof(struct pupload));
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ static int CmdAWIDSim(const char *Cmd) {
|
||||||
|
|
||||||
verify_values(&fmtlen, &fc, &cn);
|
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.");
|
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
@ -387,7 +387,7 @@ static int CmdAWIDClone(const char *Cmd) {
|
||||||
|
|
||||||
verify_values(&fmtlen, &fc, &cn);
|
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.");
|
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
@ -512,12 +512,12 @@ static int CmdAWIDBrute(const char *Cmd) {
|
||||||
|
|
||||||
// Do one up
|
// Do one up
|
||||||
if (up < 0xFFFF)
|
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)
|
// Do one down (if cardnumber is given)
|
||||||
if (cn > 1)
|
if (cn > 1)
|
||||||
if (down > 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;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ static int CmdCOTAGDemod(const char *Cmd) {
|
||||||
|
|
||||||
uint8_t alignPos = 0;
|
uint8_t alignPos = 0;
|
||||||
uint16_t err = manrawdecode(bits, &bitlen, 1, &alignPos);
|
uint16_t err = manrawdecode(bits, &bitlen, 1, &alignPos);
|
||||||
if (err > 50 ) {
|
if (err > 50) {
|
||||||
PrintAndLogEx(DEBUG, "DEBUG: Error - COTAG too many errors: %d", err);
|
PrintAndLogEx(DEBUG, "DEBUG: Error - COTAG too many errors: %d", err);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ int AskEm410xDemod(const char *Cmd, uint32_t *hi, uint64_t *lo, bool verbose) {
|
||||||
bool st = true;
|
bool st = true;
|
||||||
|
|
||||||
// em410x simulation etc uses 0/1 as signal data. This must be converted in order to demod it back again
|
// 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();
|
convertGraphFromBitstream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1263,7 +1263,7 @@ static int CmdEM4x05Write(const char *Cmd) {
|
||||||
payload.usepwd = usePwd;
|
payload.usepwd = usePwd;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_EM4X_WRITE_WORD, (uint8_t*)&payload, sizeof(payload));
|
SendCommandNG(CMD_EM4X_WRITE_WORD, (uint8_t *)&payload, sizeof(payload));
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (!WaitForResponseTimeout(CMD_EM4X_WRITE_WORD, &resp, 2000)) {
|
if (!WaitForResponseTimeout(CMD_EM4X_WRITE_WORD, &resp, 2000)) {
|
||||||
PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation.");
|
PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation.");
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ static int CmdHIDDemod(const char *Cmd) {
|
||||||
(void)Cmd; // Cmd is not used so far
|
(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
|
// 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();
|
convertGraphFromBitstream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -593,7 +593,7 @@ static int CmdHIDBrute(const char *Cmd) {
|
||||||
|
|
||||||
// Do one up
|
// Do one up
|
||||||
if (up < 0xFFFF)
|
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)
|
// Do one down (if cardnumber is given)
|
||||||
if (cn > 1)
|
if (cn > 1)
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,8 @@ int getPyramidBits(uint32_t fc, uint32_t cn, uint8_t *pyramidBits) {
|
||||||
// Get 26 wiegand from FacilityCode, CardNumber
|
// Get 26 wiegand from FacilityCode, CardNumber
|
||||||
uint8_t wiegand[24];
|
uint8_t wiegand[24];
|
||||||
memset(wiegand, 0x00, sizeof(wiegand));
|
memset(wiegand, 0x00, sizeof(wiegand));
|
||||||
num_to_bytebits(fc, 8, wiegand); num_to_bytebits(cn, 16, wiegand + 8);
|
num_to_bytebits(fc, 8, wiegand);
|
||||||
|
num_to_bytebits(cn, 16, wiegand + 8);
|
||||||
|
|
||||||
// add wiegand parity bits (dest, source, len)
|
// add wiegand parity bits (dest, source, len)
|
||||||
wiegand_add_parity(pre + 80, wiegand, 24);
|
wiegand_add_parity(pre + 80, wiegand, 24);
|
||||||
|
|
|
||||||
|
|
@ -564,7 +564,7 @@ bool tryDetectModulation(void) {
|
||||||
ans = fskClocks(&fc1, &fc2, (uint8_t *)&clk, &firstClockEdge);
|
ans = fskClocks(&fc1, &fc2, (uint8_t *)&clk, &firstClockEdge);
|
||||||
|
|
||||||
if (ans && ((fc1 == 10 && fc2 == 8) || (fc1 == 8 && fc2 == 5))) {
|
if (ans && ((fc1 == 10 && fc2 == 8) || (fc1 == 8 && fc2 == 5))) {
|
||||||
if ( (FSKrawDemod("0 0", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
if ((FSKrawDemod("0 0", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
||||||
tests[hits].modulation = DEMOD_FSK;
|
tests[hits].modulation = DEMOD_FSK;
|
||||||
if (fc1 == 8 && fc2 == 5)
|
if (fc1 == 8 && fc2 == 5)
|
||||||
tests[hits].modulation = DEMOD_FSK1a;
|
tests[hits].modulation = DEMOD_FSK1a;
|
||||||
|
|
@ -576,7 +576,7 @@ bool tryDetectModulation(void) {
|
||||||
tests[hits].ST = false;
|
tests[hits].ST = false;
|
||||||
++hits;
|
++hits;
|
||||||
}
|
}
|
||||||
if ( (FSKrawDemod("0 1", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
if ((FSKrawDemod("0 1", false) == PM3_SUCCESS) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
||||||
tests[hits].modulation = DEMOD_FSK;
|
tests[hits].modulation = DEMOD_FSK;
|
||||||
if (fc1 == 8 && fc2 == 5)
|
if (fc1 == 8 && fc2 == 5)
|
||||||
tests[hits].modulation = DEMOD_FSK1;
|
tests[hits].modulation = DEMOD_FSK1;
|
||||||
|
|
@ -661,7 +661,7 @@ bool tryDetectModulation(void) {
|
||||||
save_restoreGB(GRAPH_SAVE);
|
save_restoreGB(GRAPH_SAVE);
|
||||||
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)
|
// skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)
|
||||||
CmdLtrim("160");
|
CmdLtrim("160");
|
||||||
if ( (PSKDemod("0 0 6", false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
if ((PSKDemod("0 0 6", false) == PM3_SUCCESS) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {
|
||||||
tests[hits].modulation = DEMOD_PSK1;
|
tests[hits].modulation = DEMOD_PSK1;
|
||||||
tests[hits].bitrate = bitRate;
|
tests[hits].bitrate = bitRate;
|
||||||
tests[hits].inverted = false;
|
tests[hits].inverted = false;
|
||||||
|
|
@ -1538,7 +1538,7 @@ bool AquireData(uint8_t page, uint8_t block, bool pwdmode, uint32_t password) {
|
||||||
payload.pwdmode = pwdmode;
|
payload.pwdmode = pwdmode;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_T55XX_READ_BLOCK, (uint8_t*)&payload, sizeof(payload));
|
SendCommandNG(CMD_T55XX_READ_BLOCK, (uint8_t *)&payload, sizeof(payload));
|
||||||
if (!WaitForResponseTimeout(CMD_T55XX_READ_BLOCK, NULL, 2500)) {
|
if (!WaitForResponseTimeout(CMD_T55XX_READ_BLOCK, NULL, 2500)) {
|
||||||
PrintAndLogEx(WARNING, "command execution time out");
|
PrintAndLogEx(WARNING, "command execution time out");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
||||||
PrintAndLogEx(WARNING, _RED_("WARNING: process only if strictly needed!"));
|
PrintAndLogEx(WARNING, _RED_("WARNING: process only if strictly needed!"));
|
||||||
PrintAndLogEx(WARNING, "This requires BT turned ON and NOT connected!");
|
PrintAndLogEx(WARNING, "This requires BT turned ON and NOT connected!");
|
||||||
PrintAndLogEx(WARNING, "Is the add-on blue light blinking? (Say 'n' if you want to abort) [y/n]");
|
PrintAndLogEx(WARNING, "Is the add-on blue light blinking? (Say 'n' if you want to abort) [y/n]");
|
||||||
while(!ukbhit()) {
|
while (!ukbhit()) {
|
||||||
msleep(200);
|
msleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
|
||||||
|
|
||||||
if ((baudrate != USART_BAUD_RATE) || (parity != USART_PARITY)) {
|
if ((baudrate != USART_BAUD_RATE) || (parity != USART_PARITY)) {
|
||||||
PrintAndLogEx(WARNING, "Add-on uart settings changed, please turn BT add-on OFF and ON again, then press any key.");
|
PrintAndLogEx(WARNING, "Add-on uart settings changed, please turn BT add-on OFF and ON again, then press any key.");
|
||||||
while(!ukbhit()) {
|
while (!ukbhit()) {
|
||||||
msleep(200);
|
msleep(200);
|
||||||
}
|
}
|
||||||
int gc = getchar();
|
int gc = getchar();
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ void convertGraphFromBitstreamEx(int hi, int low) {
|
||||||
for (int i = 0; i < GraphTraceLen; i++) {
|
for (int i = 0; i < GraphTraceLen; i++) {
|
||||||
if (GraphBuffer[i] == hi)
|
if (GraphBuffer[i] == hi)
|
||||||
GraphBuffer[i] = 127;
|
GraphBuffer[i] = 127;
|
||||||
else if ( GraphBuffer[i] == low )
|
else if (GraphBuffer[i] == low)
|
||||||
GraphBuffer[i] = -127;
|
GraphBuffer[i] = -127;
|
||||||
else
|
else
|
||||||
GraphBuffer[i] = 0;
|
GraphBuffer[i] = 0;
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) {
|
||||||
payload.blockcnt = blocksCount;
|
payload.blockcnt = blocksCount;
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_MIFARE_EML_MEMGET, (uint8_t*)&payload, sizeof(payload));
|
SendCommandNG(CMD_MIFARE_EML_MEMGET, (uint8_t *)&payload, sizeof(payload));
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_MIFARE_EML_MEMGET, &resp, 1500) == 0) {
|
if (WaitForResponseTimeout(CMD_MIFARE_EML_MEMGET, &resp, 1500) == 0) {
|
||||||
|
|
@ -499,7 +499,7 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt
|
||||||
memcpy(payload->data, data, size);
|
memcpy(payload->data, data, size);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_MIFARE_EML_MEMSET, (uint8_t*)payload, sizeof(payload) + size );
|
SendCommandNG(CMD_MIFARE_EML_MEMSET, (uint8_t *)payload, sizeof(payload) + size);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -963,7 +963,7 @@ int detect_classic_nackbug(bool verbose) {
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_MIFARE_NACK_DETECT, &resp, 500)) {
|
if (WaitForResponseTimeout(CMD_MIFARE_NACK_DETECT, &resp, 500)) {
|
||||||
|
|
||||||
if ( resp.status == PM3_EOPABORTED ) {
|
if (resp.status == PM3_EOPABORTED) {
|
||||||
PrintAndLogEx(WARNING, "button pressed. Aborted.");
|
PrintAndLogEx(WARNING, "button pressed. Aborted.");
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
}
|
}
|
||||||
|
|
@ -1018,7 +1018,7 @@ void detect_classic_magic(void) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_MIFARE_CIDENT, NULL, 0);
|
SendCommandNG(CMD_MIFARE_CIDENT, NULL, 0);
|
||||||
if (WaitForResponseTimeout(CMD_MIFARE_CIDENT, &resp, 1500)) {
|
if (WaitForResponseTimeout(CMD_MIFARE_CIDENT, &resp, 1500)) {
|
||||||
if ( resp.status == PM3_SUCCESS )
|
if (resp.status == PM3_SUCCESS)
|
||||||
isGeneration = resp.data.asBytes[0];
|
isGeneration = resp.data.asBytes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,12 +160,11 @@ main_loop(char *script_cmds_file, char *script_cmd) {
|
||||||
} else {
|
} else {
|
||||||
rl_event_hook = check_comm;
|
rl_event_hook = check_comm;
|
||||||
if (session.pm3_present) {
|
if (session.pm3_present) {
|
||||||
if ( conn.send_via_fpc_usart == false )
|
if (conn.send_via_fpc_usart == false)
|
||||||
cmd = readline(PROXPROMPT_USB);
|
cmd = readline(PROXPROMPT_USB);
|
||||||
else
|
else
|
||||||
cmd = readline(PROXPROMPT_FPC);
|
cmd = readline(PROXPROMPT_FPC);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
cmd = readline(PROXPROMPT_OFFLINE);
|
cmd = readline(PROXPROMPT_OFFLINE);
|
||||||
|
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
|
|
|
||||||
|
|
@ -1527,10 +1527,10 @@ static uint16_t cleanAskRawDemod(uint8_t *bits, size_t *size, int clk, int inver
|
||||||
|
|
||||||
*size = bitCnt;
|
*size = bitCnt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (*startIdx < 0)
|
if (*startIdx < 0)
|
||||||
*startIdx = 0;
|
*startIdx = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod Startidx %d", *startIdx);
|
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod Startidx %d", *startIdx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ void usart_init(uint32_t baudrate, uint8_t parity) {
|
||||||
AT91C_US_NBSTOP_1_BIT | // 1 stop bit
|
AT91C_US_NBSTOP_1_BIT | // 1 stop bit
|
||||||
AT91C_US_CHMODE_NORMAL; // channel mode: normal
|
AT91C_US_CHMODE_NORMAL; // channel mode: normal
|
||||||
|
|
||||||
switch(usart_parity) {
|
switch (usart_parity) {
|
||||||
case 'N':
|
case 'N':
|
||||||
mode |= AT91C_US_PAR_NONE; // parity: none
|
mode |= AT91C_US_PAR_NONE; // parity: none
|
||||||
break;
|
break;
|
||||||
|
|
@ -231,7 +231,7 @@ void usart_init(uint32_t baudrate, uint8_t parity) {
|
||||||
//
|
//
|
||||||
uint32_t brgr = 48000000 / (usart_baudrate << 3);
|
uint32_t brgr = 48000000 / (usart_baudrate << 3);
|
||||||
// doing fp = round((mck / (usart_baudrate << 3) - brgr) * 8) with integers:
|
// doing fp = round((mck / (usart_baudrate << 3) - brgr) * 8) with integers:
|
||||||
uint32_t fp = ((16 * 48000000 / (usart_baudrate << 3) - 16 * brgr)+1)/2;
|
uint32_t fp = ((16 * 48000000 / (usart_baudrate << 3) - 16 * brgr) + 1) / 2;
|
||||||
|
|
||||||
pUS1->US_BRGR = (fp << 16) | brgr;
|
pUS1->US_BRGR = (fp << 16) | brgr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) {
|
||||||
|
|
||||||
struct addrinfo info;
|
struct addrinfo info;
|
||||||
|
|
||||||
memset (&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
|
||||||
info.ai_socktype = SOCK_STREAM;
|
info.ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@ int uart_receive(const serial_port sp, uint8_t *pbtRx, uint32_t pszMaxRxLen, uin
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
if ( newtimeout_pending ) {
|
if (newtimeout_pending) {
|
||||||
timeout.tv_usec = newtimeout_value * 1000;
|
timeout.tv_usec = newtimeout_value * 1000;
|
||||||
newtimeout_pending = false;
|
newtimeout_pending = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ int uart_reconfigure_timeouts(uint32_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uart_reconfigure_timeouts_polling(serial_port sp) {
|
static int uart_reconfigure_timeouts_polling(serial_port sp) {
|
||||||
if ( newtimeout_pending == false )
|
if (newtimeout_pending == false)
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
newtimeout_pending = false;
|
newtimeout_pending = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue