From 30a1604f2f83f45d2413322ed7a93a443dd1738c Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 14:01:12 +0300 Subject: [PATCH 01/33] no message --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1ebbfea5c..40b35e8da 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -304,7 +304,7 @@ test_script: #proxmark crypto tests - ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'emv test'"} "Tests ?OK" + ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'emv test'"} "Test(s) [ OK" if ($global:TestsPassed) { From 8d7ed5dec1d39204a5db9d2472399da20b1c8472 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 14:13:57 +0300 Subject: [PATCH 02/33] fix tests output --- appveyor.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 40b35e8da..0a6518702 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -292,9 +292,11 @@ test_script: #proxmark logic tests - ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q Execute && echo Passed || echo Failed'} + ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q wait && echo Passed || echo Failed'} - ExecTest "proxmark help hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q hardnested && echo Passed || echo Failed'} + ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q ISO7816 && echo Passed || echo Failed'} + + ExecTest "proxmark help text hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q hardnested && echo Passed || echo Failed'} ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf'"} "at_enc" @@ -304,7 +306,7 @@ test_script: #proxmark crypto tests - ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'emv test'"} "Test(s) [ OK" + ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'emv test'"} "Test?s? ? OK" if ($global:TestsPassed) { From 5dd202eeb8520a29d4ca87a05b5f55ad7d7a65b9 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 14:50:38 +0300 Subject: [PATCH 03/33] small fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0a6518702..84f7236dc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -296,7 +296,7 @@ test_script: ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q ISO7816 && echo Passed || echo Failed'} - ExecTest "proxmark help text hardnested" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q hardnested && echo Passed || echo Failed'} + ExecTest "proxmark help text hardnested" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q hardnested && echo Passed || echo Failed'} ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf'"} "at_enc" From 6f267c24565fc7d02bd84bb66c5f16b14ad2311e Mon Sep 17 00:00:00 2001 From: Oleg Moiseenko <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 14:56:06 +0300 Subject: [PATCH 04/33] small fix --- Installation_Instructions/Coverity-Scan-Config-&-Run.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation_Instructions/Coverity-Scan-Config-&-Run.md b/Installation_Instructions/Coverity-Scan-Config-&-Run.md index 9979c41e1..85e9cdbef 100644 --- a/Installation_Instructions/Coverity-Scan-Config-&-Run.md +++ b/Installation_Instructions/Coverity-Scan-Config-&-Run.md @@ -21,4 +21,4 @@ Make a tarball tar czvf proxmark3.tgz cov-int ``` -Upload it to coverity.com +Upload it to scan.coverity.com From 92541ae0e674ec9c5504dbad1d553815acf7e154 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 15:08:07 +0300 Subject: [PATCH 05/33] small fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 84f7236dc..c285c8d09 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -294,7 +294,7 @@ test_script: ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q wait && echo Passed || echo Failed'} - ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q ISO7816 && echo Passed || echo Failed'} + ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q ISO7816 && echo Passed || echo Failed'} ExecTest "proxmark help text hardnested" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q hardnested && echo Passed || echo Failed'} From 050be575b25cd6a275a53fcfcbb67d3dab9b4897 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 15:20:58 +0300 Subject: [PATCH 06/33] fix error terminal thread --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c285c8d09..b54f1169a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -294,9 +294,9 @@ test_script: ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h | grep -q wait && echo Passed || echo Failed'} - ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q ISO7816 && echo Passed || echo Failed'} + ExecTest "proxmark help text ISO7816" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t 2>&1 | grep -q ISO7816 && echo Passed || echo Failed'} - ExecTest "proxmark help text hardnested" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t | grep -q hardnested && echo Passed || echo Failed'} + ExecTest "proxmark help text hardnested" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t 2>&1 | grep -q hardnested && echo Passed || echo Failed'} ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf'"} "at_enc" From ac7bd3532f24ea096fdd576e944ad2737125ba94 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:02:44 +0200 Subject: [PATCH 07/33] style --- armsrc/hitagS.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index 5c7bec491..e51f720da 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -647,7 +647,7 @@ static void hitagS_handle_reader_command(uint8_t *rx, const size_t rxlen, static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrAr, uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) { uint8_t rx_air[HITAG_FRAME_LEN]; int response_bit[200]; - int i, j, z, k; + int i, j, z; unsigned char mask = 1; unsigned char uid[32]; uint8_t uid1 = 0x00, uid2 = 0x00, uid3 = 0x00, uid4 = 0x00; @@ -673,7 +673,7 @@ static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrA z++; } } - k = 0; + uint16_t k = 0; for (i = 5; i < z; i += 2) { uid[k] = response_bit[i]; k++; @@ -1749,22 +1749,17 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) { */ void check_challenges(bool file_given, uint8_t *data) { int i, j, z, k; - uint8_t uid_byte[4]; int frame_count = 0, response = 0; + uint8_t uid_byte[4]; uint8_t rx[HITAG_FRAME_LEN]; uint8_t unlocker[60][8]; int u1 = 0; - size_t rxlen = 0; + size_t rxlen = 0, txlen = 0; uint8_t txbuf[HITAG_FRAME_LEN]; - uint8_t *tx = txbuf; - size_t txlen = 0; - int lastbit; - bool bSkip; - int reset_sof; - int tag_sof; + uint8_t *tx; int t_wait = HITAG_T_WAIT_MAX; - int STATE = 0; - bool bStop; + int lastbit, reset_sof, tag_sof, STATE = 0;; + bool bSkip, bStop; int response_bit[200]; unsigned char mask = 1; unsigned char uid[32]; From 9a5b23428dde322182bc2844331f0fbc2963a248 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:05:01 +0200 Subject: [PATCH 08/33] style --- armsrc/felica.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/armsrc/felica.c b/armsrc/felica.c index f220a8a24..ca03836ed 100644 --- a/armsrc/felica.c +++ b/armsrc/felica.c @@ -391,6 +391,7 @@ bool WaitForFelicaReply(uint16_t maxbytes) { // clear RXRDY: uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR; + (void)b; uint32_t timeout = iso18092_get_timeout(); for (;;) { @@ -481,7 +482,7 @@ void felica_sendraw(UsbCommand *c) { felica_command_t param = c->arg[0]; size_t len = c->arg[1] & 0xffff; uint8_t *cmd = c->d.asBytes; - uint32_t arg0 = 0; + uint32_t arg0; felica_card_select_t card; @@ -519,7 +520,6 @@ void felica_sendraw(UsbCommand *c) { // Don't append crc on empty bytearray... if (len > 0) { AddCrc(buf, len); - len += 2; } } From 00f3c281bbf658460fedf103147f7e2c1a9ec2cd Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:06:14 +0200 Subject: [PATCH 09/33] style --- armsrc/hitagS.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index e51f720da..842811473 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -650,7 +650,7 @@ static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrA int i, j, z; unsigned char mask = 1; unsigned char uid[32]; - uint8_t uid1 = 0x00, uid2 = 0x00, uid3 = 0x00, uid4 = 0x00; + uint8_t uid1, uid2, uid3, uid4; unsigned char crc; uint64_t state; uint8_t auth_ks[4]; From e5928424b6beb8bbf7097e7eb71b8001e35eb9d7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:08:51 +0200 Subject: [PATCH 10/33] style --- armsrc/iso14443a.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 6e2ac1e85..4dde7846a 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -521,7 +521,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) { // triggered == false -- to wait first for card bool triggered = !(param & 0x03); - uint32_t rsamples = 0; + uint32_t rx_samples = 0; DbpString("Starting to sniff"); @@ -562,11 +562,11 @@ void RAMFUNC SniffIso14443a(uint8_t param) { LED_A_OFF(); // Need two samples to feed Miller and Manchester-Decoder - if (rsamples & 0x01) { + if (rx_samples & 0x01) { if (!TagIsActive) { // no need to try decoding reader data if the tag is sending uint8_t readerdata = (previous_data & 0xF0) | (*data >> 4); - if (MillerDecoding(readerdata, (rsamples - 1) * 4)) { + if (MillerDecoding(readerdata, (rx_samples - 1) * 4)) { LED_C_ON(); // check - if there is a short 7bit request from reader @@ -593,7 +593,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) { // no need to try decoding tag data if the reader is sending - and we cannot afford the time if (!ReaderIsActive) { uint8_t tagdata = (previous_data << 4) | (*data & 0x0F); - if (ManchesterDecoding(tagdata, 0, (rsamples - 1) * 4)) { + if (ManchesterDecoding(tagdata, 0, (rx_samples - 1) * 4)) { LED_B_ON(); if (!LogTrace(receivedResp, @@ -617,7 +617,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) { } previous_data = *data; - rsamples++; + rx_samples++; data++; if (data == dmaBuf + DMA_BUFFER_SIZE) { data = dmaBuf; From 144237abfd2f3434a06353b3317a40b79729c84f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:09:57 +0200 Subject: [PATCH 11/33] style --- armsrc/iso14443b.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index 2fa9b54b4..052351173 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -947,7 +947,6 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) { static void GetTagSamplesFor14443bDemod() { bool gotFrame, finished = false; // int lastRxCounter = ISO14443B_DMA_BUFFER_SIZE; - int ci = 0, cq = 0; uint32_t time_0 = 0, time_stop = 0; BigBuf_free(); @@ -978,8 +977,8 @@ static void GetTagSamplesFor14443bDemod() { WDT_HIT(); // LSB is a fpga signal bit. - ci = upTo[0]; - cq = upTo[1]; + int ci = upTo[0]; + int cq = upTo[1]; upTo += 2; // lastRxCounter -= 2; From 75524b72d170ac2f08b5808f1e8e9665d3442373 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:10:55 +0200 Subject: [PATCH 12/33] style --- armsrc/optimized_cipher.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/armsrc/optimized_cipher.c b/armsrc/optimized_cipher.c index faf739beb..fee3c156f 100644 --- a/armsrc/optimized_cipher.c +++ b/armsrc/optimized_cipher.c @@ -112,7 +112,7 @@ void opt_successor(const uint8_t *k, State *s, bool y, State *successor) { void opt_suc(const uint8_t *k, State *s, uint8_t *in, uint8_t length, bool add32Zeroes) { State x2; int i; - uint8_t head = 0; + uint8_t head; for (i = 0; i < length; i++) { head = 1 & (in[i] >> 7); opt_successor(k, s, head, &x2); @@ -149,8 +149,7 @@ void opt_suc(const uint8_t *k, State *s, uint8_t *in, uint8_t length, bool add32 } void opt_output(const uint8_t *k, State *s, uint8_t *buffer) { - uint8_t times = 0; - uint8_t bout = 0; + uint8_t bout, times = 0; State temp = {0, 0, 0, 0}; for (; times < 4; times++) { bout = 0; From 87a74e98b885c14100f3e606f63677ef773d395d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:19:53 +0200 Subject: [PATCH 13/33] style --- common/crapto1/crapto1.c | 7 +++---- tools/nonce2key/crapto1.c | 20 ++++---------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/common/crapto1/crapto1.c b/common/crapto1/crapto1.c index ea496e1c4..232afb4a0 100644 --- a/common/crapto1/crapto1.c +++ b/common/crapto1/crapto1.c @@ -85,13 +85,12 @@ static struct Crypto1State * recover(uint32_t *o_head, uint32_t *o_tail, uint32_t oks, uint32_t *e_head, uint32_t *e_tail, uint32_t eks, int rem, struct Crypto1State *sl, uint32_t in, bucket_array_t bucket) { - uint32_t *o, *e; bucket_info_t bucket_info; if (rem == -1) { - for (e = e_head; e <= e_tail; ++e) { + for (uint32_t *e = e_head; e <= e_tail; ++e) { *e = *e << 1 ^ (evenparity32(*e & LF_POLY_EVEN)) ^ !!(in & 4); - for (o = o_head; o <= o_tail; ++o, ++sl) { + for (uint32_t *o = o_head; o <= o_tail; ++o, ++sl) { sl->even = *o; sl->odd = *e ^ (evenparity32(*o & LF_POLY_ODD)); sl[1].odd = sl[1].even = 0; @@ -301,7 +300,7 @@ uint8_t lfsr_rollback_bit(struct Crypto1State *s, uint32_t in, int fb) { out ^= LF_POLY_EVEN & (s->even >>= 1); out ^= LF_POLY_ODD & s->odd; out ^= !!in; - out ^= (ret = filter(s->odd)) & !!fb; + out ^= (ret = filter(s->odd)) & (!!fb); s->even |= (evenparity32(out)) << 23; return ret; diff --git a/tools/nonce2key/crapto1.c b/tools/nonce2key/crapto1.c index 9026a57bb..bc9165f0e 100644 --- a/tools/nonce2key/crapto1.c +++ b/tools/nonce2key/crapto1.c @@ -368,12 +368,6 @@ uint8_t lfsr_rollback_bit(struct Crypto1State *s, uint32_t in, int fb) { * Rollback the shift register in order to get previous states */ uint8_t lfsr_rollback_byte(struct Crypto1State *s, uint32_t in, int fb) { - /* - int i, ret = 0; - for (i = 7; i >= 0; --i) - ret |= lfsr_rollback_bit(s, BIT(in, i), fb) << i; - */ -// unfold loop 20160112 uint8_t ret = 0; ret |= lfsr_rollback_bit(s, BIT(in, 7), fb) << 7; ret |= lfsr_rollback_bit(s, BIT(in, 6), fb) << 6; @@ -389,13 +383,7 @@ uint8_t lfsr_rollback_byte(struct Crypto1State *s, uint32_t in, int fb) { * Rollback the shift register in order to get previous states */ uint32_t lfsr_rollback_word(struct Crypto1State *s, uint32_t in, int fb) { - /* - int i; - uint32_t ret = 0; - for (i = 31; i >= 0; --i) - ret |= lfsr_rollback_bit(s, BEBIT(in, i), fb) << (i ^ 24); - */ -// unfold loop 20160112 + uint32_t ret = 0; ret |= lfsr_rollback_bit(s, BEBIT(in, 31), fb) << (31 ^ 24); ret |= lfsr_rollback_bit(s, BEBIT(in, 30), fb) << (30 ^ 24); @@ -442,7 +430,7 @@ static uint16_t *dist = 0; int nonce_distance(uint32_t from, uint32_t to) { uint16_t x, i; if (!dist) { - dist = malloc(2 << 16); + dist = calloc(2 << 16, sizeof(uint8_t)); if (!dist) return -1; for (x = i = 1; i; ++i) { @@ -470,7 +458,7 @@ static uint32_t fastfwd[2][8] = { * only correct iff [NR_3] ^ NR_3 does not depend on Nr_3 */ uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd) { - uint32_t *candidates = malloc(4 << 10); + uint32_t *candidates = calloc(4 << 10, sizeof(uint8_t)); if (!candidates) return 0; uint32_t c, entry; @@ -538,7 +526,7 @@ struct Crypto1State *lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8] odd = lfsr_prefix_ks(ks, 1); even = lfsr_prefix_ks(ks, 0); - s = statelist = malloc((sizeof * statelist) << 20); + s = statelist = malloc((sizeof * statelist) << 24); // was << 20. Need more for no_par special attack. Enough??? if (!s || !odd || !even) { free(statelist); statelist = 0; From e30dbf3ecd4177cea7af04608c6b90b772b0d1c6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:22:39 +0200 Subject: [PATCH 14/33] style --- common/crapto1/crypto1.c | 2 +- tools/nonce2key/crypto1.c | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/common/crapto1/crypto1.c b/common/crapto1/crypto1.c index 46e9fc239..7d6bb6e7d 100644 --- a/common/crapto1/crypto1.c +++ b/common/crapto1/crypto1.c @@ -68,7 +68,7 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted) { uint32_t feedin, t; uint8_t ret = filter(s->odd); - feedin = ret & !!is_encrypted; + feedin = ret & (!!is_encrypted); feedin ^= !!in; feedin ^= LF_POLY_ODD & s->odd; feedin ^= LF_POLY_EVEN & s->even; diff --git a/tools/nonce2key/crypto1.c b/tools/nonce2key/crypto1.c index 0c3f97b88..f6f4642e2 100644 --- a/tools/nonce2key/crypto1.c +++ b/tools/nonce2key/crypto1.c @@ -62,13 +62,6 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted) { return ret; } uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted) { - /* - uint8_t i, ret = 0; - - for (i = 0; i < 8; ++i) - ret |= crypto1_bit(s, BIT(in, i), is_encrypted) << i; - */ -// unfold loop 20161012 uint8_t ret = 0; ret |= crypto1_bit(s, BIT(in, 0), is_encrypted) << 0; ret |= crypto1_bit(s, BIT(in, 1), is_encrypted) << 1; @@ -81,13 +74,6 @@ uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted) { return ret; } uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted) { - /* - uint32_t i, ret = 0; - - for (i = 0; i < 32; ++i) - ret |= crypto1_bit(s, BEBIT(in, i), is_encrypted) << (i ^ 24); - */ -//unfold loop 2016012 uint32_t ret = 0; ret |= crypto1_bit(s, BEBIT(in, 0), is_encrypted) << (0 ^ 24); ret |= crypto1_bit(s, BEBIT(in, 1), is_encrypted) << (1 ^ 24); From 1c4a7709da9769e65dd82132130cb6665a9e2652 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:27:25 +0200 Subject: [PATCH 15/33] style --- client/cliparser/argtable3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cliparser/argtable3.c b/client/cliparser/argtable3.c index 019603f50..5c6947670 100644 --- a/client/cliparser/argtable3.c +++ b/client/cliparser/argtable3.c @@ -2552,7 +2552,7 @@ static int arg_rex_scanfn(struct arg_rex *parent, const char *argval) { int errorcode = 0; const TRexChar *error = NULL; TRex *rex = NULL; - TRexBool is_match = TRex_False; + TRexBool is_match; if (parent->count == parent->hdr.maxcount) { /* maximum number of arguments exceeded */ From 7b30126371d50698cc18db22f979ba980d9f185f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:29:18 +0200 Subject: [PATCH 16/33] style --- client/cmdhfmf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 67e56e8e2..2ab4a81f6 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -605,10 +605,8 @@ static int CmdHF14AMfRdBl(const char *Cmd) { static int CmdHF14AMfRdSc(const char *Cmd) { int i; - uint8_t sectorNo = 0; - uint8_t keyType = 0; + uint8_t isOK, sectorNo = 0, keyType = 0; uint8_t key[6] = {0, 0, 0, 0, 0, 0}; - uint8_t isOK = 0; uint8_t *data = NULL; char cmdp = 0x00; @@ -799,10 +797,9 @@ static int CmdHF14AMfDump(const char *Cmd) { fclose(f); - PrintAndLogEx(INFO, "Reading sector access bits..."); - uint8_t tries = 0; + uint8_t tries; for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { for (tries = 0; tries < MIFARE_SECTOR_RETRY; tries++) { From 7bc3bea2307bd4802368f4dedb6297d83184eec5 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:32:37 +0200 Subject: [PATCH 17/33] style --- common/crapto1/crapto1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/crapto1/crapto1.c b/common/crapto1/crapto1.c index 232afb4a0..a74fbb36c 100644 --- a/common/crapto1/crapto1.c +++ b/common/crapto1/crapto1.c @@ -89,7 +89,7 @@ recover(uint32_t *o_head, uint32_t *o_tail, uint32_t oks, if (rem == -1) { for (uint32_t *e = e_head; e <= e_tail; ++e) { - *e = *e << 1 ^ (evenparity32(*e & LF_POLY_EVEN)) ^ !!(in & 4); + *e = *e << 1 ^ (evenparity32(*e & LF_POLY_EVEN)) ^ (!!(in & 4)); for (uint32_t *o = o_head; o <= o_tail; ++o, ++sl) { sl->even = *o; sl->odd = *e ^ (evenparity32(*o & LF_POLY_ODD)); From d8f756fd14e0e587a6512569b32e606f9d471a1e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:43:53 +0200 Subject: [PATCH 18/33] style --- client/loclass/elite_crack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/loclass/elite_crack.c b/client/loclass/elite_crack.c index 7df30c696..a461557b1 100644 --- a/client/loclass/elite_crack.c +++ b/client/loclass/elite_crack.c @@ -504,8 +504,8 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) { errors += bruteforceItem(*attack, keytable); } free(attack); - - PrintAndLogDevice(SUCCESS, "time: %" PRIu64 " seconds", (msclock() - t1) / 1000); + t1 = msclock() - t1; + PrintAndLogDevice(SUCCESS, "time: %" PRIu64 " seconds", t1 / 1000); // Pick out the first 16 bytes of the keytable. // The keytable is now in 16-bit ints, where the upper 8 bits From a6f145bd1ae12c9d89306466267521795c2616d2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:47:21 +0200 Subject: [PATCH 19/33] style --- client/loclass/cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/loclass/cipher.c b/client/loclass/cipher.c index 331e0b44e..76a3c1375 100644 --- a/client/loclass/cipher.c +++ b/client/loclass/cipher.c @@ -118,7 +118,7 @@ static uint8_t _select(bool x, bool y, uint8_t r) { uint8_t retval = 0; retval |= (z0 << 2) & 4; retval |= (z1 << 1) & 2; - retval |= z2 & 1; + retval |= (z2) & 1; // Return value 0 <= retval <= 7 return retval; From eae370fc3dc5dc4896e22e7eb92fb0b2a990b6c7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 15:51:13 +0200 Subject: [PATCH 20/33] not null? --- client/emv/emv_pk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/emv/emv_pk.c b/client/emv/emv_pk.c index 7b8cdd233..f78997f5a 100644 --- a/client/emv/emv_pk.c +++ b/client/emv/emv_pk.c @@ -43,7 +43,7 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_t *read) { size_t left = size; char *p = buf; - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; while (left > 0) { @@ -70,7 +70,7 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_ return -(p - buf); } - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; p--; @@ -85,7 +85,7 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { *ymv = 0; - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; for (i = 0; i < 3; i++) { @@ -101,7 +101,7 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { temp[i] = (c1 * 16 + c2); } - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; p--; @@ -116,7 +116,7 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) { char *p = buf; - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; while (size > 1) { @@ -132,7 +132,7 @@ static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) { *str = 0; - while (*p != 0 && *p == ' ') + while (p != NULL && *p == ' ') p++; p--; From f50566225c51dd9e0eac20d3424a2947db3c091b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 16:02:03 +0200 Subject: [PATCH 21/33] styles --- client/emv/emv_pk.c | 24 ++++++++++++++++++------ client/fpga_compress.c | 12 +++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/client/emv/emv_pk.c b/client/emv/emv_pk.c index f78997f5a..a0bb80979 100644 --- a/client/emv/emv_pk.c +++ b/client/emv/emv_pk.c @@ -41,9 +41,13 @@ #define TOHEX(v) ((v) < 10 ? (v) + '0' : (v) - 10 + 'a') static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_t *read) { + + if ( buf == NULL ) + return 0; + size_t left = size; char *p = buf; - while (p != NULL && *p == ' ') + while (*p == ' ') p++; while (left > 0) { @@ -70,7 +74,7 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_ return -(p - buf); } - while (p != NULL && *p == ' ') + while (*p == ' ') p++; p--; @@ -79,13 +83,17 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_ } static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { + + if ( buf == NULL ) + return 0; + int i; unsigned char temp[3]; char *p = buf; *ymv = 0; - while (p != NULL && *p == ' ') + while (*p == ' ') p++; for (i = 0; i < 3; i++) { @@ -101,7 +109,7 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { temp[i] = (c1 * 16 + c2); } - while (p != NULL && *p == ' ') + while (*p == ' ') p++; p--; @@ -115,8 +123,12 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { } static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) { + + if ( buf == NULL ) + return 0; + char *p = buf; - while (p != NULL && *p == ' ') + while (*p == ' ') p++; while (size > 1) { @@ -132,7 +144,7 @@ static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) { *str = 0; - while (p != NULL && *p == ' ') + while (*p == ' ') p++; p--; diff --git a/client/fpga_compress.c b/client/fpga_compress.c index 4cb45616b..aebb3d17d 100644 --- a/client/fpga_compress.c +++ b/client/fpga_compress.c @@ -42,7 +42,7 @@ #define COMPRESS_MAX_NICE_LENGTH 258 #define COMPRESS_MAX_CHAIN 8192 -#define HARDNESTED_TABLE_SIZE (sizeof(uint32_t) * ((1L<<19)+1)) +#define HARDNESTED_TABLE_SIZE (uint32_t)(sizeof(uint32_t) * ((1L<<19)+1)) static void usage(void) { fprintf(stdout, "Usage: fpga_compress ... \n"); @@ -95,15 +95,13 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile, bool hardn if (i >= num_infiles * (hardnested_mode ? HARDNESTED_TABLE_SIZE : FPGA_CONFIG_SIZE)) { if (hardnested_mode) { fprintf(stderr, -#if __WORDSIZE == 64 - "Input file too big (> %" PRIu64 " bytes). This is probably not a hardnested bitflip state table.\n" -#else - "Input file too big (> %li bytes). This is probably not a hardnested bitflip state table.\n" -#endif + "Input file too big (> %" PRIu32 " bytes). This is probably not a hardnested bitflip state table.\n" , HARDNESTED_TABLE_SIZE); } else { - fprintf(stderr, "Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n", num_infiles * FPGA_CONFIG_SIZE); + fprintf(stderr, + "Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n" + , num_infiles * FPGA_CONFIG_SIZE); } for (uint16_t j = 0; j < num_infiles; j++) { fclose(infile[j]); From c6aa14efb703ea224bd2d5ba374f2810fd105a09 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 16:07:25 +0200 Subject: [PATCH 22/33] style --- client/cmdanalyse.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/cmdanalyse.c b/client/cmdanalyse.c index 2f669d7e5..525c8a9a7 100644 --- a/client/cmdanalyse.c +++ b/client/cmdanalyse.c @@ -222,10 +222,7 @@ static uint16_t calcBSDchecksum4(uint8_t *bytes, uint8_t len, uint32_t mask) { // measuring LFSR maximum length static int CmdAnalyseLfsr(const char *Cmd) { - uint16_t start_state = 0; /* Any nonzero start state will work. */ - uint16_t lfsr = start_state; - //uint32_t period = 0; - + uint16_t lfsr, start_state = 0; /* Any nonzero start state will work. */ uint8_t iv = param_get8ex(Cmd, 0, 0, 16); uint8_t find = param_get8ex(Cmd, 1, 0, 16); @@ -233,11 +230,9 @@ static int CmdAnalyseLfsr(const char *Cmd) { PrintAndLogEx(NORMAL, " bit# | lfsr | ^0x40 | 0x%02X ^ lfsr \n", find); for (uint8_t i = 0x01; i < 0x30; i += 1) { - //period = 0; legic_prng_init(iv); legic_prng_forward(i); lfsr = legic_prng_get_bits(12); - PrintAndLogEx(NORMAL, " %02X | %03X | %03X | %03X \n", i, lfsr, 0x40 ^ lfsr, find ^ lfsr); } return 0; From d17191d0a4b0d80e21d1919e945c1037c073190b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 16:11:46 +0200 Subject: [PATCH 23/33] style --- client/cmdcrc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/client/cmdcrc.c b/client/cmdcrc.c index 7ec34e2cd..2a07c7adc 100644 --- a/client/cmdcrc.c +++ b/client/cmdcrc.c @@ -57,8 +57,6 @@ int GetModels(char *Models[], int *count, uint8_t *width) { SETBMP(); - int args = 0, psets, pass; - int Cnt = 0; if (width[0] == 0) { //reveng -D *count = mcount(); if (!*count) { @@ -100,6 +98,8 @@ int GetModels(char *Models[], int *count, uint8_t *width) { if (!ptst(qpoly)) rflags &= ~R_HAVEQ; + int pass; + /* if endianness not specified, try * little-endian then big-endian. * NB: crossed-endian algorithms will not be @@ -108,7 +108,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) { /* scan against preset models */ if (~uflags & C_NOPCK) { pass = 0; - Cnt = 0; + int Cnt = 0, psets; do { psets = mcount(); @@ -190,6 +190,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) { return 0; } pass = 0; + int args = 0; do { mptr = candmods = reveng(&model, qpoly, rflags, args, apolys); if (mptr && plen(mptr->spoly)) { @@ -233,7 +234,7 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res static model_t model = MZERO; int ibperhx = 8, obperhx = 8; - int rflags = 0; // search flags +// int rflags = 0; // search flags int c; poly_t apoly, crc; @@ -255,17 +256,17 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res PrintAndLogEx(WARNING, "no preset models available"); return 0; } - rflags |= R_HAVEP | R_HAVEI | R_HAVERI | R_HAVERO | R_HAVEX; +// rflags |= R_HAVEP | R_HAVEI | R_HAVERI | R_HAVERO | R_HAVEX; //set flags switch (endian) { case 'b': /* b big-endian (RefIn = false, RefOut = false ) */ model.flags &= ~P_REFIN; - rflags |= R_HAVERI; + //rflags |= R_HAVERI; /* fall through: */ case 'B': /* B big-endian output (RefOut = false) */ model.flags &= ~P_REFOUT; - rflags |= R_HAVERO; + //rflags |= R_HAVERO; mnovel(&model); /* fall through: */ case 'r': /* r right-justified */ @@ -273,11 +274,11 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res break; case 'l': /* l little-endian input and output */ model.flags |= P_REFIN; - rflags |= R_HAVERI; + //rflags |= R_HAVERI; /* fall through: */ case 'L': /* L little-endian output */ model.flags |= P_REFOUT; - rflags |= R_HAVERO; + //rflags |= R_HAVERO; mnovel(&model); /* fall through: */ case 't': /* t left-justified */ From d3b6cf720950c388cab28f14cb0c2586db14f5e6 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 16 Apr 2019 17:49:52 +0300 Subject: [PATCH 24/33] fix fake com port --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b54f1169a..d3d255192 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -299,14 +299,14 @@ test_script: ExecTest "proxmark help text hardnested" "proxmark3 -t" {bash -lc 'cd ~/client;./proxmark3 -t 2>&1 | grep -q hardnested && echo Passed || echo Failed'} - ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf'"} "at_enc" + ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 -c 'hf mf'"} "at_enc" - ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;./proxmark3 comx -c 'hf mf hardnested t 1 000000000000'"} "found:" + ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;./proxmark3 -c 'hf mf hardnested t 1 000000000000'"} "found:" #proxmark crypto tests - ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 comx -c 'emv test'"} "Test?s? ? OK" + ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 -c 'emv test'"} "Test?s? ? OK" if ($global:TestsPassed) { From aaedeafbb145c1986fa4fe7393149794940acf6e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 16:56:56 +0200 Subject: [PATCH 25/33] style spaces --- armsrc/appmain.c | 13 ++++++++++++- armsrc/fpgaloader.c | 39 ++++++++++++++++++++------------------- client/cmdcrc.c | 6 +++--- client/emv/emv_pk.c | 12 ++++++------ client/fpga_compress.c | 4 ++-- client/proxmark3.c | 2 +- 6 files changed, 44 insertions(+), 32 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 03ce3750b..9376194e9 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -375,17 +375,28 @@ void printUSBSpeed(void) { uint32_t start_time = end_time = GetTickCount(); uint32_t bytes_transferred = 0; + uint32_t counter = 0, good = 0, res; LED_B_ON(); while (end_time < start_time + USB_SPEED_TEST_MIN_TIME) { - cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE); + res = cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE); end_time = GetTickCount(); bytes_transferred += USB_CMD_DATA_SIZE; + if (res == 0) + counter++; + else + good++; } LED_B_OFF(); Dbprintf(" Time elapsed............%dms", end_time - start_time); Dbprintf(" Bytes transferred.......%d", bytes_transferred); Dbprintf(" USB Transfer Speed PM3 -> Client = %d Bytes/s", 1000 * bytes_transferred / (end_time - start_time)); + if (counter > 0) + Dbprintf(" Number of errors %u", counter); + if (good > 0) { + bytes_transferred = USB_CMD_DATA_SIZE * good; + Dbprintf(" Number of good %u / bytes %u, true Speed PM3 -> Client = %d Bytes/s", good, bytes_transferred, 1000 * bytes_transferred / (end_time - start_time)); + } } /** diff --git a/armsrc/fpgaloader.c b/armsrc/fpgaloader.c index 1be2c6138..04c49edd2 100644 --- a/armsrc/fpgaloader.c +++ b/armsrc/fpgaloader.c @@ -449,33 +449,34 @@ void FpgaWriteConfWord(uint8_t v) { // the samples from the ADC always flow through the FPGA. //----------------------------------------------------------------------------- void SetAdcMuxFor(uint32_t whichGpio) { + /* + #ifndef WITH_FPC + // When compiled without FPC support + AT91C_BASE_PIOA->PIO_OER = + GPIO_MUXSEL_HIPKD | + GPIO_MUXSEL_LOPKD | + GPIO_MUXSEL_LORAW | + GPIO_MUXSEL_HIRAW; -#ifndef WITH_FPC - // When compiled without FPC support - AT91C_BASE_PIOA->PIO_OER = - GPIO_MUXSEL_HIPKD | - GPIO_MUXSEL_LOPKD | - GPIO_MUXSEL_LORAW | - GPIO_MUXSEL_HIRAW; + AT91C_BASE_PIOA->PIO_PER = + GPIO_MUXSEL_HIPKD | + GPIO_MUXSEL_LOPKD | + GPIO_MUXSEL_LORAW | + GPIO_MUXSEL_HIRAW; - AT91C_BASE_PIOA->PIO_PER = - GPIO_MUXSEL_HIPKD | - GPIO_MUXSEL_LOPKD | - GPIO_MUXSEL_LORAW | - GPIO_MUXSEL_HIRAW; + LOW(GPIO_MUXSEL_HIPKD); + LOW(GPIO_MUXSEL_LOPKD); + LOW(GPIO_MUXSEL_HIRAW); + LOW(GPIO_MUXSEL_LORAW); - LOW(GPIO_MUXSEL_HIPKD); - LOW(GPIO_MUXSEL_LOPKD); - LOW(GPIO_MUXSEL_HIRAW); - LOW(GPIO_MUXSEL_LORAW); - -#else + #else + */ // FPC serial uses HIRAW/LOWRAW pins, so they are excluded here. AT91C_BASE_PIOA->PIO_OER = GPIO_MUXSEL_HIPKD | GPIO_MUXSEL_LOPKD; AT91C_BASE_PIOA->PIO_PER = GPIO_MUXSEL_HIPKD | GPIO_MUXSEL_LOPKD; LOW(GPIO_MUXSEL_HIPKD); LOW(GPIO_MUXSEL_LOPKD); -#endif +//#endif HIGH(whichGpio); } diff --git a/client/cmdcrc.c b/client/cmdcrc.c index 2a07c7adc..cebd292b8 100644 --- a/client/cmdcrc.c +++ b/client/cmdcrc.c @@ -99,7 +99,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) { rflags &= ~R_HAVEQ; int pass; - + /* if endianness not specified, try * little-endian then big-endian. * NB: crossed-endian algorithms will not be @@ -262,7 +262,7 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res switch (endian) { case 'b': /* b big-endian (RefIn = false, RefOut = false ) */ model.flags &= ~P_REFIN; - //rflags |= R_HAVERI; + //rflags |= R_HAVERI; /* fall through: */ case 'B': /* B big-endian output (RefOut = false) */ model.flags &= ~P_REFOUT; @@ -274,7 +274,7 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res break; case 'l': /* l little-endian input and output */ model.flags |= P_REFIN; - //rflags |= R_HAVERI; + //rflags |= R_HAVERI; /* fall through: */ case 'L': /* L little-endian output */ model.flags |= P_REFOUT; diff --git a/client/emv/emv_pk.c b/client/emv/emv_pk.c index a0bb80979..ae23c8470 100644 --- a/client/emv/emv_pk.c +++ b/client/emv/emv_pk.c @@ -42,9 +42,9 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_t *read) { - if ( buf == NULL ) + if (buf == NULL) return 0; - + size_t left = size; char *p = buf; while (*p == ' ') @@ -84,9 +84,9 @@ static ssize_t emv_pk_read_bin(char *buf, unsigned char *bin, size_t size, size_ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { - if ( buf == NULL ) + if (buf == NULL) return 0; - + int i; unsigned char temp[3]; char *p = buf; @@ -124,9 +124,9 @@ static ssize_t emv_pk_read_ymv(char *buf, unsigned *ymv) { static ssize_t emv_pk_read_string(char *buf, char *str, size_t size) { - if ( buf == NULL ) + if (buf == NULL) return 0; - + char *p = buf; while (*p == ' ') p++; diff --git a/client/fpga_compress.c b/client/fpga_compress.c index aebb3d17d..7e5616813 100644 --- a/client/fpga_compress.c +++ b/client/fpga_compress.c @@ -100,8 +100,8 @@ int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile, bool hardn } else { fprintf(stderr, - "Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n" - , num_infiles * FPGA_CONFIG_SIZE); + "Input files too big (total > %li bytes). These are probably not PM3 FPGA config files.\n" + , num_infiles * FPGA_CONFIG_SIZE); } for (uint16_t j = 0; j < num_infiles; j++) { fclose(infile[j]); diff --git a/client/proxmark3.c b/client/proxmark3.c index db4479c9a..47a50a6a4 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -467,7 +467,7 @@ int main(int argc, char *argv[]) { usb_present = OpenProxmark(port, waitCOMPort, 20, false, speed); if (TestProxmark() == 0) - usb_present = false; + usb_present = false; if (!usb_present) PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Check \"%s -h\" if it's not what you want.\n", exec_name); From 64c7ee117e7f7598eec449c639230aec9565be88 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:00:18 +0200 Subject: [PATCH 26/33] revert --- armsrc/appmain.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 9376194e9..f7690e54d 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -375,28 +375,19 @@ void printUSBSpeed(void) { uint32_t start_time = end_time = GetTickCount(); uint32_t bytes_transferred = 0; - uint32_t counter = 0, good = 0, res; LED_B_ON(); while (end_time < start_time + USB_SPEED_TEST_MIN_TIME) { res = cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE); end_time = GetTickCount(); bytes_transferred += USB_CMD_DATA_SIZE; - if (res == 0) - counter++; - else - good++; } LED_B_OFF(); Dbprintf(" Time elapsed............%dms", end_time - start_time); Dbprintf(" Bytes transferred.......%d", bytes_transferred); Dbprintf(" USB Transfer Speed PM3 -> Client = %d Bytes/s", 1000 * bytes_transferred / (end_time - start_time)); - if (counter > 0) - Dbprintf(" Number of errors %u", counter); - if (good > 0) { - bytes_transferred = USB_CMD_DATA_SIZE * good; - Dbprintf(" Number of good %u / bytes %u, true Speed PM3 -> Client = %d Bytes/s", good, bytes_transferred, 1000 * bytes_transferred / (end_time - start_time)); - } + if ( res == 0 ) + Dbprintf(" Sending failed.........."); } /** From 597019b98aedec4b14e93f685418d00cfc740ca8 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:01:00 +0200 Subject: [PATCH 27/33] revert --- armsrc/fpgaloader.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/armsrc/fpgaloader.c b/armsrc/fpgaloader.c index 04c49edd2..b7554f6a0 100644 --- a/armsrc/fpgaloader.c +++ b/armsrc/fpgaloader.c @@ -449,8 +449,8 @@ void FpgaWriteConfWord(uint8_t v) { // the samples from the ADC always flow through the FPGA. //----------------------------------------------------------------------------- void SetAdcMuxFor(uint32_t whichGpio) { - /* - #ifndef WITH_FPC + +#ifndef WITH_FPC // When compiled without FPC support AT91C_BASE_PIOA->PIO_OER = GPIO_MUXSEL_HIPKD | @@ -469,14 +469,13 @@ void SetAdcMuxFor(uint32_t whichGpio) { LOW(GPIO_MUXSEL_HIRAW); LOW(GPIO_MUXSEL_LORAW); - #else - */ +#else // FPC serial uses HIRAW/LOWRAW pins, so they are excluded here. AT91C_BASE_PIOA->PIO_OER = GPIO_MUXSEL_HIPKD | GPIO_MUXSEL_LOPKD; AT91C_BASE_PIOA->PIO_PER = GPIO_MUXSEL_HIPKD | GPIO_MUXSEL_LOPKD; LOW(GPIO_MUXSEL_HIPKD); LOW(GPIO_MUXSEL_LOPKD); -//#endif +#endif HIGH(whichGpio); } From e04e2d6fa7c3b713d3ca101052b9f29523e92c02 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:02:21 +0200 Subject: [PATCH 28/33] revert --- armsrc/appmain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index f7690e54d..489de0731 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -376,8 +376,9 @@ void printUSBSpeed(void) { uint32_t bytes_transferred = 0; LED_B_ON(); + while (end_time < start_time + USB_SPEED_TEST_MIN_TIME) { - res = cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE); + cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE); end_time = GetTickCount(); bytes_transferred += USB_CMD_DATA_SIZE; } @@ -386,8 +387,6 @@ void printUSBSpeed(void) { Dbprintf(" Time elapsed............%dms", end_time - start_time); Dbprintf(" Bytes transferred.......%d", bytes_transferred); Dbprintf(" USB Transfer Speed PM3 -> Client = %d Bytes/s", 1000 * bytes_transferred / (end_time - start_time)); - if ( res == 0 ) - Dbprintf(" Sending failed.........."); } /** From 74ece72b262f0fdde951faecea143ecad0eca670 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:21:42 +0200 Subject: [PATCH 29/33] textual --- client/cmdhfmf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 2ab4a81f6..ab5c1d7d3 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -3539,7 +3539,7 @@ static command_t CommandTable[] = { {"chk", CmdHF14AMfChk, 0, "Check keys"}, {"fchk", CmdHF14AMfChk_fast, 0, "Check keys fast, targets all keys on card"}, {"decrypt", CmdHf14AMfDecryptBytes, 1, "[nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace"}, - {"-----------", CmdHelp, 1, ""}, + {"-----------", CmdHelp, 0, ""}, {"dbg", CmdHF14AMfDbg, 0, "Set default debug mode"}, {"rdbl", CmdHF14AMfRdBl, 0, "Read MIFARE classic block"}, {"rdsc", CmdHF14AMfRdSc, 0, "Read MIFARE classic sector"}, @@ -3549,7 +3549,7 @@ static command_t CommandTable[] = { {"setmod", CmdHf14AMfSetMod, 0, "Set MIFARE Classic EV1 load modulation strength"}, {"auth4", CmdHF14AMfAuth4, 0, "ISO14443-4 AES authentication"}, // {"sniff", CmdHF14AMfSniff, 0, "Sniff card-reader communication"}, - {"-----------", CmdHelp, 1, ""}, + {"-----------", CmdHelp, 0, ""}, {"sim", CmdHF14AMf1kSim, 0, "Simulate MIFARE card"}, {"eclr", CmdHF14AMfEClear, 0, "Clear simulator memory block"}, {"eget", CmdHF14AMfEGet, 0, "Get simulator memory block"}, @@ -3558,14 +3558,14 @@ static command_t CommandTable[] = { {"esave", CmdHF14AMfESave, 0, "Save to file emul dump"}, {"ecfill", CmdHF14AMfECFill, 0, "Fill simulator memory with help of keys from simulator"}, {"ekeyprn", CmdHF14AMfEKeyPrn, 0, "Print keys from simulator memory"}, - {"-----------", CmdHelp, 1, ""}, + {"-----------", CmdHelp, 0, ""}, {"csetuid", CmdHF14AMfCSetUID, 0, "Set UID for magic Chinese card"}, {"csetblk", CmdHF14AMfCSetBlk, 0, "Write block - Magic Chinese card"}, {"cgetblk", CmdHF14AMfCGetBlk, 0, "Read block - Magic Chinese card"}, {"cgetsc", CmdHF14AMfCGetSc, 0, "Read sector - Magic Chinese card"}, {"cload", CmdHF14AMfCLoad, 0, "Load dump into magic Chinese card"}, {"csave", CmdHF14AMfCSave, 0, "Save dump from magic Chinese card into file or emulator"}, - {"-----------", CmdHelp, 1, ""}, + {"-----------", CmdHelp, 0, ""}, {"mad", CmdHF14AMfMAD, 0, "Checks and prints MAD"}, {"ndef", CmdHFMFNDEF, 0, "Prints NDEF records from card"}, From 2639de23c61f1d51f7167004bc7d788551939a28 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:26:15 +0200 Subject: [PATCH 30/33] rearranged banner output and messages --- client/comms.c | 12 +++++------- client/proxmark3.c | 11 ++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/client/comms.c b/client/comms.c index a96823d81..09554888d 100644 --- a/client/comms.c +++ b/client/comms.c @@ -342,17 +342,16 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, } } +// check if we can communicate with Pm3 int TestProxmark(void) { - // check if we can communicate with Pm3 clearCommandBuffer(); UsbCommand resp; UsbCommand c = {CMD_PING, {0, 0, 0}, {{0}}}; SendCommand(&c); - if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) { - PrintAndLogEx(INFO, "Ping successful, communicating with PM3 over %s.", resp.arg[0] == 1 ? "FPC" : "USB"); + if (WaitForResponseTimeout(CMD_ACK, &resp, 5000)) { + PrintAndLogEx(INFO, "Communicating with PM3 over %s.", resp.arg[0] == 1 ? "FPC" : "USB"); return 1; } else { - PrintAndLogEx(WARNING, _RED_("Ping failed")); return 0; } } @@ -360,7 +359,6 @@ int TestProxmark(void) { void CloseProxmark(void) { conn.run = false; - #ifdef __BIONIC__ if (USB_communication_thread != 0) { pthread_join(USB_communication_thread, NULL); @@ -421,8 +419,8 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand *response, size_t ms_timeo if (msclock() - start_time > 3000 && show_warning) { // 3 seconds elapsed (but this doesn't mean the timeout was exceeded) - PrintAndLogEx(NORMAL, "Waiting for a response from the proxmark..."); - PrintAndLogEx(NORMAL, "You can cancel this operation by pressing the pm3 button"); + PrintAndLogEx(INFO, "Waiting for a response from the proxmark..."); + PrintAndLogEx(INFO, "You can cancel this operation by pressing the pm3 button"); show_warning = false; } } diff --git a/client/proxmark3.c b/client/proxmark3.c index 47a50a6a4..43ab9bc97 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -420,6 +420,12 @@ int main(int argc, char *argv[]) { return 1; } + // ascii art + bool stdinOnPipe = !isatty(STDIN_FILENO); + if (!script_cmds_file && !stdinOnPipe) + showBanner(); + + // default speed for USB 460800, USART(FPC serial) 115200 baud if (speed == 0) #ifdef WITH_FPC_HOST @@ -454,11 +460,6 @@ int main(int argc, char *argv[]) { } } - // ascii art - bool stdinOnPipe = !isatty(STDIN_FILENO); - if (!script_cmds_file && !stdinOnPipe) - showBanner(); - // set global variables set_my_executable_path(); From 8657e17a0b91859ea0f207b2d3aeceabb1cccab6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 17:29:19 +0200 Subject: [PATCH 31/33] more colors --- client/proxmark3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/proxmark3.c b/client/proxmark3.c index 43ab9bc97..4fd182ce7 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -441,7 +441,7 @@ int main(int argc, char *argv[]) { if (strlen(script_cmd) == 0) { script_cmd = NULL; - PrintAndLogEx(WARNING, "ERROR: execute command: command not found.\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") "execute command: " _YELLOW_("command not found") ".\n"); return 2; } else { if (addLuaExec) { @@ -456,7 +456,7 @@ int main(int argc, char *argv[]) { } } - PrintAndLogEx(SUCCESS, "execute command from commandline: %s\n", script_cmd); + PrintAndLogEx(SUCCESS, "execute command from commandline: " _YELLOW_("%s") "\n", script_cmd); } } From 33b4a32dfd1166f3b94973e70574e0efeeae6626 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 19:06:18 +0200 Subject: [PATCH 32/33] removed --- client/cmdanalyse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cmdanalyse.c b/client/cmdanalyse.c index 525c8a9a7..7c1ab93cf 100644 --- a/client/cmdanalyse.c +++ b/client/cmdanalyse.c @@ -222,7 +222,7 @@ static uint16_t calcBSDchecksum4(uint8_t *bytes, uint8_t len, uint32_t mask) { // measuring LFSR maximum length static int CmdAnalyseLfsr(const char *Cmd) { - uint16_t lfsr, start_state = 0; /* Any nonzero start state will work. */ + uint16_t lfsr; /* Any nonzero start state will work. */ uint8_t iv = param_get8ex(Cmd, 0, 0, 16); uint8_t find = param_get8ex(Cmd, 1, 0, 16); From 436910605b6054de024c3f96434c4c5baa823e41 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 16 Apr 2019 20:00:25 +0200 Subject: [PATCH 33/33] unified Proxmark3 text --- client/cmddata.c | 4 ++-- client/cmdhf14a.c | 8 ++++---- client/cmdhffido.c | 2 +- client/cmdhficlass.c | 2 +- client/cmdhfmf.c | 8 ++++---- client/cmdhw.c | 6 +++--- client/cmdlft55xx.c | 4 ++-- client/comms.c | 12 ++++++------ client/flash.c | 6 +++--- client/flasher.c | 6 +++--- client/hid-flasher/flash.c | 6 +++--- client/hid-flasher/flasher.c | 2 +- client/mifare/mifarehost.c | 6 +++--- client/proxmark3.c | 4 ++-- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/client/cmddata.c b/client/cmddata.c index e8c33c70c..0f99f5e48 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -1527,7 +1527,7 @@ int CmdTuneSamples(const char *Cmd) { int timeout = 0; - PrintAndLogEx(INFO, "\nmeasuring antenna characteristics, please wait..."); + PrintAndLogEx(INFO, "\nMeasuring antenna characteristics, please wait..."); UsbCommand c = {CMD_MEASURE_ANTENNA_TUNING, {0, 0, 0}, {{0}}}; clearCommandBuffer(); @@ -1538,7 +1538,7 @@ int CmdTuneSamples(const char *Cmd) { printf("."); fflush(stdout); if (timeout > 7) { - PrintAndLogEx(WARNING, "\nno response from Proxmark. Aborting..."); + PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting..."); return 1; } } diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index c03a39ca0..52b2853b0 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -531,7 +531,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}}; SendCommand(&ca); if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - PrintAndLogEx(ERR, "Proxmark connection timeout."); + PrintAndLogEx(ERR, "Proxmark3 connection timeout."); return 1; } @@ -553,7 +553,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav memcpy(cr.d.asBytes, rats, 2); SendCommand(&cr); if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - PrintAndLogEx(ERR, "Proxmark connection timeout."); + PrintAndLogEx(ERR, "Proxmark3 connection timeout."); return 1; } @@ -630,7 +630,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) { UsbCommand ca = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}, {{0}}}; SendCommand(&ca); if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - PrintAndLogEx(ERR, "Proxmark connection timeout."); + PrintAndLogEx(ERR, "Proxmark3 connection timeout."); return 1; } @@ -652,7 +652,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) { memcpy(cr.d.asBytes, rats, 2); SendCommand(&cr); if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - PrintAndLogEx(ERR, "Proxmark connection timeout."); + PrintAndLogEx(ERR, "Proxmark3 connection timeout."); return 1; } diff --git a/client/cmdhffido.c b/client/cmdhffido.c index c2f02ef0e..48a612e7f 100644 --- a/client/cmdhffido.c +++ b/client/cmdhffido.c @@ -781,7 +781,7 @@ static int CmdHFFido2GetAssertion(const char *cmd) { char fname[300] = {0}; CLIParserInit("hf fido assert", - "Execute a FIDO2 Get Assertion command. Needs json file with parameters. Sample file `fido2.json`. File can be placed in proxmark directory or in `proxmark/fido` directory.", + "Execute a FIDO2 Get Assertion command. Needs json file with parameters. Sample file " _YELLOW_("`fido2.json`") ". File can be placed in proxmark directory or in `proxmark/fido` directory.", "Usage:\n\thf fido assert -> execute command default parameters file `fido2.json`\n" "\thf fido assert test.json -l -> execute command with parameters file `text.json` and add to request CredentialId"); diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 4696ed4c6..0850e6606 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -1994,7 +1994,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { printf("."); fflush(stdout); if (timeout > 120) { - PrintAndLogEx(WARNING, "\nNo response from Proxmark. Aborting..."); + PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting..."); goto out; } } diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index ab5c1d7d3..0e91c784e 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -1137,7 +1137,7 @@ static int CmdHF14AMfNested(const char *Cmd) { int16_t isOK = mfnested(blockNo, keyType, key, trgBlockNo, trgKeyType, keyBlock, true); switch (isOK) { case -1 : - PrintAndLogEx(WARNING, "Error: No response from Proxmark.\n"); + PrintAndLogEx(WARNING, "Error: No response from Proxmark3.\n"); break; case -2 : PrintAndLogEx(WARNING, "Button pressed. Aborted.\n"); @@ -1207,7 +1207,7 @@ static int CmdHF14AMfNested(const char *Cmd) { int16_t isOK = mfnested(blockNo, keyType, key, FirstBlockOfSector(sectorNo), trgKeyType, keyBlock, calibrate); switch (isOK) { case -1 : - PrintAndLogEx(WARNING, "error: No response from Proxmark.\n"); + PrintAndLogEx(WARNING, "error: No response from Proxmark3.\n"); break; case -2 : PrintAndLogEx(WARNING, "button pressed. Aborted.\n"); @@ -1497,7 +1497,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) { if (isOK) { switch (isOK) { case 1 : - PrintAndLogEx(WARNING, "Error: No response from Proxmark.\n"); + PrintAndLogEx(WARNING, "Error: No response from Proxmark3.\n"); break; case 2 : PrintAndLogEx(NORMAL, "Button pressed. Aborted.\n"); @@ -2283,7 +2283,7 @@ static int CmdHF14AMfSniff(const char *Cmd) { PrintAndLogEx(NORMAL, "-------------------------------------------------------------------------\n"); PrintAndLogEx(NORMAL, "Executing mifare sniffing command. \n"); - PrintAndLogEx(NORMAL, "Press the key on the proxmark3 device to abort both proxmark3 and client.\n"); + PrintAndLogEx(NORMAL, "Press the key on the Proxmark3 device to abort both Proxmark3 and client.\n"); PrintAndLogEx(NORMAL, "Press the key on pc keyboard to abort the client.\n"); PrintAndLogEx(NORMAL, "-------------------------------------------------------------------------\n"); diff --git a/client/cmdhw.c b/client/cmdhw.c index d1ba4274e..bd013e706 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -451,9 +451,9 @@ static command_t CommandTable[] = { {"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"}, {"setmux", CmdSetMux, 0, " -- Set the ADC mux to a specific value"}, {"tune", CmdTune, 0, "Measure antenna tuning"}, - {"version", CmdVersion, 0, "Show version information about the connected Proxmark"}, - {"status", CmdStatus, 0, "Show runtime status information about the connected Proxmark"}, - {"ping", CmdPing, 0, "Test if the pm3 is responsive"}, + {"version", CmdVersion, 0, "Show version information about the connected Proxmark3"}, + {"status", CmdStatus, 0, "Show runtime status information about the connected Proxmark3"}, + {"ping", CmdPing, 0, "Test if the Proxmark3 is responding"}, {NULL, NULL, 0, NULL} }; diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index b578a42ea..6934e20e3 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -506,7 +506,7 @@ static bool DecodeT5555TraceBlock(void) { // sanity check. Don't use proxmark if it is offline and you didn't specify useGraphbuf static int SanityOfflineCheck(bool useGraphBuffer) { if (!useGraphBuffer && IsOffline()) { - PrintAndLogEx(NORMAL, "Your proxmark3 device is offline. Specify [1] to use graphbuffer data instead"); + PrintAndLogEx(WARNING, "Your proxmark3 device is offline. Specify [1] to use graphbuffer data instead"); return 0; } return 1; @@ -1866,7 +1866,7 @@ static int CmdT55xxChkPwds(const char *Cmd) { printf("."); fflush(stdout); if (timeout > 180) { - PrintAndLogEx(WARNING, "\nno response from Proxmark. Aborting..."); + PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting..."); return 2; } } diff --git a/client/comms.c b/client/comms.c index 09554888d..546594c92 100644 --- a/client/comms.c +++ b/client/comms.c @@ -59,7 +59,7 @@ void SendCommand(UsbCommand *c) { #endif if (offline) { - PrintAndLogEx(NORMAL, "Sending bytes to proxmark failed - offline"); + PrintAndLogEx(WARNING, "Sending bytes to Proxmark3 failed." _YELLOW_("offline") ); return; } @@ -209,7 +209,7 @@ bool hookUpPM3() { ret = false; offline = 1; } else { - PrintAndLogEx(SUCCESS, "Proxmark reconnected\n"); + PrintAndLogEx(SUCCESS, "Proxmark3 reconnected\n"); serial_port_name = ; ret = true; offline = 0; @@ -275,7 +275,7 @@ __attribute__((force_align_arg_pointer)) if (txBuffer_pending) { if (!uart_send(sp, (uint8_t *) &txBuffer, sizeof(UsbCommand))) { //counter_to_offline++; - PrintAndLogEx(WARNING, "sending bytes to proxmark failed"); + PrintAndLogEx(WARNING, "sending bytes to Proxmark3 device" _RED_("failed") ); } txBuffer_pending = false; @@ -305,7 +305,7 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, PrintAndLogEx(INFO, "Using UART port " _YELLOW_("%s"), portname); sp = uart_open(portname, speed); } else { - PrintAndLogEx(SUCCESS, "Waiting for Proxmark to appear on " _YELLOW_("%s"), portname); + PrintAndLogEx(SUCCESS, "Waiting for Proxmark3 to appear on " _YELLOW_("%s"), portname); fflush(stdout); int openCount = 0; do { @@ -419,7 +419,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, UsbCommand *response, size_t ms_timeo if (msclock() - start_time > 3000 && show_warning) { // 3 seconds elapsed (but this doesn't mean the timeout was exceeded) - PrintAndLogEx(INFO, "Waiting for a response from the proxmark..."); + PrintAndLogEx(INFO, "Waiting for a response from the proxmark3..."); PrintAndLogEx(INFO, "You can cancel this operation by pressing the pm3 button"); show_warning = false; } @@ -529,7 +529,7 @@ bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, UsbCommand *resp if (msclock() - start_time > 3000 && show_warning) { // 3 seconds elapsed (but this doesn't mean the timeout was exceeded) - PrintAndLogEx(NORMAL, "Waiting for a response from the proxmark..."); + PrintAndLogEx(NORMAL, "Waiting for a response from the Proxmark3..."); PrintAndLogEx(NORMAL, "You can cancel this operation by pressing the pm3 button"); show_warning = false; } diff --git a/client/flash.c b/client/flash.c index 627404ad9..9bf0c94d8 100644 --- a/client/flash.c +++ b/client/flash.c @@ -280,7 +280,7 @@ static int get_proxmark_state(uint32_t *state) { *state = resp.arg[0]; break; default: - fprintf(stderr, _RED_("Error:") "Couldn't get proxmark state, bad response type: 0x%04" PRIx64 "\n", resp.cmd); + fprintf(stderr, _RED_("Error:") "Couldn't get Proxmark3 state, bad response type: 0x%04" PRIx64 "\n", resp.cmd); return -1; break; } @@ -326,12 +326,12 @@ static int enter_bootloader(char *serial_port_name) { fprintf(stdout, " " _GREEN_("Found") "\n"); return 0; } else { - fprintf(stdout, _RED_("Error:") "Proxmark not found.\n"); + fprintf(stdout, _RED_("Error:") "Proxmark3 not found.\n"); return -1; } } - fprintf(stderr, _RED_("Error:") "Unknown Proxmark mode\n"); + fprintf(stderr, _RED_("Error:") "Unknown Proxmark3 mode\n"); return -1; } diff --git a/client/flasher.c b/client/flasher.c index be74ef8e6..ad17fd080 100644 --- a/client/flasher.c +++ b/client/flasher.c @@ -40,8 +40,8 @@ static void usage(char *argv0) { fprintf(stdout, "\t-b\tEnable flashing of bootloader area (DANGEROUS)\n\n"); fprintf(stdout, "\nExample:\n\n\t %s "SERIAL_PORT_H" armsrc/obj/fullimage.elf\n", argv0); #ifdef __linux__ - fprintf(stdout, "\nNote (Linux): if the flasher gets stuck in 'Waiting for Proxmark to reappear on ',\n"); - fprintf(stdout, " you need to blacklist proxmark for modem-manager - see wiki for more details:\n\n"); + fprintf(stdout, "\nNote (Linux): if the flasher gets stuck in 'Waiting for Proxmark3 to reappear on ',\n"); + fprintf(stdout, " you need to blacklist Proxmark3 for modem-manager - see wiki for more details:\n\n"); fprintf(stdout, " https://github.com/Proxmark/proxmark3/wiki/Gentoo Linux\n\n"); fprintf(stdout, " https://github.com/Proxmark/proxmark3/wiki/Ubuntu Linux\n\n"); fprintf(stdout, " https://github.com/Proxmark/proxmark3/wiki/OSX\n\n"); @@ -82,7 +82,7 @@ int main(int argc, char **argv) { char *serial_port_name = argv[1]; if (!OpenProxmark(serial_port_name, true, 60, true, FLASHMODE_SPEED)) { - fprintf(stderr, "Could not find Proxmark on " _RED_("%s") ".\n\n", serial_port_name); + fprintf(stderr, "Could not find Proxmark3 on " _RED_("%s") ".\n\n", serial_port_name); return -1; } else { fprintf(stderr, _GREEN_("Found") "\n"); diff --git a/client/hid-flasher/flash.c b/client/hid-flasher/flash.c index 6c7f037b9..22f57a817 100644 --- a/client/hid-flasher/flash.c +++ b/client/hid-flasher/flash.c @@ -281,7 +281,7 @@ static int get_proxmark_state(uint32_t *state) { *state = resp.arg[0]; break; default: - fprintf(stderr, "Error: Couldn't get proxmark state, bad response type: 0x%04x\n", resp.cmd); + fprintf(stderr, "Error: Couldn't get Proxmark3 state, bad response type: 0x%04x\n", resp.cmd); return -1; break; } @@ -319,7 +319,7 @@ static int enter_bootloader(void) { SendCommand(&c); fprintf(stderr, "Press and hold down button NOW if your bootloader requires it.\n"); } - fprintf(stderr, "Waiting for Proxmark to reappear on USB..."); + fprintf(stderr, "Waiting for Proxmark3 to reappear on USB..."); CloseProxmark(); msleep(1000); @@ -333,7 +333,7 @@ static int enter_bootloader(void) { return 0; } - fprintf(stderr, "Error: Unknown Proxmark mode\n"); + fprintf(stderr, "Error: Unknown Proxmark3 mode\n"); return -1; } diff --git a/client/hid-flasher/flasher.c b/client/hid-flasher/flasher.c index 46a68499c..0cc800826 100644 --- a/client/hid-flasher/flasher.c +++ b/client/hid-flasher/flasher.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) { usb_init(); - fprintf(stderr, "Waiting for Proxmark to appear on USB..."); + fprintf(stderr, "Waiting for Proxmark3 to appear on USB..."); while (!OpenProxmark(1)) { msleep(1000); fprintf(stderr, "."); diff --git a/client/mifare/mifarehost.c b/client/mifare/mifarehost.c index b7842dda0..211eaea02 100644 --- a/client/mifare/mifarehost.c +++ b/client/mifare/mifarehost.c @@ -21,7 +21,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) { // message PrintAndLogEx(NORMAL, "--------------------------------------------------------------------------------\n"); PrintAndLogEx(NORMAL, "executing Darkside attack. Expected execution time: 25sec on average"); - PrintAndLogEx(NORMAL, "press pm3-button on the proxmark3 device to abort both proxmark3 and client."); + PrintAndLogEx(NORMAL, "press pm3-button on the Proxmark3 device to abort both Proxmark3 and client."); PrintAndLogEx(NORMAL, "--------------------------------------------------------------------------------\n"); while (true) { @@ -159,7 +159,7 @@ int mfCheckKeys_fast(uint8_t sectorsCnt, uint8_t firstChunk, uint8_t lastChunk, // s70 with 40*2 keys to check, 80*85 = 6800 auth. // takes about 97s, still some margin before abort if (timeout > 180) { - PrintAndLogEx(WARNING, "\nno response from Proxmark. Aborting..."); + PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting..."); return 2; } } @@ -919,7 +919,7 @@ int detect_classic_nackbug(bool verbose) { UsbCommand resp; if (verbose) - PrintAndLogEx(SUCCESS, "press pm3-button on the proxmark3 device to abort both proxmark3 and client.\n"); + PrintAndLogEx(SUCCESS, "press pm3-button on the Proxmark3 device to abort both Proxmark3 and client.\n"); // for nice animation bool term = !isatty(STDIN_FILENO); diff --git a/client/proxmark3.c b/client/proxmark3.c index 4fd182ce7..267071c21 100644 --- a/client/proxmark3.c +++ b/client/proxmark3.c @@ -206,7 +206,7 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) { static void dumpAllHelp(int markdown) { PrintAndLogEx(NORMAL, "\n%sProxmark3 command dump%s\n\n", markdown ? "# " : "", markdown ? "" : "\n======================"); - PrintAndLogEx(NORMAL, "Some commands are available only if a Proxmark is actually connected.%s\n", markdown ? " " : ""); + PrintAndLogEx(NORMAL, "Some commands are available only if a Proxmark3 is actually connected.%s\n", markdown ? " " : ""); PrintAndLogEx(NORMAL, "Check column \"offline\" for their availability.\n"); PrintAndLogEx(NORMAL, "\n"); command_t *cmds = getTopLevelCommandTable(); @@ -262,7 +262,7 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " %s -m\n", exec_name); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_H" -f -- flush output everytime\n", exec_name); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_H" -w -- wait for serial port\n", exec_name); - PrintAndLogEx(NORMAL, "\n how to run proxmark3 client\n"); + PrintAndLogEx(NORMAL, "\n how to run Proxmark3 client\n"); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_H" -- runs the pm3 client\n", exec_name); PrintAndLogEx(NORMAL, " %s -- runs the pm3 client in OFFLINE mode\n", exec_name); PrintAndLogEx(NORMAL, "\n how to execute different commands from terminal\n");