mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge branch 'master' into master
This commit is contained in:
+8
-4
@@ -40,6 +40,7 @@ Makefile.platform
|
||||
|
||||
# cmake
|
||||
client/build/
|
||||
client/android/build/
|
||||
|
||||
# Coverity
|
||||
cov-int/
|
||||
@@ -60,9 +61,9 @@ flasher
|
||||
!flasher/
|
||||
lua
|
||||
luac
|
||||
fpga_compress
|
||||
mfkey32
|
||||
mfkey64
|
||||
tools/fpga_compress/fpga_compress
|
||||
tools/mfkey/mfkey32
|
||||
tools/mfkey/mfkey64
|
||||
tools/nonce2key/nonce2key
|
||||
|
||||
fpga/*
|
||||
@@ -87,7 +88,7 @@ client/dumps/*
|
||||
*.ice
|
||||
*.new
|
||||
armsrc/TEMP EMV/*
|
||||
tools/mf_nonce_brute/*
|
||||
tools/mf_nonce_brute/mf_nonce_brute
|
||||
tools/andrew/*
|
||||
tools/jtag_openocd/openocd_configuration
|
||||
ppls patches/*
|
||||
@@ -99,3 +100,6 @@ client/lualibs/pm3_cmd.lua
|
||||
fpga_version_info.c
|
||||
|
||||
.proxmark3/*
|
||||
|
||||
# .tmp files are created during compilation
|
||||
*.tmp
|
||||
|
||||
+5
-3
@@ -8,7 +8,7 @@ os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
|
||||
osx_image: xcode11
|
||||
|
||||
@@ -28,6 +28,8 @@ addons:
|
||||
- gcc-arm-none-eabi
|
||||
- libnewlib-dev
|
||||
- libbluetooth-dev
|
||||
- python3-dev
|
||||
- libbz2-dev
|
||||
homebrew:
|
||||
packages:
|
||||
- readline
|
||||
@@ -54,9 +56,9 @@ install:
|
||||
script:
|
||||
- if [ "$TO_TEST" = "MAKEFILE" ]; then
|
||||
make clean && make V=1 "$MAKE_PARAMS";
|
||||
./pm3test.sh;
|
||||
make check;
|
||||
fi
|
||||
- if [ "$TO_TEST" = "CMAKE" ]; then
|
||||
mkdir -p client/build && ( cd client/build && cmake .. && make VERBOSE=1 );
|
||||
PM3BIN=./client/build/proxmark3 ./pm3test.sh client;
|
||||
make client/check CHECKARGS="--clientbin ./client/build/proxmark3";
|
||||
fi
|
||||
|
||||
+144
-7
@@ -3,13 +3,149 @@ 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]
|
||||
- Added lf em functions: 4x50_info, 4x50_write, 4x50_write_password (@tharexde)
|
||||
- Fix em4x50 demodulation error (@tharexde)
|
||||
- Fix `hf mfdes` authentification issues, DES working (@bkerler)
|
||||
- Add Android cross-compilation to client cmake (@dxl, @doegox)
|
||||
- Fix `emv scan` - now saves in current folder and uses unique names (@iceman1001)
|
||||
- Fix pm3.sh - parse COM ports larger than one digit (@doegox)
|
||||
- Fix stack size and automatically use available space for BigBuf. Stack is now 5K (@slurdge)
|
||||
- Added Mifare MAD Card Holder Information decoding (@lukaskuzmiak)
|
||||
- Change Better precision for HF and LF voltage measurements and Add theremin.py script (@rosco)
|
||||
- Added Mifare MAD Info Byte decoding. Easier to identify Card Publisher (@lukaskuzmiak)
|
||||
- Change use system Bzip2 library instead of Zlib for hardnested tables, tables are now 7x smaller (@doegox)
|
||||
- Change pushed some ARM source to compile with THUMB. Saves a lot of space of ARM flash memory (@slurdge)
|
||||
- Change from using ZLIB compression of FPGA images in ARM to LZ4. 15%+ speedups when swapping between HF & LF now (@slurdge)
|
||||
- Fix `emv scan -w` - hash mismatch, solution similar to below (@iceman1001)
|
||||
- Fix 'emv roca' - hash mismatch, merged from offical repo (@pwpiwi)
|
||||
- Fix 'lf ti demod' - now calculates correct crc (@iceman1001)
|
||||
- Add Python3 as possible script engine (@iceman1001, @doegox)
|
||||
- Add doc/mfu_binary_format_notes.md (@iceman1001)
|
||||
- Fix `hf mfu dump` - now reads Ulev1 3counter vs NTAG 1 counters (@iceman1001)
|
||||
- Fix `hf mfu info` - now print correct cfg1 - nfc protection (@iceman1001)
|
||||
- Fix `hf mfu eload` - now detects and converts between plain/old/new mfu binary format (@iceman1001)
|
||||
- Change, hitag2crack now integrated into main Makefile, tests added (@doegox)
|
||||
- Add `make check` mechanics (@doegox)
|
||||
- Change, log files moved to subfolders (@doegox)
|
||||
- Change, use system Lua library if available (@doegox)
|
||||
- Change, use system Jansson library if available (@doegox)
|
||||
- Change, use system Whereami library if available (@doegox)
|
||||
- Change, use system Zlib library if available (@doegox)
|
||||
- Fix release version information (@doegox)
|
||||
|
||||
## [ice coffee.4.9237][2020-05-21]
|
||||
- Updated documentation (@doegox, @iceman1001)
|
||||
- Change `pm3test.sh` - more regression tests to (@doegox, @iceman1001)
|
||||
- Change `hf 15 dump` - now supports basic json format (@iceman1001)
|
||||
- Change Test and fix many `-Wxxxxxx` warnings [compiler trials] (@doegox)
|
||||
- Fix COVERITY warnings [compiler trials] (@doegox, @iceman1001)
|
||||
- Fix CPPCHECKER warnings [compiler trials] (@doegox, @iceman1001)
|
||||
- Fix CLANG warnings [compiler trials] (@doegox)
|
||||
- Change, stricter warnings [compiler trials] (@doegox)
|
||||
- Change, remove section version_information for client (@doegox)
|
||||
- Change, Add RELEASE_NAME (@doegox)
|
||||
- Change, version info also for client (@doegox)
|
||||
- Added `make release` (@doegox)
|
||||
- Change `trace load` - err if offline mode (@doegox)
|
||||
- Fix `standalone mode matty_run` eloadcard (@iceman1001)
|
||||
- Added, HF 15 traces (@FlUxIUS)
|
||||
- Fix, follow naming conventions [android] (@dxl)
|
||||
- Change, work directory supported [android] (@dxl)
|
||||
- Added `lf fdx demod` - decoding of Bio-Thermo lf tag. Thanks to Rosco! (@iceman1001)
|
||||
- Fix, 32-bit time_t compilation error on [WIN64] (@grspy)
|
||||
- Change, LogTrace error msg (@doegox)
|
||||
- Change, remove inline [compiler trials] (@iceman1001)
|
||||
- Change, adding execute/home/current working directory functions to lua (<@iceman1001)
|
||||
- Change, fix max duration in LogTrace (@doegox)
|
||||
- Change, first attempt for trace log header (@iceman1001)
|
||||
- Change, pm3.sh, attempt to detect BT dongle when udevadm is not available (@doegox)
|
||||
- Change, pm3.sh, test access to /dev/ttyXXX files as prerequisite for [linux] (@doegox)
|
||||
- iclass bf: avoid slowdown (@doegox)
|
||||
- Change, pm3tests.sh, shellcheck (@doegox)
|
||||
- Change, pm3.sh, shellcheck (@doegox)
|
||||
- Change, pm3.sh, err msgs on stderr (@doegox)
|
||||
- Change, pm3.sh, textual and --list with no device, exit 1 (@doegox)
|
||||
- Change, pm3.sh, without udev: change detection routine (@doegox)
|
||||
- Change, pm3.sh, alternative if udevadm is not available [termux] (@doegox)
|
||||
- Change `makefiles` - allow to skip pthread [termux] (@doegox)
|
||||
- Change `script run test_t55x7` - enabled param to swap modulation to test (@iceman1001)
|
||||
- Add mf_nonce_brute from https://github.com/@iceman1001/mf_nonce_brute and merge to pm3 Makefile (@doegox)
|
||||
- Change `lf indala demod` - more lenient size check (@iceman1001)
|
||||
- Change clarify BUTTON macro usages (@doegox)
|
||||
- Change fix REV macros & hitagS (@doegox)
|
||||
- Change, `hf iclass loclass` -removed printvar function (@iceman1001)
|
||||
- Change, clock can be negative (@iceman1001)
|
||||
- Change `data tune` (@doegox)
|
||||
- fancy timers (@doegox)
|
||||
- Change, copied from pm3 repo (@iceman1001)
|
||||
- Change psk demodualtion, keep starting samples to easily find the zero init bit (@iceman1001)
|
||||
- Change use machine/endian.h with osx (Jamie Fiedler)
|
||||
- Fix 2 issues in proxendian.h (@doegox)
|
||||
- Fix issue #729. Avoid stalling on non-rdv4 when polling for FeliCa without card in proximity (@doegox)
|
||||
- Change `lf nexwatch demod` - lenient demod sizes (@iceman1001)
|
||||
- Change `lf nexwath sim/clone` - now supports 88bit format direct. (@iceman1001)
|
||||
- Rewrited `standalone mode lf_em4100rwc `, added card bruteforce mode. (Dmitriy Loginoov)
|
||||
- Change `data load` - color (@iceman1001)
|
||||
- Change appveyor verbose (@doegox)
|
||||
- Change `lf nexwatch demod` - now detects type, and show parity /chksum (@iceman1001)
|
||||
- Change `lfsampling` - interruptible only when logging not yet triggered (@doegox)
|
||||
- Change `lf keri demod - more leanient when it comes to bits (@iceman1001)
|
||||
- fix, proper filtering of RL markers (@doegox)
|
||||
- Change, clean deps [compiler trials] (@doegox)
|
||||
- Change, remove c99 restrictions [compiler trials] (@doegox)
|
||||
- Added tracelog file for hf mfu sniff or a ntag (@iceman1001)
|
||||
- Change `trace list` - different alloc (@iceman1001)
|
||||
- Change, convert OLD -> MIX (@iceman1001)
|
||||
- Change `trace list` - adjust messages (@iceman1001)
|
||||
- Fix a mem corruption in `trace load/list` (@doegox)
|
||||
- Change, rework banners (@doegox)
|
||||
- Change, Let's see if the prompt suffixed spaces are still needed.(@doegox)
|
||||
- Fix colored readline prompt bug (@doegox)
|
||||
- Change, simpler ul_print_type (@doegox)
|
||||
- Fix cmake for reveng [compiler trials] (@doegox)
|
||||
- Change, hook reveng outputs to pm3 machinery, add regression test (@doegox)
|
||||
- Change, cmake android: add backslashes for host compatibility [compiler trials](@doegox)
|
||||
- Change, Translation some comments from Chinese to English. [android] (@dxl)
|
||||
- Change, cmake android: use common cmake files for deps [android] (@doegox)
|
||||
- Fix, proper way to fix reveng getopt bug(@doegox)
|
||||
- Change, cmake deps: add prefix pm3rrg_rdv4_ [compiler trials] (@doegox)
|
||||
- Change, cmake deps: add -fPIC so they can be integrated in a pm3 shared lib [compiler trials] (@doegox)
|
||||
- Change, platform adaptation [android] (@dxl)
|
||||
- Change, don't mix ifdef and defined [android] (@dxl)
|
||||
- fix `trace list`- too short array for explanation (@iceman1001)
|
||||
- Change, check for sim module fw file (@iceman1001)
|
||||
- Change, rpi aling warning [compiler trials] (@iceman1001)
|
||||
- Change, more LF demodulation tests (@iceman1001)
|
||||
- Change, update whereami and avoid compiling unnneded troublesome parts [compiler trials] (@doegox)
|
||||
- Change, rework C includes in C++ [compiler trials] (@doegox)
|
||||
- Change, leanient parsing of tcp:/bt:/socket: vars (@iceman1001)
|
||||
- Change, add bluetooth group to `make accessrights` (@iceman1001)
|
||||
- Change, `Makefile` - fix PKG_CONFIG_ENV (@uli)
|
||||
- Change, `f sim` - now only fills until bigbuffer is full (@iceman1001)
|
||||
- Change, `hf mf hardnested` - don't drop field when in test mode (@doegox)
|
||||
- Change, `lf sim` - better to return err on faulty offset, thanks @iceman (@doegox)
|
||||
- Change, `lf sim` - fix offset of last packet (@doegox)
|
||||
- Change, `client Makefile` - make sure to rebuild deps when needed [compiler trials](@doegox)
|
||||
- Change, silent err if dbus absent [linux] (@doegox)
|
||||
- Change, `pm3.sh` - for direct bt devices (@doegox)
|
||||
- Change, `pm3.sh` - moved WSL/PS3.x bt native to be tested first. Since call to Win32_serialport crashes it. (@iceman1001)
|
||||
- Change, `pm3.sh` - Bt dongle, bt direct listing of serial ports on WSL and PS3.x, now using powershell.exe since wmic is deprecated (@iceman1001)
|
||||
- Change, remove libsndfile (@doegox)
|
||||
- Change, enforce PACKED structs [compiler trials] (@iceman1001)
|
||||
- Change, adjust number of threads according to cpu (@iceman1001)
|
||||
- Change, `hitag2crack` compile flags(@doegox)
|
||||
- Change, msdsal fix bug after var de-shadowing (@doegox)
|
||||
- Change, lighter msg for loading prefs, json will anyway always tell the filename (@doegox)
|
||||
- Change, make sure colors and emoji are disabled when not on TTY (@doegox)
|
||||
- Added `pref` command. PM3 client now support user preferences saved to a json file. (@mwalker33)
|
||||
- Added native support for Bluetooth in client [linux] (@doegox)
|
||||
- Added `LF_EM4100RSWB` (based on `LF_EM4100RWC`) standalone mode to read/sim/clone/brute EM4100 cards (@Monster1024)
|
||||
- Added `HF_MSDSAL` standalone mode which read and emulate Visa EMV cards (@Netxing)
|
||||
- Added Mifare Ultralight tear off experiment (@cintainfinita and @fukmar)
|
||||
- Added `hf mfu tear` - Mifare Ultralight tear off experiment (@cintainfinitam, @fukmar)
|
||||
- Added Mifare Desfire Read/Write/Create files/records/values functionality and several fixes to `hf mfdes` (@bkerler)
|
||||
- Added CreateStdFile command to Mifare `hf mfdes` (@bkerler)
|
||||
- Rework des/3des/3k3des/aes auth. Port to mbedtls crypto library on device (@bkerler)
|
||||
- Port 'hf mfdes' Authentification to CommandNG structure, fix auth session key (@bkerler)
|
||||
- Port `hf mfdes` Authentification to CommandNG structure, fix auth session key (@bkerler)
|
||||
- Updates `hf mfdes` functions, improved logging and added new commands (@bkerler)
|
||||
- Updated 'legic.lua' and 'legic_clone.lua' script - works with current command set (@Pizza_4u)
|
||||
- Rewrote `hf mfdes` functions and added apdu debugging (@bkerler)
|
||||
@@ -18,10 +154,11 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
||||
- Improved `hf 14a info` - card detection handling (@bkerler)
|
||||
- Updated helptext layout in all luascripts (@iceman1001)
|
||||
- Change `hf mfdes info` - output and logging (@bkerler)
|
||||
- Updated texts in legic commands (@ikarus23)
|
||||
- Updated texts in `hf legic` commands (@ikarus23)
|
||||
- Fix timing bug inside 40x5 (@mwalker33)
|
||||
- Refactored all Hitag2 attacks (@doegox)
|
||||
- Added two new Hitag2 attacks (@doegox)
|
||||
- Change `hf iclass decrypt` - limit amount of data to read if wrong app limit (@iceman1001)
|
||||
- Change `hf search` - now continue to search in case of dual tech cards (@iceman1001) Thanks to @ikarus23 for the suggestion!
|
||||
- Added `hf topas info` - old reader command, now also prints NDEF (@iceman1001)
|
||||
- Change `hf topaz reader` - now only prints lighter info, like UID. (@iceman1001)
|
||||
@@ -40,14 +177,14 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
||||
- Change - NDEF supports more signatures now (@iceman1001)
|
||||
- OSX Makefile now supports `make style` and `make checks` (@Pizza_4u)
|
||||
- Added `HF_LEGIC` standalone mode to read and simulate a Legic prime tag (@Pizza_4u)
|
||||
- Added keri MS decode/encode and update 'lf keri clone' to support MS fc/cid cloning. (@mwalker33)
|
||||
- Fix 'hf mfdes enum' - now actually manages to enumerate files under all AID's. :smiley: (@iceman1001)
|
||||
- Fix 'hf mfdes info' - now detects DESFire light and work properly Wrapped commands :+1: (@iceman1001)
|
||||
- Added keri MS decode/encode and update `lf keri clone` to support MS fc/cid cloning. (@mwalker33)
|
||||
- Fix `hf mfdes enum` - now actually manages to enumerate files under all AID's. :smiley: (@iceman1001)
|
||||
- Fix `hf mfdes info` - now detects DESFire light and work properly Wrapped commands :+1: (@iceman1001)
|
||||
- :smiling_imp: support (@doegox)
|
||||
- Additional colour changes as recommended by @iceman (@dunderhay)
|
||||
- Change type colour for `hf 14a` card types (@dunderhay)
|
||||
- Add colour to `hf mfdes` command (@dunderhay)
|
||||
- Add 'HINTS' command. Will turn off / on hint messages. Default mode is OFF. (@iceman1001)
|
||||
- Add `HINTS` command. Will turn off / on hint messages. Default mode is OFF. (@iceman1001)
|
||||
- Add colour to `hf 14a` and `hf mfu` commands (@dunderhay)
|
||||
- Add colour to `lf hid` commands (@dunderhay)
|
||||
- Change `script run hf_bruteforce -s start_id -e end_id -t timeout -x mifare_card_type` - The hf_bruteforce card script now requires Mifare type (mfc or mfu) (@dunderhay)
|
||||
|
||||
@@ -14,7 +14,9 @@ ifneq (,$(DESTDIR))
|
||||
endif
|
||||
endif
|
||||
|
||||
all clean install uninstall: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/% fpga_compress/%
|
||||
all clean install uninstall check: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/% mf_nonce_brute/% fpga_compress/%
|
||||
# hitag2crack toolsuite is not yet integrated in "all", it must be called explicitly: "make hitag2crack"
|
||||
#all clean install uninstall check: %: hitag2crack/%
|
||||
|
||||
INSTALLTOOLS=pm3_eml2lower.sh pm3_eml2upper.sh pm3_mfdread.py pm3_mfd2eml.py pm3_eml2mfd.py findbits.py rfidtest.pl xorcheck.py
|
||||
INSTALLSIMFW=sim011.bin sim011.sha512.txt
|
||||
@@ -78,12 +80,49 @@ ifeq ($(platform),Linux)
|
||||
endif
|
||||
$(Q)$(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH)
|
||||
|
||||
# tests
|
||||
mfkey/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
nonce2key/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
mf_nonce_brute/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
fpga_compress/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
bootrom/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
armsrc/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
client/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
recovery/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
hitag2crack/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
common/check: FORCE
|
||||
$(info [*] CHECK $(patsubst %/check,%,$@))
|
||||
$(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@)
|
||||
check: common/check
|
||||
$(info [*] ALL CHECKS DONE)
|
||||
|
||||
mfkey/%: FORCE
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C tools/mfkey $(patsubst mfkey/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
nonce2key/%: FORCE
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C tools/nonce2key $(patsubst nonce2key/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
mf_nonce_brute/%: FORCE
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C tools/mf_nonce_brute $(patsubst mf_nonce_brute/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
fpga_compress/%: FORCE
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C tools/fpga_compress $(patsubst fpga_compress/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
@@ -101,9 +140,12 @@ recovery/install: bootrom/all armsrc/all
|
||||
recovery/%: FORCE cleanifplatformchanged
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C recovery $(patsubst recovery/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
hitag2crack/%: FORCE
|
||||
$(info [*] MAKE $@)
|
||||
$(Q)$(MAKE) --no-print-directory -C tools/hitag2crack $(patsubst hitag2crack/%,%,$@) DESTDIR=$(MYDESTDIR)
|
||||
FORCE: # Dummy target to force remake in the subdirectories, even if files exist (this Makefile doesn't know about the prerequisites)
|
||||
|
||||
.PHONY: all clean install uninstall help _test bootrom fullimage recovery client mfkey nonce2key style checks FORCE udev accessrights cleanifplatformchanged
|
||||
.PHONY: all clean install uninstall help _test bootrom fullimage recovery client mfkey nonce2key mf_nonce_brute hitag2crack style miscchecks release FORCE udev accessrights cleanifplatformchanged
|
||||
|
||||
help:
|
||||
@echo "Multi-OS Makefile"
|
||||
@@ -122,10 +164,14 @@ help:
|
||||
@echo "+ client - Make only the OS-specific host client"
|
||||
@echo "+ mfkey - Make tools/mfkey"
|
||||
@echo "+ nonce2key - Make tools/nonce2key"
|
||||
@echo "+ mf_nonce_brute - Make tools/mf_nonce_brute"
|
||||
@echo "+ hitag2crack - Make tools/hitag2crack"
|
||||
@echo "+ fpga_compress - Make tools/fpga_compress"
|
||||
@echo
|
||||
@echo "+ style - Apply some automated source code formatting rules"
|
||||
@echo "+ checks - Detect various encoding issues in source code"
|
||||
@echo "+ check - Run offline tests. Set CHECKARGS to pass arguments to the test script"
|
||||
@echo "+ .../check - Run offline tests against specific target. See above."
|
||||
@echo "+ miscchecks - Detect various encoding issues in source code"
|
||||
@echo
|
||||
@echo "Possible platforms: try \"make PLATFORM=\" for more info, default is PM3RDV4"
|
||||
@echo "To activate verbose mode, use make V=1"
|
||||
@@ -152,8 +198,12 @@ mfkey: mfkey/all
|
||||
|
||||
nonce2key: nonce2key/all
|
||||
|
||||
mf_nonce_brute: mf_nonce_brute/all
|
||||
|
||||
fpga_compress: fpga_compress/all
|
||||
|
||||
hitag2crack: hitag2crack/all
|
||||
|
||||
newtarbin:
|
||||
$(RM) proxmark3-$(platform)-bin.tar proxmark3-$(platform)-bin.tar.gz
|
||||
@touch proxmark3-$(platform)-bin.tar
|
||||
@@ -164,7 +214,7 @@ tarbin: newtarbin client/tarbin armsrc/tarbin bootrom/tarbin
|
||||
|
||||
# detect if there were changes in the platform definitions, requiring a clean
|
||||
cleanifplatformchanged:
|
||||
ifeq ($(PLATFORM_CHANGED), true)
|
||||
ifeq ($(PLATFORM_CHANGED),true)
|
||||
$(info [!] Platform definitions changed, cleaning bootrom/armsrc/recovery first...)
|
||||
$(Q)$(MAKE) --no-print-directory -C bootrom clean
|
||||
$(Q)$(MAKE) --no-print-directory -C armsrc clean
|
||||
@@ -211,7 +261,7 @@ style:
|
||||
--align-pointer=name {} \;
|
||||
|
||||
# Detecting weird codepages and tabs.
|
||||
checks:
|
||||
miscchecks:
|
||||
# Make sure recode is installed
|
||||
@which recode >/dev/null || ( echo "Please install 'recode' package first" ; exit 1 )
|
||||
@echo "Files with suspicious chars:"
|
||||
@@ -230,5 +280,39 @@ endif
|
||||
# @find . \( -name "*.[ch]" -or \( -name "*.cpp" -and -not -name "*.moc.cpp" \) -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "*.md" -or -name "*.txt" -or -name "*.awk" -or -name "*.v" \) \
|
||||
# -exec grep -lP '\\t' {} \;
|
||||
|
||||
release: VERSION="v4.$(shell git log --oneline master | wc -l)"
|
||||
release:
|
||||
$(if $(findstring master,$(shell git rev-parse --abbrev-ref HEAD)),,$(error "!!! you are not on master branch, aborting"))
|
||||
$(if $(findstring dirty,$(shell git describe --dirty --always)),$(error "!!! you have pending changes, aborting"))
|
||||
$(if $(RELEASE_NAME),,$(error "!!! missing RELEASE_NAME, aborting"))
|
||||
# Preparing a commit for release tagging, to be reverted after tagging.
|
||||
@echo "# - Release Tag: $(VERSION)"
|
||||
@echo "# - Release Name: $(RELEASE_NAME)"
|
||||
# - Removing -Werror...
|
||||
@find . \( -path "./Makefile.defs" -or -path "./client/Makefile" -or -path "./common_arm/Makefile.common" -or -path "./tools/hitag2crack/*/Makefile" \) -exec sed -i 's/ -Werror//' {} \;
|
||||
@find . \( -path "./client/deps/*.cmake" -or -path "./client/CMakeLists.txt" \) -exec sed -i 's/ -Werror//' {} \;
|
||||
# - Changing banner...
|
||||
@sed -i "s/^#define BANNERMSG3 .*/#define BANNERMSG3 \"Release $(VERSION) - $(RELEASE_NAME)\"/" client/src/proxmark3.c
|
||||
@echo -n "# ";grep "^#define BANNERMSG3" client/src/proxmark3.c
|
||||
# - Committing temporarily...
|
||||
@git commit -a -m "Release $(VERSION) - $(RELEASE_NAME)"
|
||||
# - Tagging temporarily...
|
||||
@git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
|
||||
# - Changing default version information based on new tag
|
||||
@$(SH) tools/mkversion.sh > common/default_version.c.tmp && $(MV) common/default_version.c.tmp common/default_version.c
|
||||
# - Removing mkversion calls
|
||||
@sed -i 's#^.*\.\./tools/mkversion.sh.*|| #\t$$(Q)#' client/Makefile bootrom/Makefile armsrc/Makefile
|
||||
@sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt
|
||||
# - Deleting tag...
|
||||
@git tag -d $(VERSION)
|
||||
# - Amending commit...
|
||||
@git commit -a --amend -m "Release $(VERSION) - $(RELEASE_NAME)"
|
||||
# - Tagging again...
|
||||
@git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
|
||||
# - Reverting tagged commit...
|
||||
@git revert --no-edit HEAD
|
||||
@echo "==================================================================="
|
||||
@echo "Done! You can now execute 'git push && git push origin $(VERSION)'"
|
||||
|
||||
# Dummy target to test for GNU make availability
|
||||
_test:
|
||||
|
||||
@@ -24,6 +24,9 @@ CROSS ?= arm-none-eabi-
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
LD = g++
|
||||
SH = sh
|
||||
BASH = bash
|
||||
PERL = perl
|
||||
|
||||
PATHSEP=/
|
||||
PREFIX ?= /usr/local
|
||||
@@ -63,6 +66,7 @@ endif
|
||||
EXTRACFLAGS =
|
||||
EXTRACFLAGS += -Wunused-parameter -Wno-error=unused-parameter
|
||||
EXTRACFLAGS += -Wsign-compare -Wno-error=sign-compare
|
||||
EXTRACFLAGS += -Wconversion -Wno-error=conversion -Wno-error=sign-conversion -Wno-error=float-conversion
|
||||
|
||||
# unknown to clang or old gcc:
|
||||
# First we activate Wextra then we explicitly list those we know about
|
||||
|
||||
+3
-1
@@ -17,6 +17,8 @@ endif
|
||||
|
||||
CFLAGS ?= $(DEFCFLAGS)
|
||||
CFLAGS += $(MYDEFS) $(MYCFLAGS) $(MYINCLUDES)
|
||||
LDFLAGS += $(MYLDFLAGS)
|
||||
LDLIBS += $(MYLDLIBS)
|
||||
|
||||
vpath %.c $(MYSRCPATHS)
|
||||
|
||||
@@ -66,7 +68,7 @@ $(BINDIR)/$(LIB_A): $(MYOBJS)
|
||||
|
||||
$(BINDIR)/% : $(OBJDIR)/%.o $(MYOBJS) $(MYLIBS)
|
||||
$(info [=] LD $(notdir $@))
|
||||
$(Q)$(LD) $(LDFLAGS) $(MYOBJS) $< -o $@ $(MYLIBS)
|
||||
$(Q)$(LD) $(LDFLAGS) $(MYOBJS) $< -o $@ $(MYLIBS) $(MYLDLIBS)
|
||||
|
||||
$(OBJDIR)/%.o : %.c | $(OBJDIR)
|
||||
$(info [-] CC $<)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Run 'make PLATFORM=' to get an exhaustive list of possible parameters for this file.
|
||||
|
||||
PLATFORM=PM3RDV4
|
||||
#PLATFORM=PM3OTHER
|
||||
# If you want more than one PLATFORM_EXTRAS option, separate them by spaces:
|
||||
#PLATFORM_EXTRAS=BTADDON
|
||||
#STANDALONE=LF_SAMYRUN
|
||||
STANDALONE=LF_ICEHID
|
||||
#STANDALONE=HF_MSDSAL
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# RRG / Iceman repo - Proxmark3
|
||||
|
||||
|
||||
|
||||
|
||||
| Releases | Linux & OSX CI | Windows CI | Coverity |
|
||||
| ------------------- |:-------------------:| -------------------:| -------------------:|
|
||||
| [](https://github.com/RfidResearchGroup/proxmark3/releases/latest) | [](https://travis-ci.org/RfidResearchGroup/proxmark3) | [](https://ci.appveyor.com/project/RfidResearchGroup/proxmark3/branch/master) | [](https://scan.coverity.com/projects/proxmark3-rrg-iceman-repo)|
|
||||
| [](https://github.com/RfidResearchGroup/proxmark3/releases/latest) | [](https://travis-ci.org/RfidResearchGroup/proxmark3) | [](https://ci.appveyor.com/project/RfidResearchGroup/proxmark3/branch/master) | [](https://scan.coverity.com/projects/proxmark3-rrg-iceman-repo)|
|
||||
|
||||
|
||||
|
||||
@@ -16,15 +18,22 @@
|
||||
|[Why didn't you base it on official Proxmark3 Master?](#why-didnt-you-base-it-on-official-proxmark3-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)|
|
||||
|[Proxmark3 GUI](#proxmark3-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) ||
|
||||
|[Notes on UART](/doc/uart_notes.md)|[Maintainers](/doc/md/Development/Maintainers.md)|[Command Cheat sheet](/doc/cheatsheet.md)|
|
||||
|[Notes on frame format](/doc/new_frame_format.md)|[Advanced compilation parameters](/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md)|[More cheat sheets](https://github.com/RfidResearchGroup/proxmark3/wiki/More-cheat-sheets)|
|
||||
|[Notes on external flash](/doc/ext_flash_notes.md)||[EMV](/doc/emv_notes.md)|
|
||||
|[Notes on Termux / Android](/doc/termux_notes.md)|**[Troubleshooting](/doc/md/Installation_Instructions/Troubleshooting.md)**|[Complete client command set](/doc/commands.md)|
|
||||
|[Notes on tracedata / wireshark](/doc/trace_notes.md)|**[JTAG](/doc/jtag_notes.md)**||
|
||||
|[Notes on loclass](/doc/loclass_notes.md)|||
|
||||
|[Notes on paths](/doc/path_notes.md)|||
|
||||
|[Developing standalone mode](/armsrc/Standalone/readme.md)|[Wiki about standalone mode](https://github.com/RfidResearchGroup/proxmark3/wiki/Standalone-mode) ||
|
||||
|[Donations](#Donations)|||
|
||||
|[Donations](#Donations)|[Maintainers](/doc/md/Development/Maintainers.md)|[Command Cheat sheet](/doc/cheatsheet.md)|
|
||||
||[Advanced compilation parameters](/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md)|[More cheat sheets](https://github.com/RfidResearchGroup/proxmark3/wiki/More-cheat-sheets)|
|
||||
||**[Troubleshooting](/doc/md/Installation_Instructions/Troubleshooting.md)**|[Complete client command set](/doc/commands.md)|
|
||||
||**[JTAG](/doc/jtag_notes.md)**||
|
||||
|
||||
|
||||
## Notes / helpful documents
|
||||
|
||||
| Notes |||
|
||||
| ------------------- |:-------------------:| -------------------:|
|
||||
|[Notes on UART](/doc/uart_notes.md)|[Notes on Termux / Android](/doc/termux_notes.md)|[Notes on paths](/doc/path_notes.md)|
|
||||
|[Notes on frame format](/doc/new_frame_format.md)|[Notes on tracelog / wireshark](/doc/trace_notes.md)|[Notes on EMV](/doc/emv_notes.md)|
|
||||
|[Notes on external flash](/doc/ext_flash_notes.md)|[Notes on loclass](/doc/loclass_notes.md)|[Notes on Coverity Scan Config & Run](/doc/md/Development/Coverity-Scan-Config-%26-Run.md)|
|
||||
|[Notes on file formats used with Proxmark3](/doc/extensions_notes.md)|[Notes on MFU binary format](/doc/mfu_binary_format_notes.md)|[Notes on FPGA & ARM](/doc/fpga_arm_notes.md)|
|
||||
|[Developing standalone mode](/armsrc/Standalone/readme.md)|[Wiki about standalone mode](https://github.com/RfidResearchGroup/proxmark3/wiki/Standalone-mode)||
|
||||
|[Notes on Color usage](/doc/colors_notes.md)||
|
||||
|
||||
|
||||
## Build for non-RDV4 Proxmark3 platforms
|
||||
@@ -48,30 +57,63 @@ On the software side: quite a lot, see the [Changelog file](CHANGELOG.md).
|
||||
|
||||
This repo compiles nicely on
|
||||
- Proxspace v3.x
|
||||
- Windows/mingw environment with Qt5.6.1 & GCC 4.8
|
||||
- Ubuntu 1604, 1804, 1904
|
||||
- [latest release v3.4](https://github.com/Gator96100/ProxSpace/releases)
|
||||
- Windows/mingw environment with Qt5.6.1 & GCC 4.9
|
||||
- Ubuntu 1604 -> 2004
|
||||
- ParrotOS, Gentoo, Pentoo, Kali, Nethunter, Archlinux, Fedora, Debian
|
||||
- Rasbian
|
||||
- Android / Termux
|
||||
- Mac OS X / Homebrew
|
||||
- ParrotOS, Gentoo, Pentoo, Kali, Nethunter, Archlinux, Fedora
|
||||
- WSL, WSL2 (Windows subsystem linux) on Windows 10
|
||||
- Docker container
|
||||
- [ RRG / Iceman repo based ubuntu 18.04 container ](https://hub.docker.com/r/secopsconsult/proxmark3)
|
||||
- [ Iceman fork based container v1.7 ](https://hub.docker.com/r/iceman1001/proxmark3/)
|
||||
|
||||
Hardware to run client on
|
||||
- PC
|
||||
- Android
|
||||
- Raspberry Pi & Raspberry Pi Zero
|
||||
- Jetson Nano
|
||||
|
||||
## Precompiled binaries
|
||||
We don't maintain any precompiled binaries in this repo. There is community effort over at the Proxmark3 forum where @gator96100 has set up a google drive with many mingw binaries which is up-to-date. We link to these files here as to make it easier for users.
|
||||
If you are having troubles with these files, contact the package maintainer @gator96100 and read the [sticky thread at forum](http://www.proxmark.org/forum/viewtopic.php?pid=24763#p24763) where known issues has been documented.
|
||||
|
||||
|
||||
Ref:
|
||||
|
||||
- [Precompiled builds for RDV40 dedicated x86](https://drive.google.com/open?id=13zUs-aiQkYaSl5KWrBtuW5IWCoHJPsue)
|
||||
- [Precompiled builds for RDV40 dedicated x64](https://drive.google.com/open?id=1SyPB8t5Vo8O0Lh7PjNm3Kv-mO4BNbxjX)
|
||||
|
||||
- [Precompiled builds for RDV40 dedicated with Bluetooth addon x86](https://drive.google.com/open?id=1TqWYctkRvkLshQ1ZRBHPLDzYHR-asuMO)
|
||||
- [Precompiled builds for RDV40 dedicated with Bluetooth addon x64](https://drive.google.com/open?id=17ful7u2QyYmMQzQzc5fAf8nJvyoDJfSL)
|
||||
|
||||
Generice Proxmark3 devices (non RDV4)
|
||||
- [Precompiled builds for RRG / Iceman repository x86](https://drive.google.com/open?id=1PI3Xr1mussPBPnYGu4ZjWzGPARK4N7JR)
|
||||
- [Precompiled builds for RRG / Iceman repository x64](https://drive.google.com/open?id=1uX9RtYGinuFrpHybu4xq_BE3HrobI20e)
|
||||
|
||||
|
||||
## Roadmap
|
||||
The [public roadmap](https://github.com/RfidResearchGroup/proxmark3/wiki/Public-Roadmap) is an excellent start to read if you are interesting in contributing.
|
||||
|
||||
> 👉 **Remember!** If you intend to contribute to the code, please read the [coding style notes](HACKING.md) first.
|
||||
We usually merge your contributions fast since we do like the idea of getting a functionality in the Proxmark3 and weed out the bugs afterwards.
|
||||
|
||||
## Notes / helpful documents
|
||||
- notes on [Coverity Scan Config & Run](/doc/md/Development/Coverity-Scan-Config-%26-Run.md).
|
||||
- notes on [UART](/doc/uart_notes.md)
|
||||
- notes on [Frame format](/doc/new_frame_format.md)
|
||||
- notes on [external flash](/doc/ext_flash_notes.md)
|
||||
- notes on [standalone mode](https://github.com/RfidResearchGroup/proxmark3/wiki/Standalone-mode)
|
||||
- notes on [Termux / Android](/doc/termux_notes.md)
|
||||
- notes on [tracedata / Wireshark](/doc/trace_notes.md)
|
||||
- notes on [loclass](/doc/loclass_notes.md)
|
||||
- notes on [EMV](/doc/emv_notes.md)
|
||||
- notes on [Paths](/doc/path_notes.md)
|
||||
- notes on [file formats used with Proxmark3](/doc/extensions_notes.md)
|
||||
|
||||
## Issues & Troubleshooting
|
||||
Please search the [issues](https://github.com/rfidresearchgroup/proxmark3/issues) page here and see if your issue is listed in the first instance. Next place to visit is the [Proxmark Forum](http://www.proxmark.org/forum/index.php). Learn to search it well and finally Google / duckduckgo is your friend :) You will find many blogposts, youtube videos, tweets, reddit
|
||||
|
||||
Read the [Troubleshooting](/doc/md/Installation_Instructions/Troubleshooting.md) guide to weed out most known problems.
|
||||
|
||||
Offical channels
|
||||
- [Proxmark3 IRC channel](http://webchat.freenode.net/?channels=#proxmark3)
|
||||
- [Proxmark3 sub reddit](https://www.reddit.com/r/proxmark3/)
|
||||
- [Twitter](https://twitter.com/proxmark3/)
|
||||
|
||||
_no discord or slack channel_
|
||||
|
||||
Iceman has quite a few videos on his [youtube channel](https://www.youtube.com/c/ChrisHerrmann1001)
|
||||
|
||||
## Cheat sheet
|
||||
|
||||
Thanks to Alex Dibs, you can enjoy a [command cheat sheet](/doc/cheatsheet.md)
|
||||
@@ -90,13 +132,6 @@ The separation from official Proxmark3 repo gives us a lot of freedom to create
|
||||
The official PM3-GUI from Gaucho will not work.
|
||||
The new universal GUI will work. [Proxmark3 Universal GUI](https://github.com/burma69/PM3UniversalGUI) Almost, change needed in order to show helptext when client isn't connected to a device.
|
||||
|
||||
## Issues
|
||||
|
||||
Please see the [Proxmark Forum](http://www.proxmark.org/forum/index.php) and see if your issue is listed in the first instance Google is your friend :) Questions will be answered via the forum by Iceman and the team.
|
||||
|
||||
Read the [Troubleshooting](/doc/md/Installation_Instructions/Troubleshooting.md) guide to weed out most known problems.
|
||||
|
||||
|
||||
## The end
|
||||
|
||||
- July 2018 [@herrmann1001](https://mobile.twitter.com/herrmann1001)
|
||||
|
||||
+66
-202
@@ -1,5 +1,5 @@
|
||||
version: 3.0.1.{build}
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
clone_folder: C:\ProxSpace\pm3
|
||||
init:
|
||||
- ps: >-
|
||||
@@ -7,7 +7,6 @@ init:
|
||||
|
||||
#Get-ChildItem Env:
|
||||
|
||||
|
||||
$releasename=""
|
||||
|
||||
$env:APPVEYOR_REPO_COMMIT_SHORT = $env:APPVEYOR_REPO_COMMIT.Substring(0, 8)
|
||||
@@ -23,11 +22,12 @@ init:
|
||||
|
||||
Add-AppveyorMessage -Message "[$env:APPVEYOR_REPO_COMMIT_SHORT]$env:appveyor_repo_name($env:APPVEYOR_REPO_BRANCH)" -Category Information -Details "repository: $env:appveyor_repo_name branch: $env:APPVEYOR_REPO_BRANCH release: $releasename"
|
||||
|
||||
|
||||
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
clone_script:
|
||||
- ps: >-
|
||||
Write-Host "Removing ProxSpace..." -NoNewLine
|
||||
|
||||
$CloneTime=[System.Environment]::TickCount
|
||||
|
||||
cd \
|
||||
|
||||
@@ -152,24 +152,15 @@ clone_script:
|
||||
|
||||
ExecUpdate "update2" "C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start /dev/null" "terminate?MSYS2"
|
||||
|
||||
Add-AppveyorMessage -Message "ProxSpace download and update took $(([System.Environment]::TickCount-$CloneTime) / 1000) sec" -Category Information
|
||||
|
||||
Write-Host "Update " -NoNewLine
|
||||
|
||||
Write-Host "[ OK ]" -ForegroundColor Green
|
||||
install:
|
||||
- ps: >-
|
||||
function Exec-External {
|
||||
param(
|
||||
[Parameter(Position=0,Mandatory=1)][scriptblock] $command
|
||||
)
|
||||
& $command
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw ("Command returned non-zero error-code ${LASTEXITCODE}: $command")
|
||||
}
|
||||
}
|
||||
build_script:
|
||||
- ps: >-
|
||||
"C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;$env:Path"
|
||||
|
||||
$env:Path="C:\ProxSpace\msys2\usr\bin;C:\ProxSpace\msys2\mingw32\bin;C:\ProxSpace\gcc-arm-none-eabi\bin;c:\Python38;c:\Python38\Scripts;$env:Path"
|
||||
|
||||
$env:MINGW_HOME="C:\ProxSpace\msys2\mingw32"
|
||||
|
||||
@@ -185,9 +176,13 @@ build_script:
|
||||
|
||||
cd C:\ProxSpace\pm3
|
||||
|
||||
Write-Host "---------- make ----------" -ForegroundColor Yellow
|
||||
|
||||
$TestTime=[System.Environment]::TickCount
|
||||
|
||||
#make
|
||||
|
||||
bash -c -i 'pwd;make clean;make V=1'
|
||||
bash -c -i 'echo $PATH;pwd;make clean;make V=1'
|
||||
|
||||
|
||||
#some checks
|
||||
@@ -198,206 +193,75 @@ build_script:
|
||||
|
||||
}
|
||||
|
||||
if(!(Test-Path C:\ProxSpace\pm3\armsrc\obj\fullimage.elf)){
|
||||
cd c:\ProxSpace\pm3
|
||||
|
||||
throw "ARM file fullimage.elf not exists."
|
||||
bash -c -i 'make check'
|
||||
|
||||
$testspass = ($LASTEXITCODE -eq 0)
|
||||
|
||||
$global:TestsPassed=$testspass
|
||||
|
||||
if ($testspass) {
|
||||
Add-AppveyorTest -Name "make Tests" -Framework NUnit -Filename "make check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "make Tests [ OK ]" -ForegroundColor Green
|
||||
} else {
|
||||
Add-AppveyorTest -Name "make Tests" -Framework NUnit -Filename "make check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "make Tests [ ERROR ]" -ForegroundColor Red
|
||||
throw "Tests error."
|
||||
}
|
||||
|
||||
Write-Host "---------- btaddon ----------" -ForegroundColor Yellow
|
||||
|
||||
$TestTime=[System.Environment]::TickCount
|
||||
|
||||
if(!(Test-Path C:\ProxSpace\pm3\client\resources\hardnested_tables\*.bin.z)){
|
||||
|
||||
throw "Files in client\resources\hardnested_tables is not exists."
|
||||
|
||||
}
|
||||
|
||||
|
||||
#install
|
||||
|
||||
Write-Host "Installing..." -NoNewLine -ForegroundColor Yellow
|
||||
|
||||
New-Item -ItemType Directory -Force -Path C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
bash -c -i 'make install DESTDIR=Release PREFIX='
|
||||
|
||||
# dll files
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\libgcc_s_dw2-1.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\libstdc++-6.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\libwinpthread-1.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\Qt5Core.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\Qt5Gui.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\Qt5Widgets.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\libreadline*.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Copy-Item C:\ProxSpace\msys2\mingw32\bin\libtermcap-0.dll C:\ProxSpace\pm3\Release\bin
|
||||
|
||||
Write-Host "[ OK ]" -ForegroundColor Green
|
||||
|
||||
|
||||
#archive and push
|
||||
|
||||
$releasename=""
|
||||
|
||||
if ($env:appveyor_repo_tag -match "true"){
|
||||
|
||||
$releasename=$env:APPVEYOR_REPO_TAG_NAME + "/"
|
||||
|
||||
}
|
||||
|
||||
$releasename+=$env:APPVEYOR_BUILD_VERSION + " [" + $env:APPVEYOR_REPO_COMMIT.Substring(0, 7) + "]"
|
||||
|
||||
|
||||
Write-Host "Archive and publish release files ($releasename)..." -NoNewLine -ForegroundColor Yellow
|
||||
|
||||
cd C:\ProxSpace
|
||||
|
||||
7z a release.zip C:\ProxSpace\pm3\Release
|
||||
|
||||
Push-AppveyorArtifact release.zip -DeploymentName "$releasename"
|
||||
|
||||
Write-Host "[ OK ]" -ForegroundColor Green
|
||||
|
||||
|
||||
Write-Host "Builded..." -ForegroundColor Yellow
|
||||
test_script:
|
||||
- ps: >-
|
||||
$env:Path = "C:\ProxSpace\msys\bin;$env:Path"
|
||||
bash -c -i 'pwd;make clean;make PLATFORM_EXTRAS=BTADDON'
|
||||
|
||||
cd c:\ProxSpace\pm3
|
||||
|
||||
bash -c -i 'make check'
|
||||
|
||||
$global:TestsPassed=$true
|
||||
$testspass = ($LASTEXITCODE -eq 0)
|
||||
|
||||
|
||||
Function ExecTest($Name, $File, $Cmd, $CheckResult) {
|
||||
$global:TestsPassed=(($global:TestsPassed) -and ($testspass))
|
||||
|
||||
#--- begin Job
|
||||
|
||||
$Job = Start-Job -ScriptBlock {
|
||||
[bool]$res=$false
|
||||
$TestTime=[System.Environment]::TickCount
|
||||
$env:Path = "C:\ProxSpace\msys\bin;$env:Path"
|
||||
Set-Location $using:PWD
|
||||
|
||||
$sb=[scriptblock]::Create("$using:Cmd")
|
||||
#execute scriptblock
|
||||
Write-host "Test [$using:Name] job: $using:Cmd"
|
||||
$Cond=&$sb
|
||||
|
||||
if ($Cond -eq $null){
|
||||
} ElseIf($using:CheckResult -ne $null) {
|
||||
[String]$searchstr=""
|
||||
if ($Cond -is [Object]){
|
||||
ForEach($line in $Cond){
|
||||
Write-host $line -ForegroundColor Gray
|
||||
$searchstr += $line
|
||||
}
|
||||
}else{
|
||||
Write-host "$Cond" -ForegroundColor Gray
|
||||
$searchstr = $Cond
|
||||
}
|
||||
If($searchstr -like "*$using:CheckResult*") {
|
||||
$res=$true
|
||||
}
|
||||
$Cond="*$using:CheckResult*"
|
||||
} Else {
|
||||
If (!($Cond -is [bool] -or $Cond -is [byte] -or $Cond -is [int16] -or $Cond -is [int32] -or $Cond -is [int64] -or $Cond -is [float])){
|
||||
if ($Cond -is "String" -and $Cond -like "*passed*"){
|
||||
$res= $true
|
||||
}
|
||||
if ($Cond -is "String" -and $Cond -like "*true*"){
|
||||
$res= $true
|
||||
}
|
||||
ForEach($line in $Cond){
|
||||
if ($line -like "*passed*"){
|
||||
$res = $true
|
||||
$Cond = $line
|
||||
break
|
||||
}
|
||||
}
|
||||
} Else {
|
||||
$res=$Cond
|
||||
}
|
||||
}
|
||||
|
||||
If ($res) {
|
||||
Write-host "Result[$using:Name]: $Cond" -ForegroundColor Green
|
||||
Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
}Else {
|
||||
Write-host "Result[$using:Name]: $Cond" -ForegroundColor Red
|
||||
Add-AppveyorTest -Name "$using:Name" -Framework NUnit -Filename "$using:File" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)" -ErrorMessage "command:$using:Cmd`nresult:$Cond"
|
||||
}
|
||||
return $res
|
||||
if ($testspass) {
|
||||
Add-AppveyorTest -Name "BTaddon Tests" -Framework NUnit -Filename "make check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "BTaddon Tests [ OK ]" -ForegroundColor Green
|
||||
} else {
|
||||
Add-AppveyorTest -Name "BTaddon Tests" -Framework NUnit -Filename "make check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "BTaddon Tests [ ERROR ]" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host "---------- make clean ----------" -ForegroundColor Yellow
|
||||
|
||||
bash -c -i 'make clean'
|
||||
|
||||
Write-Host "---------- cmake ----------" -ForegroundColor Yellow
|
||||
|
||||
$TestTime=[System.Environment]::TickCount
|
||||
|
||||
#--- end Job
|
||||
cmd.exe /c 'C:\ProxSpace\msys2\msys2_shell.cmd -mingw32 -defterm -no-start -c "mkdir -p client/build; cd client/build; cmake -G""MSYS Makefiles"" ..; make VERBOSE=1;"'
|
||||
|
||||
Write-Host "---------- cmake tests ----------" -ForegroundColor Yellow
|
||||
|
||||
[bool]$res=$false
|
||||
# Wait 180 sec timeout for Job
|
||||
if(Wait-Job $Job -Timeout 180){
|
||||
$Results = $Job | Receive-Job
|
||||
if($Results -like "true"){
|
||||
$res=$true
|
||||
}
|
||||
} else {
|
||||
Write-host "Test [$Name] timeout" -ForegroundColor Red
|
||||
Add-AppveyorTest -Name "$Name" -Framework NUnit -Filename "$File" -Outcome Failed -Duration 60000 -ErrorMessage "timeout"
|
||||
}
|
||||
Remove-Job -Force $Job
|
||||
cd c:\ProxSpace\pm3
|
||||
|
||||
if(!$res){
|
||||
Write-host "--------------------- tests fail" -ForegroundColor Red
|
||||
$global:TestsPassed=$false
|
||||
}
|
||||
bash -c -i './tools/pm3_tests.sh --clientbin client/build/proxmark3.exe client'
|
||||
|
||||
$testspass = ($LASTEXITCODE -eq 0)
|
||||
|
||||
$global:TestsPassed=(($global:TestsPassed) -and ($testspass))
|
||||
|
||||
if ($testspass) {
|
||||
Add-AppveyorTest -Name "cmake Tests" -Framework NUnit -Filename "make client/check" -Outcome Passed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "cmake Tests [ OK ]" -ForegroundColor Green
|
||||
} else {
|
||||
Add-AppveyorTest -Name "cmake Tests" -Framework NUnit -Filename "make client/check" -Outcome Failed -Duration "$([System.Environment]::TickCount-$TestTime)"
|
||||
Write-Host "cmake Tests [ ERROR ]" -ForegroundColor Red
|
||||
}
|
||||
|
||||
|
||||
Write-Host "Running tests..." -ForegroundColor Yellow
|
||||
|
||||
|
||||
#file test
|
||||
|
||||
ExecTest "proxmark3 exists" "proxmark3.exe" {Test-Path C:\ProxSpace\pm3\Release\bin\proxmark3.exe}
|
||||
|
||||
ExecTest "arm bootrom exists" "bootrom.elf" {Test-Path C:\ProxSpace\pm3\Release\share\proxmark3\firmware\bootrom.elf}
|
||||
|
||||
ExecTest "arm image exists" "fullimage.elf" {Test-Path C:\ProxSpace\pm3\Release\share\proxmark3\firmware\fullimage.elf}
|
||||
|
||||
ExecTest "arm recovery image exists" "proxmark3_recovery.bin" {Test-Path C:\ProxSpace\pm3\Release\share\proxmark3\firmware\proxmark3_recovery.bin}
|
||||
|
||||
ExecTest "hardnested tables exists" "hardnested" {Test-Path C:\ProxSpace\pm3\Release\share\proxmark3\resources\hardnested_tables\*.z}
|
||||
|
||||
ExecTest "release exists" "release.zip" {Test-Path C:\ProxSpace\release.zip}
|
||||
|
||||
|
||||
#proxmark logic tests
|
||||
|
||||
ExecTest "proxmark help" "proxmark3 -h" {bash -lc 'cd ~/client;./proxmark3 -h 2>&1 | grep -q wait && 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 2>&1 | grep -q hardnested && echo passed || echo failed'}
|
||||
|
||||
|
||||
ExecTest "hf mf offline text" "hf mf" {bash -lc "cd ~/client;./proxmark3 -c 'hf mf'"} "at_enc"
|
||||
|
||||
#proxmark crypto tests
|
||||
|
||||
# Long tests:
|
||||
# ExecTest "hf mf hardnested" "hf mf hardnested" {bash -lc "cd ~/client;./proxmark3 -c 'hf mf hardnested t 1 000000000000'"} "found:"
|
||||
# ExecTest "hf mf iclass" "hf mf iclass" {bash -lc "cd ~/client;./proxmark3 -c 'hf iclass loclass t l'"} "verified ok"
|
||||
# ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 -c 'emv test -i -l'"} "Test?s? ? OK"
|
||||
# Short tests:
|
||||
ExecTest "hf mf iclass" "hf mf iclass" {bash -lc "cd ~/client;./proxmark3 -c 'hf iclass loclass t'"} "OK!"
|
||||
ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 -c 'emv test -i'"} "Test?s? ? OK"
|
||||
|
||||
|
||||
|
||||
test_script:
|
||||
- ps: >-
|
||||
if ($global:TestsPassed) {
|
||||
Write-Host "Tests [ OK ]" -ForegroundColor Green
|
||||
} else {
|
||||
@@ -409,4 +273,4 @@ on_success:
|
||||
on_failure:
|
||||
- ps: Write-Host "Build error." -ForegroundColor Red
|
||||
on_finish:
|
||||
- ps: # $blockRdp = $false; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- ps: # $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
+50
-39
@@ -12,35 +12,50 @@
|
||||
|
||||
#include "string.h"
|
||||
#include "dbprint.h"
|
||||
#include "pm3_cmd.h"
|
||||
|
||||
extern uint8_t _stack_start, __bss_end__;
|
||||
|
||||
// BigBuf is the large multi-purpose buffer, typically used to hold A/D samples or traces.
|
||||
// Also used to hold various smaller buffers and the Mifare Emulator Memory.
|
||||
// declare it as uint32_t to achieve alignment to 4 Byte boundary
|
||||
static uint32_t BigBuf[BIGBUF_SIZE / sizeof(uint32_t)];
|
||||
// We know that bss is aligned to 4 bytes.
|
||||
static uint8_t *BigBuf = &__bss_end__;
|
||||
|
||||
/* BigBuf memory layout:
|
||||
Pointer to highest available memory: BigBuf_hi
|
||||
|
||||
high BIGBUF_SIZE
|
||||
high BigBuf_size
|
||||
reserved = BigBuf_malloc() subtracts amount from BigBuf_hi,
|
||||
low 0x00
|
||||
*/
|
||||
|
||||
static uint32_t BigBuf_size = 0;
|
||||
|
||||
// High memory mark
|
||||
static uint16_t BigBuf_hi = BIGBUF_SIZE;
|
||||
static uint32_t BigBuf_hi = 0;
|
||||
|
||||
// pointer to the emulator memory.
|
||||
static uint8_t *emulator_memory = NULL;
|
||||
|
||||
// trace related variables
|
||||
static uint32_t traceLen = 0;
|
||||
static bool tracing = true; //todo static?
|
||||
static bool tracing = true;
|
||||
|
||||
// compute the available size for BigBuf
|
||||
void BigBuf_initialize(void) {
|
||||
BigBuf_size = (uint32_t)&_stack_start - (uint32_t)&__bss_end__;
|
||||
BigBuf_hi = BigBuf_size;
|
||||
traceLen = 0;
|
||||
}
|
||||
|
||||
// get the address of BigBuf
|
||||
uint8_t *BigBuf_get_addr(void) {
|
||||
return (uint8_t *)BigBuf;
|
||||
}
|
||||
|
||||
uint32_t BigBuf_get_size(void) {
|
||||
return BigBuf_size;
|
||||
}
|
||||
|
||||
// get the address of the emulator memory. Allocate part of Bigbuf for it, if not yet done
|
||||
uint8_t *BigBuf_get_EM_addr(void) {
|
||||
// not yet allocated
|
||||
@@ -57,9 +72,9 @@ void BigBuf_Clear(void) {
|
||||
|
||||
// clear ALL of BigBuf
|
||||
void BigBuf_Clear_ext(bool verbose) {
|
||||
memset(BigBuf, 0, BIGBUF_SIZE);
|
||||
memset(BigBuf, 0, BigBuf_size);
|
||||
if (verbose)
|
||||
Dbprintf("Buffer cleared (%i bytes)", BIGBUF_SIZE);
|
||||
Dbprintf("Buffer cleared (%i bytes)", BigBuf_size);
|
||||
}
|
||||
|
||||
void BigBuf_Clear_EM(void) {
|
||||
@@ -73,7 +88,7 @@ void BigBuf_Clear_keep_EM(void) {
|
||||
// allocate a chunk of memory from BigBuf. We allocate high memory first. The unallocated memory
|
||||
// at the beginning of BigBuf is always for traces/samples
|
||||
uint8_t *BigBuf_malloc(uint16_t chunksize) {
|
||||
if (BigBuf_hi - chunksize < 0)
|
||||
if (BigBuf_hi < chunksize)
|
||||
return NULL; // no memory left
|
||||
|
||||
chunksize = (chunksize + 3) & 0xfffc; // round to next multiple of 4
|
||||
@@ -83,7 +98,7 @@ uint8_t *BigBuf_malloc(uint16_t chunksize) {
|
||||
|
||||
// free ALL allocated chunks. The whole BigBuf is available for traces or samples again.
|
||||
void BigBuf_free(void) {
|
||||
BigBuf_hi = BIGBUF_SIZE;
|
||||
BigBuf_hi = BigBuf_size;
|
||||
emulator_memory = NULL;
|
||||
// shouldn't this empty BigBuf also?
|
||||
}
|
||||
@@ -93,16 +108,16 @@ void BigBuf_free_keep_EM(void) {
|
||||
if (emulator_memory != NULL)
|
||||
BigBuf_hi = emulator_memory - (uint8_t *)BigBuf;
|
||||
else
|
||||
BigBuf_hi = BIGBUF_SIZE;
|
||||
BigBuf_hi = BigBuf_size;
|
||||
|
||||
// shouldn't this empty BigBuf also?
|
||||
}
|
||||
|
||||
void BigBuf_print_status(void) {
|
||||
DbpString(_BLUE_("Memory"));
|
||||
Dbprintf(" BIGBUF_SIZE.............%d", BIGBUF_SIZE);
|
||||
DbpString(_CYAN_("Memory"));
|
||||
Dbprintf(" BigBuf_size.............%d", BigBuf_size);
|
||||
Dbprintf(" Available memory........%d", BigBuf_hi);
|
||||
DbpString(_BLUE_("Tracing"));
|
||||
DbpString(_CYAN_("Tracing"));
|
||||
Dbprintf(" tracing ................%d", tracing);
|
||||
Dbprintf(" traceLen ...............%d", traceLen);
|
||||
}
|
||||
@@ -146,41 +161,37 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_
|
||||
if (!tracing) return false;
|
||||
|
||||
uint8_t *trace = BigBuf_get_addr();
|
||||
tracelog_hdr_t *hdr = (tracelog_hdr_t *)(trace + traceLen);
|
||||
|
||||
uint32_t num_paritybytes = (iLen - 1) / 8 + 1; // number of valid paritybytes in *parity
|
||||
uint32_t duration = timestamp_end - timestamp_start;
|
||||
|
||||
// Return when trace is full
|
||||
if (traceLen + sizeof(iLen) + sizeof(timestamp_start) + sizeof(duration) + num_paritybytes + iLen >= BigBuf_max_traceLen()) {
|
||||
if (TRACELOG_HDR_LEN + iLen + num_paritybytes >= BigBuf_max_traceLen() - traceLen) {
|
||||
tracing = false; // don't trace any more
|
||||
return false;
|
||||
}
|
||||
// Traceformat:
|
||||
// 32 bits timestamp (little endian)
|
||||
// 16 bits duration (little endian)
|
||||
// 16 bits data length (little endian, Highest Bit used as readerToTag flag)
|
||||
// y Bytes data
|
||||
// x Bytes parity (one byte per 8 bytes data)
|
||||
|
||||
// timestamp (start)
|
||||
trace[traceLen++] = ((timestamp_start >> 0) & 0xff);
|
||||
trace[traceLen++] = ((timestamp_start >> 8) & 0xff);
|
||||
trace[traceLen++] = ((timestamp_start >> 16) & 0xff);
|
||||
trace[traceLen++] = ((timestamp_start >> 24) & 0xff);
|
||||
|
||||
// duration
|
||||
trace[traceLen++] = ((duration >> 0) & 0xff);
|
||||
trace[traceLen++] = ((duration >> 8) & 0xff);
|
||||
|
||||
// data length
|
||||
trace[traceLen++] = ((iLen >> 0) & 0xff);
|
||||
trace[traceLen++] = ((iLen >> 8) & 0xff);
|
||||
|
||||
// readerToTag flag
|
||||
if (!readerToTag) {
|
||||
trace[traceLen - 1] |= 0x80;
|
||||
uint32_t duration;
|
||||
if (timestamp_end > timestamp_start) {
|
||||
duration = timestamp_end - timestamp_start;
|
||||
} else {
|
||||
duration = (UINT32_MAX - timestamp_start) + timestamp_end;
|
||||
}
|
||||
|
||||
if (duration > 0x7FFF) {
|
||||
if (DBGLEVEL >= DBG_DEBUG) {
|
||||
Dbprintf("Error in LogTrace: duration too long for 15 bits encoding: 0x%08x start:0x%08x end:0x%08x", duration, timestamp_start, timestamp_end);
|
||||
Dbprintf("Forcing duration = 0");
|
||||
}
|
||||
duration = 0;
|
||||
}
|
||||
|
||||
hdr->timestamp = timestamp_start;
|
||||
hdr->duration = duration;
|
||||
hdr->data_len = iLen;
|
||||
hdr->isResponse = !readerToTag;
|
||||
traceLen += TRACELOG_HDR_LEN;
|
||||
|
||||
// data bytes
|
||||
if (btBytes != NULL && iLen != 0) {
|
||||
memcpy(trace + traceLen, btBytes, iLen);
|
||||
|
||||
+2
-1
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BIGBUF_SIZE 40000
|
||||
#define MAX_FRAME_SIZE 256 // maximum allowed ISO14443 frame
|
||||
#define MAX_PARITY_SIZE ((MAX_FRAME_SIZE + 7) / 8)
|
||||
#define MAX_MIFARE_FRAME_SIZE 18 // biggest Mifare frame is answer to a read (one block = 16 Bytes) + 2 Bytes CRC
|
||||
@@ -23,8 +22,10 @@
|
||||
#define DMA_BUFFER_SIZE 256 //128 (how big is the dma?!?
|
||||
|
||||
uint8_t *BigBuf_get_addr(void);
|
||||
uint32_t BigBuf_get_size(void);
|
||||
uint8_t *BigBuf_get_EM_addr(void);
|
||||
uint16_t BigBuf_max_traceLen(void);
|
||||
void BigBuf_initialize(void);
|
||||
void BigBuf_Clear(void);
|
||||
void BigBuf_Clear_ext(bool verbose);
|
||||
void BigBuf_Clear_keep_EM(void);
|
||||
|
||||
+28
-24
@@ -20,8 +20,7 @@ endif
|
||||
#in the next section to remove that particular feature from compilation.
|
||||
# NO space,TABs after the "\" sign.
|
||||
APP_CFLAGS = $(PLATFORM_DEFS) \
|
||||
-DON_DEVICE \
|
||||
-fno-strict-aliasing -ffunction-sections -fdata-sections
|
||||
-ffunction-sections -fdata-sections
|
||||
|
||||
SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c lfadc.c
|
||||
SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
@@ -64,6 +63,12 @@ else
|
||||
SRC_HITAG =
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring WITH_EM4x50,$(APP_CFLAGS)))
|
||||
SRC_EM4x50 = em4x50.c
|
||||
else
|
||||
SRC_EM4x50 =
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring WITH_LCD,$(APP_CFLAGS)))
|
||||
SRC_LCD = fonts.c LCD.c
|
||||
else
|
||||
@@ -76,13 +81,13 @@ include Standalone/Makefile.inc
|
||||
#the FPGA bitstream files. Note: order matters!
|
||||
FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit
|
||||
|
||||
#the zlib source files required for decompressing the fpga config at run time
|
||||
SRC_ZLIB = inflate.c inffast.c inftrees.c adler32.c zutil.c
|
||||
#additional defines required to compile zlib
|
||||
ZLIB_CFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
||||
APP_CFLAGS += $(ZLIB_CFLAGS)
|
||||
# zlib includes:
|
||||
APP_CFLAGS += -I../common/zlib
|
||||
#the lz4 source files required for decompressing the fpga config at run time
|
||||
SRC_LZ4 = lz4.c
|
||||
#additional defines required to compile lz4
|
||||
LZ4_CFLAGS = -DLZ4_MEMORY_USAGE=8
|
||||
APP_CFLAGS += $(LZ4_CFLAGS)
|
||||
# lz4 includes:
|
||||
APP_CFLAGS += -I../common/lz4
|
||||
|
||||
# stdint.h provided locally until GCC 4.5 becomes C99 compliant,
|
||||
# stack-protect , no-pie reduces size on Gentoo Hardened 8.2 gcc
|
||||
@@ -94,13 +99,22 @@ THUMBSRC = start.c \
|
||||
$(SRC_ISO15693) \
|
||||
$(SRC_NFCBARCODE) \
|
||||
$(SRC_LF) \
|
||||
$(SRC_ZLIB) \
|
||||
$(SRC_LZ4) \
|
||||
$(SRC_LEGIC) \
|
||||
$(SRC_FLASH) \
|
||||
$(SRC_SMARTCARD) \
|
||||
$(SRC_FPC) \
|
||||
$(SRC_HITAG) \
|
||||
$(SRC_EM4x50) \
|
||||
$(SRC_SPIFFS) \
|
||||
$(SRC_ISO14443a) \
|
||||
$(SRC_ISO14443b) \
|
||||
$(SRC_CRAPTO1) \
|
||||
$(SRC_ICLASS) \
|
||||
$(SRC_EMV) \
|
||||
$(SRC_CRC) \
|
||||
$(SRC_FELICA) \
|
||||
$(SRC_STANDALONE) \
|
||||
appmain.c \
|
||||
printf.c \
|
||||
dbprint.c \
|
||||
@@ -115,14 +129,6 @@ THUMBSRC = start.c \
|
||||
|
||||
# These are to be compiled in ARM mode
|
||||
ARMSRC = fpgaloader.c \
|
||||
$(SRC_ISO14443a) \
|
||||
$(SRC_ISO14443b) \
|
||||
$(SRC_CRAPTO1) \
|
||||
$(SRC_ICLASS) \
|
||||
$(SRC_EMV) \
|
||||
$(SRC_CRC) \
|
||||
$(SRC_FELICA) \
|
||||
$(SRC_STANDALONE) \
|
||||
parity.c \
|
||||
usb_cdc.c \
|
||||
cmd.c
|
||||
@@ -133,8 +139,6 @@ VERSIONSRC = version.c \
|
||||
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
|
||||
include ../common_arm/Makefile.common
|
||||
|
||||
COMMON_FLAGS = -Os
|
||||
|
||||
INSTALLFW = $(OBJDIR)/fullimage.elf
|
||||
ifneq (,$(FWTAG))
|
||||
INSTALLFWTAG = $(notdir $(INSTALLFW:%.elf=%-$(FWTAG).elf))
|
||||
@@ -155,9 +159,9 @@ showinfo:
|
||||
# version.c should be remade on every time fullimage.stage1.elf should be remade
|
||||
version.c: default_version.c $(OBJDIR)/fpga_version_info.o $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
|
||||
$(info [-] GEN $@)
|
||||
$(Q)sh ../tools/mkversion.sh > $@ || perl ../tools/mkversion.pl > $@ || $(CP) $^ $@
|
||||
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
||||
|
||||
fpga_version_info.c: $(FPGA_BITSTREAMS) | $(FPGA_COMPRESSOR)
|
||||
fpga_version_info.c: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR)
|
||||
$(info [-] GEN $@)
|
||||
$(Q)$(FPGA_COMPRESSOR) -v $(filter %.bit,$^) $@
|
||||
|
||||
@@ -179,7 +183,7 @@ $(FPGA_COMPRESSOR):
|
||||
|
||||
$(OBJDIR)/fullimage.stage1.elf: $(VERSIONOBJ) $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
|
||||
$(info [=] LD $@)
|
||||
$(Q)$(CC) $(LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
|
||||
$(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
|
||||
|
||||
$(OBJDIR)/fullimage.nodata.bin: $(OBJDIR)/fullimage.stage1.elf
|
||||
$(info [-] GEN $@)
|
||||
@@ -207,7 +211,7 @@ $(OBJDIR)/fullimage.data.o: $(OBJDIR)/fullimage.data.bin.z
|
||||
|
||||
$(OBJDIR)/fullimage.elf: $(OBJDIR)/fullimage.nodata.o $(OBJDIR)/fullimage.data.o
|
||||
$(info [=] LD $@)
|
||||
$(Q)$(CC) $(LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||
$(Q)$(CC) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-e,_osimage_entry,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||
|
||||
tarbin: $(OBJS)
|
||||
$(info TAR $@)
|
||||
|
||||
@@ -81,12 +81,12 @@
|
||||
|
||||
*/
|
||||
|
||||
uint8_t cjuid[10];
|
||||
uint32_t cjcuid;
|
||||
iso14a_card_select_t p_card;
|
||||
int currline;
|
||||
int currfline;
|
||||
int curlline;
|
||||
static uint8_t cjuid[10];
|
||||
static uint32_t cjcuid;
|
||||
static iso14a_card_select_t p_card;
|
||||
static int currline;
|
||||
static int currfline;
|
||||
static int curlline;
|
||||
|
||||
// TODO : Implement fast read of KEYS like in RFIdea
|
||||
// also http://ext.delaat.net/rp/2015-2016/p04/report.pdf
|
||||
@@ -104,12 +104,7 @@ static const uint8_t is_hex[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
// Note: inlining this function would fail with -Os
|
||||
#ifdef __OPTIMIZE_SIZE__
|
||||
static uint64_t hex2i(const char *s) {
|
||||
#else
|
||||
static inline uint64_t hex2i(const char *s) {
|
||||
#endif
|
||||
uint64_t val = 0;
|
||||
if (s == NULL || s[0] == 0)
|
||||
return 0;
|
||||
@@ -167,7 +162,7 @@ static void scan_keys(const char *str, int len, uint64_t *user_data) {
|
||||
}
|
||||
}
|
||||
|
||||
MFC1KSchema Schemas[MAX_SCHEMAS];
|
||||
static MFC1KSchema Schemas[MAX_SCHEMAS];
|
||||
|
||||
/*MFC1KSchema Noralsy = {
|
||||
.name = "Noralsy",
|
||||
@@ -201,7 +196,7 @@ MFC1KSchema InfiHexact = {.name = "Infineon/Hexact",
|
||||
0x8829da9daf76, 0x8829da9daf76, 0x8829da9daf76, 0x8829da9daf76}};
|
||||
*/
|
||||
|
||||
int total_schemas = 0;
|
||||
static int total_schemas = 0;
|
||||
|
||||
static void add_schema(MFC1KSchema *p, MFC1KSchema a, int *schemas_counter) {
|
||||
if (*schemas_counter < MAX_SCHEMAS) {
|
||||
@@ -237,14 +232,6 @@ static void cjSetCursLeft(void) {
|
||||
|
||||
static void cjTabulize(void) { DbprintfEx(FLAG_RAWPRINT, "\t\t\t"); }
|
||||
|
||||
/*
|
||||
void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type) {
|
||||
char tosendkey[13];
|
||||
sprintf(tosendkey, "%02x%02x%02x%02x%02x%02x", foundKey[0], foundKey[1], foundKey[2], foundKey[3], foundKey[4],
|
||||
foundKey[5]); cjSetCursRight(); DbprintfEx(FLAG_NEWLINE, "SEC: %02x | KEY : %s | TYP: %d", sectorNo, tosendkey, type);
|
||||
}
|
||||
*/
|
||||
|
||||
static char *ReadSchemasFromSPIFFS(char *filename) {
|
||||
SpinOff(0);
|
||||
|
||||
@@ -297,6 +284,7 @@ static void ReadLastTagFromFlash(void) {
|
||||
// this one will handle filetype (symlink or not) and resolving by itself
|
||||
rdv40_spiffs_read_as_filetype((char *)HFCOLIN_LASTTAG_SYMLINK, (uint8_t *)mem, len, RDV40_SPIFFS_SAFETY_SAFE);
|
||||
|
||||
// copy 64blocks (16bytes) starting w block0, to emulator mem.
|
||||
emlSetMem(mem, 0, 64);
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator");
|
||||
@@ -335,16 +323,22 @@ void WriteTagToFlash(uint32_t uid, size_t size) {
|
||||
return;
|
||||
}
|
||||
|
||||
void ModInfo(void) { DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); }
|
||||
void ModInfo(void) {
|
||||
DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)");
|
||||
}
|
||||
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
Dbprintf(">> HF Mifare ultra fast sniff/sim/clone a.k.a VIGIKPWN Started <<");
|
||||
|
||||
// turn off all debugging.
|
||||
DBGLEVEL = DBG_NONE;
|
||||
|
||||
// add_schema(Schemas, Noralsy, &total_schemas);
|
||||
// add_schema(Schemas, InfiHexact, &total_schemas);
|
||||
// add_schema_from_json_in_spiffs((char *)HFCOLIN_URMETCAPTIVE_JSON);
|
||||
// add_schema(Schemas, UrmetCaptive, &total_schemas);
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
currline = 20;
|
||||
curlline = 20;
|
||||
@@ -391,11 +385,11 @@ void RunMod(void) {
|
||||
ACCBITS : 796788[00]+VALUE
|
||||
*/
|
||||
|
||||
//----------------------------
|
||||
// ----------------------------
|
||||
// Set of keys to be used.
|
||||
// This should cover ~98% of
|
||||
// French VIGIK system @2017
|
||||
//----------------------------
|
||||
// ----------------------------
|
||||
|
||||
const uint64_t mfKeys[] = {
|
||||
0xffffffffffff, // TRANSPORTS
|
||||
@@ -464,7 +458,6 @@ void RunMod(void) {
|
||||
bool err = 0;
|
||||
bool trapped = 0;
|
||||
bool allKeysFound = true;
|
||||
|
||||
uint32_t size = mfKeysCnt;
|
||||
|
||||
// banner:
|
||||
@@ -492,7 +485,7 @@ failtag:
|
||||
SpinOff(50);
|
||||
LED_A_ON();
|
||||
uint8_t ticker = 0;
|
||||
// while (!BUTTON_PRESS() && !iso14443a_select_card(cjuid, NULL, &cjcuid, true, 0, true))
|
||||
|
||||
while (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||
WDT_HIT();
|
||||
|
||||
@@ -510,8 +503,8 @@ failtag:
|
||||
}
|
||||
|
||||
SpinOff(50);
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
||||
vtsend_cursor_position_restore(NULL);
|
||||
DbprintfEx(FLAG_NEWLINE, "\t\t\t%s[ GOT a Tag ! ]%s", _XGREEN_, _XWHITE_);
|
||||
cjSetCursLeft();
|
||||
@@ -539,7 +532,7 @@ failtag:
|
||||
uint32_t start_time = GetTickCount();
|
||||
uint32_t delta_time = 0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------
|
||||
// WE SHOULD FIND A WAY TO GET UID TO AVOID THIS "TESTRUN"
|
||||
// --------------------------------------------------------
|
||||
// + HERE IS TO BE THOUGHT AS ONLY A KEY SHOULD BE CHECK
|
||||
@@ -549,7 +542,7 @@ failtag:
|
||||
// `-+ THEN FILL EMULATOR WITH B KEEY
|
||||
// `-+ THEN EMULATOR WITH CARD WITH B KEY
|
||||
// `-+ IF IT HAS FAILED OF ANY OF SORT THEN WE ARE MARRON LIKE POMALO.
|
||||
//----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
// AN EVEN BETTER IMPLEMENTATION IS TO CHECK EVERY KEY FOR SECTOR 0 KEY A
|
||||
// THEN IF FOUND CHECK THE SAME KEY FOR NEXT SECTOR ONLY KEY A
|
||||
// THEN IF FAIL CHECK EVERY SECTOR A KEY FOR EVERY OTHER KEY BUT NOT THE BLOCK
|
||||
@@ -563,7 +556,7 @@ failtag:
|
||||
// DERIVATION
|
||||
// THEN IF B KEY IS NOT OF THIS SCHEME CHECK EVERY REMAINING B KEYED SECTOR
|
||||
// WITH EVERY REMAINING KEYS, BUT DISCARDING ANY DEFAULT TRANSPORT KEYS.
|
||||
//-----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// also we could avoid first UID check for every block
|
||||
|
||||
// then let's expose this optimal case of well known vigik schemes :
|
||||
@@ -630,7 +623,6 @@ failtag:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* etc etc for testing schemes quick schemes */
|
||||
}
|
||||
}
|
||||
@@ -646,7 +638,7 @@ failtag:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Settings keys to emulator */
|
||||
// Settings keys to emulator
|
||||
emlClearMem();
|
||||
uint8_t mblock[16];
|
||||
for (uint8_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
||||
@@ -660,7 +652,7 @@ failtag:
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "%s>>%s Setting Keys->Emulator MEM...[%sOK%s]", _XYELLOW_, _XWHITE_, _XGREEN_, _XWHITE_);
|
||||
|
||||
/* filling TAG to emulator */
|
||||
// filling TAG to emulator
|
||||
int filled;
|
||||
cjSetCursLeft();
|
||||
|
||||
@@ -671,11 +663,10 @@ failtag:
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "%s>>%s W_FAILURE ! %sTrying fallback B keys....", _XRED_, _XORANGE_, _XWHITE_);
|
||||
|
||||
/* no trace, no dbg */
|
||||
// no trace, no dbg
|
||||
filled = e_MifareECardLoad(sectorsCnt, 1);
|
||||
if (filled != PM3_SUCCESS) {
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "FATAL:EML_FALLBACKFILL_B");
|
||||
SpinErr(LED_C, 100, 8);
|
||||
SpinOff(100);
|
||||
@@ -722,10 +713,9 @@ readysim:
|
||||
SpinOff(100);
|
||||
LED_C_ON();
|
||||
|
||||
DBGLEVEL = DBG_NONE;
|
||||
|
||||
//uint16_t flags=0;
|
||||
/*switch (p_card.uidlen) {
|
||||
/*
|
||||
uint16_t flags = 0;
|
||||
switch (p_card.uidlen) {
|
||||
case 10:
|
||||
flags = FLAG_10B_UID_IN_DATA;
|
||||
break;
|
||||
@@ -738,19 +728,18 @@ readysim:
|
||||
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;
|
||||
//}
|
||||
//flags |= FLAG_MF_1K;
|
||||
//if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||
// flags |= FLAG_UID_IN_EMUL;
|
||||
//}
|
||||
//flags = 0x10;
|
||||
uint16_t flags = 0;
|
||||
flags = 16;
|
||||
if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||
flags |= FLAG_UID_IN_EMUL;
|
||||
}
|
||||
flags |= FLAG_MF_1K;
|
||||
if ((flags & (FLAG_4B_UID_IN_DATA | FLAG_7B_UID_IN_DATA | FLAG_10B_UID_IN_DATA)) == 0) {
|
||||
flags |= FLAG_UID_IN_EMUL;
|
||||
}
|
||||
flags = 0x10;
|
||||
*/
|
||||
uint16_t flags = FLAG_UID_IN_EMUL;
|
||||
DbprintfEx(FLAG_NEWLINE, "\n\n\n\n\n\n\n\nn\n\nn\n\n\nflags: %d (0x%02x)", flags, flags);
|
||||
cjSetCursLeft();
|
||||
SpinOff(1000);
|
||||
@@ -794,8 +783,6 @@ readysim:
|
||||
* - tracing is falsed
|
||||
*/
|
||||
int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
DBGLEVEL = DBG_NONE;
|
||||
|
||||
uint8_t numSectors = numofsectors;
|
||||
uint8_t keyType = keytype;
|
||||
|
||||
@@ -807,7 +794,6 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
uint8_t dataoutbuf2[16];
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
@@ -815,24 +801,17 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
|
||||
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||
isOK = false;
|
||||
if (DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_RAWPRINT, "Can't select card");
|
||||
}
|
||||
|
||||
for (uint8_t s = 0; isOK && s < numSectors; s++) {
|
||||
uint64_t ui64Key = emlGetKey(s, keyType);
|
||||
if (s == 0) {
|
||||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_FIRST)) {
|
||||
|
||||
if (DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth error", s);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (isOK && mifare_classic_auth(pcs, cjcuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_NESTED)) {
|
||||
isOK = false;
|
||||
if (DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NEWLINE, "Sector[%2d]. Auth nested error", s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -840,8 +819,6 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
for (uint8_t blockNo = 0; isOK && blockNo < NumBlocksPerSector(s); blockNo++) {
|
||||
if (isOK && mifare_classic_readblock(pcs, cjcuid, FirstBlockOfSector(s) + blockNo, dataoutbuf)) {
|
||||
isOK = false;
|
||||
if (DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NEWLINE, "Error reading sector %2d block %2d", s, blockNo);
|
||||
break;
|
||||
};
|
||||
if (isOK) {
|
||||
@@ -857,23 +834,18 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mifare_classic_halt(pcs, cjcuid)) {
|
||||
if (DBGLEVEL >= 1)
|
||||
DbprintfEx(FLAG_NEWLINE, "Halt error");
|
||||
};
|
||||
int res = mifare_classic_halt(pcs, cjcuid);
|
||||
(void)res;
|
||||
|
||||
crypto1_deinit(pcs);
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
||||
return (isOK) ? PM3_SUCCESS : PM3_EUNDEF;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
||||
uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
set_tracing(false);
|
||||
|
||||
@@ -881,14 +853,16 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
for (int i = 0; i < keyCount; ++i) {
|
||||
int retval = -1;
|
||||
|
||||
for (uint8_t i = 0; i < keyCount; i++) {
|
||||
|
||||
/* no need for anticollision. just verify tag is still here */
|
||||
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
||||
if (!iso14443a_select_card(cjuid, &p_card, &cjcuid, true, 0, true)) {
|
||||
cjSetCursLeft();
|
||||
DbprintfEx(FLAG_NEWLINE, "%sFATAL%s : E_MF_LOSTTAG", _XRED_, _XWHITE_);
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t ui64Key = bytes_to_num(datain + i * 6, 6);
|
||||
@@ -899,15 +873,13 @@ int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||
SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
crypto1_deinit(pcs);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
*key = ui64Key;
|
||||
return i;
|
||||
retval = i;
|
||||
break;
|
||||
}
|
||||
crypto1_deinit(pcs);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
||||
return -1;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void saMifareMakeTag(void) {
|
||||
@@ -925,7 +897,6 @@ void saMifareMakeTag(void) {
|
||||
int flags = 0;
|
||||
for (int blockNum = 0; blockNum < 16 * 4; blockNum++) {
|
||||
uint8_t mblock[16];
|
||||
// cnt = 0;
|
||||
emlGetMem(mblock, blockNum, 1);
|
||||
// switch on field and send magic sequence
|
||||
if (blockNum == 0)
|
||||
@@ -940,21 +911,15 @@ void saMifareMakeTag(void) {
|
||||
flags = 0x04 + 0x10;
|
||||
|
||||
if (saMifareCSetBlock(0, flags & 0xFE, blockNum, mblock)) {
|
||||
//&& cnt <= retry) {
|
||||
// cnt++;
|
||||
cjSetCursFRight();
|
||||
if (currfline > 53) {
|
||||
currfline = 54;
|
||||
}
|
||||
DbprintfEx(FLAG_NEWLINE, "Block :%02x %sOK%s", blockNum, _XGREEN_, _XWHITE_);
|
||||
// DbprintfEx(FLAG_RAWPRINT,"FATAL:E_MF_CHINESECOOK_NORICE");
|
||||
// cfail=1;
|
||||
// return;
|
||||
continue;
|
||||
} else {
|
||||
cjSetCursLeft();
|
||||
cjSetCursLeft();
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "`--> %sFAIL%s : CHN_FAIL_BLK_%02x_NOK", _XRED_, _XWHITE_, blockNum);
|
||||
cjSetCursFRight();
|
||||
DbprintfEx(FLAG_NEWLINE, "%s>>>>%s STOP AT %02x", _XRED_, _XWHITE_, blockNum);
|
||||
@@ -962,14 +927,9 @@ void saMifareMakeTag(void) {
|
||||
break;
|
||||
}
|
||||
cjSetCursFRight();
|
||||
|
||||
DbprintfEx(FLAG_NEWLINE, "%s>>>>>>>> END <<<<<<<<%s", _XYELLOW_, _XWHITE_);
|
||||
// break;
|
||||
/*if (cfail == 1) {
|
||||
DbprintfEx(FLAG_RAWPRINT,"FATAL: E_MF_HARA_KIRI_\r\n");
|
||||
break;
|
||||
} */
|
||||
}
|
||||
|
||||
if (cfail == 0) {
|
||||
SpinUp(50);
|
||||
SpinUp(50);
|
||||
|
||||
+196
-84
@@ -49,19 +49,16 @@ on a blank card.
|
||||
#include "mifaresim.h" // mifare1ksim
|
||||
#include "mifareutil.h"
|
||||
|
||||
uint8_t uid[10];
|
||||
uint32_t cuid;
|
||||
iso14a_card_select_t p_card;
|
||||
static uint8_t uid[10];
|
||||
static uint32_t cuid;
|
||||
static iso14a_card_select_t p_card;
|
||||
|
||||
/*
|
||||
Pseudo-configuration block.
|
||||
*/
|
||||
bool printKeys = false; // Prints keys
|
||||
bool transferToEml = true; // Transfer keys to emulator memory
|
||||
bool ecfill = true; // Fill emulator memory with cards content.
|
||||
bool simulation = true; // Simulates an exact copy of the target tag
|
||||
bool fillFromEmulator = false; // Dump emulator memory.
|
||||
uint8_t stKeyBlock = 20; // Set the quantity of keys in the block.
|
||||
// Pseudo-configuration block.
|
||||
static bool printKeys = false; // Prints keys
|
||||
static bool transferToEml = true; // Transfer keys to emulator memory
|
||||
static bool ecfill = true; // Fill emulator memory with cards content.
|
||||
static bool simulation = true; // Simulates an exact copy of the target tag
|
||||
static bool fillFromEmulator = false; // Dump emulator memory.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Matt's StandAlone mod.
|
||||
@@ -179,7 +176,8 @@ static int saMifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_
|
||||
|
||||
/* the chk function is a piwi’ed(tm) check that will try all keys for
|
||||
a particular sector. also no tracing no dbg */
|
||||
static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
||||
static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace,
|
||||
uint8_t keyCount, uint8_t *datain, uint64_t *key) {
|
||||
DBGLEVEL = DBG_NONE;
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
set_tracing(false);
|
||||
@@ -188,13 +186,15 @@ static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
for (int i = 0; i < keyCount; ++i) {
|
||||
int retval = -1;
|
||||
|
||||
for (uint8_t i = 0; i < keyCount; i++) {
|
||||
|
||||
/* no need for anticollision. just verify tag is still here */
|
||||
// if (!iso14443a_fast_select_card(cjuid, 0)) {
|
||||
if (!iso14443a_select_card(uid, &p_card, &cuid, true, 0, true)) {
|
||||
DbprintfEx(FLAG_NEWLINE, "FATAL : E_MF_LOSTTAG");
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t ui64Key = bytes_to_num(datain + i * 6, 6);
|
||||
@@ -205,45 +205,111 @@ static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui
|
||||
SpinDelayUs(AUTHENTICATION_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
crypto1_deinit(pcs);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
*key = ui64Key;
|
||||
return i;
|
||||
retval = i;
|
||||
break;
|
||||
}
|
||||
crypto1_deinit(pcs);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
||||
return -1;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Abusive microgain on original MifareECardLoad :
|
||||
* - *datain used as error return
|
||||
* - tracing is falsed
|
||||
*/
|
||||
static int saMifareECardLoad(uint32_t numofsectors, uint8_t keytype) {
|
||||
DBGLEVEL = DBG_NONE;
|
||||
|
||||
uint8_t numSectors = numofsectors;
|
||||
uint8_t keyType = keytype;
|
||||
|
||||
struct Crypto1State mpcs = {0, 0};
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
uint8_t dataoutbuf[16];
|
||||
uint8_t dataoutbuf2[16];
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
clear_trace();
|
||||
set_tracing(false);
|
||||
|
||||
int retval = PM3_SUCCESS;
|
||||
|
||||
if (!iso14443a_select_card(uid, &p_card, &cuid, true, 0, true)) {
|
||||
retval = PM3_ESOFT;
|
||||
DbprintfEx(FLAG_RAWPRINT, "Can't select card");
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (uint8_t s = 0; s < numSectors; s++) {
|
||||
uint64_t ui64Key = emlGetKey(s, keyType);
|
||||
if (s == 0) {
|
||||
if (mifare_classic_auth(pcs, cuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_FIRST)) {
|
||||
retval = PM3_ESOFT;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (mifare_classic_auth(pcs, cuid, FirstBlockOfSector(s), keyType, ui64Key, AUTH_NESTED)) {
|
||||
retval = PM3_ESOFT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// failure to read one block, skips to next sector.
|
||||
for (uint8_t blockNo = 0; blockNo < NumBlocksPerSector(s); blockNo++) {
|
||||
if (mifare_classic_readblock(pcs, cuid, FirstBlockOfSector(s) + blockNo, dataoutbuf)) {
|
||||
retval = PM3_ESOFT;
|
||||
break;
|
||||
};
|
||||
|
||||
if (blockNo < NumBlocksPerSector(s) - 1) {
|
||||
emlSetMem(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1);
|
||||
} else {
|
||||
// sector trailer, keep the keys, set only the AC
|
||||
emlGetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
||||
memcpy(&dataoutbuf2[6], &dataoutbuf[6], 4);
|
||||
emlSetMem(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int res = mifare_classic_halt(pcs, cuid);
|
||||
(void)res;
|
||||
|
||||
out:
|
||||
crypto1_deinit(pcs);
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)");
|
||||
}
|
||||
|
||||
/*
|
||||
It will check if the keys from the attacked tag are a subset from
|
||||
the hardcoded set of keys inside of the ARM. If this is the case
|
||||
then it will load the keys into the emulator memory and also the
|
||||
content of the victim tag, to finally simulate it.
|
||||
|
||||
Alternatively, it can be dumped into a blank card.
|
||||
|
||||
This source code has been tested only in Mifare 1k.
|
||||
|
||||
If you're using the proxmark connected to a device that has an OS, and you're not using the proxmark3 client to see the debug
|
||||
messages, you MUST uncomment usb_disable().
|
||||
*/
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(">> Matty mifare chk/dump/sim a.k.a MattyRun Started <<");
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
/*
|
||||
It will check if the keys from the attacked tag are a subset from
|
||||
the hardcoded set of keys inside of the ARM. If this is the case
|
||||
then it will load the keys into the emulator memory and also the
|
||||
content of the victim tag, to finally simulate it.
|
||||
|
||||
Alternatively, it can be dumped into a blank card.
|
||||
|
||||
This source code has been tested only in Mifare 1k.
|
||||
|
||||
If you're using the proxmark connected to a device that has an OS, and you're not using the proxmark3 client to see the debug
|
||||
messages, you MUST uncomment usb_disable().
|
||||
*/
|
||||
Dbprintf(">> Matty mifare chk/dump/sim a.k.a MattyRun Started <<");
|
||||
|
||||
// Comment this line below if you want to see debug messages.
|
||||
// usb_disable();
|
||||
|
||||
|
||||
|
||||
uint16_t mifare_size = 1024; // Mifare 1k (only 1k supported for now)
|
||||
uint8_t sectorSize = 64; // 1k's sector size is 64 bytes.
|
||||
uint8_t blockNo = 3; // Security block is number 3 for each sector.
|
||||
@@ -252,9 +318,7 @@ void RunMod(void) {
|
||||
uint8_t *keyBlock; // Where the keys will be held in memory.
|
||||
bool keyFound = false;
|
||||
|
||||
/*
|
||||
Set of keys to be used.
|
||||
*/
|
||||
// Set of keys to be used.
|
||||
uint64_t mfKeys[] = {
|
||||
0xffffffffffff, // Default key
|
||||
0x000000000000, // Blank key
|
||||
@@ -269,22 +333,73 @@ void RunMod(void) {
|
||||
0xa0478cc39091,
|
||||
0x533cb6c723f6,
|
||||
0x8fd0a4f256e9,
|
||||
0x484558414354, // INFINEONON A / 0F SEC B / INTRATONE / HEXACT...
|
||||
0x414c41524f4e, // ALARON NORALSY
|
||||
0x424c41524f4e, // BLARON NORALSY
|
||||
0x4a6352684677, // COMELIT A General Key / 08 [2] 004
|
||||
0x536653644c65, // COMELIT B General Key / 08 [2] 004
|
||||
0x8829da9daf76, // URMET CAPTIV IF A => ALL A/B / BTICINO
|
||||
0x314B49474956, // "1KIGIV" VIGIK'S SERVICE BADGE A KEY
|
||||
0x021209197591, // BTCINO UNDETERMINED SPREAKD 0x01->0x13 key
|
||||
0x010203040506, // VIGIK's B Derivative
|
||||
0xa22ae129c013, // INFINEON B 00
|
||||
0x49fae4e3849f, // INFINEON B 01
|
||||
0x38fcf33072e0, // INFINEON B 02
|
||||
0x8ad5517b4b18, // INFINEON B 03
|
||||
0x509359f131b1, // INFINEON B 04
|
||||
0x6c78928e1317, // INFINEON B 05
|
||||
0xaa0720018738, // INFINEON B 06
|
||||
0xa6cac2886412, // INFINEON B 07
|
||||
0x62d0c424ed8e, // INFINEON B 08
|
||||
0xe64a986a5d94, // INFINEON B 09
|
||||
0x8fa1d601d0a2, // INFINEON B 0A
|
||||
0x89347350bd36, // INFINEON B 0B
|
||||
0x66d2b7dc39ef, // INFINEON B 0C
|
||||
0x6bc1e1ae547d, // INFINEON B 0D
|
||||
0x22729a9bd40f, // INFINEON B 0E
|
||||
0xd2ece8b9395e, // lib / Nat Bieb
|
||||
0x1494E81663D7, // # NSCP default key
|
||||
0x569369c5a0e5, // # kiev
|
||||
0x632193be1c3c, // # kiev
|
||||
0x644672bd4afe, // # kiev
|
||||
0x8fe644038790, // # kiev
|
||||
0x9de89e070277, // # kiev
|
||||
0xb5ff67cba951, // # kiev / ov-chipkaart
|
||||
0xeff603e1efe9, // # kiev
|
||||
0xf14ee7cae863, // # kiev
|
||||
0xfc00018778f7, // # Västtrafiken KeyA, RKF ÖstgötaTrafiken KeyA
|
||||
0x0297927c0f77, // # Västtrafiken KeyA
|
||||
0x54726176656c, // # Västtrafiken KeyA
|
||||
0x00000ffe2488, // # Västtrafiken KeyB
|
||||
0x776974687573, // # Västtrafiken KeyB
|
||||
0xee0042f88840, // # Västtrafiken KeyB
|
||||
0x26940b21ff5d, // # RKF SLKeyA
|
||||
0xa64598a77478, // # RKF SLKeyA
|
||||
0x5c598c9c58b5, // # RKF SLKeyB
|
||||
0xe4d2770a89be, // # RKF SLKeyB
|
||||
0x722bfcc5375f, // # RKF RejskortDanmark KeyA
|
||||
0xf1d83f964314, // # RKF RejskortDanmark KeyB
|
||||
0x505249564141, // # RKF JOJOPRIVAKeyA
|
||||
0x505249564142, // # RKF JOJOPRIVAKeyB
|
||||
0x47524f555041, // # RKF JOJOGROUPKeyA
|
||||
0x47524f555042, // # RKF JOJOGROUPKeyB
|
||||
0x434f4d4d4f41, // # RKF JOJOGROUPKeyA
|
||||
0x434f4d4d4f42, // # RKF JOJOGROUPKeyB
|
||||
0x4b0b20107ccb, // # TNP3xxx
|
||||
};
|
||||
|
||||
/*
|
||||
This part allocates the byte representation of the
|
||||
keys in keyBlock's memory space .
|
||||
*/
|
||||
keyBlock = BigBuf_malloc(stKeyBlock * 6);
|
||||
keyBlock = BigBuf_malloc(ARRAYLEN(mfKeys) * 6);
|
||||
int mfKeysCnt = ARRAYLEN(mfKeys);
|
||||
|
||||
for (int mfKeyCounter = 0; mfKeyCounter < mfKeysCnt; mfKeyCounter++) {
|
||||
num_to_bytes(mfKeys[mfKeyCounter], 6, (uint8_t *)(keyBlock + mfKeyCounter * 6));
|
||||
}
|
||||
|
||||
/*
|
||||
Pretty print of the keys to be checked.
|
||||
*/
|
||||
// Pretty print of the keys to be checked.
|
||||
if (printKeys) {
|
||||
Dbprintf("[+] Printing mf keys");
|
||||
for (uint8_t keycnt = 0; keycnt < mfKeysCnt; keycnt++)
|
||||
@@ -301,18 +416,19 @@ void RunMod(void) {
|
||||
*/
|
||||
bool validKey[2][40];
|
||||
uint8_t foundKey[2][40][6];
|
||||
for (uint16_t t = 0; t < 2; t++) {
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
for (uint16_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
||||
validKey[t][sectorNo] = false;
|
||||
for (uint16_t i = 0; i < 6; i++) {
|
||||
foundKey[t][sectorNo][i] = 0xff;
|
||||
}
|
||||
validKey[i][sectorNo] = false;
|
||||
foundKey[i][sectorNo][0] = 0xFF;
|
||||
foundKey[i][sectorNo][1] = 0xFF;
|
||||
foundKey[i][sectorNo][2] = 0xFF;
|
||||
foundKey[i][sectorNo][3] = 0xFF;
|
||||
foundKey[i][sectorNo][4] = 0xFF;
|
||||
foundKey[i][sectorNo][5] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Iterates through each sector checking if there is a correct key.
|
||||
*/
|
||||
// Iterates through each sector checking if there is a correct key.
|
||||
bool err = 0;
|
||||
bool allKeysFound = true;
|
||||
uint32_t size = mfKeysCnt;
|
||||
@@ -324,7 +440,7 @@ void RunMod(void) {
|
||||
int key = saMifareChkKeys(block, type, true, size, &keyBlock[0], &key64);
|
||||
if (key == -1) {
|
||||
LED(LED_RED, 50);
|
||||
Dbprintf("\t✕ Key not found for this sector!");
|
||||
Dbprintf("\t [✕] Key not found for this sector!");
|
||||
allKeysFound = false;
|
||||
// break;
|
||||
} else if (key == -2) {
|
||||
@@ -334,7 +450,7 @@ void RunMod(void) {
|
||||
num_to_bytes(key64, 6, foundKey[type][sec]);
|
||||
validKey[type][sec] = true;
|
||||
keyFound = true;
|
||||
Dbprintf("\t✓ Found valid key: [%02x%02x%02x%02x%02x%02x]\n",
|
||||
Dbprintf("\t [✓] Found valid key: [%02x%02x%02x%02x%02x%02x]\n",
|
||||
(keyBlock + 6 * key)[0], (keyBlock + 6 * key)[1], (keyBlock + 6 * key)[2],
|
||||
(keyBlock + 6 * key)[3], (keyBlock + 6 * key)[4], (keyBlock + 6 * key)[5]
|
||||
);
|
||||
@@ -371,8 +487,9 @@ void RunMod(void) {
|
||||
emlClearMem();
|
||||
|
||||
uint8_t mblock[16];
|
||||
for (uint16_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
||||
for (uint8_t sectorNo = 0; sectorNo < sectorsCnt; sectorNo++) {
|
||||
if (validKey[0][sectorNo] || validKey[1][sectorNo]) {
|
||||
|
||||
emlGetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1); // data, block num, blocks count (max 4)
|
||||
for (uint16_t t = 0; t < 2; t++) {
|
||||
if (validKey[t][sectorNo]) {
|
||||
@@ -382,47 +499,40 @@ void RunMod(void) {
|
||||
emlSetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1);
|
||||
}
|
||||
}
|
||||
Dbprintf("\t✓ Found keys have been transferred to the emulator memory.");
|
||||
|
||||
Dbprintf("\t [✓] Found keys have been transferred to the emulator memory.");
|
||||
|
||||
if (ecfill) {
|
||||
int filled;
|
||||
Dbprintf("\tFilling in with key A.");
|
||||
filled = MifareECardLoad(sectorsCnt, 0);
|
||||
if (filled != PM3_SUCCESS) {
|
||||
Dbprintf("\t✕ Failed filling with A.");
|
||||
}
|
||||
|
||||
Dbprintf("\tFilling in with key B.");
|
||||
filled = MifareECardLoad(sectorsCnt, 1);
|
||||
filled = saMifareECardLoad(sectorsCnt, 0);
|
||||
if (filled != PM3_SUCCESS) {
|
||||
Dbprintf("\t✕ Failed filling with B.");
|
||||
|
||||
Dbprintf("\t [✕] Failed filling with A.");
|
||||
Dbprintf("\tFilling in with key B.");
|
||||
filled = saMifareECardLoad(sectorsCnt, 1);
|
||||
if (filled != PM3_SUCCESS) {
|
||||
Dbprintf("\t [✕] Failed filling with B.");
|
||||
}
|
||||
}
|
||||
|
||||
if ((filled == PM3_SUCCESS) && simulation) {
|
||||
Dbprintf("\t✓ Emulator memory filled, simulation started.");
|
||||
Dbprintf("\t [✓] Emulator memory filled, simulation started.");
|
||||
|
||||
// This will tell the fpga to emulate using previous keys and current target tag content.
|
||||
Dbprintf("\t Press button to abort simulation at anytime.");
|
||||
|
||||
LED_B_ON(); // green
|
||||
// assuming arg0==0, use hardcoded uid 0xdeadbeaf
|
||||
uint16_t simflags;
|
||||
switch (p_card.uidlen) {
|
||||
case 10:
|
||||
simflags = FLAG_10B_UID_IN_DATA;
|
||||
break;
|
||||
case 7:
|
||||
simflags = FLAG_7B_UID_IN_DATA;
|
||||
break;
|
||||
default:
|
||||
simflags = FLAG_4B_UID_IN_DATA;
|
||||
break;
|
||||
}
|
||||
Mifare1ksim(simflags | FLAG_MF_1K, 0, uid, 0, 0);
|
||||
LED_B_OFF();
|
||||
|
||||
/*
|
||||
Needs further testing.
|
||||
*/
|
||||
uint16_t simflags = FLAG_UID_IN_EMUL | FLAG_MF_1K;
|
||||
|
||||
SpinOff(1000);
|
||||
Mifare1ksim(simflags, 0, uid, 0, 0);
|
||||
LED_B_OFF();
|
||||
Dbprintf("\t [✓] Simulation ended");
|
||||
|
||||
// Needs further testing.
|
||||
if (fillFromEmulator) {
|
||||
uint8_t retry = 5;
|
||||
Dbprintf("\t Trying to dump into blank card.");
|
||||
@@ -457,8 +567,10 @@ void RunMod(void) {
|
||||
}
|
||||
|
||||
}
|
||||
} else if (filled != PM3_SUCCESS) {
|
||||
Dbprintf("\t✕ Emulator memory could not be filled due to errors.");
|
||||
}
|
||||
|
||||
if (filled != PM3_SUCCESS) {
|
||||
Dbprintf("\t [✕] Emulator memory could not be filled due to errors.");
|
||||
LED_C_ON();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void ModInfo(void) {
|
||||
* technologies. Be brave enough to share your knowledge & inspire others. Salvador Mendoza.
|
||||
*/
|
||||
|
||||
uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00}; // Default GET PROCESSING
|
||||
static uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00}; // Default GET PROCESSING
|
||||
|
||||
static uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCESSING
|
||||
uint8_t plen = 7;
|
||||
@@ -119,7 +119,7 @@ static uint8_t treatPDOL(uint8_t *apdu) { //Generate GET PROCES
|
||||
|
||||
void RunMod(void) {
|
||||
StandAloneMode();
|
||||
Dbprintf(_YELLOW_(">>") "Reading Visa cards & Emulating a Visa MSD Transaction a.k.a. MSDSal Started<<");
|
||||
DbpString(_YELLOW_(">>") "Reading Visa cards & Emulating a Visa MSD Transaction a.k.a. MSDSal Started " _YELLOW_("<<"));
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
//For reading process
|
||||
@@ -206,10 +206,10 @@ void RunMod(void) {
|
||||
//Checking if the user wants to go directly to emulation mode using a hardcoded track 2
|
||||
if (chktoken == true && token[0] != 0x00) {
|
||||
state = STATE_EMU;
|
||||
Dbprintf(_YELLOW_("[") "Initialized emulation mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Initialized emulation mode" _YELLOW_(" ]"));
|
||||
DbpString("\n"_YELLOW_("!!") "Waiting for a card reader...");
|
||||
} else {
|
||||
DbpString(_YELLOW_("[") "Initialized reading mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Initialized reading mode" _YELLOW_(" ]"));
|
||||
DbpString("\n"_YELLOW_("!!") "Waiting for a Visa card...");
|
||||
}
|
||||
|
||||
@@ -228,12 +228,12 @@ void RunMod(void) {
|
||||
if (state == STATE_READ) {
|
||||
if (chktoken == true && token[0] != 0x00) { //Only change to emulation if it saved a track 2 in memory
|
||||
state = STATE_EMU;
|
||||
Dbprintf(_YELLOW_("[") "In emulation mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "In emulation mode" _YELLOW_(" ]"));
|
||||
} else
|
||||
Dbprintf(_YELLOW_("!!") "Nothing in memory to emulate");
|
||||
DbpString(_YELLOW_("!!") "Nothing in memory to emulate");
|
||||
} else {
|
||||
state = STATE_READ;
|
||||
Dbprintf(_YELLOW_("[") "In reading mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "In reading mode" _YELLOW_(" ]"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ void RunMod(void) {
|
||||
|
||||
if (iso14443a_select_card(NULL, &card_a_info, NULL, true, 0, false)) {
|
||||
|
||||
Dbprintf(_YELLOW_("+") "Found ISO 14443 Type A!");
|
||||
DbpString(_YELLOW_("+") "Found ISO 14443 Type A!");
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
chktoken = false;
|
||||
@@ -257,11 +257,11 @@ void RunMod(void) {
|
||||
uint8_t apdulen = iso14_apdu(apdus[i], (uint16_t) apdusLen[i], false, apdubuffer, NULL);
|
||||
|
||||
if (apdulen > 0) {
|
||||
Dbprintf(_YELLOW_("[") "Proxmark command " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Proxmark command" _YELLOW_(" ]"));
|
||||
Dbhexdump(apdusLen[i], apdus[i], false);
|
||||
Dbprintf(_GREEN_("[") "Card answer " _GREEN_("]"));
|
||||
DbpString(_GREEN_("[ ") "Card answer" _GREEN_(" ]"));
|
||||
Dbhexdump(apdulen - 2, apdubuffer, false);
|
||||
Dbprintf("----");
|
||||
DbpString("----");
|
||||
|
||||
for (uint8_t u = 0; u < apdulen; u++) {
|
||||
if (i == 1) {
|
||||
@@ -284,24 +284,24 @@ void RunMod(void) {
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
Dbprintf(_GREEN_("[") "Challenge generated " _GREEN_("]"));
|
||||
DbpString(_GREEN_("[ ") "Challenge generated" _GREEN_(" ]"));
|
||||
Dbhexdump(plen, existpdol ? ppdol : processing, false);
|
||||
}
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("!!") "Error reading the card");
|
||||
DbpString(_YELLOW_("!!") "Error reading the card");
|
||||
}
|
||||
LED_B_OFF();
|
||||
}
|
||||
|
||||
if (chktoken) {
|
||||
Dbprintf(_RED_("[") "Track 2 " _RED_("]"));
|
||||
DbpString(_RED_("[ ") "Track 2" _RED_(" ]"));
|
||||
Dbhexdump(19, (uint8_t *)token, false);
|
||||
Dbprintf(_YELLOW_("!!") "Card number");
|
||||
DbpString(_YELLOW_("!!") "Card number");
|
||||
Dbhexdump(8, (uint8_t *)token, false);
|
||||
DbpString("---");
|
||||
LED_C_ON();
|
||||
state = STATE_EMU;
|
||||
Dbprintf(_YELLOW_("[") "Initialized emulation mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Initialized emulation mode" _YELLOW_(" ]"));
|
||||
DbpString("\n"_YELLOW_("!!") "Waiting for a card reader...");
|
||||
}
|
||||
}
|
||||
@@ -318,7 +318,7 @@ void RunMod(void) {
|
||||
DbpString(_YELLOW_("!!") "Error initializing the emulation process!");
|
||||
SpinDelay(500);
|
||||
state = STATE_READ;
|
||||
DbpString(_YELLOW_("[") "Initialized reading mode " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Initialized reading mode" _YELLOW_(" ]"));
|
||||
DbpString("\n" _YELLOW_("!!") "Waiting for a Visa card...");
|
||||
break;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ void RunMod(void) {
|
||||
LED_B_OFF();
|
||||
// Clean receive command buffer
|
||||
if (!GetIso14443aCommandFromReader(receivedCmd, receivedCmdPar, &len)) {
|
||||
Dbprintf(_YELLOW_("!!") "Emulator stopped");
|
||||
DbpString(_YELLOW_("!!") "Emulator stopped");
|
||||
retval = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
@@ -367,7 +367,7 @@ void RunMod(void) {
|
||||
DbpString(_YELLOW_("+") "Request for RATS");
|
||||
p_response = &responses[RATS];
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("[") "Card reader command " _YELLOW_("]"));
|
||||
DbpString(_YELLOW_("[ ") "Card reader command" _YELLOW_(" ]"));
|
||||
Dbhexdump(len, receivedCmd, false);
|
||||
|
||||
if (receivedCmd[0] == 0x02 || receivedCmd[0] == 0x03) { //Emulate a Visa MSD(Magnetic stripe data) card
|
||||
@@ -408,7 +408,7 @@ void RunMod(void) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Dbprintf(_YELLOW_("!!") "Received unknown command!");
|
||||
DbpString(_YELLOW_("!!") "Received unknown command!");
|
||||
if (prevCmd < 4) {
|
||||
memcpy(dynamic_response_info.response, receivedCmd, len);
|
||||
dynamic_response_info.response_n = len;
|
||||
@@ -418,9 +418,9 @@ void RunMod(void) {
|
||||
}
|
||||
}
|
||||
if (dynamic_response_info.response_n > 0) {
|
||||
Dbprintf(_GREEN_("[") "Proxmark3 answer " _GREEN_("]"));
|
||||
DbpString(_GREEN_("[ ") "Proxmark3 answer" _GREEN_(" ]"));
|
||||
Dbhexdump(dynamic_response_info.response_n, dynamic_response_info.response, false);
|
||||
Dbprintf("----");
|
||||
DbpString("----");
|
||||
|
||||
// Add CRC bytes, always used in ISO 14443A-4 compliant cards
|
||||
AddCrc14A(dynamic_response_info.response, dynamic_response_info.response_n);
|
||||
|
||||
@@ -151,10 +151,10 @@ void RunMod(void) {
|
||||
SpinDelay(500);
|
||||
// Begin clone function here:
|
||||
/* Example from client/mifarehost.c for commanding a block write for "magic Chinese" cards:
|
||||
SendCommandOLD(CMD_HF_MIFARE_CSETBL, params & (0xFE | (uid == NULL ? 0:1)), blockNo, 0, data, 16);
|
||||
SendCommandMIX(CMD_HF_MIFARE_CSETBL, params & (0xFE | (uid == NULL ? 0:1)), blockNo, 0, data, 16);
|
||||
|
||||
Block read is similar:
|
||||
SendCommandOLD(CMD_HF_MIFARE_CGETBL, params, blockNo, 0,...};
|
||||
SendCommandMIX(CMD_HF_MIFARE_CGETBL, params, blockNo, 0,...};
|
||||
We need to imitate that call with blockNo 0 to set a uid.
|
||||
|
||||
The get and set commands are handled in this file:
|
||||
|
||||
@@ -25,11 +25,9 @@
|
||||
|
||||
// low & high - array for storage IDs. Its length must be equal.
|
||||
// Predefined IDs must be stored in low[].
|
||||
// In high[] must be nulls
|
||||
uint64_t low[] = {0x565A1140BE, 0x365A398149, 0x5555555555, 0xFFFFFFFFFF};
|
||||
uint32_t high[] = {0, 0, 0, 0};
|
||||
uint8_t *bba, slots_count;
|
||||
int buflen;
|
||||
static uint64_t low[] = {0x565A1140BE, 0x365A398149, 0x5555555555, 0xFFFFFFFFFF};
|
||||
static uint8_t *bba, slots_count;
|
||||
static int buflen;
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF EM4100 simulator standalone mode");
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
// low & high - array for storage IDs. Its length must be equal.
|
||||
// Predefined IDs must be stored in low[].
|
||||
// In high[] must be nulls
|
||||
uint64_t low[] = {0x565AF781C7, 0x540053E4E2, 0x1234567890, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint32_t high[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t *bba, slots_count;
|
||||
int buflen;
|
||||
static uint64_t low[] = {0x565AF781C7, 0x540053E4E2, 0x1234567890, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static uint32_t high[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
static uint8_t *bba, slots_count;
|
||||
static int buflen;
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" LF EM4100 read/write/clone mode");
|
||||
@@ -161,7 +161,7 @@ void RunMod(void) {
|
||||
state = 3;
|
||||
} else if (button_pressed == BUTTON_SINGLE_CLICK) {
|
||||
// Click - exit to select mode
|
||||
CmdEM410xdemod(1, &high[selected], &low[selected], 0);
|
||||
CmdEM410xdemod(1, &high[selected], &low[selected]);
|
||||
FlashLEDs(100, 5);
|
||||
#ifdef WITH_FLASH
|
||||
SaveIDtoFlash(selected, low[selected]);
|
||||
|
||||
@@ -231,7 +231,8 @@ static uint32_t IceHIDDemod(void) {
|
||||
uint32_t hi2 = 0, hi = 0, lo = 0;
|
||||
|
||||
// large enough to catch 2 sequences of largest format
|
||||
size_t size = 50 * 128 * 2; // 12800 bytes
|
||||
// size_t size = 50 * 128 * 2; // 12800 bytes
|
||||
size_t size = MIN(12800, BigBuf_max_traceLen());
|
||||
//uint8_t *dest = BigBuf_malloc(size);
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
|
||||
@@ -350,30 +351,32 @@ void RunMod(void) {
|
||||
|
||||
uint32_t res;
|
||||
|
||||
// since we steal 12800 from bigbuffer, no need to sample it.
|
||||
DoAcquisition_config(false, 28000);
|
||||
// since we steal 12800 from bigbuffer, no need to sample it.
|
||||
size_t size = MIN(28000, BigBuf_max_traceLen());
|
||||
DoAcquisition_config(false, size);
|
||||
res = IceHIDDemod();
|
||||
if (res == PM3_SUCCESS) {
|
||||
LED_A_OFF();
|
||||
continue;
|
||||
}
|
||||
|
||||
DoAcquisition_config(false, 28000);
|
||||
DoAcquisition_config(false, size);
|
||||
res = IceAWIDdemod();
|
||||
if (res == PM3_SUCCESS) {
|
||||
LED_A_OFF();
|
||||
continue;
|
||||
}
|
||||
|
||||
DoAcquisition_config(false, 20000);
|
||||
res = IceEM410xdemod();
|
||||
DoAcquisition_config(false, size);
|
||||
res = IceIOdemod();
|
||||
if (res == PM3_SUCCESS) {
|
||||
LED_A_OFF();
|
||||
continue;
|
||||
}
|
||||
|
||||
DoAcquisition_config(false, 28000);
|
||||
res = IceIOdemod();
|
||||
size = MIN(20000, BigBuf_max_traceLen());
|
||||
DoAcquisition_config(false, size);
|
||||
res = IceEM410xdemod();
|
||||
if (res == PM3_SUCCESS) {
|
||||
LED_A_OFF();
|
||||
continue;
|
||||
|
||||
+131
-55
@@ -29,6 +29,7 @@
|
||||
#include "felica.h"
|
||||
#include "hitag2.h"
|
||||
#include "hitagS.h"
|
||||
#include "em4x50.h"
|
||||
#include "iclass.h"
|
||||
#include "legicrfsim.h"
|
||||
#include "epa.h"
|
||||
@@ -70,10 +71,14 @@
|
||||
#define TOSEND_BUFFER_SIZE (9*MAX_FRAME_SIZE + 1 + 1 + 2) // 8 data bits and 1 parity bit per payload byte, 1 correction bit, 1 SOC bit, 2 EOC bits
|
||||
uint8_t ToSend[TOSEND_BUFFER_SIZE];
|
||||
int ToSendMax = -1;
|
||||
|
||||
extern uint32_t _stack_start, _stack_end;
|
||||
|
||||
|
||||
static int ToSendBit;
|
||||
struct common_area common_area __attribute__((section(".commonarea")));
|
||||
int button_status = BUTTON_NO_CLICK;
|
||||
bool allow_send_wtx = false;
|
||||
static int button_status = BUTTON_NO_CLICK;
|
||||
static bool allow_send_wtx = false;
|
||||
|
||||
inline void send_wtx(uint16_t wtx) {
|
||||
if (allow_send_wtx) {
|
||||
@@ -106,7 +111,7 @@ void ToSendStuffBit(int b) {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Read an ADC channel and block till it completes, then return the result
|
||||
// in ADC units (0 to 1023). Also a routine to average 32 samples and
|
||||
// in ADC units (0 to 1023). Also a routine to sum up a number of samples and
|
||||
// return that.
|
||||
//-----------------------------------------------------------------------------
|
||||
static uint16_t ReadAdc(int ch) {
|
||||
@@ -136,12 +141,14 @@ static uint16_t ReadAdc(int ch) {
|
||||
|
||||
// was static - merlok
|
||||
uint16_t AvgAdc(int ch) {
|
||||
uint16_t a = 0;
|
||||
for (uint8_t i = 0; i < 32; i++)
|
||||
a += ReadAdc(ch);
|
||||
return SumAdc(ch, 32) >> 5;
|
||||
}
|
||||
|
||||
//division by 32
|
||||
return (a + 15) >> 5;
|
||||
uint16_t SumAdc(int ch, int NbSamples) {
|
||||
uint16_t a = 0;
|
||||
for (uint8_t i = 0; i < NbSamples; i++)
|
||||
a += ReadAdc(ch);
|
||||
return (a + (NbSamples >> 1) - 1);
|
||||
}
|
||||
|
||||
static void MeasureAntennaTuning(void) {
|
||||
@@ -184,7 +191,7 @@ static void MeasureAntennaTuning(void) {
|
||||
WDT_HIT();
|
||||
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, i);
|
||||
SpinDelay(20);
|
||||
uint32_t adcval = ((MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10);
|
||||
uint32_t adcval = ((MAX_ADC_LF_VOLTAGE * (SumAdc(ADC_CHAN_LF, 32) >> 1)) >> 14);
|
||||
if (i == LF_DIVISOR_125)
|
||||
payload.v_lf125 = adcval; // voltage at 125kHz
|
||||
|
||||
@@ -210,9 +217,9 @@ static void MeasureAntennaTuning(void) {
|
||||
SpinDelay(50);
|
||||
|
||||
#if defined RDV4
|
||||
payload.v_hf = (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
payload.v_hf = (MAX_ADC_HF_VOLTAGE_RDV40 * SumAdc(ADC_CHAN_HF_RDV40, 32)) >> 15;
|
||||
#else
|
||||
payload.v_hf = (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10;
|
||||
payload.v_hf = (MAX_ADC_HF_VOLTAGE * SumAdc(ADC_CHAN_HF, 32)) >> 15;
|
||||
#endif
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
@@ -224,16 +231,26 @@ static void MeasureAntennaTuning(void) {
|
||||
static uint16_t MeasureAntennaTuningHfData(void) {
|
||||
|
||||
#if defined RDV4
|
||||
return (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
return (MAX_ADC_HF_VOLTAGE_RDV40 * SumAdc(ADC_CHAN_HF_RDV40, 32)) >> 15;
|
||||
#else
|
||||
return (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10;
|
||||
return (MAX_ADC_HF_VOLTAGE * SumAdc(ADC_CHAN_HF, 32)) >> 15;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Measure LF in milliVolt
|
||||
static uint32_t MeasureAntennaTuningLfData(void) {
|
||||
return (MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10;
|
||||
return (MAX_ADC_LF_VOLTAGE * (SumAdc(ADC_CHAN_LF, 32) >> 1)) >> 14;
|
||||
}
|
||||
|
||||
void print_stack_usage(void) {
|
||||
// pointer arithmetic is times 4. (two shifts to the left)
|
||||
for (uint32_t *p = &_stack_start; ; ++p) {
|
||||
if (*p != 0xdeadbeef) {
|
||||
Dbprintf(" Max stack usage.........%d / %d bytes", (&_stack_end - p) << 2, (&_stack_end - &_stack_start) << 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReadMem(int addr) {
|
||||
@@ -242,8 +259,7 @@ void ReadMem(int addr) {
|
||||
Dbprintf("%x: %02x %02x %02x %02x %02x %02x %02x %02x", addr, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
|
||||
}
|
||||
|
||||
/* osimage version information is linked in */
|
||||
extern struct version_information version_information;
|
||||
/* osimage version information is linked in, cf commonutil.h */
|
||||
/* bootrom version information is pointed to from _bootphase1_version_pointer */
|
||||
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, __data_src_start__;
|
||||
static void SendVersion(void) {
|
||||
@@ -256,17 +272,19 @@ static void SendVersion(void) {
|
||||
*/
|
||||
char *bootrom_version = *(char **)&_bootphase1_version_pointer;
|
||||
|
||||
strncat(VersionString, " [ ARM ]\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, " "_YELLOW_("[ ARM ]")"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
||||
if (bootrom_version < &_flash_start || bootrom_version >= &_flash_end) {
|
||||
strcat(VersionString, "bootrom version information appears invalid\n");
|
||||
} else {
|
||||
FormatVersionInformation(temp, sizeof(temp), " bootrom: ", bootrom_version);
|
||||
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
}
|
||||
|
||||
FormatVersionInformation(temp, sizeof(temp), " os: ", &version_information);
|
||||
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
||||
#if defined(__clang__)
|
||||
strncat(VersionString, " compiled with Clang/LLVM "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
@@ -274,11 +292,11 @@ static void SendVersion(void) {
|
||||
strncat(VersionString, " compiled with GCC "__VERSION__"\n", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
#endif
|
||||
|
||||
strncat(VersionString, "\n [ FPGA ]\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
strncat(VersionString, "\n "_YELLOW_("[ FPGA ]")"\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
|
||||
for (int i = 0; i < fpga_bitstream_num; i++) {
|
||||
strncat(VersionString, fpga_version_information[i], sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
if (i < fpga_bitstream_num - 1) {
|
||||
for (int i = 0; i < g_fpga_bitstream_num; i++) {
|
||||
strncat(VersionString, g_fpga_version_information[i], sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
if (i < g_fpga_bitstream_num - 1) {
|
||||
strncat(VersionString, "\n ", sizeof(VersionString) - strlen(VersionString) - 1);
|
||||
}
|
||||
}
|
||||
@@ -313,7 +331,7 @@ static void TimingIntervalAcquisition(void) {
|
||||
// measure the Connection Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
|
||||
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandNG structure included.
|
||||
static void printConnSpeed(void) {
|
||||
DbpString(_BLUE_("Transfer Speed"));
|
||||
DbpString(_CYAN_("Transfer Speed"));
|
||||
Dbprintf(" Sending packets to client...");
|
||||
|
||||
#define CONN_SPEED_TEST_MIN_TIME 500 // in milliseconds
|
||||
@@ -353,7 +371,10 @@ static void SendStatus(void) {
|
||||
printT55xxConfig(); // LF T55XX Config
|
||||
#endif
|
||||
printConnSpeed();
|
||||
DbpString(_BLUE_("Various"));
|
||||
DbpString(_CYAN_("Various"));
|
||||
|
||||
print_stack_usage();
|
||||
|
||||
Dbprintf(" DBGLEVEL................%d", DBGLEVEL);
|
||||
Dbprintf(" ToSendMax...............%d", ToSendMax);
|
||||
Dbprintf(" ToSendBit...............%d", ToSendBit);
|
||||
@@ -372,7 +393,7 @@ static void SendStatus(void) {
|
||||
Dbprintf(_YELLOW_(" Slow Clock actual speed seems closer to %d kHz"),
|
||||
(16 * MAINCK / 1000) / mainf * delta_time / SLCK_CHECK_MS);
|
||||
}
|
||||
DbpString(_BLUE_("Installed StandAlone Mode"));
|
||||
DbpString(_CYAN_("Installed StandAlone Mode"));
|
||||
ModInfo();
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
@@ -385,12 +406,13 @@ static void SendStatus(void) {
|
||||
static void SendCapabilities(void) {
|
||||
capabilities_t capabilities;
|
||||
capabilities.version = CAPABILITIES_VERSION;
|
||||
capabilities.via_fpc = reply_via_fpc;
|
||||
capabilities.via_usb = reply_via_usb;
|
||||
capabilities.via_fpc = g_reply_via_fpc;
|
||||
capabilities.via_usb = g_reply_via_usb;
|
||||
capabilities.bigbuf_size = BigBuf_get_size();
|
||||
capabilities.baudrate = 0; // no real baudrate for USB-CDC
|
||||
#ifdef WITH_FPC_USART
|
||||
if (reply_via_fpc)
|
||||
capabilities.baudrate = usart_baudrate;
|
||||
if (g_reply_via_fpc)
|
||||
capabilities.baudrate = g_usart_baudrate;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FLASH
|
||||
@@ -433,6 +455,11 @@ static void SendCapabilities(void) {
|
||||
#else
|
||||
capabilities.compiled_with_hitag = false;
|
||||
#endif
|
||||
#ifdef WITH_EM4x50
|
||||
capabilities.compiled_with_em4x50 = true;
|
||||
#else
|
||||
capabilities.compiled_with_em4x50 = false;
|
||||
#endif
|
||||
#ifdef WITH_HFSNIFF
|
||||
capabilities.compiled_with_hfsniff = true;
|
||||
#else
|
||||
@@ -524,7 +551,7 @@ at the same place! :-)
|
||||
void ListenReaderField(uint8_t limit) {
|
||||
#define LF_ONLY 1
|
||||
#define HF_ONLY 2
|
||||
#define REPORT_CHANGE 10 // report new values only if they have changed at least by REPORT_CHANGE
|
||||
#define REPORT_CHANGE 1000 // report new values only if they have changed at least by REPORT_CHANGE mV
|
||||
|
||||
uint16_t lf_av = 0, lf_av_new, lf_baseline = 0, lf_max = 0;
|
||||
uint16_t hf_av = 0, hf_av_new, hf_baseline = 0, hf_max = 0;
|
||||
@@ -538,8 +565,8 @@ void ListenReaderField(uint8_t limit) {
|
||||
LEDsoff();
|
||||
|
||||
if (limit == LF_ONLY) {
|
||||
lf_av = lf_max = AvgAdc(ADC_CHAN_LF);
|
||||
Dbprintf("LF 125/134kHz Baseline: %dmV", (MAX_ADC_LF_VOLTAGE * lf_av) >> 10);
|
||||
lf_av = lf_max = (MAX_ADC_LF_VOLTAGE * SumAdc(ADC_CHAN_LF, 32)) >> 15;
|
||||
Dbprintf("LF 125/134kHz Baseline: %dmV", lf_av);
|
||||
lf_baseline = lf_av;
|
||||
}
|
||||
|
||||
@@ -547,11 +574,11 @@ void ListenReaderField(uint8_t limit) {
|
||||
|
||||
#if defined RDV4
|
||||
// iceman, useless, since we are measuring readerfield, not our field. My tests shows a max of 20v from a reader.
|
||||
hf_av = hf_max = AvgAdc(ADC_CHAN_HF_RDV40);
|
||||
hf_av = hf_max = (MAX_ADC_HF_VOLTAGE_RDV40 * SumAdc(ADC_CHAN_HF_RDV40, 32)) >> 15;
|
||||
#else
|
||||
hf_av = hf_max = AvgAdc(ADC_CHAN_HF);
|
||||
hf_av = hf_max = (MAX_ADC_HF_VOLTAGE * SumAdc(ADC_CHAN_HF, 32)) >> 15;
|
||||
#endif
|
||||
Dbprintf("HF 13.56MHz Baseline: %dmV", (MAX_ADC_HF_VOLTAGE * hf_av) >> 10);
|
||||
Dbprintf("HF 13.56MHz Baseline: %dmV", hf_av);
|
||||
hf_baseline = hf_av;
|
||||
}
|
||||
|
||||
@@ -583,10 +610,10 @@ void ListenReaderField(uint8_t limit) {
|
||||
LED_D_OFF();
|
||||
}
|
||||
|
||||
lf_av_new = AvgAdc(ADC_CHAN_LF);
|
||||
lf_av_new = (MAX_ADC_LF_VOLTAGE * SumAdc(ADC_CHAN_LF, 32)) >> 15;
|
||||
// see if there's a significant change
|
||||
if (ABS(lf_av - lf_av_new) > REPORT_CHANGE) {
|
||||
Dbprintf("LF 125/134kHz Field Change: %5dmV", (MAX_ADC_LF_VOLTAGE * lf_av_new) >> 10);
|
||||
Dbprintf("LF 125/134kHz Field Change: %5dmV", lf_av_new);
|
||||
lf_av = lf_av_new;
|
||||
if (lf_av > lf_max)
|
||||
lf_max = lf_av;
|
||||
@@ -602,13 +629,13 @@ void ListenReaderField(uint8_t limit) {
|
||||
}
|
||||
|
||||
#if defined RDV4
|
||||
hf_av_new = AvgAdc(ADC_CHAN_HF_RDV40);
|
||||
hf_av_new = (MAX_ADC_HF_VOLTAGE_RDV40 * SumAdc(ADC_CHAN_HF_RDV40, 32)) >> 15;
|
||||
#else
|
||||
hf_av_new = AvgAdc(ADC_CHAN_HF);
|
||||
hf_av_new = (MAX_ADC_HF_VOLTAGE * SumAdc(ADC_CHAN_HF, 32)) >> 15;
|
||||
#endif
|
||||
// see if there's a significant change
|
||||
if (ABS(hf_av - hf_av_new) > REPORT_CHANGE) {
|
||||
Dbprintf("HF 13.56MHz Field Change: %5dmV", (MAX_ADC_HF_VOLTAGE * hf_av_new) >> 10);
|
||||
Dbprintf("HF 13.56MHz Field Change: %5dmV", hf_av_new);
|
||||
hf_av = hf_av_new;
|
||||
if (hf_av > hf_max)
|
||||
hf_max = hf_av;
|
||||
@@ -701,8 +728,8 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
case CMD_BREAK_LOOP:
|
||||
break;
|
||||
case CMD_QUIT_SESSION: {
|
||||
reply_via_fpc = false;
|
||||
reply_via_usb = false;
|
||||
g_reply_via_fpc = false;
|
||||
g_reply_via_usb = false;
|
||||
break;
|
||||
}
|
||||
// emulator
|
||||
@@ -763,9 +790,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
reply_mix(CMD_ACK, bits, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HID_DEMOD: {
|
||||
case CMD_LF_HID_WATCH: {
|
||||
uint32_t high, low;
|
||||
CmdHIDdemodFSK(0, &high, &low, 1);
|
||||
int res = lf_hid_watch(0, &high, &low);
|
||||
reply_ng(CMD_LF_HID_WATCH, res, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_HID_SIMULATE: {
|
||||
@@ -797,19 +825,29 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
CopyHIDtoT55x7(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes[0]);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_IO_DEMOD: {
|
||||
case CMD_LF_IO_WATCH: {
|
||||
uint32_t high, low;
|
||||
CmdIOdemodFSK(0, &high, &low, 1);
|
||||
int res = lf_io_watch(0, &high, &low);
|
||||
reply_ng(CMD_LF_IO_WATCH, res, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM410X_DEMOD: {
|
||||
case CMD_LF_EM410X_WATCH: {
|
||||
uint32_t high;
|
||||
uint64_t low;
|
||||
CmdEM410xdemod(packet->oldarg[0], &high, &low, 1);
|
||||
int res = lf_em410x_watch(0, &high, &low);
|
||||
reply_ng(CMD_LF_EM410X_WATCH, res, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM410X_WRITE: {
|
||||
WriteEM410x(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2]);
|
||||
struct p {
|
||||
uint8_t card;
|
||||
uint8_t clock;
|
||||
uint32_t high;
|
||||
uint32_t low;
|
||||
} PACKED;
|
||||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
int res = copy_em410x_to_t55xx(payload->card, payload->clock, payload->high, payload->low);
|
||||
reply_ng(CMD_LF_EM410X_WRITE, res, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_TI_READ: {
|
||||
@@ -911,10 +949,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
EM4xWriteWord(payload->address, payload->data, payload->password, payload->usepwd);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_AWID_DEMOD: {
|
||||
case CMD_LF_AWID_WATCH: {
|
||||
uint32_t high, low;
|
||||
// Set realtime AWID demodulation
|
||||
CmdAWIDdemodFSK(0, &high, &low, 1);
|
||||
int res = lf_awid_watch(0, &high, &low);
|
||||
reply_ng(CMD_LF_AWID_WATCH, res, NULL, 0);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_VIKING_CLONE: {
|
||||
@@ -968,6 +1006,21 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_EM4x50
|
||||
case CMD_LF_EM4X50_INFO: {
|
||||
em4x50_info((em4x50_data_t *)packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM4X50_WRITE: {
|
||||
em4x50_write((em4x50_data_t *)packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
case CMD_LF_EM4X50_WRITE_PASSWORD: {
|
||||
em4x50_write_password((em4x50_data_t *)packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_ISO15693
|
||||
case CMD_HF_ISO15693_ACQ_RAW_ADC: {
|
||||
AcquireRawAdcSamplesIso15693();
|
||||
@@ -1395,7 +1448,20 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
|
||||
#ifdef WITH_HFSNIFF
|
||||
case CMD_HF_SNIFF: {
|
||||
HfSniff(packet->oldarg[0], packet->oldarg[1]);
|
||||
struct p {
|
||||
uint32_t samplesToSkip;
|
||||
uint32_t triggersToSkip;
|
||||
} PACKED;
|
||||
struct p *payload = (struct p *)packet->data.asBytes;
|
||||
|
||||
uint16_t len = 0;
|
||||
int res = HfSniff(payload->samplesToSkip, payload->triggersToSkip, &len);
|
||||
|
||||
struct {
|
||||
uint16_t len;
|
||||
} PACKED retval;
|
||||
retval.len = len;
|
||||
reply_ng(CMD_HF_SNIFF, res, (uint8_t *)&retval, sizeof(retval));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -1654,12 +1720,12 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
}
|
||||
|
||||
// offset should not be over buffer
|
||||
if (payload->offset >= BIGBUF_SIZE) {
|
||||
if (payload->offset >= BigBuf_get_size()) {
|
||||
reply_ng(CMD_LF_UPLOAD_SIM_SAMPLES, PM3_EOVFLOW, NULL, 0);
|
||||
break;
|
||||
}
|
||||
// ensure len bytes copied wont go past end of bigbuf
|
||||
uint16_t len = MIN(BIGBUF_SIZE - payload->offset, sizeof(payload->data));
|
||||
uint16_t len = MIN(BigBuf_get_size() - payload->offset, sizeof(payload->data));
|
||||
|
||||
uint8_t *mem = BigBuf_get_addr();
|
||||
|
||||
@@ -2049,7 +2115,11 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
void __attribute__((noreturn)) AppMain(void) {
|
||||
|
||||
SpinDelay(100);
|
||||
clear_trace();
|
||||
BigBuf_initialize();
|
||||
|
||||
for (uint32_t *p = &_stack_start; p < (uint32_t *)((uintptr_t)&_stack_end - 0x200); ++p) {
|
||||
*p = 0xdeadbeef;
|
||||
}
|
||||
|
||||
if (common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
|
||||
/* Initialize common area */
|
||||
@@ -2116,6 +2186,12 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
if (_stack_start != 0xdeadbeef) {
|
||||
Dbprintf("Stack overflow detected! Please increase stack size, currently %d bytes", (&_stack_end - &_stack_start) << 2);
|
||||
Dbprintf("Unplug your device now.");
|
||||
while (1);
|
||||
}
|
||||
|
||||
// Check if there is a packet available
|
||||
PacketCommandNG rx;
|
||||
memset(&rx.data, 0, sizeof(rx.data));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user