mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge branch 'master' into ext_apdu
This commit is contained in:
+20
-2
@@ -4,15 +4,33 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Added to `hf 14a apdu` print apdu and compose apdu (@merlokk)
|
||||
- Change: buggy 'mem read' removed, 'mem save' renamed 'mem dump', can now display too (@doegox)
|
||||
- Fix: timeout for mem wipe was too short, thanks @cjbrigato (@doegox)
|
||||
- Fix 'hf mf sim' - Mifare Classic simulation more flexible anti-collision check (@McEloff)
|
||||
- Change: 'hf mf sim' - Mifare Classic simulation not respond NACK on invalid authentication request (@McEloff)
|
||||
- Change: 'read_pwd_mem.lua' now handles Mifare Classic dictionaries large than 4096 bytes (@iceman)
|
||||
- Change: Don't clear trace log during 'hf mf chk', to save whole process history (@McEloff)
|
||||
- Add 'msleep' command, for pauses in scripts (@doegox)
|
||||
- Add support for WSL in proxmark.sh (@doegox)
|
||||
- Add documentation for usage of Proxmark3 under WSL (@doegox)
|
||||
- Change: replace aes.c with mbedtls version (@slurdge)
|
||||
- Change: replace ukbhit by kbd_enter_pressed, not requiring tcgetattr (@xianglin1998/@doegox)
|
||||
- Add config for RaspberryPi in JTAG tools (@doegox)
|
||||
- Add config for FTDI C232HM-DDHSL-0 in JTAG tools (@doegox)
|
||||
- Fix compilation under MacOSX with binutils (@matrix)
|
||||
- Add dynamic report of the chipID for flashing purposes (@slurdge)
|
||||
- Fix Clang warnings (@matrix)
|
||||
- Fix EMVGPO bug (@matrix)
|
||||
- Add hitag2 write password auth (@ViRb3)
|
||||
- Add check if bootloader segment is within bounds (@slurdge)
|
||||
- Add `hf 15 csetuid` - set UID on ISO-15693 Magic tags (@t0m4-null)
|
||||
- Add 'hf 15 csetuid' - set UID on ISO-15693 Magic tags (@t0m4-null)
|
||||
- Change: Print help if unknown arg for hitag reader/writer (@ViRb3)
|
||||
- Fix clock deadlock in hitag sniff (@ViRb3)
|
||||
- Add compiler info in client & ARM sections (@slurdge)
|
||||
- Add support for automatic COM detection on Windows (@slurdge)
|
||||
- Add support for compilation on RaspberryPiZero (armv6) (@doegox)
|
||||
- Change: updates to README (@iceman)
|
||||
- Change: hf mf/mfu dbg => hw dbg (@doegox)
|
||||
- Change: 'hf mf/mfu dbg' => 'hw dbg' (@doegox)
|
||||
- Change: replace usb_poll_validate_length() by data_available() that supports USART too (@doegox)
|
||||
- Make sure standalone modes can be launched when connected on USB without client (@doegox)
|
||||
- Change: cleaner makefile execution, use 'make V=1' if you want to see full lines (@doegox)
|
||||
|
||||
@@ -145,12 +145,12 @@ style:
|
||||
# Make sure astyle is installed
|
||||
@which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
|
||||
# Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
-exec perl -pi -e 's/[ \t]+$$//' {} \; \
|
||||
-exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \
|
||||
-exec sh -c "echo >> {}" \;
|
||||
# Apply astyle on *.c, *.h, *.cpp
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" \) -exec astyle --formatted --mode=c --suffix=none \
|
||||
find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) \) -exec astyle --formatted --mode=c --suffix=none \
|
||||
--indent=spaces=4 --indent-switches \
|
||||
--keep-one-line-blocks --max-instatement-indent=60 \
|
||||
--style=google --pad-oper --unpad-paren --pad-header \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Proxmark3 RDV4.0 Dedicated Github
|
||||
|
||||
This repo is based on iceman fork for Proxmark3. It is dedicated to bringing the most out of the new features for Proxmark3 RDV4.0 new hardware and design.
|
||||
Note that it also supports other Proxmark3 platforms as well!
|
||||
|
||||
[](https://ci.appveyor.com/project/iceman1001/proxmark3-ji4wj/branch/master)
|
||||
[](https://github.com/RfidResearchGroup/proxmark3/releases/latest)
|
||||
@@ -15,7 +16,7 @@ This repo is based on iceman fork for Proxmark3. It is dedicated to bringing the
|
||||
|[Development](#development) | [Important notes on ModemManager for Linux users](/doc/md/Installation_Instructions/ModemManager-Must-Be-Discarded.md) | [Validating proxmark client functionality](/doc/md/Use_of_Proxmark/1_Validation.md) |
|
||||
|[Why didn't you base it on official PM3 Master?](#why-didnt-you-base-it-on-official-pm3-master)| [Homebrew (Mac OS X) & Upgrading HomeBrew Tap Formula](/doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md) | [First Use and Verification](/doc/md/Use_of_Proxmark/2_Configuration-and-Verification.md)|
|
||||
|[PM3 GUI](#pm3-gui)|[Setup and build for Windows](/doc/md/Installation_Instructions/Windows-Installation-Instructions.md)|[Commands & Features](/doc/md/Use_of_Proxmark/3_Commands-and-Features.md)|
|
||||
|[Issues](#issues)|[Blue shark manual](/doc/bt_manual_v10.md) ||
|
||||
|[Issues](#issues)|[Blue shark manual](/doc/bt_manual_v10.md) |[Advanced compilation parameters](/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md)|
|
||||
|[Notes on UART](/doc/uart_notes.md)|||
|
||||
|[Notes on Frame format](/doc/new_frame_format.md)|||
|
||||
|[Notes on Termux / Android](/doc/termux_notes.md)|||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c epa.c mifaresim.c
|
||||
SRC_ISO14443b = iso14443b.c
|
||||
SRC_FELICA = felica.c
|
||||
SRC_CRAPTO1 = crypto1.c des.c aes.c desfire_key.c desfire_crypto.c mifaredesfire.c
|
||||
SRC_CRAPTO1 = crypto1.c des.c desfire_key.c desfire_crypto.c mifaredesfire.c aes.c platform_util.c
|
||||
SRC_CRC = crc.c crc16.c crc32.c
|
||||
SRC_ICLASS = iclass.c optimized_cipher.c
|
||||
SRC_LEGIC = legicrf.c legicrfsim.c legic_prng.c
|
||||
|
||||
@@ -15,7 +15,7 @@ The retrieved sniffing session can be acquired by connecting the device
|
||||
to a client that supports the reconnect capability and issue 'hf 14a list'.
|
||||
|
||||
In order to view the grabbed authentication attempts in the flash mem,
|
||||
you can simply run 'script run read_pwd_mem' or just 'mem read l 256'
|
||||
you can simply run 'script run read_pwd_mem' or just 'mem dump p l 256'
|
||||
from the client to view the stored quadlets.
|
||||
*/
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ void ReadLastTagFromFlash() {
|
||||
size_t size = len;
|
||||
uint8_t *mem = BigBuf_malloc(size);
|
||||
|
||||
FlashmemSetSpiBaudrate(24000000);
|
||||
|
||||
if (!FlashInit()) {
|
||||
return;
|
||||
}
|
||||
@@ -148,6 +150,9 @@ void WriteTagToFlash(uint8_t index, size_t size) {
|
||||
|
||||
emlGetMem(data, 0, (size * 64) / 1024);
|
||||
|
||||
|
||||
FlashmemSetSpiBaudrate(48000000);
|
||||
|
||||
if (!FlashInit()) {
|
||||
return;
|
||||
}
|
||||
@@ -424,7 +429,7 @@ failtag:
|
||||
//-----------------------------------------------------------------------------
|
||||
// also we could avoid first UID check for every block
|
||||
|
||||
// then let’s expose this “optimal case” of “well known vigik schemes” :
|
||||
// then let's expose this “optimal case” of “well known vigik schemes” :
|
||||
for (uint8_t type = 0; type < 2 && !err && !trapped; type++) {
|
||||
for (int sec = 0; sec < sectorsCnt && !err && !trapped; ++sec) {
|
||||
key = cjat91_saMifareChkKeys(sec * 4, type, NULL, size, &keyBlock[0], &key64);
|
||||
@@ -783,10 +788,18 @@ readysim:
|
||||
case 7:
|
||||
flags = FLAG_7B_UID_IN_DATA;
|
||||
break;
|
||||
default:
|
||||
case 4:
|
||||
flags = FLAG_4B_UID_IN_DATA;
|
||||
break;
|
||||
default:
|
||||
flags = FLAG_UID_IN_EMUL;
|
||||
break;
|
||||
}
|
||||
|
||||
// Use UID, SAK, ATQA from EMUL, if uid not defined
|
||||
//if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||
flags |= FLAG_UID_IN_EMUL;
|
||||
//}
|
||||
Mifare1ksim(flags | FLAG_MF_1K, 0, cjuid);
|
||||
LED_C_OFF();
|
||||
SpinOff(50);
|
||||
@@ -902,7 +915,7 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
|
||||
}
|
||||
|
||||
/* the chk function is a piwi’ed(tm) check that will try all keys for
|
||||
/* the chk function is a piwi'ed(tm) check that will try all keys for
|
||||
a particular sector. also no tracing no dbg */
|
||||
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
||||
DBGLEVEL = DBG_NONE;
|
||||
|
||||
-1170
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* AES Cryptographic Algorithm Header File. Include this header file in
|
||||
* your source which uses these given APIs. (This source is kept under
|
||||
* public domain)
|
||||
*/
|
||||
#ifndef __AES_H
|
||||
#define __AES_H
|
||||
|
||||
// AES context structure
|
||||
typedef struct {
|
||||
unsigned int Ek[60];
|
||||
unsigned int Dk[60];
|
||||
unsigned int Iv[4];
|
||||
unsigned char Nr;
|
||||
unsigned char Mode;
|
||||
} AesCtx;
|
||||
|
||||
// key length in bytes
|
||||
#define KEY128 16
|
||||
#define KEY192 24
|
||||
#define KEY256 32
|
||||
// block size in bytes
|
||||
#define BLOCKSZ 16
|
||||
// mode
|
||||
#define EBC 0
|
||||
#define CBC 1
|
||||
|
||||
// AES API function prototype
|
||||
|
||||
int AesCtxIni(AesCtx *pCtx, unsigned char *pIV, unsigned char *pKey, unsigned int KeyLen, unsigned char Mode);
|
||||
int AesEncrypt(AesCtx *pCtx, unsigned char *pData, unsigned char *pCipher, unsigned int DataLen);
|
||||
int AesDecrypt(AesCtx *pCtx, unsigned char *pCipher, unsigned char *pData, unsigned int CipherLen);
|
||||
|
||||
#endif
|
||||
+2
-34
@@ -347,9 +347,9 @@ void SendVersion(void) {
|
||||
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
||||
#if defined(__clang__)
|
||||
strncat(VersionString, " compiled with Clang/LLVM "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, " compiled with Clang/LLVM "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
strncat(VersionString, " compiled with GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, " compiled with GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
#endif
|
||||
|
||||
strncat(VersionString, "\n [ FPGA ]\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
@@ -1592,38 +1592,6 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
FlashmemSetSpiBaudrate(packet->oldarg[0]);
|
||||
break;
|
||||
}
|
||||
case CMD_FLASHMEM_READ: {
|
||||
LED_B_ON();
|
||||
uint32_t startidx = packet->oldarg[0];
|
||||
uint16_t len = packet->oldarg[1];
|
||||
|
||||
Dbprintf("FlashMem read | %d - %d | ", startidx, len);
|
||||
|
||||
size_t size = MIN(PM3_CMD_DATA_SIZE, len);
|
||||
|
||||
if (!FlashInit()) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t *mem = BigBuf_malloc(size);
|
||||
|
||||
for (size_t i = 0; i < len; i += size) {
|
||||
len = MIN((len - i), size);
|
||||
|
||||
Dbprintf("FlashMem reading | %d | %d | %d |", startidx + i, i, len);
|
||||
uint16_t isok = Flash_ReadDataCont(startidx + i, mem, len);
|
||||
if (isok == len) {
|
||||
print_result("Chunk: ", mem, len);
|
||||
} else {
|
||||
Dbprintf("FlashMem reading failed | %d | %d", len, isok);
|
||||
break;
|
||||
}
|
||||
}
|
||||
BigBuf_free();
|
||||
FlashStop();
|
||||
LED_B_OFF();
|
||||
break;
|
||||
}
|
||||
case CMD_FLASHMEM_WRITE: {
|
||||
LED_B_ON();
|
||||
uint8_t isok = 0;
|
||||
|
||||
+10
-6
@@ -571,15 +571,19 @@ void mifare_cypher_single_block(desfirekey_t key, uint8_t *data, uint8_t *ivect,
|
||||
case T_AES:
|
||||
switch (operation) {
|
||||
case MCO_ENCYPHER: {
|
||||
AesCtx ctx;
|
||||
AesCtxIni(&ctx, ivect, key->data, KEY128, CBC);
|
||||
AesEncrypt(&ctx, data, edata, sizeof(edata));
|
||||
mbedtls_aes_context ctx;
|
||||
mbedtls_aes_init(&ctx);
|
||||
mbedtls_aes_setkey_enc(&ctx, key->data, 128);
|
||||
mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, sizeof(edata), ivect, data, edata);
|
||||
mbedtls_aes_free(&ctx);
|
||||
break;
|
||||
}
|
||||
case MCO_DECYPHER: {
|
||||
AesCtx ctx;
|
||||
AesCtxIni(&ctx, ivect, key->data, KEY128, CBC);
|
||||
AesDecrypt(&ctx, edata, data, sizeof(edata));
|
||||
mbedtls_aes_context ctx;
|
||||
mbedtls_aes_init(&ctx);
|
||||
mbedtls_aes_setkey_dec(&ctx, key->data, 128);
|
||||
mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, sizeof(edata), ivect, edata, data);
|
||||
mbedtls_aes_free(&ctx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
#define RESUME 0x7A
|
||||
|
||||
// Flash busy timeout: 20ms is the strict minimum when writing 256kb
|
||||
#define BUSY_TIMEOUT 50000L
|
||||
#define BUSY_TIMEOUT 200000L
|
||||
|
||||
#define WINBOND_MANID 0xEF
|
||||
#define WINBOND_DEVID 0x11
|
||||
|
||||
+1
-1
@@ -434,7 +434,7 @@ static bool hitag2_password(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -136,11 +136,11 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
||||
uint32_t sample_total_numbers = 0;
|
||||
uint32_t sample_total_saved = 0;
|
||||
uint32_t cancel_counter = 0;
|
||||
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while (true) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
@@ -148,7 +148,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
||||
} else {
|
||||
++checker;
|
||||
}
|
||||
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
||||
@@ -293,11 +293,11 @@ void doT55x7Acquisition(size_t sample_size) {
|
||||
bool startFound = false;
|
||||
bool highFound = false;
|
||||
bool lowFound = false;
|
||||
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
while ( skipCnt < 1000 && (i < bufsize)) {
|
||||
if ( checker == 1000 ) {
|
||||
|
||||
while (skipCnt < 1000 && (i < bufsize)) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
@@ -371,9 +371,9 @@ void doCotagAcquisition(size_t sample_size) {
|
||||
uint16_t noise_counter = 0;
|
||||
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while ((i < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
@@ -431,9 +431,9 @@ uint32_t doCotagAcquisitionManchester() {
|
||||
uint8_t curr = 0, prev = 0;
|
||||
uint16_t noise_counter = 0;
|
||||
uint16_t checker = 0;
|
||||
|
||||
|
||||
while ((sample_counter < bufsize) && (noise_counter < (COTAG_T1 << 1))) {
|
||||
if ( checker == 1000 ) {
|
||||
if (checker == 1000) {
|
||||
if (BUTTON_PRESS() || data_available())
|
||||
break;
|
||||
else
|
||||
|
||||
+18
-10
@@ -433,15 +433,9 @@ void MifareDES_Auth1(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
||||
desfirekey_t key = &defaultkey;
|
||||
Desfire_aes_key_new(keybytes, key);
|
||||
|
||||
AesCtx ctx;
|
||||
mbedtls_aes_context ctx;
|
||||
uint8_t IV[16] = {0x00};
|
||||
if (AesCtxIni(&ctx, IV, key->data, KEY128, CBC) < 0) {
|
||||
if (DBGLEVEL >= 4) {
|
||||
DbpString("AES context failed to init");
|
||||
}
|
||||
OnError(7);
|
||||
return;
|
||||
}
|
||||
mbedtls_aes_init(&ctx);
|
||||
|
||||
cmd[0] = AUTHENTICATE_AES;
|
||||
cmd[1] = 0x00; //keynumber
|
||||
@@ -457,13 +451,27 @@ void MifareDES_Auth1(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
||||
memcpy(encRndB, resp + 3, 16);
|
||||
|
||||
// dekryptera tagnonce.
|
||||
AesDecrypt(&ctx, encRndB, decRndB, 16);
|
||||
if (mbedtls_aes_setkey_dec(&ctx, key->data, 128) != 0) {
|
||||
if (DBGLEVEL >= 4) {
|
||||
DbpString("mbedtls_aes_setkey_dec failed");
|
||||
}
|
||||
OnError(7);
|
||||
return;
|
||||
}
|
||||
mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, 16, IV, encRndB, decRndB);
|
||||
rol(decRndB, 16);
|
||||
uint8_t nonce[16] = {0x00};
|
||||
memcpy(both, nonce, 16);
|
||||
memcpy(both + 16, decRndB, 16);
|
||||
uint8_t encBoth[32] = {0x00};
|
||||
AesEncrypt(&ctx, both, encBoth, 32);
|
||||
if (mbedtls_aes_setkey_enc(&ctx, key->data, 128) != 0) {
|
||||
if (DBGLEVEL >= 4) {
|
||||
DbpString("mbedtls_aes_setkey_enc failed");
|
||||
}
|
||||
OnError(7);
|
||||
return;
|
||||
}
|
||||
mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, 32, IV, both, encBoth);
|
||||
|
||||
cmd[0] = ADDITIONAL_FRAME;
|
||||
memcpy(cmd + 1, encBoth, 32);
|
||||
|
||||
+6
-4
@@ -606,8 +606,8 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
||||
if (receivedCmd_len == 9 && receivedCmd[1] == 0x70) {
|
||||
if (memcmp(&receivedCmd[2], responses[uid_index].response, 4) == 0) {
|
||||
bool cl_finished = (uid_len == 4 && uid_index == UIDBCC1) ||
|
||||
(uid_len == 7 && uid_index == UIDBCC2) ||
|
||||
(uid_len == 10 && uid_index == UIDBCC3);
|
||||
(uid_len == 7 && uid_index == UIDBCC2) ||
|
||||
(uid_len == 10 && uid_index == UIDBCC3);
|
||||
EmSendPrecompiledCmd(&responses[cl_finished ? SAK : SAKuid]);
|
||||
if (DBGLEVEL >= DBG_EXTENDED) Dbprintf("SELECT CLx %02x%02x%02x%02x received", receivedCmd[2], receivedCmd[3], receivedCmd[4], receivedCmd[5]);
|
||||
if (cl_finished) {
|
||||
@@ -625,7 +625,8 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
||||
}
|
||||
|
||||
// Incoming anti-collision frame
|
||||
if (receivedCmd_len >= 2 && receivedCmd_len <= 6 && receivedCmd[1] == 0x50) {
|
||||
// receivedCmd[1] indicates number of byte and bit collision, supports only for bit collision is zero
|
||||
if (receivedCmd_len >= 3 && receivedCmd_len <= 6 && (receivedCmd[1] & 0x0f) == 0) {
|
||||
// we can process only full-byte frame anti-collision procedure
|
||||
if (memcmp(&receivedCmd[2], responses[uid_index].response, receivedCmd_len - 2) == 0) {
|
||||
// response missing part of UID via relative array index
|
||||
@@ -1036,8 +1037,9 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain) {
|
||||
);
|
||||
}
|
||||
cardAUTHKEY = AUTHKEYNONE; // not authenticated
|
||||
EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_NACK_NA));
|
||||
cardSTATE_TO_IDLE();
|
||||
// Really tags not respond NACK on invalid authentication
|
||||
LogTrace(uart->output, uart->len, uart->startTime * 16 - DELAY_AIR2ARM_AS_TAG, uart->endTime * 16 - DELAY_AIR2ARM_AS_TAG, uart->parity, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -122,8 +122,10 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
switch (c->cmd) {
|
||||
case CMD_DEVICE_INFO: {
|
||||
dont_ack = 1;
|
||||
arg0 = DEVICE_INFO_FLAG_BOOTROM_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
|
||||
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH;
|
||||
arg0 = DEVICE_INFO_FLAG_BOOTROM_PRESENT |
|
||||
DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM |
|
||||
DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH |
|
||||
DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO;
|
||||
if (common_area.flags.osimage_present)
|
||||
arg0 |= DEVICE_INFO_FLAG_OSIMAGE_PRESENT;
|
||||
|
||||
@@ -131,6 +133,13 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_CHIP_INFO: {
|
||||
dont_ack = 1;
|
||||
arg0 = *(AT91C_DBGU_CIDR);
|
||||
reply_old(CMD_CHIP_INFO, arg0, 0, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case CMD_SETUP_WRITE: {
|
||||
/* The temporary write buffer of the embedded flash controller is mapped to the
|
||||
* whole memory region, only the last 8 bits are decoded.
|
||||
|
||||
+6
-1
@@ -31,7 +31,12 @@ platform = $(shell uname)
|
||||
VPATH = ../common ../zlib ../uart
|
||||
OBJDIR = obj
|
||||
|
||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm
|
||||
LDLIBS =
|
||||
ifneq ($(platform),Darwin)
|
||||
LDLIBS += -L/opt/local/lib
|
||||
endif
|
||||
LDLIBS += -L/usr/local/lib -lreadline -lpthread -lm
|
||||
|
||||
# RPi Zero gcc requires -latomic
|
||||
# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
|
||||
# doesn't recognize option --as-needed
|
||||
|
||||
+1
-2
@@ -623,8 +623,7 @@ static int CmdAnalyseA(const char *Cmd) {
|
||||
for (uint8_t k=0; k<4; k = (k+1) % 4 ) {
|
||||
PrintAndLogEx(NORMAL, "\e[s%c\e[u", star[k]);
|
||||
fflush(stdout);
|
||||
if (ukbhit()) {
|
||||
int gc = getchar(); (void)gc;
|
||||
if (kbd_enter_pressed()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -248,7 +248,7 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res
|
||||
//set model
|
||||
c = mbynam(&model, inModel);
|
||||
if (!c) {
|
||||
PrintAndLogEx(WARNING, "error: preset model '%s' not found. Use reveng -D to list presets. [%d]", inModel, c);
|
||||
PrintAndLogEx(ERR, "error: preset model '%s' not found. Use reveng -D to list presets. [%d]", inModel, c);
|
||||
return 0;
|
||||
}
|
||||
if (c < 0) {
|
||||
|
||||
+6
-6
@@ -602,7 +602,7 @@ static int Cmdmandecoderaw(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (high > 7 || low < 0) {
|
||||
PrintAndLogEx(WARNING, "Error: please raw demod the wave first then manchester raw decode");
|
||||
PrintAndLogEx(ERR, "Error: please raw demod the wave first then manchester raw decode");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ static int Cmdmandecoderaw(const char *Cmd) {
|
||||
uint8_t alignPos = 0;
|
||||
errCnt = manrawdecode(bits, &size, invert, &alignPos);
|
||||
if (errCnt >= maxErr) {
|
||||
PrintAndLogEx(WARNING, "Too many errors: %u", errCnt);
|
||||
PrintAndLogEx(ERR, "Too many errors: %u", errCnt);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -658,11 +658,11 @@ static int CmdBiphaseDecodeRaw(const char *Cmd) {
|
||||
|
||||
errCnt = BiphaseRawDecode(bits, &size, &offset, invert);
|
||||
if (errCnt < 0) {
|
||||
PrintAndLogEx(WARNING, "Error during decode:%d", errCnt);
|
||||
PrintAndLogEx(ERR, "Error during decode:%d", errCnt);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
if (errCnt > maxErr) {
|
||||
PrintAndLogEx(WARNING, "Too many errors attempting to decode: %d", errCnt);
|
||||
PrintAndLogEx(ERR, "Too many errors attempting to decode: %d", errCnt);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -1290,7 +1290,7 @@ int CmdPSK1rawDemod(const char *Cmd) {
|
||||
int ans = PSKDemod(Cmd, true);
|
||||
//output
|
||||
if (ans != PM3_SUCCESS) {
|
||||
if (g_debugMode) PrintAndLogEx(WARNING, "Error demoding: %d", ans);
|
||||
if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "PSK1 demoded bitstream:");
|
||||
@@ -1307,7 +1307,7 @@ static int CmdPSK2rawDemod(const char *Cmd) {
|
||||
|
||||
int ans = PSKDemod(Cmd, true);
|
||||
if (ans != PM3_SUCCESS) {
|
||||
if (g_debugMode) PrintAndLogEx(WARNING, "Error demoding: %d", ans);
|
||||
if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
psk1TOpsk2(DemodBuffer, DemodBufferLen);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user