From ab856ab73d81724fc9533305099d5b37275fd14d Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 6 Aug 2019 02:00:26 +0100 Subject: [PATCH 1/8] Update Android Termux guide --- doc/termux_notes.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/doc/termux_notes.md b/doc/termux_notes.md index a2f883846..d86ec7f08 100644 --- a/doc/termux_notes.md +++ b/doc/termux_notes.md @@ -29,28 +29,15 @@ ref : https://github.com/Proxmark/proxmark3/wiki/android - [Magisk 19.3](https://github.com/topjohnwu/Magisk/) ## Setup -### Getting ncurses with termcap -You need `termcap` to build the Proxmark3 client. Unfortunately, the prebuilt `ncurses` package does not include it. Since [this PR](https://github.com/termux/termux-packages/pull/2131) hasn't been merged yet, you will have to build `ncurses` yourself - -1. Clone the [termux-packages](https://github.com/termux/termux-packages) repo -2. Apply [the PR](https://github.com/termux/termux-packages/pull/2131) -3. Build `ncurses`. Refer to the [build docs](https://github.com/termux/termux-packages/blob/master/docs/BUILD_ENVIRONMENT.md) for more information. The easiest way is to use Docker: - - `./scripts/run-docker.sh` - - `./build-package.sh ncurses` - - the built packages will be under the `debs` directory -4. Copy `ncurses_6.1.x-x_aarch64.deb` to your phone's `/sdcard` ### Setting up Termux 1. Install [Termux](https://play.google.com/store/apps/details?id=com.termux) and start it 2. Run the following commands: ``` -pkg install make, clang, clang++, readline-dev, libclang-dev, libc++, git, tsu -termux-setup-storage -dpkg -i /sdcard/ncurses_6.1.x-x_aarch64.deb +pkg install make clang clang++ readline libc++ git tsu git clone https://github.com/RfidResearchGroup/proxmark3.git ``` ### Building Proxmark3 client -1. Edit `proxmark3/client/Makefile` and append `-fPIC` to the `CFLAGS` variable (line 30) -2. `make clean && make client` +1. `make clean && make client` ### USB_ACM You need the `USB_ACM` driver enabled and working to communicate with the Proxmark3. To see if it's working, run `tsudo ls /dev/tty*` and it should list `/dev/ttyACM0` (or similar). If you see this, congratulations, skip this step! From 67887a83d3e7966df2bad7f096e42ed7d04be239 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 5 Aug 2019 19:16:57 +0100 Subject: [PATCH 2/8] Rework hitag2 read/write help --- client/cmdlfhitag.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/client/cmdlfhitag.c b/client/cmdlfhitag.c index 74664e2b8..b9b989966 100644 --- a/client/cmdlfhitag.c +++ b/client/cmdlfhitag.c @@ -84,13 +84,13 @@ static int usage_hitag_reader(void) { PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, " HitagS (0*)"); - PrintAndLogEx(NORMAL, " 01 Challenge, read all pages from a Hitag S tag"); - PrintAndLogEx(NORMAL, " 02 Set to 0 if no authentication is needed. Read all pages from a Hitag S tag"); + PrintAndLogEx(NORMAL, " 01 Read all pages, challenge mode"); + PrintAndLogEx(NORMAL, " 02 Read all pages, crypto mode. Set key=0 for no auth"); PrintAndLogEx(NORMAL, " Hitag1 (1*)"); PrintAndLogEx(NORMAL, " Hitag2 (2*)"); - PrintAndLogEx(NORMAL, " 21 Password mode"); - PrintAndLogEx(NORMAL, " 22 Authentication"); - PrintAndLogEx(NORMAL, " 23 Authentication, key is in format: ISK high + ISK low"); + PrintAndLogEx(NORMAL, " 21 Read all pages, password mode. Default: 4D494B52 (\"MIKR\")"); + PrintAndLogEx(NORMAL, " 22 Read all pages, challenge mode"); + PrintAndLogEx(NORMAL, " 23 Read all pages, crypto mode. Key format: ISK high + ISK low. Default: 4F4E4D494B52 (\"ONMIKR\")"); PrintAndLogEx(NORMAL, " 25 Test recorded authentications"); PrintAndLogEx(NORMAL, " 26 Just read UID"); return 0; @@ -99,14 +99,15 @@ static int usage_hitag_writer(void) { PrintAndLogEx(NORMAL, "Hitag writer functions"); PrintAndLogEx(NORMAL, "Usage: lf hitag write [h] "); PrintAndLogEx(NORMAL, "Options:"); - PrintAndLogEx(NORMAL, " h This help"); + PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, " HitagS (0*)"); - PrintAndLogEx(NORMAL, " 03 (Challenge) write page on a Hitag S tag"); - PrintAndLogEx(NORMAL, " 04 (set to 0 if no authentication is needed) write page on a Hitag S tag"); + PrintAndLogEx(NORMAL, " 03 Write page, challenge mode"); + PrintAndLogEx(NORMAL, " 04 Write page, crypto mode. Set key=0 for no auth"); PrintAndLogEx(NORMAL, " Hitag1 (1*)"); PrintAndLogEx(NORMAL, " Hitag2 (2*)"); - PrintAndLogEx(NORMAL, " 24 (set to 0 if no authentication is needed) write page on a Hitag2 tag"); - PrintAndLogEx(NORMAL, " 27 write page on a Hitag2 tag"); + PrintAndLogEx(NORMAL, " 24 Write page, crypto mode. Key format: ISK high + ISK low."); + PrintAndLogEx(NORMAL, " Default: 4F4E4D494B52 (\"ONMIKR\"). Set key=0 for no auth"); + PrintAndLogEx(NORMAL, " 27 Write page, password mode. Default: 4D494B52 (\"MIKR\")"); return 0; } static int usage_hitag_checkchallenges(void) { From f913f7156a2085007e9c38fbec5e09875fb07583 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 5 Aug 2019 19:25:51 +0100 Subject: [PATCH 3/8] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d7da93c..90f193bd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Rework hitag2 read/write help (@ViRb3) - Add 'lf nedap' - encoding / decoding (anon) - Add client option `-i` to stay in interactive mode after a script or command (@DidierStevens/@doegox) - Add VSCode tasks (@ViRb3) From d158ffebfde96489b9805bd06b8a89b6469a7108 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 6 Aug 2019 19:13:38 +0100 Subject: [PATCH 4/8] Note that hitag1 read/write not yet implemented --- client/cmdlfhitag.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/cmdlfhitag.c b/client/cmdlfhitag.c index b9b989966..a1fb3415b 100644 --- a/client/cmdlfhitag.c +++ b/client/cmdlfhitag.c @@ -87,6 +87,7 @@ static int usage_hitag_reader(void) { PrintAndLogEx(NORMAL, " 01 Read all pages, challenge mode"); PrintAndLogEx(NORMAL, " 02 Read all pages, crypto mode. Set key=0 for no auth"); PrintAndLogEx(NORMAL, " Hitag1 (1*)"); + PrintAndLogEx(NORMAL, " Not implemented"); PrintAndLogEx(NORMAL, " Hitag2 (2*)"); PrintAndLogEx(NORMAL, " 21 Read all pages, password mode. Default: 4D494B52 (\"MIKR\")"); PrintAndLogEx(NORMAL, " 22 Read all pages, challenge mode"); @@ -104,6 +105,7 @@ static int usage_hitag_writer(void) { PrintAndLogEx(NORMAL, " 03 Write page, challenge mode"); PrintAndLogEx(NORMAL, " 04 Write page, crypto mode. Set key=0 for no auth"); PrintAndLogEx(NORMAL, " Hitag1 (1*)"); + PrintAndLogEx(NORMAL, " Not implemented"); PrintAndLogEx(NORMAL, " Hitag2 (2*)"); PrintAndLogEx(NORMAL, " 24 Write page, crypto mode. Key format: ISK high + ISK low."); PrintAndLogEx(NORMAL, " Default: 4F4E4D494B52 (\"ONMIKR\"). Set key=0 for no auth"); From c58937b5f5644b2aae84a50c7c6e7514ac7eebfe Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 9 Aug 2019 11:50:40 +0200 Subject: [PATCH 5/8] client: clean deps while cleaning objects --- armsrc/Makefile | 1 + client/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/armsrc/Makefile b/armsrc/Makefile index 2901d5a77..488bb0cac 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -204,6 +204,7 @@ tarbin: $(OBJS) $(Q)$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(OBJS:%=armsrc/%) $(OBJS:%.s19=armsrc/%.elf) clean: + $(Q)$(DELETE) $(DEPENDENCY_FILES) $(Q)$(DELETE) $(OBJDIR)$(PATHSEP)*.o $(Q)$(DELETE) $(OBJDIR)$(PATHSEP)*.elf $(Q)$(DELETE) $(OBJDIR)$(PATHSEP)*.s19 diff --git a/client/Makefile b/client/Makefile index b0544ced4..47a890d0a 100644 --- a/client/Makefile +++ b/client/Makefile @@ -292,7 +292,7 @@ ifeq "$(SUPPORTS_AVX512)" "True" endif BINS = proxmark3 flasher fpga_compress -CLEAN = $(BINS) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua +CLEAN = $(BINS) $(DEPENDENCY_FILES) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua # need to assign dependancies to build these first... all: lua_build jansson_build mbedtls_build cbor_build $(BINS) From 92122877d0678bfbfa9714b2960dd9c89380a80c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 9 Aug 2019 12:04:22 +0200 Subject: [PATCH 6/8] fix nonce2key typo --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5817b80bf..d3305bb5e 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ recovery/%: FORCE cleanifplatformchanged bootrom/% armsrc/% $(Q)$(MAKE) --no-print-directory -C recovery $(patsubst recovery/%,%,$@) FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites) -.PHONY: all clean help _test bootrom flash-bootrom os flash-os flash-all recovery client mfkey nounce2key style checks FORCE udev accessrights cleanifplatformchanged +.PHONY: all clean help _test bootrom flash-bootrom os flash-os flash-all recovery client mfkey nonce2key style checks FORCE udev accessrights cleanifplatformchanged help: @echo "Multi-OS Makefile" @@ -73,7 +73,7 @@ help: @echo @echo "+ client - Make only the OS-specific host client" @echo "+ mfkey - Make tools/mfkey" - @echo "+ nounce2key - Make tools/nounce2key" + @echo "+ nonce2key - Make tools/nonce2key" @echo @echo "+ style - Apply some automated source code formatting rules" @echo "+ checks - Detect various encoding issues in source code" From 5051ea429d7d44d5a8ee7b46531e902f16fe2bc6 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 9 Aug 2019 13:02:10 +0200 Subject: [PATCH 7/8] typo --- client/cmdhfmfdes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cmdhfmfdes.c b/client/cmdhfmfdes.c index 5dd4489f6..c5a54735a 100644 --- a/client/cmdhfmfdes.c +++ b/client/cmdhfmfdes.c @@ -358,7 +358,7 @@ void getKeySettings(uint8_t *aid) { str = "All keys (except AMK,see Bit0) within this application are frozen"; break; default: - str = "Authentication with the specified key is necessary to change any ley. A change key and a PICC master key (CMK) can only be changed after authentication with the master key. For keys other then the master or change key, an authentication with the same key is needed."; + str = "Authentication with the specified key is necessary to change any key. A change key and a PICC master key (CMK) can only be changed after authentication with the master key. For keys other then the master or change key, an authentication with the same key is needed."; break; } PrintAndLogEx(NORMAL, "Changekey Access rights"); From 7722f3af992df1f0fb1822286863fe4c67bea3a4 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 9 Aug 2019 16:03:14 +0200 Subject: [PATCH 8/8] Guard Makefile.hal against Make trying to remake it --- common/Makefile.hal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/Makefile.hal b/common/Makefile.hal index 68de2b154..af80bc6ac 100644 --- a/common/Makefile.hal +++ b/common/Makefile.hal @@ -2,6 +2,8 @@ PLATFORM?=PM3RDV4 # Standalone Mode info (path depends if make is called at top or from armsrc) +# Guard Makefile.hal against implicit rules: (with % to avoid being first goal) +%/Makefile.hal: ; -include armsrc/Standalone/Makefile.hal -include Standalone/Makefile.hal ifndef DEFAULT_STANDALONE