diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0ec56e054..e035578b4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,7 +41,7 @@ jobs: run: sudo apt-get update - name: Install dependencies - run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev + run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev - name: Install Python dependencies run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index acce10e3a..9887be49f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -26,7 +26,7 @@ jobs: run: sudo apt-get update - name: Install dependencies - run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev + run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev - name: Install Python dependencies run: | @@ -58,7 +58,7 @@ jobs: run: sudo apt-get update - name: Install dependencies - run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev + run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev - name: Install Python dependencies run: | @@ -91,7 +91,7 @@ jobs: run: sudo apt-get update - name: Install dependencies - run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev + run: sudo apt-get install -yqq make autoconf build-essential ca-certificates pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev python3 python3-dev libpython3-all-dev liblua5.2-dev liblua5.2-0 lua5.2 sed libssl-dev - name: Install Python dependencies run: | diff --git a/.github/workflows/uniq.yaml b/.github/workflows/uniq.yaml index 89f845483..a770a4fde 100644 --- a/.github/workflows/uniq.yaml +++ b/.github/workflows/uniq.yaml @@ -18,6 +18,5 @@ jobs: - name: check unique keys in dic files shell: bash run: | - find . -type f -name "*.dic" | xargs -I {} sh -c "echo {} && cat {} | grep -v '#' | sort | uniq -i -d -c | sort -n -r " - if [[ $(find . -type f -name "*.dic" | xargs -I {} sh -c "echo {} && cat {} | grep -v '#' | sort | uniq -i -d -c | sort -n -r " | grep -v "./" | wc -l) -gt 0 ]]; then exit 1; fi - + find . -type f -name "*.dic" | xargs -I {} sh -c "echo {} && cat {} | sed 's/ *#.*//;/^$/d' | sort | uniq -i -d -c | sort -n -r " + if [[ $(find . -type f -name "*.dic" | xargs -I {} sh -c "echo {} && cat {} | sed 's/ *#.*//;/^$/d' | sort | uniq -i -d -c | sort -n -r " | grep -v '^\./' | wc -l) -gt 0 ]]; then exit 1; fi diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 77c3dc70c..3c093f96b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -110,6 +110,7 @@ jobs: gcc-arm-none-eabi libnewlib-dev libbz2-dev + liblz4-dev qtbase5-dev cmake libpython3-dev diff --git a/.vscode/setup.sh b/.vscode/setup.sh index 70672b924..a319ab056 100755 --- a/.vscode/setup.sh +++ b/.vscode/setup.sh @@ -39,7 +39,7 @@ function print_config { function setup_serial_port { if [ -z "$SerialPort" ]; then pm3list=$($VSCODEPATH/../pm3 --list 2>/dev/null) - #Use first port listed + #Use first port listed export SerialPort=$(echo $pm3list | head -n 1 | cut -c 4-) if [ -z "$SerialPort" ]; then echo >&2 "[!!] No serial port found, please set SerialPort manually" @@ -129,17 +129,17 @@ fi HOSTOS=$(uname | awk '{print toupper($0)}') if [ "$HOSTOS" = "LINUX" ]; then - if uname -a|grep -q Microsoft; then + if uname -a|grep -q Microsoft; then setup_wsl - else + else setup_linux - fi + fi elif [ "$HOSTOS" = "DARWIN" ]; then echo >&2 "[!!] MacOS not supported, sorry!" exit 1 elif [[ "$HOSTOS" =~ MINGW(32|64)_NT* ]]; then setup_ps else - echo >&2 "[!!] Host OS not recognized, abort: $HOSTOS" - exit 1 + echo >&2 "[!!] Host OS not recognized, abort: $HOSTOS" + exit 1 fi \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0851d3a2e..d82b128c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,62 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac ## [unreleased][unreleased] - Use proxmark3 as a generic smartcard reader with other software with `smart relay` (@gm3197) + - Fixed `utils.lua` library function "convertdectohex" wasn't working (@iceman1001) + - Added `hf iclass creditepurse` command to allow crediting the epurse debit value (@nvx) + +## [Raccoon.4.17140][2023-09-09] + - Changed text and adjust pm3_test case for mf_aes_brute (@doegox) + - Fix CPPChecker warnings (@doegox) + - Fix TubmleWeed docker setup (@doegox) + - Added default keys (@ernestask) (@craftbyte) + - Fixed MFU authentication to send PACK correctly (@shallax) + - Fixed list output when line has 16 bytes (@piru) + - Changed AIDlist w new entries (@kormax) + - Swapped to OE1 for Shallow modulation on RDV4. Thanks to @gentilkiwi for testing (@d18c7db) + - Changed iClass SIO and Legacy credential detection to be more reliable (@nvx) + - Add hf_cardhopper standalone mode for long-distance relay attacks (@startrekdude) + - Added `hf iclass esetblk` - set iClass emulator memory block data (@nvx) + - Added cryptorf regressiontests (@iceman1001) + - Fixed `cryptorf/sma_multi` - local state used in multithread (@iceman1001) + - Changed `fpga_compress` - better deallocation of memory and closing of file handles (@iceman1001) + - Changed `hf search` - less swaps of fpga images on device side (@iceman1001) + - Changed `mkversion.sh` - now regenerates version_pm3.c (and consequently the binaries) only when needed (@doegox) + - Added `data atr` - a command to lookup ATR (@iceman1001) + - Fixed bug in ATR lookup fct, thanks @DidierA (@iceman1001) + - Updated ATR list (@iceman1001) + - Changed `mem load -m` - now correctly erase all allocated flash memory (@iceman1001) + - Fixed emulator quick dump to handle MFC Ev1 extra sectors (@iceman100) + - Removed some empty dump files (@iceman1001) + - Added a fct to choose fpga mode (@iceman1001) + - Changed `hf mf eload/gsave` - fast uploading to emulator memory (@iceman1001) + - Added empty dump files with keys for easy simulation (@iceman1001) + - Added `hf 15 view` - view ISO15693 dump files (@iceman1001) + - Fixed `hf iclass config` - now loops correct in keyroll generation (@iceman1001) + - Added `hf iclass sam` - skeleton command (@iceman1001) + - Changed `lf cotag demo` - a new decoder (@iceman1001) + - Changed `hf legic view/eview/info` - now in verbose mode will print raw hex dump (@iceman1001) + - Added new test for cotag demod using data commands in pm3_test.sh (@iceman1001) + - Added new sample trace file for cotag w fc/272. Thanks s1acky! (@iceman1001) + - Fixed `hf legic eload` - now it doesn't crash client (@doegox) + - Changed `lf hitag *` - rework client side (@doegox) + - Changed data commands to handle ask/nrz clocks above 256 (@iceman1001) + - Added `data envelope` - almost acts like data askedgedetect (@iceman1001) + - Added `data cthreshold` - acts like an inverted dirtythreshold command. Remove center values (@iceman1001) + - Added `hf mfp list` - interprets MIFARE Plus commands in traces (@DidierA) + - Changed `hf legic sim` - loop and return codes on deviceside updated to DEFINES (@iceman1001) + - Changed `hf legic einfo` - now accepts the three different cardsizes as params (@iceman1001) + - Fixed `lf cotag reader -1` - now doesn't fail (@iceman1001) + - Added support for LZ4 compressed hardnested tables (@doegox) + - Changed `emv reader -v` - now tries to print found transactions logs (@iceman1001) + - Added ISO4217 currency lookup (@iceman1001) + - Fixed bad free in loadfilebinarykey fct. Thanks to @gentilkiwi - Changed `emv reader -v` - now can decode track1/2 data if found (@iceman1001) - Added `emv reader` - act as a EMV reader (@iceman1001) - Added support for Apple Wallet NFC Passes with the Value Added Services protocol implementation (@gm3197) - - Fix compiling liblua on iOS (@The-SamminAter) + - Fixed compiling liblua on iOS (@The-SamminAter) - Changed `hf_mf_luxeo_dump.lua` - now have list of keys to iterate (@iceman1001) - Fixed the timeout of TCP connections (@wh201906) - - Made the connection timeout configurable (@wh201906) + - Changed the connection timeout configurable (@wh201906) ## [Seven.4.16717][2023-06-25] - Change `hf 14a info` - now identifes QL88 tags (@iceman1001) @@ -27,7 +76,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac - Added more default keys (@iceman1001) Thanks anon! - Fixed `pm3-flash-all` shell script now correctly identify the if running on outdated bootloader (@iceman1001) - Fixed `hf 15693/iclass sniff` trace timings (@nvx) - - Fix LegicCash segment handling in `hf_legic.lua` script (@jmichelp) + - Fixed LegicCash segment handling in `hf_legic.lua` script (@jmichelp) - Fixed `trace list` - now handles marking of crc bytes w color a bit better (@iceman1001) - Changed `hf mfu pwdgen -r` - now generates pwd/pack for Philips Sonicare, thanks @ckuenzi, @atc1441 (@iceman1001) - Changed `hf mfu info` - now detects Philips Sonicare devices (@iceman1001) @@ -117,11 +166,11 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac - Changed `hf mfu info` - now also does a simple OTP fingerprinting (@iceman1001) - Changed `hf mf wrbl` - now checks for strict readonly ACL's in the data to write (@iceman1001) - Changed `hf mf view` - verbose printing if strict readonly ACL's exists in dump file (@iceman1001) - - Add command `piv authsign` to get a buffer signed by the selected key (@jmichelp) - - Add command `piv scan` which tries to read all known containers on PIV (@jmichelp) - - Add support for PIV commands, over wired and contactless interfaces (@jmichelp) - - Add `--shallow` option to `hf iclass` reader commands to do shallow (ASK) reader modulation instead of OOK (@nvx) - - Improved NXP SLI/SLIX series tag identification (@nvx) + - Added command `piv authsign` to get a buffer signed by the selected key (@jmichelp) + - Added command `piv scan` which tries to read all known containers on PIV (@jmichelp) + - Added support for PIV commands, over wired and contactless interfaces (@jmichelp) + - Added `--shallow` option to `hf iclass` reader commands to do shallow (ASK) reader modulation instead of OOK (@nvx) + - Change and improved NXP SLI/SLIX series tag identification (@nvx) - Fixed buffer overflow in "lf em 4x05 sniff" (@HeinrichsH) - Fixed potential NULL array printing (@jmichelp) - Added PIV aid to resource file (@jmichelp) diff --git a/Makefile b/Makefile index be4af6682..64b0aa6ab 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ ifneq (,$(DESTDIR)) endif endif -all clean install uninstall check: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/% mf_nonce_brute/% mfd_aes_brute/% fpga_compress/% +all clean install uninstall check: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/% mf_nonce_brute/% mfd_aes_brute/% fpga_compress/% cryptorf/% # hitag2crack toolsuite is not yet integrated in "all", it must be called explicitly: "make hitag2crack" #all clean install uninstall check: %: hitag2crack/% @@ -39,7 +39,7 @@ INSTALLSCRIPTS=pm3 pm3-flash pm3-flash-all pm3-flash-bootrom pm3-flash-fullimage INSTALLSHARES=tools/jtag_openocd traces INSTALLDOCS=doc/*.md doc/md -install: all common/install +install: common/install common/install: $(info [@] Installing common resources to $(MYDESTDIR)$(PREFIX)...) @@ -109,6 +109,9 @@ endif $(Q)-$(INSTALLSUDO) $(RMDIR_SOFT) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLSHARERELPATH) # tests +cryptorf/check: FORCE + $(info [*] CHECK $(patsubst %/check,%,$@)) + $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@) mfkey/check: FORCE $(info [*] CHECK $(patsubst %/check,%,$@)) $(Q)$(BASH) tools/pm3_tests.sh $(CHECKARGS) $(patsubst %/check,%,$@) @@ -145,6 +148,9 @@ common/check: FORCE check: common/check $(info [*] ALL CHECKS DONE) +cryptorf/%: FORCE + $(info [*] MAKE $@) + $(Q)$(MAKE) --no-print-directory -C tools/cryptorf $(patsubst cryptorf/%,%,$@) DESTDIR=$(MYDESTDIR) mfkey/%: FORCE $(info [*] MAKE $@) $(Q)$(MAKE) --no-print-directory -C tools/mfkey $(patsubst mfkey/%,%,$@) DESTDIR=$(MYDESTDIR) @@ -170,7 +176,7 @@ client/%: FORCE cleanifplatformchanged $(info [*] MAKE $@) $(Q)$(MAKE) --no-print-directory -C client $(patsubst client/%,%,$@) DESTDIR=$(MYDESTDIR) recovery/all: bootrom/all armsrc/all -recovery/install: bootrom/all armsrc/all +recovery/install: bootrom/install armsrc/install recovery/%: FORCE cleanifplatformchanged $(info [*] MAKE $@) $(Q)$(MAKE) --no-print-directory -C recovery $(patsubst recovery/%,%,$@) DESTDIR=$(MYDESTDIR) @@ -196,6 +202,7 @@ help: @echo "+ recovery - Make bootrom and fullimage files for JTAG flashing" @echo @echo "+ client - Make only the OS-specific host client" + @echo "+ cryptorf - Make tools/cryptorf" @echo "+ mfkey - Make tools/mfkey" @echo "+ nonce2key - Make tools/nonce2key" @echo "+ mf_nonce_brute - Make tools/mf_nonce_brute" @@ -232,6 +239,8 @@ fullimage/uninstall: armsrc/uninstall recovery: recovery/all +cryptorf: cryptorf/all + mfkey: mfkey/all nonce2key: nonce2key/all @@ -318,10 +327,10 @@ style: # Make sure python3 is installed @command -v python3 >/dev/null || ( echo "Please install 'python3' package first" ; exit 1 ) # Update commands.json, patch port in case it was run under Windows - [ -x client/proxmark3 ] && client/proxmark3 --fulltext | sed 's#com[0-9]#/dev/ttyacm0#'|python3 client/pyscripts/pm3_help2json.py - doc/commands.json + [ -x client/proxmark3 ] && client/proxmark3 --fulltext | sed 's#com[0-9]#/dev/ttyACM0#'|python3 client/pyscripts/pm3_help2json.py - doc/commands.json # Update the readline autocomplete autogenerated code - [ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2list.py - client/src/pm3line_vocabulory.h + [ -x client/proxmark3 ] && client/proxmark3 --fulltext | python3 client/pyscripts/pm3_help2list.py - client/src/pm3line_vocabulary.h # Detecting weird codepages and tabs. @@ -370,10 +379,10 @@ release: # - 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_pm3.c.tmp && $(MV) common/default_version_pm3.c.tmp common/default_version_pm3.c + @$(SH) tools/mkversion.sh --force common/default_version_pm3.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 + @sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt client/experimental_lib/CMakeLists.txt # - Deleting tag... @git tag -d $(VERSION) # - Amending commit... diff --git a/README.md b/README.md index 9096c9559..d65262674 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,9 @@ The Proxmark3 is the swiss-army tool of RFID, allowing for interactions with the | :------------------: | :------------------: | | [Linux - Setup and Build](/doc/md/Installation_Instructions/Linux-Installation-Instructions.md) | [Compilation Instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md)| | [Linux - Important notes on ModemManager](/doc/md/Installation_Instructions/ModemManager-Must-Be-Discarded.md) | [Validating Proxmark3 Client Functionality](/doc/md/Use_of_Proxmark/1_Validation.md)| -| [Mac OS X - Homebrew & 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)| -| [Mac OS X - MacPorts](/doc/md/Installation_Instructions/Mac-OS-X-MacPorts-Installation-Instructions.md) | [Commands & Features](/doc/md/Use_of_Proxmark/3_Commands-and-Features.md)| -| [Mac OS X - Setup and Build](/doc/md/Installation_Instructions/Mac-OS-X-Compile-From-Source-Instructions.md) || +| [macOS - Homebrew & Upgrading HomeBrew Tap Formula](/doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md) | [First Use and Verification](/doc/md/Use_of_Proxmark/2_Configuration-and-Verification.md)| +| [macOS - MacPorts](/doc/md/Installation_Instructions/macOS-MacPorts-Installation-Instructions.md) | [Commands & Features](/doc/md/Use_of_Proxmark/3_Commands-and-Features.md)| +| [macOS - Setup and Build](/doc/md/Installation_Instructions/macOS-Compile-From-Source-Instructions.md) || | [Windows - Setup and Build](/doc/md/Installation_Instructions/Windows-Installation-Instructions.md) || | [Termux / Android - Setup and Build](/doc/termux_notes.md) || | [Blue Shark Manual](/doc/bt_manual_v10.md) | [Command Cheat Sheet](/doc/cheatsheet.md)| @@ -184,7 +184,7 @@ This repo compiles nicely on - Windows/MinGW environment - Ubuntu, ParrotOS, Gentoo, Pentoo, Kali, NetHunter, Arch Linux, Fedora, Debian, Raspbian - Android / Termux - - Mac OS X / Homebrew (or MacPorts, experimental) / Apple Silicon M1 + - macOS / Homebrew (or MacPorts, experimental) / Apple Silicon M1 - Docker container - [ 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/) diff --git a/armsrc/BigBuf.c b/armsrc/BigBuf.c index d685f0388..b622e013b 100644 --- a/armsrc/BigBuf.c +++ b/armsrc/BigBuf.c @@ -233,7 +233,7 @@ uint32_t BigBuf_get_traceLen(void) { by 'hf list -t raw', alternatively 'hf list -t ' for protocol-specific annotation of commands/responses. **/ -bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool reader2tag) { +bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, const uint8_t *parity, bool reader2tag) { if (tracing == false) { return false; } @@ -290,7 +290,7 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_ } // specific LogTrace function for ISO15693: the duration needs to be scaled because otherwise it won't fit into a uint16_t -bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, uint8_t *parity, bool reader2tag) { +bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, const uint8_t *parity, bool reader2tag) { uint32_t duration = ts_end - ts_start; duration /= 32; ts_end = ts_start + duration; @@ -306,17 +306,24 @@ bool RAMFUNC LogTraceBits(const uint8_t *btBytes, uint16_t bitLen, uint32_t time } // Emulator memory -uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length) { +uint8_t emlSet(const uint8_t *data, uint32_t offset, uint32_t length) { uint8_t *mem = BigBuf_get_EM_addr(); - if (offset + length < CARD_MEMORY_SIZE) { + if (offset + length <= CARD_MEMORY_SIZE) { memcpy(mem + offset, data, length); return 0; } - Dbprintf("Error, trying to set memory outside of bounds! %d > %d", (offset + length), CARD_MEMORY_SIZE); + Dbprintf("Error, trying to set memory outside of bounds! " _RED_("%d") " > %d", (offset + length), CARD_MEMORY_SIZE); + return 1; +} +uint8_t emlGet(uint8_t *out, uint32_t offset, uint32_t length) { + uint8_t *mem = BigBuf_get_EM_addr(); + if (offset + length <= CARD_MEMORY_SIZE) { + memcpy(out, mem + offset, length); + return 0; + } + Dbprintf("Error, trying to read memory outside of bounds! " _RED_("%d") " > %d", (offset + length), CARD_MEMORY_SIZE); return 1; } - - // get the address of the ToSend buffer. Allocate part of Bigbuf for it, if not yet done tosend_t *get_tosend(void) { diff --git a/armsrc/BigBuf.h b/armsrc/BigBuf.h index b1003a4c1..0938bd555 100644 --- a/armsrc/BigBuf.h +++ b/armsrc/BigBuf.h @@ -51,11 +51,12 @@ void set_tracing(bool enable); void set_tracelen(uint32_t value); bool get_tracing(void); -bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool reader2tag); +bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, const uint8_t *parity, bool reader2tag); bool RAMFUNC LogTraceBits(const uint8_t *btBytes, uint16_t bitLen, uint32_t timestamp_start, uint32_t timestamp_end, bool reader2tag); -bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, uint8_t *parity, bool reader2tag); +bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, const uint8_t *parity, bool reader2tag); -uint8_t emlSet(uint8_t *data, uint32_t offset, uint32_t length); +uint8_t emlSet(const uint8_t *data, uint32_t offset, uint32_t length); +uint8_t emlGet(uint8_t *out, uint32_t offset, uint32_t length); typedef struct { int max; diff --git a/armsrc/LCD_disabled.c b/armsrc/LCD_disabled.c index 1a4b253e2..67b0f3de9 100644 --- a/armsrc/LCD_disabled.c +++ b/armsrc/LCD_disabled.c @@ -53,7 +53,7 @@ void LCDFill(unsigned char xs, unsigned char ys, unsigned char width, unsigned c } } -void LCDString(char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor) { +void LCDString(const char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor) { unsigned int i; unsigned char mask = 0, px, py, xme, yme, offset; const char *data; diff --git a/armsrc/LCD_disabled.h b/armsrc/LCD_disabled.h index e2f57e02c..26900531a 100644 --- a/armsrc/LCD_disabled.h +++ b/armsrc/LCD_disabled.h @@ -130,7 +130,7 @@ void LCDInit(void); void LCDReset(void); void LCDSetXY(unsigned char x, unsigned char y); void LCDSetPixel(unsigned char x, unsigned char y, unsigned char color); -void LCDString(char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor); +void LCDString(const char *lcd_string, const char *font_style, unsigned char x, unsigned char y, unsigned char fcolor, unsigned char bcolor); void LCDFill(unsigned char xs, unsigned char ys, unsigned char width, unsigned char height, unsigned char color); #endif diff --git a/armsrc/Makefile b/armsrc/Makefile index c481a6f22..d6ab2bfc4 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -127,7 +127,7 @@ THUMBSRC = start.c \ $(SRC_SMARTCARD) \ $(SRC_FPC) \ $(SRC_HITAG) \ - $(SRC_EM4x50) \ + $(SRC_EM4x50) \ $(SRC_EM4x70) \ $(SRC_SPIFFS) \ $(SRC_HF) \ @@ -181,10 +181,10 @@ showinfo: .DELETE_ON_ERROR: -# version_pm3.c should be remade on every time fullimage.stage1.elf should be remade +# version_pm3.c should be checked on every time fullimage.stage1.elf should be remade version_pm3.c: default_version_pm3.c $(OBJDIR)/fpga_version_info.o $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ) .FORCE - $(info [-] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(CP) $< $@ + $(info [-] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ fpga_version_info.c: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR) $(info [-] GEN $@) diff --git a/armsrc/Standalone/Makefile.hal b/armsrc/Standalone/Makefile.hal index da204eaca..1a903a0ac 100644 --- a/armsrc/Standalone/Makefile.hal +++ b/armsrc/Standalone/Makefile.hal @@ -86,6 +86,9 @@ define KNOWN_STANDALONE_DEFINITIONS | HF_BOG | 14a sniff with ULC/ULEV1/NTAG auth | | (RDV4 only) | storing in flashmem - Bogito | +----------------------------------------------------------+ +| HF_CARDHOPPER | Relay 14a protocols over long distances| +| (RDV4 only) | (w/ IP backbone) - Sam Haskins | ++----------------------------------------------------------+ | HF_COLIN | Mifare ultra fast sniff/sim/clone | | (RDV4 only) | - Colin Brigato | +----------------------------------------------------------+ @@ -130,9 +133,9 @@ endef STANDALONE_MODES := LF_SKELETON STANDALONE_MODES += LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RSWW LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_MULTIHID LF_NEDAP_SIM LF_NEXID LF_PROXBRUTE LF_PROX2BRUTE LF_SAMYRUN LF_THAREXDE -STANDALONE_MODES += HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_AVEFUL HF_BOG HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_TCPRST HF_TMUDFORD HF_YOUNG +STANDALONE_MODES += HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_AVEFUL HF_BOG HF_CARDHOPPER HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_TCPRST HF_TMUDFORD HF_YOUNG STANDALONE_MODES += DANKARMULTI -STANDALONE_MODES_REQ_BT := HF_REBLAY +STANDALONE_MODES_REQ_BT := HF_CARDHOPPER HF_REBLAY STANDALONE_MODES_REQ_SMARTCARD := STANDALONE_MODES_REQ_FLASH := LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_BOG HF_COLIN HF_ICECLASS HF_LEGICSIM HF_MFCSIM ifneq ($(filter $(STANDALONE),$(STANDALONE_MODES)),) diff --git a/armsrc/Standalone/Makefile.inc b/armsrc/Standalone/Makefile.inc index 6aeb163bb..19e3645ff 100644 --- a/armsrc/Standalone/Makefile.inc +++ b/armsrc/Standalone/Makefile.inc @@ -97,6 +97,10 @@ endif ifneq (,$(findstring WITH_STANDALONE_HF_BOG,$(APP_CFLAGS))) SRC_STANDALONE = hf_bog.c endif +# WITH_STANDALONE_HF_CARDHOPPER +ifneq (,$(findstring WITH_STANDALONE_HF_CARDHOPPER,$(APP_CFLAGS))) + SRC_STANDALONE = hf_cardhopper.c +endif # WITH_STANDALONE_HF_COLIN ifneq (,$(findstring WITH_STANDALONE_HF_COLIN,$(APP_CFLAGS))) SRC_STANDALONE = vtsend.c hf_colin.c frozen.c nprintf.c diff --git a/armsrc/Standalone/hf_14asniff.c b/armsrc/Standalone/hf_14asniff.c index 041a0b6f0..dc0c0905c 100644 --- a/armsrc/Standalone/hf_14asniff.c +++ b/armsrc/Standalone/hf_14asniff.c @@ -43,7 +43,7 @@ * 1. mem spiffs dump -s hf_14asniff.trace -d hf_14asniff.trace * Copies trace data file from flash to your PC. * - * 2. trace load hf_14asniff.trace + * 2. trace load -f hf_14asniff.trace * Loads trace data from a file into PC-side buffers. * * 3. For ISO14a: trace list -t 14a -1 @@ -55,6 +55,7 @@ * the lab connected to PM3 client before taking it into the field. * * To delete the trace data from flash: + * mem spiffs remove -f hf_14asniff.trace * * Caveats / notes: * - Trace buffer will be cleared on starting stand-alone mode. Data in flash diff --git a/armsrc/Standalone/hf_14bsniff.c b/armsrc/Standalone/hf_14bsniff.c old mode 100755 new mode 100644 index d342afa93..d3adaeb23 --- a/armsrc/Standalone/hf_14bsniff.c +++ b/armsrc/Standalone/hf_14bsniff.c @@ -14,9 +14,24 @@ * - LED3: sniffed reader command, turns off when finished sniffing tag command * - LED4: unmounting/sync'ing flash (normally < 100ms) * + * To retrieve trace data from flash: + * + * 1. mem spiffs dump -s hf_14bsniff.trace -d hf_14bsniff.trace + * Copies trace data file from flash to your PC. + * + * 2. trace load -f hf_14bsniff.trace + * Loads trace data from a file into PC-side buffers. + * + * 3. For ISO14a: trace list -t 14b -1 + * + * Lists trace data from buffer without requesting it from PM3. + * * This module emits debug strings during normal operation -- so try it out in * the lab connected to PM3 client before taking it into the field. * + * To delete the trace data from flash: + * mem spiffs remove -f hf_14bsniff.trace + * * Caveats / notes: * - Trace buffer will be cleared on starting stand-alone mode. * - This module will terminate if the trace buffer is full. diff --git a/armsrc/Standalone/hf_15sniff.c b/armsrc/Standalone/hf_15sniff.c index 24d068275..ad1d3f8b6 100644 --- a/armsrc/Standalone/hf_15sniff.c +++ b/armsrc/Standalone/hf_15sniff.c @@ -43,7 +43,7 @@ * 1. mem spiffs dump -s hf_15693sniff.trace -d hf_15693sniff.trace * Copies trace data file from flash to your PC. * - * 2. trace load hf_15693sniff.trace + * 2. trace load -f hf_15693sniff.trace * Loads trace data from a file into PC-side buffers. * * 3. For ISO15693: trace list -t 15 -1 @@ -54,6 +54,7 @@ * the lab connected to PM3 client before taking it into the field. * * To delete the trace data from flash: + * mem spiffs remove -f hf_15693sniff.trace * * Caveats / notes: * - Trace buffer will be cleared on starting stand-alone mode. Data in flash diff --git a/armsrc/Standalone/hf_cardhopper.c b/armsrc/Standalone/hf_cardhopper.c new file mode 100644 index 000000000..90742f4cf --- /dev/null +++ b/armsrc/Standalone/hf_cardhopper.c @@ -0,0 +1,417 @@ +/* + * hf_cardhopper standalone mode by Sam Haskins + * + * A component of our (me + Trevor Stevado) research on long-range relay + * attacks against 14a-based protocols (as presented at DEF CON '31). + * Works with a CardHopper (recommended) or BlueShark add-on. + * + * If you're reading this, you're clearly a very interesting person--- + * do reach out if you get any fun results? [ sam AT loudmouth DOT io ] + * Good luck, and may the odds be ever in your favour! + * + * The companion Android app is available on our gitlab: gitlab.com/loudmouth-security + * + * For more information, see: https://media.defcon.org/DEF%20CON%2031/DEF%20CON%2031%20presentations/Trevor%20Stevado%20Sam%20Haskins%20-%20Unlocking%20Doors%20from%20Half%20a%20Continent%20Away.pdf + */ + +#include + +#include "appmain.h" +#include "BigBuf.h" +#include "dbprint.h" +#include "fpgaloader.h" +#include "iso14443a.h" +#include "protocols.h" +#include "proxmark3_arm.h" +#include "standalone.h" +#include "ticks.h" +#include "util.h" +#include "usart.h" + + +void ModInfo(void) { + DbpString(" HF - Long-range relay 14a over serial<->IP - a.k.a. CardHopper (Sam Haskins)"); +} + + +typedef struct PACKED { + uint8_t len; + uint8_t dat[255]; +} packet_t; + +// Magic numbers +static const uint8_t magicREAD[4] = "READ"; +static const uint8_t magicCARD[4] = "CARD"; +static const uint8_t magicEND [4] = "\xff" "END"; +static const uint8_t magicRSRT[7] = "RESTART"; +static const uint8_t magicERR [4] = "\xff" "ERR"; +static uint8_t magicACK [1] = "\xfe"; // is constant, but must be passed to API that doesn't like that + +// Forward declarations +static void become_reader(void); +static void select_card(void); + +static void become_card(void); +static void prepare_emulation(uint8_t *, uint16_t *, uint8_t *, packet_t *); +static void cook_ats(packet_t *, uint8_t, uint8_t); +static bool try_use_canned_response(const uint8_t *, int, tag_response_info_t *); +static void reply_with_packet(packet_t *); + +static void read_packet(packet_t *); +static void write_packet(packet_t *); + +static bool GetIso14443aCommandFromReaderInterruptible(uint8_t *, uint8_t *, int *); + + +void RunMod(void) { + StandAloneMode(); + DbpString(_CYAN_("[@]") " CardHopper has started - waiting for mode"); + FpgaDownloadAndGo(FPGA_BITSTREAM_HF); + + clear_trace(); + set_tracing(true); + + // Indicate we are alive and in CardHopper + LEDsoff(); + LED_A_ON(); + LED_D_ON(); + + while (1) { + WDT_HIT(); + + packet_t modeRx = { 0 }; + read_packet(&modeRx); + + if (memcmp(magicREAD, modeRx.dat, sizeof(magicREAD)) == 0) { + DbpString(_CYAN_("[@]") " I am a READER. I talk to a CARD."); + become_reader(); + } else if (memcmp(magicCARD, modeRx.dat, sizeof(magicCARD)) == 0) { + DbpString(_CYAN_("[@]") " I am a CARD. I talk to a READER."); + become_card(); + } else if (memcmp(magicEND, modeRx.dat, sizeof(magicEND)) == 0) { + break; + } else { + DbpString(_YELLOW_("[!]") " unknown mode!"); + Dbhexdump(modeRx.len, modeRx.dat, true); + } + } + + DbpString(_CYAN_("[@]") " exiting ..."); + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); + LEDsoff(); +} + + +static void become_reader(void) { + iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD); + select_card(); // also sends UID, ATS + + DbpString(_CYAN_("[@]") " entering reader main loop ..."); + packet_t packet = { 0 }; + packet_t *rx = &packet; + packet_t *tx = &packet; + uint8_t toCard[256] = { 0 }; + uint8_t parity[MAX_PARITY_SIZE] = { 0 }; + + while (1) { + WDT_HIT(); + + read_packet(rx); + if (memcmp(magicRSRT, rx->dat, sizeof(magicRSRT)) == 0) break; + + memcpy(toCard, rx->dat, rx->len); + AddCrc14A(toCard, rx->len); + ReaderTransmit(toCard, rx->len + 2, NULL); + + tx->len = ReaderReceive(tx->dat, parity); + if (tx->len == 0) { + tx->len = sizeof(magicERR); + memcpy(tx->dat, magicERR, sizeof(magicERR)); + } else tx->len -= 2; // cut off the CRC + + write_packet(tx); + } +} + + +static void select_card(void) { + iso14a_card_select_t card = { 0 }; + while (1) { + WDT_HIT(); + + int ret = iso14443a_select_card(NULL, &card, NULL, true, 0, false); + if (ret && ret != 1) + Dbprintf(_RED_("[!]") " Error selecting card: %d", ret); + if (ret == 1) break; + + SpinDelay(20); + } + + DbpString(_CYAN_("[@]") " UID:"); + Dbhexdump(card.uidlen, card.uid, false); + DbpString(_CYAN_("[@]") " ATS:"); + Dbhexdump(card.ats_len - 2 /* no CRC */, card.ats, false); + + packet_t tx = { 0 }; + tx.len = card.uidlen; + memcpy(tx.dat, card.uid, tx.len); + write_packet(&tx); + + tx.len = card.ats_len - 2; + memcpy(tx.dat, card.ats, tx.len); + write_packet(&tx); +} + + +static void become_card(void) { + iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN); + + uint8_t tagType; + uint16_t flags; + uint8_t data[PM3_CMD_DATA_SIZE] = { 0 }; + packet_t ats = { 0 }; + prepare_emulation(&tagType, &flags, data, &ats); + + tag_response_info_t *canned; + uint32_t cuid; + uint32_t counters[3] = { 0 }; + uint8_t tearings[3] = { 0xbd, 0xbd, 0xbd }; + uint8_t pages; + SimulateIso14443aInit(tagType, flags, data, &canned, &cuid, counters, tearings, &pages); + + DbpString(_CYAN_("[@]") " Setup done - entering emulation loop"); + int fromReaderLen; + uint8_t fromReaderDat[256] = { 0 }; + uint8_t parity[MAX_PARITY_SIZE] = { 0 }; + packet_t packet = { 0 }; + packet_t *tx = &packet; + packet_t *rx = &packet; + + while (1) { + WDT_HIT(); + + if (!GetIso14443aCommandFromReaderInterruptible(fromReaderDat, parity, &fromReaderLen)) { + if (usart_rxdata_available()) { + read_packet(rx); + if (memcmp(magicRSRT, rx->dat, sizeof(magicRSRT)) == 0) { + DbpString(_CYAN_("[@]") " Breaking from reader loop"); + break; + } + } + continue; + } + + // Option 1: Use a canned response + if (try_use_canned_response(fromReaderDat, fromReaderLen, canned)) continue; + + // Option 2: Reply with our cooked ATS + if (fromReaderDat[0] == ISO14443A_CMD_RATS && fromReaderLen == 4) { + reply_with_packet(&ats); + continue; + } + + // Option 3: Relay the message + tx->len = fromReaderLen - 2; // cut off the crc + memcpy(tx->dat, fromReaderDat, tx->len); + write_packet(tx); + + read_packet(rx); + reply_with_packet(rx); + } +} + + +static void prepare_emulation(uint8_t *tagType, uint16_t *flags, uint8_t *data, packet_t *ats) { + packet_t tagTypeRx = { 0 }; + read_packet(&tagTypeRx); + packet_t timeModeRx = { 0 }; + read_packet(&timeModeRx); + packet_t uidRx = { 0 }; + read_packet(&uidRx); + read_packet(ats); + + *tagType = tagTypeRx.dat[0]; + Dbprintf(_CYAN_("[@]") " Using tag type: %hhu", *tagType); + + DbpString(_CYAN_("[@]") " Time control parameters:"); + Dbhexdump(timeModeRx.len, timeModeRx.dat, false); + uint8_t fwi = timeModeRx.dat[0] & 0x0f; + uint8_t sfgi = timeModeRx.dat[1] & 0x0f; + Dbprintf(_CYAN_("[@]") " Parsed as fwi = %hhu, sfgi = %hhu", fwi, sfgi); + + if (fwi == 0xf) { + DbpString(_YELLOW_("[!]") " Refusing to use 15 as FWI - will use 14"); + fwi = 0xe; + } + if (sfgi == 0xf) { + DbpString(_YELLOW_("[!]") " Refusing to use 15 as SFGI - will use 14"); + sfgi = 0xe; + } + + memcpy(data, uidRx.dat, uidRx.len); + *flags = (uidRx.len == 10 ? FLAG_10B_UID_IN_DATA : (uidRx.len == 7 ? FLAG_7B_UID_IN_DATA : FLAG_4B_UID_IN_DATA)); + DbpString(_CYAN_("[@]") " UID:"); + Dbhexdump(uidRx.len, data, false); + Dbprintf(_CYAN_("[@]") " Flags: %hu", *flags); + + DbpString(_CYAN_("[@]") " Original ATS:"); + Dbhexdump(ats->len, ats->dat, false); + cook_ats(ats, fwi, sfgi); + DbpString(_CYAN_("[@]") " Cooked ATS:"); + Dbhexdump(ats->len, ats->dat, false); +} + + +static void cook_ats(packet_t *ats, uint8_t fwi, uint8_t sfgi) { + if (ats->len != ats->dat[0]) { + DbpString(_RED_("[!]") " Malformed ATS - unable to cook; things may go wrong!"); + return; + } + + // If the ATS is too short (unusual), pad it to length with hopefully-sensible data + // Might be better for the phone side to do this tbh + if (ats->len == 1) { + ats->len = 4; + ats->dat[0] = 0x04; + ats->dat[1] = 0x78; + ats->dat[2] = 0x77; + // ats->dat[3] = 0x80; + } else if (ats->len == 2) { + ats->len = 4; + ats->dat[0] = 0x04; + ats->dat[2] = 0x77; + // ats->dat[3] = 0x80; + } else if (ats->len == 3) { + ats->len = 4; + ats->dat[0] = 0x04; + // ats->dat[3] = 0x80; + } + + // Set the SFGI as well as the FWI - needed for some older readers (firmware revs?) + uint8_t cookedTB0 = (fwi << 4) | sfgi; + ats->dat[3] = cookedTB0; +} + + +static bool try_use_canned_response(const uint8_t *dat, int len, tag_response_info_t *canned) { + if ((dat[0] == ISO14443A_CMD_REQA || dat[0] == ISO14443A_CMD_WUPA) && len == 1) { + EmSendPrecompiledCmd(canned + RESP_INDEX_ATQA); + return true; + } + + if (dat[1] == 0x20 && len == 2) { + if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT) { + EmSendPrecompiledCmd(canned + RESP_INDEX_UIDC1); + return true; + } else if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT_2) { + EmSendPrecompiledCmd(canned + RESP_INDEX_UIDC2); + return true; + } else if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT_3) { + EmSendPrecompiledCmd(canned + RESP_INDEX_UIDC3); + return true; + } + } + + if (dat[1] == 0x70 && len == 9) { + if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT) { + EmSendPrecompiledCmd(canned + RESP_INDEX_SAKC1); + return true; + } else if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT_2) { + EmSendPrecompiledCmd(canned + RESP_INDEX_SAKC2); + return true; + } else if (dat[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT_3) { + EmSendPrecompiledCmd(canned + RESP_INDEX_SAKC3); + return true; + } + } + + if (dat[0] == ISO14443A_CMD_PPS) { + EmSendPrecompiledCmd(canned + RESP_INDEX_PPS); + return true; + } + + // No response is expected to these 14a commands + if ((dat[0] == 0xf2 && len == 4) || dat[0] == 0xfa) return true; + if (dat[0] == ISO14443A_CMD_HALT && len == 4) return true; + + // Ignore Apple ECP2 polling + if (dat[0] == 0x6a) return true; + + return false; +} + + +static uint8_t g_responseBuffer [512 ] = { 0 }; +static uint8_t g_modulationBuffer[1024] = { 0 }; + +static void reply_with_packet(packet_t *packet) { + tag_response_info_t response = { 0 }; + response.response = g_responseBuffer; + response.modulation = g_modulationBuffer; + + memcpy(response.response, packet->dat, packet->len); + AddCrc14A(response.response, packet->len); + response.response_n = packet->len + 2; + + prepare_tag_modulation(&response, sizeof(g_modulationBuffer)); + EmSendPrecompiledCmd(&response); +} + + +static void read_packet(packet_t *packet) { + while (!usart_rxdata_available()) { + WDT_HIT(); + SpinDelayUs(100); + } + + uint32_t dataReceived = usart_read_ng((uint8_t *) packet, sizeof(packet_t)) - 1; + while (dataReceived != packet->len) { + while (!usart_rxdata_available()) WDT_HIT(); + + dataReceived += usart_read_ng(packet->dat + dataReceived, 255 - dataReceived); + } + usart_writebuffer_sync(magicACK, sizeof(magicACK)); +} + + +static void write_packet(packet_t *packet) { + usart_writebuffer_sync((uint8_t *) packet, packet->len + 1); +} + + +static bool GetIso14443aCommandFromReaderInterruptible(uint8_t *received, uint8_t *par, int *len) { + LED_D_OFF(); + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_TAGSIM_LISTEN); + + Uart14aInit(received, par); + + uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR; + (void)b; + + uint8_t flip = 0; + uint16_t checker = 4000; + for (;;) { + WDT_HIT(); + + if (flip == 3) { + if (usart_rxdata_available()) + return false; + + flip = 0; + } + + if (checker-- == 0) { + flip++; + checker = 4000; + } + + if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) { + b = (uint8_t)AT91C_BASE_SSC->SSC_RHR; + if (MillerDecoding(b, 0)) { + *len = GetUart14a()->len; + return true; + } + } + } + return false; +} diff --git a/armsrc/Standalone/hf_colin.c b/armsrc/Standalone/hf_colin.c index 91fa971eb..044d3aba3 100644 --- a/armsrc/Standalone/hf_colin.c +++ b/armsrc/Standalone/hf_colin.c @@ -293,7 +293,7 @@ static void ReadLastTagFromFlash(void) { 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); + emlSetMem_xt(mem, 0, 64, 16); DbprintfEx(FLAG_NEWLINE, "[OK] Last tag recovered from FLASHMEM set to emulator"); cjSetCursLeft(); @@ -650,7 +650,7 @@ failtag: for (uint8_t t = 0; t < 2; t++) { memcpy(mblock + t * 10, foundKey[t][sectorNo], 6); } - emlSetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1); + emlSetMem_xt(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1, 16); } cjSetCursLeft(); @@ -827,12 +827,12 @@ int e_MifareECardLoad(uint32_t numofsectors, uint8_t keytype) { }; if (isOK) { if (blockNo < NumBlocksPerSector(s) - 1) { - emlSetMem(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1); + emlSetMem_xt(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1, 16); } 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); + emlSetMem_xt(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1, 16); } } } diff --git a/armsrc/Standalone/hf_legicsim.c b/armsrc/Standalone/hf_legicsim.c index 7765672b0..849d2be3b 100644 --- a/armsrc/Standalone/hf_legicsim.c +++ b/armsrc/Standalone/hf_legicsim.c @@ -68,8 +68,10 @@ static bool fill_eml_from_file(char *dumpfile) { } //read and load dump file BigBuf_Clear(); - if (g_dbglevel >= DBG_INFO) - Dbprintf(_YELLOW_("Found dump file %s. Uploading to emulator memory..."), dumpfile); + if (g_dbglevel >= DBG_INFO) { + Dbprintf("Found dump file... `" _YELLOW_("%s") "`", dumpfile); + Dbprintf("Uploading to emulator memory..."); + } uint8_t *emCARD = BigBuf_get_EM_addr(); rdv40_spiffs_read_as_filetype(dumpfile, emCARD, size, RDV40_SPIFFS_SAFETY_SAFE); return true; diff --git a/armsrc/Standalone/hf_mattyrun.c b/armsrc/Standalone/hf_mattyrun.c index 9b41f18c4..ed6f93a3b 100644 --- a/armsrc/Standalone/hf_mattyrun.c +++ b/armsrc/Standalone/hf_mattyrun.c @@ -273,12 +273,12 @@ static int saMifareECardLoad(uint32_t numofsectors, uint8_t keytype) { }; if (blockNo < NumBlocksPerSector(s) - 1) { - emlSetMem(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1); + emlSetMem_xt(dataoutbuf, FirstBlockOfSector(s) + blockNo, 1, 16); } 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); + emlSetMem_xt(dataoutbuf2, FirstBlockOfSector(s) + blockNo, 1, 16); } } } @@ -505,7 +505,7 @@ void RunMod(void) { memcpy(mblock + t * 10, foundKey[t][sectorNo], 6); } } - emlSetMem(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1); + emlSetMem_xt(mblock, FirstBlockOfSector(sectorNo) + NumBlocksPerSector(sectorNo) - 1, 1, 16); } } diff --git a/armsrc/Standalone/hf_mfcsim.c b/armsrc/Standalone/hf_mfcsim.c index 86ff62f6c..bba01d472 100644 --- a/armsrc/Standalone/hf_mfcsim.c +++ b/armsrc/Standalone/hf_mfcsim.c @@ -71,7 +71,8 @@ static bool fill_eml_from_file(char *dumpfile) { //read and load dump file if (g_dbglevel >= DBG_INFO) { - Dbprintf(_YELLOW_("Found dump file %s. Uploading to emulator memory..."), dumpfile); + Dbprintf("Found dump file... `" _YELLOW_("%s") "`", dumpfile); + Dbprintf("Uploading to emulator memory..."); } emlClearMem(); diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 6cdff3eb6..42d551d9b 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -61,6 +61,7 @@ #include "commonutil.h" #include "crc16.h" #include "protocols.h" +#include "mifareutil.h" #ifdef WITH_LCD @@ -783,6 +784,15 @@ static void PacketReceived(PacketCommandNG *packet) { g_reply_via_usb = false; break; } + case CMD_SET_FPGAMODE: { + uint8_t mode = packet->data.asBytes[0]; + if (mode >= FPGA_BITSTREAM_LF && mode <= FPGA_BITSTREAM_HF_15) { + FpgaDownloadAndGo(mode); + reply_ng(CMD_SET_FPGAMODE, PM3_SUCCESS, NULL, 0); + } + reply_ng(CMD_SET_FPGAMODE, PM3_EINVARG, NULL, 0); + break; + } // emulator case CMD_SET_DBGMODE: { g_dbglevel = packet->data.asBytes[0]; @@ -1144,27 +1154,27 @@ static void PacketReceived(PacketCommandNG *packet) { #ifdef WITH_EM4x50 case CMD_LF_EM4X50_INFO: { - em4x50_info((em4x50_data_t *)packet->data.asBytes, true); + em4x50_info((const em4x50_data_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_WRITE: { - em4x50_write((em4x50_data_t *)packet->data.asBytes, true); + em4x50_write((const em4x50_data_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_WRITEPWD: { - em4x50_writepwd((em4x50_data_t *)packet->data.asBytes, true); + em4x50_writepwd((const em4x50_data_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_READ: { - em4x50_read((em4x50_data_t *)packet->data.asBytes, true); + em4x50_read((const em4x50_data_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_BRUTE: { - em4x50_brute((em4x50_data_t *)packet->data.asBytes, true); + em4x50_brute((const em4x50_data_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_LOGIN: { - em4x50_login((uint32_t *)packet->data.asBytes, true); + em4x50_login((const uint32_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_SIM: { @@ -1174,7 +1184,7 @@ static void PacketReceived(PacketCommandNG *packet) { // destroy the Emulator Memory. //----------------------------------------------------------------------------- FpgaDownloadAndGo(FPGA_BITSTREAM_LF); - em4x50_sim((uint32_t *)packet->data.asBytes, true); + em4x50_sim((const uint32_t *)packet->data.asBytes, true); break; } case CMD_LF_EM4X50_READER: { @@ -1198,7 +1208,7 @@ static void PacketReceived(PacketCommandNG *packet) { // destroy the Emulator Memory. //----------------------------------------------------------------------------- FpgaDownloadAndGo(FPGA_BITSTREAM_LF); - em4x50_chk((uint8_t *)packet->data.asBytes, true); + em4x50_chk((const char *)packet->data.asBytes, true); break; } #endif @@ -1278,7 +1288,7 @@ static void PacketReceived(PacketCommandNG *packet) { uint8_t data[]; } PACKED; struct p *payload = (struct p *) packet->data.asBytes; - EmlSetMemIso15693(payload->count, payload->data, payload->offset); + emlSet(payload->data, payload->offset, payload->count); break; } case CMD_HF_ISO15693_SIMULATE: { @@ -1684,7 +1694,14 @@ static void PacketReceived(PacketCommandNG *packet) { uint8_t data[]; } PACKED; struct p *payload = (struct p *) packet->data.asBytes; - MifareEMemSet(payload->blockno, payload->blockcnt, payload->blockwidth, payload->data); + + FpgaDownloadAndGo(FPGA_BITSTREAM_HF); + + // backwards compat... default bytewidth + if (payload->blockwidth == 0) + payload->blockwidth = 16; + + emlSetMem_xt(payload->data, payload->blockno, payload->blockcnt, payload->blockwidth); break; } case CMD_HF_MIFARE_EML_MEMGET: { @@ -1923,6 +1940,10 @@ static void PacketReceived(PacketCommandNG *packet) { iClass_Restore((iclass_restore_req_t *)packet->data.asBytes); break; } + case CMD_HF_ICLASS_CREDIT_EPURSE: { + iclass_credit_epurse((iclass_credit_epurse_t *)packet->data.asBytes); + break; + } #endif #ifdef WITH_HFSNIFF @@ -2499,6 +2520,9 @@ static void PacketReceived(PacketCommandNG *packet) { Flash_WriteEnable(); Flash_Erase4k(3, 0xC); } else if (payload->startidx == DEFAULT_MF_KEYS_OFFSET) { + Flash_CheckBusy(BUSY_TIMEOUT); + Flash_WriteEnable(); + Flash_Erase4k(3, 0x8); Flash_CheckBusy(BUSY_TIMEOUT); Flash_WriteEnable(); Flash_Erase4k(3, 0x9); @@ -2703,6 +2727,7 @@ void __attribute__((noreturn)) AppMain(void) { SpinDelay(100); BigBuf_initialize(); + // Add stack canary for (uint32_t *p = _stack_start; p + 0x200 < _stack_end ; ++p) { *p = 0xdeadbeef; } diff --git a/armsrc/cmd.c b/armsrc/cmd.c index c179ed2a9..f2b432d33 100644 --- a/armsrc/cmd.c +++ b/armsrc/cmd.c @@ -26,7 +26,7 @@ bool g_reply_with_crc_on_fpc = true; bool g_reply_via_fpc = false; bool g_reply_via_usb = false; -int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) { +int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len) { PacketResponseOLD txcmd = {CMD_UNKNOWN, {0, 0, 0}, {{0}}}; // for (size_t i = 0; i < sizeof(PacketResponseOLD); i++) @@ -42,7 +42,7 @@ int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *d if (data && len) { len = MIN(len, PM3_CMD_DATA_SIZE); for (size_t i = 0; i < len; i++) { - txcmd.d.asBytes[i] = ((uint8_t *)data)[i]; + txcmd.d.asBytes[i] = ((const uint8_t *)data)[i]; } } @@ -135,7 +135,7 @@ int reply_ng(uint16_t cmd, int16_t status, const uint8_t *data, size_t len) { return reply_ng_internal(cmd, status, data, len, true); } -int reply_mix(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len) { +int reply_mix(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len) { int16_t status = PM3_SUCCESS; uint64_t arg[3] = {arg0, arg1, arg2}; if (len > PM3_CMD_DATA_SIZE - sizeof(arg)) { diff --git a/armsrc/cmd.h b/armsrc/cmd.h index b578db8e8..22a79ce16 100644 --- a/armsrc/cmd.h +++ b/armsrc/cmd.h @@ -27,9 +27,9 @@ extern bool g_reply_with_crc_on_fpc; extern bool g_reply_via_fpc; extern bool g_reply_via_usb; -int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len); +int reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len); int reply_ng(uint16_t cmd, int16_t status, const uint8_t *data, size_t len); -int reply_mix(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len); +int reply_mix(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, const void *data, size_t len); int receive_ng(PacketCommandNG *rx); #endif // _PROXMARK_CMD_H_ diff --git a/armsrc/dbprint.c b/armsrc/dbprint.c index 7be7bba4c..218223231 100644 --- a/armsrc/dbprint.c +++ b/armsrc/dbprint.c @@ -74,7 +74,7 @@ void Dbprintf(const char *fmt, ...) { } // prints HEX & ASCII -void Dbhexdump(int len, uint8_t *d, bool bAsci) { +void Dbhexdump(int len, const uint8_t *d, bool bAsci) { #if DEBUG char ascii[9]; @@ -103,9 +103,9 @@ void Dbhexdump(int len, uint8_t *d, bool bAsci) { #endif } -void print_result(const char *name, uint8_t *buf, size_t len) { +void print_result(const char *name, const uint8_t *buf, size_t len) { - uint8_t *p = buf; + const uint8_t *p = buf; uint16_t tmp = len & 0xFFF0; for (; p - buf < tmp; p += 16) { diff --git a/armsrc/dbprint.h b/armsrc/dbprint.h index b1a7753da..0795db274 100644 --- a/armsrc/dbprint.h +++ b/armsrc/dbprint.h @@ -22,40 +22,12 @@ #include "common.h" #include "ansi.h" -#define Dbprintf_usb(...) {\ - bool tmpfpc = g_reply_via_fpc;\ - bool tmpusb = g_reply_via_usb;\ - g_reply_via_fpc = false;\ - g_reply_via_usb = true;\ - Dbprintf(__VA_ARGS__);\ - g_reply_via_fpc = tmpfpc;\ - g_reply_via_usb = tmpusb;} - -#define Dbprintf_fpc(...) {\ - bool tmpfpc = g_reply_via_fpc;\ - bool tmpusb = g_reply_via_usb;\ - g_reply_via_fpc = true;\ - g_reply_via_usb = false;\ - Dbprintf(__VA_ARGS__);\ - g_reply_via_fpc = tmpfpc;\ - g_reply_via_usb = tmpusb;} - -#define Dbprintf_all(...) {\ - bool tmpfpc = g_reply_via_fpc;\ - bool tmpusb = g_reply_via_usb;\ - g_reply_via_fpc = true;\ - g_reply_via_usb = true;\ - Dbprintf(__VA_ARGS__);\ - g_reply_via_fpc = tmpfpc;\ - g_reply_via_usb = tmpusb;} - - void DbpString(const char *str); void DbpStringEx(uint32_t flags, const char *src, size_t srclen); void Dbprintf(const char *fmt, ...); void DbprintfEx(uint32_t flags, const char *fmt, ...); -void Dbhexdump(int len, uint8_t *d, bool bAsci); -void print_result(const char *name, uint8_t *buf, size_t len); +void Dbhexdump(int len, const uint8_t *d, bool bAsci); +void print_result(const char *name, const uint8_t *buf, size_t len); //void PrintToSendBuffer(void); #endif diff --git a/armsrc/em4x50.c b/armsrc/em4x50.c index d43a6a15f..4910caa31 100644 --- a/armsrc/em4x50.c +++ b/armsrc/em4x50.c @@ -634,7 +634,7 @@ static int login(uint32_t password) { } // searching for password using chosen bruteforce algorithm -static bool brute(em4x50_data_t *etd, uint32_t *pwd) { +static bool brute(const em4x50_data_t *etd, uint32_t *pwd) { generator_context_t ctx; bool pwd_found = false; @@ -694,7 +694,7 @@ static bool brute(em4x50_data_t *etd, uint32_t *pwd) { } // login into EM4x50 -void em4x50_login(uint32_t *password, bool ledcontrol) { +void em4x50_login(const uint32_t *password, bool ledcontrol) { em4x50_setup_read(); int status = PM3_EFAILED; @@ -713,7 +713,7 @@ void em4x50_login(uint32_t *password, bool ledcontrol) { } // invoke password search -void em4x50_brute(em4x50_data_t *etd, bool ledcontrol) { +void em4x50_brute(const em4x50_data_t *etd, bool ledcontrol) { em4x50_setup_read(); bool bsuccess = false; @@ -733,7 +733,7 @@ void em4x50_brute(em4x50_data_t *etd, bool ledcontrol) { } // check passwords from dictionary content in flash memory -void em4x50_chk(uint8_t *filename, bool ledcontrol) { +void em4x50_chk(const char *filename, bool ledcontrol) { int status = PM3_EFAILED; uint32_t pwd = 0x0; @@ -743,11 +743,11 @@ void em4x50_chk(uint8_t *filename, bool ledcontrol) { int changed = rdv40_spiffs_lazy_mount(); uint16_t pwd_count = 0; - uint32_t size = size_in_spiffs((char *)filename); + uint32_t size = size_in_spiffs(filename); pwd_count = size / 4; uint8_t *pwds = BigBuf_malloc(size); - rdv40_spiffs_read_as_filetype((char *)filename, pwds, size, RDV40_SPIFFS_SAFETY_SAFE); + rdv40_spiffs_read_as_filetype(filename, pwds, size, RDV40_SPIFFS_SAFETY_SAFE); if (changed) rdv40_spiffs_lazy_unmount(); @@ -873,7 +873,7 @@ static int selective_read(uint32_t addresses, uint32_t *words) { } // reads by using "selective read mode" -> bidirectional communication -void em4x50_read(em4x50_data_t *etd, bool ledcontrol) { +void em4x50_read(const em4x50_data_t *etd, bool ledcontrol) { int status = PM3_EFAILED; uint32_t words[EM4X50_NO_WORDS] = {0x0}; @@ -906,7 +906,7 @@ void em4x50_read(em4x50_data_t *etd, bool ledcontrol) { } // collects as much information as possible via selective read mode -void em4x50_info(em4x50_data_t *etd, bool ledcontrol) { +void em4x50_info(const em4x50_data_t *etd, bool ledcontrol) { int status = PM3_EFAILED; uint32_t words[EM4X50_NO_WORDS] = {0x0}; @@ -1053,7 +1053,7 @@ static int write_password(uint32_t password, uint32_t new_password) { // write operation process for EM4x50 tag, // single word is written to given address, verified by selective read operation // wrong password -> return with PM3_EFAILED -void em4x50_write(em4x50_data_t *etd, bool ledcontrol) { +void em4x50_write(const em4x50_data_t *etd, bool ledcontrol) { int status = PM3_EFAILED; uint32_t words[EM4X50_NO_WORDS] = {0x0}; @@ -1113,7 +1113,7 @@ void em4x50_write(em4x50_data_t *etd, bool ledcontrol) { } // simple change of password -void em4x50_writepwd(em4x50_data_t *etd, bool ledcontrol) { +void em4x50_writepwd(const em4x50_data_t *etd, bool ledcontrol) { int status = PM3_EFAILED; em4x50_setup_read(); @@ -1358,7 +1358,7 @@ static bool em4x50_sim_read_word(uint32_t *word) { } // check if reader requests receive mode (rm) by sending two zeros -static int check_rm_request(uint32_t *tag, bool ledcontrol) { +static int check_rm_request(const uint32_t *tag, bool ledcontrol) { // look for first zero int bit = em4x50_sim_read_bit(); @@ -1387,7 +1387,7 @@ static int check_rm_request(uint32_t *tag, bool ledcontrol) { } // send single listen window in simulation mode -static int em4x50_sim_send_listen_window(uint32_t *tag, bool ledcontrol) { +static int em4x50_sim_send_listen_window(const uint32_t *tag, bool ledcontrol) { SHORT_COIL(); wait_cycles(EM4X50_T_TAG_HALF_PERIOD); @@ -1460,7 +1460,7 @@ static void em4x50_sim_send_nak(void) { } // standard read mode process (simulation mode) -static int em4x50_sim_handle_standard_read_command(uint32_t *tag, bool ledcontrol) { +static int em4x50_sim_handle_standard_read_command(const uint32_t *tag, bool ledcontrol) { // extract control data int fwr = reflect32(tag[EM4X50_CONTROL]) & 0xFF; // first word read @@ -1500,7 +1500,7 @@ static int em4x50_sim_handle_standard_read_command(uint32_t *tag, bool ledcontro } // selective read mode process (simulation mode) -static int em4x50_sim_handle_selective_read_command(uint32_t *tag, bool ledcontrol) { +static int em4x50_sim_handle_selective_read_command(const uint32_t *tag, bool ledcontrol) { // read password uint32_t address = 0; @@ -1555,7 +1555,7 @@ static int em4x50_sim_handle_selective_read_command(uint32_t *tag, bool ledcontr } // login process (simulation mode) -static int em4x50_sim_handle_login_command(uint32_t *tag, bool ledcontrol) { +static int em4x50_sim_handle_login_command(const uint32_t *tag, bool ledcontrol) { // read password uint32_t password = 0; @@ -1581,7 +1581,7 @@ static int em4x50_sim_handle_login_command(uint32_t *tag, bool ledcontrol) { } // reset process (simulation mode) -static int em4x50_sim_handle_reset_command(uint32_t *tag, bool ledcontrol) { +static int em4x50_sim_handle_reset_command(const uint32_t *tag, bool ledcontrol) { // processing pause time (corresponds to a "1" bit) em4x50_sim_send_bit(1); @@ -1806,7 +1806,7 @@ void em4x50_handle_commands(int *command, uint32_t *tag, bool ledcontrol) { // simulate uploaded data in emulator memory // LED C -> reader command has been detected // LED D -> operations that require authentication are possible -void em4x50_sim(uint32_t *password, bool ledcontrol) { +void em4x50_sim(const uint32_t *password, bool ledcontrol) { int command = PM3_ENODATA; diff --git a/armsrc/em4x50.h b/armsrc/em4x50.h index af3a7a8db..eb52c36e5 100644 --- a/armsrc/em4x50.h +++ b/armsrc/em4x50.h @@ -21,20 +21,21 @@ #include "../include/em4x50.h" +// used by standalone mode void em4x50_setup_read(void); int standard_read(int *now, uint32_t *words); - void em4x50_setup_sim(void); void em4x50_handle_commands(int *command, uint32_t *tag, bool ledcontrol); -void em4x50_info(em4x50_data_t *etd, bool ledcontrol); -void em4x50_write(em4x50_data_t *etd, bool ledcontrol); -void em4x50_writepwd(em4x50_data_t *etd, bool ledcontrol); -void em4x50_read(em4x50_data_t *etd, bool ledcontrol); -void em4x50_brute(em4x50_data_t *etd, bool ledcontrol); -void em4x50_login(uint32_t *password, bool ledcontrol); -void em4x50_sim(uint32_t *password, bool ledcontrol); +// dispatch functions (appmain.c) +void em4x50_info(const em4x50_data_t *etd, bool ledcontrol); +void em4x50_write(const em4x50_data_t *etd, bool ledcontrol); +void em4x50_writepwd(const em4x50_data_t *etd, bool ledcontrol); +void em4x50_read(const em4x50_data_t *etd, bool ledcontrol); +void em4x50_brute(const em4x50_data_t *etd, bool ledcontrol); +void em4x50_login(const uint32_t *password, bool ledcontrol); +void em4x50_sim(const uint32_t *password, bool ledcontrol); void em4x50_reader(bool ledcontrol); -void em4x50_chk(uint8_t *filename, bool ledcontrol); +void em4x50_chk(const char *filename, bool ledcontrol); #endif /* EM4X50_H */ diff --git a/armsrc/em4x70.c b/armsrc/em4x70.c index 806442f7f..40eadb890 100644 --- a/armsrc/em4x70.c +++ b/armsrc/em4x70.c @@ -310,6 +310,7 @@ static bool check_ack(void) { return false; } +// TODO: define and use structs for rnd, frnd, response static int authenticate(const uint8_t *rnd, const uint8_t *frnd, uint8_t *response) { if (find_listen_window(true)) { @@ -350,8 +351,10 @@ static int authenticate(const uint8_t *rnd, const uint8_t *frnd, uint8_t *respon return PM3_ESOFT; } -static int set_byte(uint8_t *target, int value) { - int c = value > 0xFF; +// Sets one (reflected) byte and returns carry bit +// (1 if `value` parameter was greater than 0xFF) +static int set_byte(uint8_t *target, uint16_t value) { + int c = value > 0xFF ? 1 : 0; // be explicit about carry bit values *target = reflect8(value); return c; } @@ -373,8 +376,8 @@ static int bruteforce(const uint8_t address, const uint8_t *rnd, const uint8_t * uint16_t rev_k = reflect16(k); switch (address) { case 9: - c = set_byte(&temp_rnd[0], rev_rnd[0] + (rev_k & 0xFF)); - c = set_byte(&temp_rnd[1], rev_rnd[1] + c + ((rev_k >> 8) & 0xFF)); + c = set_byte(&temp_rnd[0], rev_rnd[0] + ((rev_k) & 0xFFu)); + c = set_byte(&temp_rnd[1], rev_rnd[1] + c + ((rev_k >> 8) & 0xFFu)); c = set_byte(&temp_rnd[2], rev_rnd[2] + c); c = set_byte(&temp_rnd[3], rev_rnd[3] + c); c = set_byte(&temp_rnd[4], rev_rnd[4] + c); @@ -383,16 +386,16 @@ static int bruteforce(const uint8_t address, const uint8_t *rnd, const uint8_t * break; case 8: - c = set_byte(&temp_rnd[2], rev_rnd[2] + (rev_k & 0xFF)); - c = set_byte(&temp_rnd[3], rev_rnd[3] + c + ((rev_k >> 8) & 0xFF)); + c = set_byte(&temp_rnd[2], rev_rnd[2] + ((rev_k) & 0xFFu)); + c = set_byte(&temp_rnd[3], rev_rnd[3] + c + ((rev_k >> 8) & 0xFFu)); c = set_byte(&temp_rnd[4], rev_rnd[4] + c); c = set_byte(&temp_rnd[5], rev_rnd[5] + c); set_byte(&temp_rnd[6], rev_rnd[6] + c); break; case 7: - c = set_byte(&temp_rnd[4], rev_rnd[4] + (rev_k & 0xFF)); - c = set_byte(&temp_rnd[5], rev_rnd[5] + c + ((rev_k >> 8) & 0xFF)); + c = set_byte(&temp_rnd[4], rev_rnd[4] + ((rev_k) & 0xFFu)); + c = set_byte(&temp_rnd[5], rev_rnd[5] + c + ((rev_k >> 8) & 0xFFu)); set_byte(&temp_rnd[6], rev_rnd[6] + c); break; @@ -707,7 +710,7 @@ static int em4x70_receive(uint8_t *bits, size_t length) { return bit_pos; } -void em4x70_info(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_info(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; @@ -728,7 +731,7 @@ void em4x70_info(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_INFO, status, tag.data, sizeof(tag.data)); } -void em4x70_write(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_write(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; @@ -758,7 +761,7 @@ void em4x70_write(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_WRITE, status, tag.data, sizeof(tag.data)); } -void em4x70_unlock(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_unlock(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; @@ -791,7 +794,7 @@ void em4x70_unlock(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_UNLOCK, status, tag.data, sizeof(tag.data)); } -void em4x70_auth(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_auth(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; uint8_t response[3] = {0}; @@ -813,7 +816,7 @@ void em4x70_auth(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_AUTH, status, response, sizeof(response)); } -void em4x70_brute(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_brute(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; uint8_t response[2] = {0}; @@ -834,7 +837,7 @@ void em4x70_brute(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_BRUTE, status, response, sizeof(response)); } -void em4x70_write_pin(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_write_pin(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; @@ -850,7 +853,7 @@ void em4x70_write_pin(em4x70_data_t *etd, bool ledcontrol) { if (em4x70_read_id()) { // Write new PIN - if ((write(etd->pin & 0xFFFF, EM4X70_PIN_WORD_UPPER) == PM3_SUCCESS) && + if ((write((etd->pin) & 0xFFFF, EM4X70_PIN_WORD_UPPER) == PM3_SUCCESS) && (write((etd->pin >> 16) & 0xFFFF, EM4X70_PIN_WORD_LOWER) == PM3_SUCCESS)) { // Now Try to authenticate using the new PIN @@ -874,7 +877,7 @@ void em4x70_write_pin(em4x70_data_t *etd, bool ledcontrol) { reply_ng(CMD_LF_EM4X70_WRITEPIN, status, tag.data, sizeof(tag.data)); } -void em4x70_write_key(em4x70_data_t *etd, bool ledcontrol) { +void em4x70_write_key(const em4x70_data_t *etd, bool ledcontrol) { uint8_t status = 0; diff --git a/armsrc/em4x70.h b/armsrc/em4x70.h index 0fd640f86..83a8237d7 100644 --- a/armsrc/em4x70.h +++ b/armsrc/em4x70.h @@ -30,12 +30,12 @@ typedef enum { FALLING_EDGE } edge_detection_t; -void em4x70_info(em4x70_data_t *etd, bool ledcontrol); -void em4x70_write(em4x70_data_t *etd, bool ledcontrol); -void em4x70_brute(em4x70_data_t *etd, bool ledcontrol); -void em4x70_unlock(em4x70_data_t *etd, bool ledcontrol); -void em4x70_auth(em4x70_data_t *etd, bool ledcontrol); -void em4x70_write_pin(em4x70_data_t *etd, bool ledcontrol); -void em4x70_write_key(em4x70_data_t *etd, bool ledcontrol); +void em4x70_info(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_write(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_brute(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_unlock(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_auth(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_write_pin(const em4x70_data_t *etd, bool ledcontrol); +void em4x70_write_key(const em4x70_data_t *etd, bool ledcontrol); #endif /* EM4x70_H */ diff --git a/armsrc/epa.c b/armsrc/epa.c index 7bd563676..4e4113d45 100644 --- a/armsrc/epa.c +++ b/armsrc/epa.c @@ -37,6 +37,24 @@ static const uint8_t pps[] = {0xD0, 0x11, 0x00, 0x52, 0xA6}; #endif +// this struct is used by EPA_Parse_CardAccess and contains info about the +// PACE protocol supported by the chip +typedef struct { + uint8_t oid[10]; + uint8_t version; + uint8_t parameter_id; +} pace_version_info_t; + +// general functions +static void EPA_Finish(void); +static size_t EPA_Parse_CardAccess(const uint8_t *data, size_t length, pace_version_info_t *pace_info); +static int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length); +static int EPA_Setup(void); + +// PACE related functions +static int EPA_PACE_MSE_Set_AT(const pace_version_info_t pace_version_info, uint8_t password); +static int EPA_PACE_Get_Nonce(uint8_t requested_length, uint8_t *nonce); + // APDUs for communication with German Identification Card // General Authenticate (request encrypted nonce) WITHOUT the Le at the end @@ -153,7 +171,7 @@ static int EPA_APDU(uint8_t *apdu, size_t length, uint8_t *response, uint16_t re //----------------------------------------------------------------------------- // Closes the communication channel and turns off the field //----------------------------------------------------------------------------- -void EPA_Finish(void) { +static void EPA_Finish(void) { FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); iso_type = 0; @@ -172,7 +190,7 @@ void EPA_Finish(void) { // TODO: Support elements with long tags (tag is longer than 1 byte) // TODO: Support proprietary PACE domain parameters //----------------------------------------------------------------------------- -size_t EPA_Parse_CardAccess(uint8_t *data, size_t length, pace_version_info_t *pace_info) { +static size_t EPA_Parse_CardAccess(const uint8_t *data, size_t length, pace_version_info_t *pace_info) { size_t index = 0; @@ -243,7 +261,7 @@ size_t EPA_Parse_CardAccess(uint8_t *data, size_t length, pace_version_info_t *p // Returns -1 on failure or the length of the data on success // TODO: for the moment this sends only 1 APDU regardless of the requested length //----------------------------------------------------------------------------- -int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length) { +static int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length) { // the response APDU of the card // since the card doesn't always care for the expected length we send it, // we reserve 262 bytes here just to be safe (256-byte APDU + SW + ISO frame) @@ -300,7 +318,7 @@ static void EPA_PACE_Collect_Nonce_Abort(uint32_t cmd, uint8_t step, int func_re //----------------------------------------------------------------------------- // Acquire one encrypted PACE nonce //----------------------------------------------------------------------------- -void EPA_PACE_Collect_Nonce(PacketCommandNG *c) { +void EPA_PACE_Collect_Nonce(const PacketCommandNG *c) { /* * ack layout: * arg: @@ -354,7 +372,7 @@ void EPA_PACE_Collect_Nonce(PacketCommandNG *c) { struct p { uint32_t m; } PACKED; - struct p *packet = (struct p *)c->data.asBytes; + const struct p *packet = (const struct p *)c->data.asBytes; func_return = EPA_PACE_Get_Nonce(packet->m, nonce); // check if the command succeeded @@ -377,7 +395,7 @@ void EPA_PACE_Collect_Nonce(PacketCommandNG *c) { // Returns the actual size of the nonce on success or a less-than-zero error // code on failure. //----------------------------------------------------------------------------- -int EPA_PACE_Get_Nonce(uint8_t requested_length, uint8_t *nonce) { +static int EPA_PACE_Get_Nonce(uint8_t requested_length, uint8_t *nonce) { // build the APDU uint8_t apdu[sizeof(apdu_general_authenticate_pace_get_nonce) + 1]; @@ -416,7 +434,7 @@ int EPA_PACE_Get_Nonce(uint8_t requested_length, uint8_t *nonce) { // Initializes the PACE protocol by performing the "MSE: Set AT" step // Returns 0 on success or a non-zero error code on failure //----------------------------------------------------------------------------- -int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password) { +static int EPA_PACE_MSE_Set_AT(const pace_version_info_t pace_version_info, uint8_t password) { // create the MSE: Set AT APDU uint8_t apdu[23]; @@ -479,7 +497,7 @@ int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password) //----------------------------------------------------------------------------- // Perform the PACE protocol by replaying given APDUs //----------------------------------------------------------------------------- -void EPA_PACE_Replay(PacketCommandNG *c) { +void EPA_PACE_Replay(const PacketCommandNG *c) { uint32_t timings[ARRAYLEN(apdu_lengths_replay)] = {0}; @@ -547,7 +565,7 @@ void EPA_PACE_Replay(PacketCommandNG *c) { // Set up a communication channel (Card Select, PPS) // Returns 0 on success or a non-zero error code on failure //----------------------------------------------------------------------------- -int EPA_Setup(void) { +static int EPA_Setup(void) { #ifdef WITH_ISO14443a { @@ -593,7 +611,7 @@ int EPA_Setup(void) { return 1; } -void EPA_PACE_Simulate(PacketCommandNG *c) { +void EPA_PACE_Simulate(const PacketCommandNG *c) { //---------Initializing--------- diff --git a/armsrc/epa.h b/armsrc/epa.h index 72524f836..62880eca3 100644 --- a/armsrc/epa.h +++ b/armsrc/epa.h @@ -22,26 +22,8 @@ #include "common.h" #include "pm3_cmd.h" -// this struct is used by EPA_Parse_CardAccess and contains info about the -// PACE protocol supported by the chip -typedef struct { - uint8_t oid[10]; - uint8_t version; - uint8_t parameter_id; -} pace_version_info_t; - -// general functions -void EPA_Finish(void); -size_t EPA_Parse_CardAccess(uint8_t *data, size_t length, pace_version_info_t *pace_info); -int EPA_Read_CardAccess(uint8_t *buffer, size_t max_length); -int EPA_Setup(void); - -// PACE related functions -int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password); -int EPA_PACE_Get_Nonce(uint8_t requested_length, uint8_t *nonce); - -void EPA_PACE_Collect_Nonce(PacketCommandNG *c); -void EPA_PACE_Replay(PacketCommandNG *c); -void EPA_PACE_Simulate(PacketCommandNG *c); +void EPA_PACE_Collect_Nonce(const PacketCommandNG *c); +void EPA_PACE_Replay(const PacketCommandNG *c); +void EPA_PACE_Simulate(const PacketCommandNG *c); #endif /* __EPA_H */ diff --git a/armsrc/felica.c b/armsrc/felica.c index 0a74a30cc..b575ad9c4 100644 --- a/armsrc/felica.c +++ b/armsrc/felica.c @@ -49,7 +49,7 @@ static uint32_t felica_lasttime_prox2air_start; static void iso18092_setup(uint8_t fpga_minor_mode); static uint8_t felica_select_card(felica_card_select_t *card); -static void TransmitFor18092_AsReader(uint8_t *frame, uint16_t len, uint32_t *timing, uint8_t power, uint8_t highspeed); +static void TransmitFor18092_AsReader(const uint8_t *frame, uint16_t len, const uint32_t *NYI_timing_NYI, uint8_t power, uint8_t highspeed); static bool WaitForFelicaReply(uint16_t maxbytes); static void iso18092_set_timeout(uint32_t timeout) { @@ -269,13 +269,13 @@ static uint8_t felica_select_card(felica_card_select_t *card) { // copy UID // idm 8 if (card) { - memcpy(card->IDm, FelicaFrame.framebytes + 4, 8); + memcpy(card->IDm, FelicaFrame.framebytes + 4, 8); memcpy(card->PMm, FelicaFrame.framebytes + 4 + 8, 8); //memcpy(card->servicecode, FelicaFrame.framebytes + 4 + 8 + 8, 2); - memcpy(card->code, card->IDm, 2); - memcpy(card->uid, card->IDm + 2, 6); - memcpy(card->iccode, card->PMm, 2); - memcpy(card->mrt, card->PMm + 2, 6); + memcpy(card->code, card->IDm, 2); + memcpy(card->uid, card->IDm + 2, 6); + memcpy(card->iccode, card->PMm, 2); + memcpy(card->mrt, card->PMm + 2, 6); if (g_dbglevel >= DBG_DEBUG) { Dbprintf("Received Frame: "); Dbhexdump(FelicaFrame.len, FelicaFrame.framebytes, 0); @@ -350,7 +350,12 @@ static void BuildFliteRdblk(const uint8_t *idm, uint8_t blocknum, const uint16_t AddCrc(frameSpace + 2, c - 2); } -static void TransmitFor18092_AsReader(uint8_t *frame, uint16_t len, uint32_t *timing, uint8_t power, uint8_t highspeed) { +static void TransmitFor18092_AsReader(const uint8_t *frame, uint16_t len, const uint32_t *NYI_timing_NYI, uint8_t power, uint8_t highspeed) { + if (NYI_timing_NYI != NULL) { + Dbprintf("Error: TransmitFor18092_AsReader does not check or set parameter NYI_timing_NYI"); + return; + } + uint16_t flags = FPGA_MAJOR_MODE_HF_ISO18092; if (power) flags |= FPGA_HF_ISO18092_FLAG_READER; @@ -512,12 +517,12 @@ static void felica_reset_frame_mode(void) { // arg0 FeliCa flags // arg1 len of commandbytes // d.asBytes command bytes to send -void felica_sendraw(PacketCommandNG *c) { +void felica_sendraw(const PacketCommandNG *c) { if (g_dbglevel >= DBG_DEBUG) Dbprintf("FeliCa_sendraw Enter"); felica_command_t param = c->oldarg[0]; size_t len = c->oldarg[1] & 0xffff; - uint8_t *cmd = c->data.asBytes; + const uint8_t *cmd = c->data.asBytes; uint32_t arg0; felica_card_select_t card; @@ -675,7 +680,7 @@ void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip) { #define R_READBLK_LEN 0x21 //simulate NFC Tag3 card - for now only poll response works // second half (4 bytes) of NDEF2 goes into nfcid2_0, first into nfcid2_1 -void felica_sim_lite(uint8_t *uid) { +void felica_sim_lite(const uint8_t *uid) { // prepare our 3 responses... uint8_t resp_poll0[R_POLL0_LEN] = { 0xb2, 0x4d, 0x12, FELICA_POLL_ACK, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0x01, 0x43, 0x00, 0xb3, 0x7f}; diff --git a/armsrc/felica.h b/armsrc/felica.h index 8f232b3e4..2677dbfb9 100644 --- a/armsrc/felica.h +++ b/armsrc/felica.h @@ -21,9 +21,9 @@ #include "common.h" #include "cmd.h" -void felica_sendraw(PacketCommandNG *c); +void felica_sendraw(const PacketCommandNG *c); void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip); -void felica_sim_lite(uint8_t *uid); +void felica_sim_lite(const uint8_t *uid); void felica_dump_lite_s(void); #endif diff --git a/armsrc/fpgaloader.c b/armsrc/fpgaloader.c index 5c5b6f8c5..ccc47bcde 100644 --- a/armsrc/fpgaloader.c +++ b/armsrc/fpgaloader.c @@ -95,40 +95,40 @@ void SetupSpi(int mode) { case SPI_FPGA_MODE: AT91C_BASE_SPI->SPI_MR = (0 << 24) | // Delay between chip selects (take default: 6 MCK periods) - (0xE << 16) | // Peripheral Chip Select (selects FPGA SPI_NCS0 or PA11) + (0xE << 16) | // Peripheral Chip Select (selects FPGA SPI_NCS0 or PA11) (0 << 7) | // Local Loopback Disabled - AT91C_SPI_MODFDIS | // Mode Fault Detection disabled + AT91C_SPI_MODFDIS | // Mode Fault Detection disabled (0 << 2) | // Chip selects connected directly to peripheral - AT91C_SPI_PS_FIXED | // Fixed Peripheral Select + AT91C_SPI_PS_FIXED | // Fixed Peripheral Select AT91C_SPI_MSTR; // Master Mode AT91C_BASE_SPI->SPI_CSR[0] = (1 << 24) | // Delay between Consecutive Transfers (32 MCK periods) (1 << 16) | // Delay Before SPCK (1 MCK period) (6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud - AT91C_SPI_BITS_16 | // Bits per Transfer (16 bits) + AT91C_SPI_BITS_16 | // Bits per Transfer (16 bits) (0 << 3) | // Chip Select inactive after transfer - AT91C_SPI_NCPHA | // Clock Phase data captured on leading edge, changes on following edge + AT91C_SPI_NCPHA | // Clock Phase data captured on leading edge, changes on following edge (0 << 0); // Clock Polarity inactive state is logic 0 break; /* case SPI_LCD_MODE: AT91C_BASE_SPI->SPI_MR = - ( 0 << 24) | // Delay between chip selects (take default: 6 MCK periods) - (0xB << 16) | // Peripheral Chip Select (selects LCD SPI_NCS2 or PA10) - ( 0 << 7) | // Local Loopback Disabled - ( 1 << 4) | // Mode Fault Detection disabled - ( 0 << 2) | // Chip selects connected directly to peripheral - ( 0 << 1) | // Fixed Peripheral Select + ( 0 << 24) | // Delay between chip selects (take default: 6 MCK periods) + (0xB << 16) | // Peripheral Chip Select (selects LCD SPI_NCS2 or PA10) + ( 0 << 7) | // Local Loopback Disabled + ( 1 << 4) | // Mode Fault Detection disabled + ( 0 << 2) | // Chip selects connected directly to peripheral + ( 0 << 1) | // Fixed Peripheral Select ( 1 << 0); // Master Mode AT91C_BASE_SPI->SPI_CSR[2] = - ( 1 << 24) | // Delay between Consecutive Transfers (32 MCK periods) - ( 1 << 16) | // Delay Before SPCK (1 MCK period) - ( 6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud - AT91C_SPI_BITS_9 | // Bits per Transfer (9 bits) - ( 0 << 3) | // Chip Select inactive after transfer - ( 1 << 1) | // Clock Phase data captured on leading edge, changes on following edge + ( 1 << 24) | // Delay between Consecutive Transfers (32 MCK periods) + ( 1 << 16) | // Delay Before SPCK (1 MCK period) + ( 6 << 8) | // Serial Clock Baud Rate (baudrate = MCK/6 = 24MHz/6 = 4M baud + AT91C_SPI_BITS_9 | // Bits per Transfer (9 bits) + ( 0 << 3) | // Chip Select inactive after transfer + ( 1 << 1) | // Clock Phase data captured on leading edge, changes on following edge ( 0 << 0); // Clock Polarity inactive state is logic 0 break; */ @@ -162,8 +162,7 @@ void FpgaSetupSsc(uint16_t fpga_mode) { // 8, 16 or 32 bits per transfer, no loopback, MSB first, 1 transfer per sync // pulse, no output sync - if (((fpga_mode & FPGA_MAJOR_MODE_MASK) == FPGA_MAJOR_MODE_HF_READER || - (fpga_mode & FPGA_MAJOR_MODE_MASK) == FPGA_MAJOR_MODE_HF_FSK_READER) && + if (((fpga_mode & FPGA_MAJOR_MODE_MASK) == FPGA_MAJOR_MODE_HF_READER) && (FpgaGetCurrent() == FPGA_BITSTREAM_HF || FpgaGetCurrent() == FPGA_BITSTREAM_HF_15)) { AT91C_BASE_SSC->SSC_RFMR = SSC_FRAME_MODE_BITS_IN_WORD(16) | AT91C_SSC_MSBF | SSC_FRAME_MODE_WORDS_PER_TRANSFER(0); } else { diff --git a/armsrc/fpgaloader.h b/armsrc/fpgaloader.h index 6069d3257..b345e34f2 100644 --- a/armsrc/fpgaloader.h +++ b/armsrc/fpgaloader.h @@ -1,5 +1,4 @@ //----------------------------------------------------------------------------- -// Copyright (C) Jonathan Westhues, April 2006 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. // // This program is free software: you can redistribute it and/or modify @@ -32,76 +31,116 @@ #define FPGA_BITSTREAM_HF_15 4 /* - Communication between ARM / FPGA is done inside armsrc/fpgaloader.c (function FpgaSendCommand) - Send 16 bit command / data pair to FPGA - The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 - where - C is 4bit command - D is 12bit data + Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand() + Send 16 bit command / data pair to FPGA with the bit format: + ++------ frame layout circa 2020 ------------------+ +| 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | ++-------------------------------------------------+ +| C C C C M M M M P P P P P P P P | C = FPGA_CMD_SET_CONFREG, M = FPGA_MAJOR_MODE_*, P = FPGA_LF_* or FPGA_HF_* parameter +| C C C C D D D D D D D D | C = FPGA_CMD_SET_DIVISOR, D = divisor +| C C C C T T T T T T T T | C = FPGA_CMD_SET_EDGE_DETECT_THRESHOLD, T = threshold +| C C C C E | C = FPGA_CMD_TRACE_ENABLE, E=0 off, E=1 on ++-------------------------------------------------+ + ++------ frame layout current ---------------------+ +| 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | ++-------------------------------------------------+ +| C C C C M M M P P P P P P | C = FPGA_CMD_SET_CONFREG, M = FPGA_MAJOR_MODE_*, P = FPGA_LF_* or FPGA_HF_* parameter +| C C C C D D D D D D D D | C = FPGA_CMD_SET_DIVISOR, D = divisor +| C C C C T T T T T T T T | C = FPGA_CMD_SET_EDGE_DETECT_THRESHOLD, T = threshold +| C C C C E | C = FPGA_CMD_TRACE_ENABLE, E=0 off, E=1 on ++-------------------------------------------------+ + + shift_reg receive this 16bit frame + + LF command + ---------- + shift_reg[15:12] == 4bit command + LF has three commands (FPGA_CMD_SET_CONFREG, FPGA_CMD_SET_DIVISOR, FPGA_CMD_SET_EDGE_DETECT_THRESHOLD) + Current commands uses only 2bits. We have room for up to 4bits of commands total (7). + + LF data + ------- + shift_reg[11:0] == 12bit data + lf data is divided into MAJOR MODES and configuration values. + + The major modes uses 3bits (0,1,2,3,7 | 000, 001, 010, 011, 111) + 000 FPGA_MAJOR_MODE_LF_READER = Act as LF reader (modulate) + 001 FPGA_MAJOR_MODE_LF_EDGE_DETECT = Simulate LF + 010 FPGA_MAJOR_MODE_LF_PASSTHRU = Passthrough mode, CROSS_LO line connected to SSP_DIN. SSP_DOUT logic level controls if we modulate / listening + 011 FPGA_MAJOR_MODE_LF_ADC = refactor hitag2, clear ADC sampling + 111 FPGA_MAJOR_MODE_OFF = turn off sampling. + + Each one of this major modes can have options. Currently these two major modes uses options. + - FPGA_MAJOR_MODE_LF_READER + - FPGA_MAJOR_MODE_LF_EDGE_DETECT + + FPGA_MAJOR_MODE_LF_READER + ------------------------------------- + lf_field = 1bit (FPGA_LF_ADC_READER_FIELD) + + You can send FPGA_CMD_SET_DIVISOR to set with FREQUENCY the fpga should sample at + divisor = 8bits shift_reg[7:0] + + FPGA_MAJOR_MODE_LF_EDGE_DETECT + ------------------------------------------ + lf_ed_toggle_mode = 1bits + lf_ed_threshold = 8bits threshold defaults to 127 + + You can send FPGA_CMD_SET_EDGE_DETECT_THRESHOLD to set a custom threshold + lf_ed_threshold = 8bits threshold value. + + conf_word 12bits + conf_word[7:5] = 3bit major mode. + conf_word[0] = 1bit lf_field + conf_word[1] = 1bit lf_ed_toggle_mode + conf_word[7:0] = 8bit divisor + conf_word[7:0] = 8bit threshold ------+--------- frame layout -------------------- -bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ------+------------------------------------------- -cmd | x x x x -major| x x x -opt | x x -divi | x x x x x x x x -thres| x x x x x x x x ------+------------------------------------------- */ - -// Definitions for the FPGA commands. -// BOTH HF / LF -#define FPGA_CMD_SET_CONFREG (1<<12) // C - -// LF -#define FPGA_CMD_SET_DIVISOR (2<<12) // C -#define FPGA_CMD_SET_USER_BYTE1 (3<<12) // C - -// HF -#define FPGA_CMD_TRACE_ENABLE (2<<12) // C - -// Definitions for the FPGA configuration word. +// Defining commands, modes and options. This must be aligned to the definitions in fpga/define.v #define FPGA_MAJOR_MODE_MASK 0x01C0 #define FPGA_MINOR_MODE_MASK 0x003F -// LF +// Definitions for the FPGA commands. +#define FPGA_CMD_SET_CONFREG (1<<12) +#define FPGA_CMD_SET_DIVISOR (2<<12) +#define FPGA_CMD_SET_EDGE_DETECT_THRESHOLD (3<<12) +#define FPGA_CMD_TRACE_ENABLE (2<<12) + +// Major modes #define FPGA_MAJOR_MODE_LF_READER (0<<6) #define FPGA_MAJOR_MODE_LF_EDGE_DETECT (1<<6) #define FPGA_MAJOR_MODE_LF_PASSTHRU (2<<6) #define FPGA_MAJOR_MODE_LF_ADC (3<<6) -// HF -#define FPGA_MAJOR_MODE_HF_READER (0<<6) // D -#define FPGA_MAJOR_MODE_HF_SIMULATOR (1<<6) // D -#define FPGA_MAJOR_MODE_HF_ISO14443A (2<<6) // D -#define FPGA_MAJOR_MODE_HF_SNIFF (3<<6) // D -#define FPGA_MAJOR_MODE_HF_ISO18092 (4<<6) // D -#define FPGA_MAJOR_MODE_HF_GET_TRACE (5<<6) // D -#define FPGA_MAJOR_MODE_HF_FSK_READER (6<<6) // D - -// BOTH HF / LF -#define FPGA_MAJOR_MODE_OFF (7<<6) // D - +#define FPGA_MAJOR_MODE_HF_READER (0<<6) +#define FPGA_MAJOR_MODE_HF_SIMULATOR (1<<6) +#define FPGA_MAJOR_MODE_HF_ISO14443A (2<<6) +#define FPGA_MAJOR_MODE_HF_SNIFF (3<<6) +#define FPGA_MAJOR_MODE_HF_ISO18092 (4<<6) +#define FPGA_MAJOR_MODE_HF_GET_TRACE (5<<6) +#define FPGA_MAJOR_MODE_OFF (7<<6) // Options for LF_READER -#define FPGA_LF_ADC_READER_FIELD 0x1 +#define FPGA_LF_ADC_READER_FIELD ( 1 ) // Options for LF_EDGE_DETECT -#define FPGA_CMD_SET_EDGE_DETECT_THRESHOLD FPGA_CMD_SET_USER_BYTE1 -#define FPGA_LF_EDGE_DETECT_READER_FIELD 0x1 -#define FPGA_LF_EDGE_DETECT_TOGGLE_MODE 0x2 +#define FPGA_LF_EDGE_DETECT_READER_FIELD ( 1 ) +#define FPGA_LF_EDGE_DETECT_TOGGLE_MODE ( 2 ) -// Options for the HF reader -#define FPGA_HF_READER_MODE_RECEIVE_IQ (0<<0) -#define FPGA_HF_READER_MODE_RECEIVE_AMPLITUDE (1<<0) -#define FPGA_HF_READER_MODE_RECEIVE_PHASE (2<<0) -#define FPGA_HF_READER_MODE_SEND_FULL_MOD (3<<0) -#define FPGA_HF_READER_MODE_SEND_SHALLOW_MOD (4<<0) -#define FPGA_HF_READER_MODE_SNIFF_IQ (5<<0) -#define FPGA_HF_READER_MODE_SNIFF_AMPLITUDE (6<<0) -#define FPGA_HF_READER_MODE_SNIFF_PHASE (7<<0) -#define FPGA_HF_READER_MODE_SEND_JAM (8<<0) +// Options for the generic HF reader +#define FPGA_HF_READER_MODE_RECEIVE_IQ ( 0 ) +#define FPGA_HF_READER_MODE_RECEIVE_AMPLITUDE ( 1 ) +#define FPGA_HF_READER_MODE_RECEIVE_PHASE ( 2 ) +#define FPGA_HF_READER_MODE_SEND_FULL_MOD ( 3 ) +#define FPGA_HF_READER_MODE_SEND_SHALLOW_MOD ( 4 ) +#define FPGA_HF_READER_MODE_SNIFF_IQ ( 5 ) +#define FPGA_HF_READER_MODE_SNIFF_AMPLITUDE ( 6 ) +#define FPGA_HF_READER_MODE_SNIFF_PHASE ( 7 ) +#define FPGA_HF_READER_MODE_SEND_JAM ( 8 ) +#define FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4 ( 9 ) #define FPGA_HF_READER_SUBCARRIER_848_KHZ (0<<4) #define FPGA_HF_READER_SUBCARRIER_424_KHZ (1<<4) @@ -109,24 +148,23 @@ thres| x x x x x x x x #define FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ (3<<4) // Options for the HF simulated tag, how to modulate -#define FPGA_HF_SIMULATOR_NO_MODULATION 0x0 // 0000 -#define FPGA_HF_SIMULATOR_MODULATE_BPSK 0x1 // 0001 -#define FPGA_HF_SIMULATOR_MODULATE_212K 0x2 // 0010 -#define FPGA_HF_SIMULATOR_MODULATE_424K 0x4 // 0100 -#define FPGA_HF_SIMULATOR_MODULATE_424K_8BIT 0x5 // 0101 -// no 848K +#define FPGA_HF_SIMULATOR_NO_MODULATION ( 0 ) +#define FPGA_HF_SIMULATOR_MODULATE_BPSK ( 1 ) +#define FPGA_HF_SIMULATOR_MODULATE_212K ( 2 ) +#define FPGA_HF_SIMULATOR_MODULATE_424K ( 4 ) +#define FPGA_HF_SIMULATOR_MODULATE_424K_8BIT ( 5 ) // Options for ISO14443A -#define FPGA_HF_ISO14443A_SNIFFER 0x0 -#define FPGA_HF_ISO14443A_TAGSIM_LISTEN 0x1 -#define FPGA_HF_ISO14443A_TAGSIM_MOD 0x2 -#define FPGA_HF_ISO14443A_READER_LISTEN 0x3 -#define FPGA_HF_ISO14443A_READER_MOD 0x4 +#define FPGA_HF_ISO14443A_SNIFFER ( 0 ) +#define FPGA_HF_ISO14443A_TAGSIM_LISTEN ( 1 ) +#define FPGA_HF_ISO14443A_TAGSIM_MOD ( 2 ) +#define FPGA_HF_ISO14443A_READER_LISTEN ( 3 ) +#define FPGA_HF_ISO14443A_READER_MOD ( 4 ) -//options for Felica. -#define FPGA_HF_ISO18092_FLAG_NOMOD 0x1 // 0001 disable modulation module -#define FPGA_HF_ISO18092_FLAG_424K 0x2 // 0010 should enable 414k mode (untested). No autodetect -#define FPGA_HF_ISO18092_FLAG_READER 0x4 // 0100 enables antenna power, to act as a reader instead of tag +// Options for ISO18092 / Felica +#define FPGA_HF_ISO18092_FLAG_NOMOD ( 1 ) // 0001 disable modulation module +#define FPGA_HF_ISO18092_FLAG_424K ( 2 ) // 0010 should enable 414k mode (untested). No autodetect +#define FPGA_HF_ISO18092_FLAG_READER ( 4 ) // 0100 enables antenna power, to act as a reader instead of tag void FpgaSendCommand(uint16_t cmd, uint16_t v); void FpgaWriteConfWord(uint16_t v); diff --git a/armsrc/hfops.c b/armsrc/hfops.c index 6a97be76a..df42c8685 100644 --- a/armsrc/hfops.c +++ b/armsrc/hfops.c @@ -200,7 +200,7 @@ static uint32_t HfEncodeTkm(const uint8_t *uid, uint8_t modulation, uint8_t *dat return len; } -int HfSimulateTkm(uint8_t *uid, uint8_t modulation, uint32_t timeout) { +int HfSimulateTkm(const uint8_t *uid, uint8_t modulation, uint32_t timeout) { // free eventually allocated BigBuf memory BigBuf_free_keep_EM(); diff --git a/armsrc/hfops.h b/armsrc/hfops.h index 352f9d2bc..c738887b4 100644 --- a/armsrc/hfops.h +++ b/armsrc/hfops.h @@ -22,6 +22,6 @@ #include "common.h" int HfReadADC(uint32_t samplesCount, bool ledcontrol); -int HfSimulateTkm(uint8_t *uid, uint8_t modulation, uint32_t timeout); +int HfSimulateTkm(const uint8_t *uid, uint8_t modulation, uint32_t timeout); #endif diff --git a/armsrc/hitag2.c b/armsrc/hitag2.c index 90a667105..d4abe9ff1 100644 --- a/armsrc/hitag2.c +++ b/armsrc/hitag2.c @@ -281,7 +281,7 @@ static void hitag2_handle_reader_command(uint8_t *rx, const size_t rxlen, uint8_ } break; - // Received RWD authentication challenge and respnse + // Received RWD authentication challenge and response case 64: { // Store the authentication attempt if (auth_table_len < (AUTH_TABLE_LENGTH - 8)) { @@ -891,7 +891,7 @@ static bool hitag2_test_auth_attempts(uint8_t *rx, const size_t rxlen, uint8_t * if (bCrypto) { Dbprintf("auth: %02x%02x%02x%02x%02x%02x%02x%02x Failed, removed entry!", NrAr[0], NrAr[1], NrAr[2], NrAr[3], NrAr[4], NrAr[5], NrAr[6], NrAr[7]); - // Removing failed entry from authentiations table + // Removing failed entry from authentications table memcpy(auth_table + auth_table_pos, auth_table + auth_table_pos + 8, 8); auth_table_len -= 8; @@ -979,7 +979,7 @@ static bool hitag2_read_uid(uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t return true; } -void EloadHitag(uint8_t *data, uint16_t len) { +void EloadHitag(const uint8_t *data, uint16_t len) { memcpy(tag.sectors, data, sizeof(tag.sectors)); } @@ -1532,7 +1532,7 @@ void SimulateHitag2(bool ledcontrol) { // reply_ng(CMD_LF_HITAG_SIMULATE, (checked == -1) ? PM3_EOPABORTED : PM3_SUCCESS, (uint8_t *)tag.sectors, tag_size); } -void ReaderHitag(hitag_function htf, hitag_data *htd, bool ledcontrol) { +void ReaderHitag(hitag_function htf, const hitag_data *htd, bool ledcontrol) { uint32_t command_start = 0, command_duration = 0; uint32_t response_start = 0, response_duration = 0; @@ -1928,7 +1928,7 @@ out: reply_mix(CMD_ACK, bSuccessful, 0, 0, 0, 0); } -void WriterHitag(hitag_function htf, hitag_data *htd, int page, bool ledcontrol) { +void WriterHitag(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol) { uint32_t command_start = 0; uint32_t command_duration = 0; diff --git a/armsrc/hitag2.h b/armsrc/hitag2.h index dcad3b417..90aa8132b 100644 --- a/armsrc/hitag2.h +++ b/armsrc/hitag2.h @@ -24,7 +24,7 @@ void SniffHitag2(bool ledcontrol); void SimulateHitag2(bool ledcontrol); -void ReaderHitag(hitag_function htf, hitag_data *htd, bool ledcontrol); -void WriterHitag(hitag_function htf, hitag_data *htd, int page, bool ledcontrol); -void EloadHitag(uint8_t *data, uint16_t len); +void ReaderHitag(hitag_function htf, const hitag_data *htd, bool ledcontrol); +void WriterHitag(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol); +void EloadHitag(const uint8_t *data, uint16_t len); #endif diff --git a/armsrc/hitag2_crypto.c b/armsrc/hitag2_crypto.c index a8a01dae4..931c17fa8 100644 --- a/armsrc/hitag2_crypto.c +++ b/armsrc/hitag2_crypto.c @@ -91,17 +91,17 @@ uint32_t _hitag2_byte(uint64_t *x) { void hitag2_cipher_reset(struct hitag2_tag *tag, const uint8_t *iv) { uint64_t key = ((uint64_t)tag->sectors[2][2]) | - ((uint64_t)tag->sectors[2][3] << 8) | + ((uint64_t)tag->sectors[2][3] << 8) | ((uint64_t)tag->sectors[1][0] << 16) | ((uint64_t)tag->sectors[1][1] << 24) | ((uint64_t)tag->sectors[1][2] << 32) | ((uint64_t)tag->sectors[1][3] << 40); uint32_t uid = ((uint32_t)tag->sectors[0][0]) | - ((uint32_t)tag->sectors[0][1] << 8) | + ((uint32_t)tag->sectors[0][1] << 8) | ((uint32_t)tag->sectors[0][2] << 16) | ((uint32_t)tag->sectors[0][3] << 24); uint32_t iv_ = (((uint32_t)(iv[0]))) | - (((uint32_t)(iv[1])) << 8) | + (((uint32_t)(iv[1])) << 8) | (((uint32_t)(iv[2])) << 16) | (((uint32_t)(iv[3])) << 24); tag->cs = _hitag2_init(REV64(key), REV32(uid), REV32(iv_)); diff --git a/armsrc/hitagS.c b/armsrc/hitagS.c index db219bcf2..d304cb6b3 100644 --- a/armsrc/hitagS.c +++ b/armsrc/hitagS.c @@ -635,7 +635,7 @@ static void hitagS_handle_reader_command(uint8_t *rx, const size_t rxlen, /* * Emulates a Hitag S Tag with the given data from the .hts file */ -void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data, bool ledcontrol) { +void SimulateHitagSTag(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol) { StopTicks(); @@ -1052,7 +1052,7 @@ static size_t concatbits(uint8_t *dstbuf, size_t dstbufskip, const uint8_t *srcb return dstbufskip + srcbuflen; } -static int selectHitagS(hitag_function htf, hitag_data *htd, uint8_t *tx, size_t sizeoftx, uint8_t *rx, size_t sizeofrx, int t_wait, bool ledcontrol) { +static int selectHitagS(hitag_function htf, const hitag_data *htd, uint8_t *tx, size_t sizeoftx, uint8_t *rx, size_t sizeofrx, int t_wait, bool ledcontrol) { StopTicks(); FpgaDownloadAndGo(FPGA_BITSTREAM_LF); @@ -1263,7 +1263,7 @@ static int selectHitagS(hitag_function htf, hitag_data *htd, uint8_t *tx, size_t * If the key was given the password will be decrypted. * Reads every page of a hitag S transpoder. */ -void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol) { +void ReadHitagS(hitag_function htf, const hitag_data *htd, bool ledcontrol) { uint8_t rx[HITAG_FRAME_LEN]; size_t rxlen = 0; @@ -1356,7 +1356,7 @@ void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol) { * Authenticates to the Tag with the given Key or Challenge. * Writes the given 32Bit data into page_ */ -void WritePageHitagS(hitag_function htf, hitag_data *htd, int page, bool ledcontrol) { +void WritePageHitagS(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol) { bool bSuccessful = false; //check for valid input @@ -1443,7 +1443,7 @@ write_end: * is not received correctly due to Antenna problems. This function * detects these challenges. */ -void Hitag_check_challenges(uint8_t *data, uint32_t datalen, bool ledcontrol) { +void Hitag_check_challenges(const uint8_t *data, uint32_t datalen, bool ledcontrol) { //check for valid input if (datalen < 8) { Dbprintf("Error, need chals"); diff --git a/armsrc/hitagS.h b/armsrc/hitagS.h index 49a4f358f..cbb87722f 100644 --- a/armsrc/hitagS.h +++ b/armsrc/hitagS.h @@ -25,8 +25,8 @@ #include "hitag.h" -void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data, bool ledcontrol); -void ReadHitagS(hitag_function htf, hitag_data *htd, bool ledcontrol); -void WritePageHitagS(hitag_function htf, hitag_data *htd, int page, bool ledcontrol); -void Hitag_check_challenges(uint8_t *data, uint32_t datalen, bool ledcontrol); +void SimulateHitagSTag(bool tag_mem_supplied, const uint8_t *data, bool ledcontrol); +void ReadHitagS(hitag_function htf, const hitag_data *htd, bool ledcontrol); +void WritePageHitagS(hitag_function htf, const hitag_data *htd, int page, bool ledcontrol); +void Hitag_check_challenges(const uint8_t *data, uint32_t datalen, bool ledcontrol); #endif diff --git a/armsrc/i2c.c b/armsrc/i2c.c index ca3cb46fd..016ae2f13 100644 --- a/armsrc/i2c.c +++ b/armsrc/i2c.c @@ -407,7 +407,7 @@ bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address) { //Sends array of data (Array, length, command to be written , SlaveDevice address ). // len = uint16 because we need to write up to 256 bytes -bool I2C_BufferWrite(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address) { +bool I2C_BufferWrite(const uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address) { bool bBreak = true; do { if (!I2C_Start()) @@ -602,7 +602,7 @@ int16_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t return readcount; } -bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address) { +bool I2C_WriteFW(const uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address) { //START, 0xB0, 0x00, 0x00, xx, yy, zz, ......, STOP bool bBreak = true; @@ -772,7 +772,7 @@ void SmartCardAtr(void) { // StopTicks(); } -void SmartCardRaw(smart_card_raw_t *p) { +void SmartCardRaw(const smart_card_raw_t *p) { LED_D_ON(); uint16_t len = 0; diff --git a/armsrc/i2c.h b/armsrc/i2c.h index 972704c1b..6fa8b8809 100644 --- a/armsrc/i2c.h +++ b/armsrc/i2c.h @@ -41,12 +41,12 @@ void I2C_Reset_EnterBootloader(void); bool I2C_WriteCmd(uint8_t device_cmd, uint8_t device_address); bool I2C_WriteByte(uint8_t data, uint8_t device_cmd, uint8_t device_address); -bool I2C_BufferWrite(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address); +bool I2C_BufferWrite(const uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address); int16_t I2C_BufferRead(uint8_t *data, uint16_t len, uint8_t device_cmd, uint8_t device_address); // for firmware int16_t I2C_ReadFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address); -bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address); +bool I2C_WriteFW(const uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t device_address); bool sc_rx_bytes(uint8_t *dest, uint16_t *destlen); // @@ -54,7 +54,7 @@ bool GetATR(smart_card_atr_t *card_ptr, bool verbose); // generice functions void SmartCardAtr(void); -void SmartCardRaw(smart_card_raw_t *p); +void SmartCardRaw(const smart_card_raw_t *p); void SmartCardUpgrade(uint64_t arg0); void SmartCardSetBaud(uint64_t arg0); void SmartCardSetClock(uint64_t arg0); diff --git a/armsrc/iclass.c b/armsrc/iclass.c index 5a68a8207..953cfaa6f 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -1902,13 +1902,13 @@ void iClass_WriteBlock(uint8_t *msg) { // verify write uint8_t all_ff[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - if (payload->req.blockno == 2) { + if (pagemap == PICOPASS_SECURE_PAGEMODE && payload->req.blockno == 2) { // check response. e-purse update swaps first and second half if (memcmp(payload->data + 4, resp, 4) || memcmp(payload->data, resp + 4, 4)) { res = false; goto out; } - } else if (payload->req.blockno == 3 || payload->req.blockno == 4) { + } else if (pagemap == PICOPASS_SECURE_PAGEMODE && (payload->req.blockno == 3 || payload->req.blockno == 4)) { // check response. Key updates always return 0xffffffffffffffff if (memcmp(all_ff, resp, 8)) { res = false; @@ -1929,6 +1929,159 @@ out: reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_SUCCESS, (uint8_t *)&res, sizeof(uint8_t)); } +void iclass_credit_epurse(iclass_credit_epurse_t *payload) { + + LED_A_ON(); + + bool shallow_mod = payload->req.shallow_mod; + + Iso15693InitReader(); + + // select tag. + uint32_t eof_time = 0; + picopass_hdr_t hdr = {0}; + uint8_t res = select_iclass_tag(&hdr, payload->req.use_credit_key, &eof_time, shallow_mod); + if (res == false) { + goto out; + } + + uint32_t start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER; + + uint8_t mac[4] = {0}; + + // authenticate + if (payload->req.do_auth) { + + res = authenticate_iclass_tag(&payload->req, &hdr, &start_time, &eof_time, mac); + if (res == false) { + goto out; + } + } + + start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER; + + uint8_t cmd_read[] = {ICLASS_CMD_READ_OR_IDENTIFY, payload->req.blockno, 0x00, 0x00}; + AddCrc(cmd_read + 1, 1); + + uint8_t epurse[10]; + res = iclass_send_cmd_with_retries(cmd_read, sizeof(cmd_read), epurse, sizeof(epurse), 10, 3, &start_time, ICLASS_READER_TIMEOUT_OTHERS, &eof_time, shallow_mod); + if (!res) { + switch_off(); + if (payload->req.send_reply) + reply_ng(CMD_HF_ICLASS_CREDIT_EPURSE, PM3_ETIMEOUT, (uint8_t *)&res, sizeof(uint8_t)); + return; + } + + uint8_t write[14] = { 0x80 | ICLASS_CMD_UPDATE, payload->req.blockno }; + uint8_t write_len = 14; + + uint8_t epurse_offset = 0; + const uint8_t empty_epurse[] = {0xff, 0xff, 0xff, 0xff}; + if (!memcmp(epurse, empty_epurse, 4)) { + // epurse data in stage 2 + epurse_offset = 4; + } + + memcpy(epurse + epurse_offset, payload->epurse, 4); + + // blank out debiting value as per the first step of the crediting procedure + epurse[epurse_offset + 0] = 0xFF; + epurse[epurse_offset + 1] = 0xFF; + + // initial epurse write for credit + memcpy(write + 2, epurse, 8); + + doMAC_N(write + 1, 9, payload->req.use_credit_key ? hdr.key_c : hdr.key_d, mac); + memcpy(write + 10, mac, sizeof(mac)); + + start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER; + + uint8_t resp[10] = {0}; + + uint8_t tries = 3; + while (tries-- > 0) { + + iclass_send_as_reader(write, write_len, &start_time, &eof_time, shallow_mod); + + if (tearoff_hook() == PM3_ETEAROFF) { // tearoff occurred + res = false; + switch_off(); + if (payload->req.send_reply) + reply_ng(CMD_HF_ICLASS_CREDIT_EPURSE, PM3_ETEAROFF, (uint8_t *)&res, sizeof(uint8_t)); + return; + } else { + + uint16_t resp_len = 0; + int res2 = GetIso15693AnswerFromTag(resp, sizeof(resp), ICLASS_READER_TIMEOUT_UPDATE, &eof_time, false, true, &resp_len); + if (res2 == PM3_SUCCESS && resp_len == 10) { + res = true; + break; + } + } + } + + if (tries == 0) { + res = false; + goto out; + } + + // check response. e-purse update swaps first and second half + if (memcmp(write + 2 + 4, resp, 4) || memcmp(write + 2, resp + 4, 4)) { + res = false; + goto out; + } + + // new epurse write + // epurse offset is now flipped after the first write + epurse_offset ^= 4; + memcpy(resp + epurse_offset, payload->epurse, 4); + memcpy(write + 2, resp, 8); + + doMAC_N(write + 1, 9, payload->req.use_credit_key ? hdr.key_c : hdr.key_d, mac); + memcpy(write + 10, mac, sizeof(mac)); + + start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER; + + tries = 3; + while (tries-- > 0) { + + iclass_send_as_reader(write, write_len, &start_time, &eof_time, shallow_mod); + + if (tearoff_hook() == PM3_ETEAROFF) { // tearoff occurred + res = false; + switch_off(); + if (payload->req.send_reply) + reply_ng(CMD_HF_ICLASS_CREDIT_EPURSE, PM3_ETEAROFF, (uint8_t *)&res, sizeof(uint8_t)); + return; + } else { + + uint16_t resp_len = 0; + int res2 = GetIso15693AnswerFromTag(resp, sizeof(resp), ICLASS_READER_TIMEOUT_UPDATE, &eof_time, false, true, &resp_len); + if (res2 == PM3_SUCCESS && resp_len == 10) { + res = true; + break; + } + } + } + + if (tries == 0) { + res = false; + goto out; + } + + // check response. e-purse update swaps first and second half + if (memcmp(write + 2 + 4, resp, 4) || memcmp(write + 2, resp + 4, 4)) { + res = false; + goto out; + } + +out: + switch_off(); + + if (payload->req.send_reply) + reply_ng(CMD_HF_ICLASS_CREDIT_EPURSE, PM3_SUCCESS, (uint8_t *)&res, sizeof(uint8_t)); +} + void iClass_Restore(iclass_restore_req_t *msg) { // sanitation diff --git a/armsrc/iclass.h b/armsrc/iclass.h index ebbda2e9f..363c042ab 100644 --- a/armsrc/iclass.h +++ b/armsrc/iclass.h @@ -25,6 +25,7 @@ void SniffIClass(uint8_t jam_search_len, uint8_t *jam_search_string); void ReaderIClass(uint8_t flags); void iClass_WriteBlock(uint8_t *msg); +void iclass_credit_epurse(iclass_credit_epurse_t *payload); void iClass_Dump(uint8_t *msg); void iClass_Restore(iclass_restore_req_t *msg); diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 5416f2917..346669398 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -142,6 +142,15 @@ Default HF 14a config is set to: */ static hf14a_config hf14aconfig = { 0, 0, 0, 0, 0 } ; + +// Polling frames and configurations +static iso14a_polling_parameters_t WUPA_POLLING_PARAMETERS = { + .frames = { {{ 0x52 }, 1, 7, 0} }, + .frame_count = 1, + .extra_timeout = 0, +}; + + void printHf14aConfig(void) { DbpString(_CYAN_("HF 14a config")); Dbprintf(" [a] Anticol override.... %s%s%s", @@ -179,7 +188,7 @@ void printHf14aConfig(void) { * @brief setSamplingConfig * @param sc */ -void setHf14aConfig(hf14a_config *hc) { +void setHf14aConfig(const hf14a_config *hc) { if ((hc->forceanticol >= 0) && (hc->forceanticol <= 2)) hf14aconfig.forceanticol = hc->forceanticol; @@ -555,7 +564,7 @@ RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_t } -// Thinfilm, Kovio mangels ISO14443A in the way that they don't use start bit nor parity bits. +// Thinfilm, Kovio mangles ISO14443A in the way that they don't use start bit nor parity bits. static RAMFUNC int ManchesterDecoding_Thinfilm(uint8_t bit) { Demod.twoBits = (Demod.twoBits << 8) | bit; @@ -1045,8 +1054,8 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r case 1: { // MIFARE Classic 1k rATQA[0] = 0x04; sak = 0x08; + break; } - break; case 2: { // MIFARE Ultralight rATQA[0] = 0x44; sak = 0x00; @@ -1076,33 +1085,32 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r // READ_SIG memcpy(rSIGN, mfu_header->signature, 32); AddCrc14A(rSIGN, sizeof(rSIGN) - 2); - + break; } - break; case 3: { // MIFARE DESFire rATQA[0] = 0x44; rATQA[1] = 0x03; sak = 0x20; memcpy(rRATS, "\x06\x75\x77\x81\x02\x80\x00\x00", 8); + break; } - break; case 4: { // ISO/IEC 14443-4 - javacard (JCOP) rATQA[0] = 0x04; sak = 0x28; + break; } - break; case 5: { // MIFARE TNP3XXX rATQA[0] = 0x01; rATQA[1] = 0x0f; sak = 0x01; + break; } - break; case 6: { // MIFARE Mini 320b rATQA[0] = 0x44; sak = 0x09; + break; } - break; - case 7: { // NTAG + case 7: { // NTAG 215 rATQA[0] = 0x44; sak = 0x00; // some first pages of UL/NTAG dump is special data @@ -1131,37 +1139,39 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r // READ_SIG memcpy(rSIGN, mfu_header->signature, 32); AddCrc14A(rSIGN, sizeof(rSIGN) - 2); - + break; } - break; case 8: { // MIFARE Classic 4k rATQA[0] = 0x02; sak = 0x18; + break; } - break; case 9: { // FM11RF005SH (Shanghai Metro) rATQA[0] = 0x03; rATQA[1] = 0x00; sak = 0x0A; + break; } - break; case 10: { // ST25TA IKEA Rothult rATQA[0] = 0x42; rATQA[1] = 0x00; sak = 0x20; + break; } - break; case 11: { // ISO/IEC 14443-4 - javacard (JCOP) rATQA[0] = 0x04; sak = 0x20; + break; + } + case 12: { // HID Seos 4K card + rATQA[0] = 0x01; + sak = 0x20; + break; } - break; - default: { if (g_dbglevel >= DBG_ERROR) Dbprintf("Error: unknown tagtype (%d)", tagType); return false; } - break; } // if uid not supplied then get from emulator memory @@ -1264,17 +1274,20 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r AddCrc14A(rPPS, sizeof(rPPS) - 2); + // EV1/NTAG, set PWD w AMIIBO algo if all zero. if (tagType == 7) { - uint8_t pwd[4]; - uint8_t gen_pwd[4]; - uint16_t start = (*pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH; - emlGetMemBt(pwd, start, sizeof(pwd)); + uint8_t pwd[4] = {0, 0, 0, 0}; + uint8_t gen_pwd[4] = {0, 0, 0, 0}; + emlGetMemBt(pwd, (*pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(pwd)); + emlGetMemBt(rPACK, (*pages) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(rPACK)); + Uint4byteToMemBe(gen_pwd, ul_ev1_pwdgenB(data)); if (memcmp(pwd, gen_pwd, sizeof(pwd)) == 0) { rPACK[0] = 0x80; rPACK[1] = 0x80; } } + AddCrc14A(rPACK, sizeof(rPACK) - 2); static tag_response_info_t responses_init[] = { @@ -1558,7 +1571,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_ // block1 = 4byte UID. p_response = &responses[RESP_INDEX_UIDC1]; } else { // all other tags (16 byte block tags) - uint8_t emdata[MAX_MIFARE_FRAME_SIZE]; + uint8_t emdata[MAX_MIFARE_FRAME_SIZE] = {0}; emlGetMemBt(emdata, block, 16); AddCrc14A(emdata, 16); EmSendCmd(emdata, sizeof(emdata)); @@ -1572,7 +1585,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_ // send NACK 0x0 == invalid argument EmSend4bit(CARD_NACK_IV); } else { - uint8_t emdata[MAX_FRAME_SIZE]; + uint8_t emdata[MAX_FRAME_SIZE] = {0}; // first blocks of emu are header int start = block1 * 4 + MFU_DUMP_PREFIX_LENGTH; len = (block2 - block1 + 1) * 4; @@ -1656,7 +1669,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_ // send NACK 0x0 == invalid argument EmSend4bit(CARD_NACK_IV); } else { - uint8_t cmd[3]; + uint8_t cmd[3] = {0, 0, 0}; cmd[0] = tearings[index]; AddCrc14A(cmd, sizeof(cmd) - 2); EmSendCmd(cmd, sizeof(cmd)); @@ -1692,36 +1705,32 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_ } else if (receivedCmd[0] == MIFARE_ULC_AUTH_1) { // ULC authentication, or Desfire Authentication LogTrace(receivedCmd, Uart.len, Uart.startTime * 16 - DELAY_AIR2ARM_AS_TAG, Uart.endTime * 16 - DELAY_AIR2ARM_AS_TAG, Uart.parity, true); p_response = NULL; - } else if (receivedCmd[0] == MIFARE_ULEV1_AUTH && len == 7 && tagType == 7) { // NTAG / EV-1 authentication - - /* - // PWD stored in dump now - uint8_t pwd[4]; + } else if (receivedCmd[0] == MIFARE_ULEV1_AUTH && len == 7 && tagType == 7) { // NTAG / EV-1 + uint8_t pwd[4] = {0, 0, 0, 0}; emlGetMemBt(pwd, (pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(pwd)); + if (g_dbglevel >= DBG_DEBUG) { + Dbprintf("Reader sent password: "); + Dbhexdump(4, receivedCmd + 1, 0); + Dbprintf("Loaded password from memory: "); + Dbhexdump(4, pwd, 0); + } + if (memcmp(pwd, "\x00\x00\x00\x00", 4) == 0) { Uint4byteToMemLe(pwd, ul_ev1_pwdgenB(data)); - Dbprintf("Calc pwd... %02X %02X %02X %02X", pwd[0], pwd[1], pwd[2], pwd[3]); + if (g_dbglevel >= DBG_DEBUG) Dbprintf("Calc pwd... %02X %02X %02X %02X", pwd[0], pwd[1], pwd[2], pwd[3]); } if (memcmp(receivedCmd + 1, pwd, 4) == 0) { - - uint8_t pack[4]; - emlGetMemBt(pack, pages * 4 + MFU_DUMP_PREFIX_LENGTH, 2); - if (memcmp(pack, "\x00\x00\x00\x00", 4) == 0) { - pack[0] = 0x80; - pack[1] = 0x80; - } - AddCrc14A(pack, sizeof(pack) - 2); - EmSendCmd(pack, sizeof(pack)); + if (g_dbglevel >= DBG_DEBUG) Dbprintf("Password match, responding with PACK."); + p_response = &responses[RESP_INDEX_PACK]; } else { - EmSend4bit(CARD_NACK_NA); - if (g_dbglevel >= DBG_DEBUG) Dbprintf("Auth attempt: %08x", bytes_to_num(receivedCmd + 1, 4)); + if (g_dbglevel >= DBG_DEBUG) Dbprintf("Password did not match, NACK_IV."); + p_response = NULL; + EmSend4bit(CARD_NACK_IV); } - p_response = NULL; - */ - p_response = &responses[RESP_INDEX_PACK]; + } else if (receivedCmd[0] == MIFARE_ULEV1_VCSL && len == 23 && tagType == 7) { - uint8_t cmd[3]; + uint8_t cmd[3] = {0, 0, 0}; emlGetMemBt(cmd, (pages - 2) * 4 + 1 + MFU_DUMP_PREFIX_LENGTH, 1); AddCrc14A(cmd, sizeof(cmd) - 2); EmSendCmd(cmd, sizeof(cmd)); @@ -2355,8 +2364,9 @@ static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receive } // timeout already in ms + 100ms guard time - if (GetTickCountDelta(receive_timer) > timeout + 100) + if (GetTickCountDelta(receive_timer) > timeout + 100) { break; + } } return false; } @@ -2391,15 +2401,17 @@ void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing) { } static uint16_t ReaderReceiveOffset(uint8_t *receivedAnswer, uint16_t offset, uint8_t *par) { - if (!GetIso14443aAnswerFromTag(receivedAnswer, par, offset)) + if (GetIso14443aAnswerFromTag(receivedAnswer, par, offset) == false) { return 0; + } LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false); return Demod.len; } uint16_t ReaderReceive(uint8_t *receivedAnswer, uint8_t *par) { - if (!GetIso14443aAnswerFromTag(receivedAnswer, par, 0)) + if (GetIso14443aAnswerFromTag(receivedAnswer, par, 0) == false) { return 0; + } LogTrace(receivedAnswer, Demod.len, Demod.startTime * 16 - DELAY_AIR2ARM_AS_READER, Demod.endTime * 16 - DELAY_AIR2ARM_AS_READER, par, false); return Demod.len; } @@ -2508,57 +2520,33 @@ static void iso14a_set_ATS_times(const uint8_t *ats) { } } -static int GetATQA(uint8_t *resp, uint8_t *resp_par, bool use_ecp, bool use_magsafe) { -#define ECP_DELAY 10 -#define ECP_RETRY_TIMEOUT 100 -#define WUPA_RETRY_TIMEOUT 10 // 10ms - - - // 0x26 - REQA - // 0x52 - WAKE-UP - // 0x7A - MAGESAFE WAKE UP - uint8_t wupa[] = { ISO14443A_CMD_WUPA }; - - // if magsafe, set it outofbounds - if (use_magsafe) { - wupa[0] = MAGSAFE_CMD_WUPA_4; - } - - if (use_ecp) { - // In case a device was already selected, we send a S-BLOCK deselect to bring it into an idle state so it can be selected again - uint8_t deselect_cmd[] = {0xc2, 0xe0, 0xb4}; - ReaderTransmit(deselect_cmd, sizeof(deselect_cmd), NULL); - // Read response if present - (void) ReaderReceive(resp, resp_par); - } +static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters_t *polling_parameters) { +#define WUPA_RETRY_TIMEOUT 10 uint32_t save_iso14a_timeout = iso14a_get_timeout(); iso14a_set_timeout(1236 / 128 + 1); // response to WUPA is expected at exactly 1236/fc. No need to wait longer. bool first_try = true; - uint32_t retry_timeout = use_ecp ? ECP_RETRY_TIMEOUT : WUPA_RETRY_TIMEOUT; - uint32_t start_time; + uint32_t retry_timeout = WUPA_RETRY_TIMEOUT * polling_parameters->frame_count + polling_parameters->extra_timeout; + uint32_t start_time = 0; int len; - // we may need several tries if we did send an unknown command or a wrong authentication before... + uint8_t current_frame = 0; + do { - if (use_ecp && !first_try) { - uint8_t ecp[] = { 0x6a, 0x02, 0xC8, 0x01, 0x00, 0x03, 0x00, 0x02, 0x79, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xD8}; - ReaderTransmit(ecp, sizeof(ecp), NULL); - SpinDelay(ECP_DELAY); + iso14a_polling_frame_t *frame_parameters = &polling_parameters->frames[current_frame]; + + if (frame_parameters->last_byte_bits == 8) { + ReaderTransmit(frame_parameters->frame, frame_parameters->frame_length, NULL); + } else { + ReaderTransmitBitsPar(frame_parameters->frame, frame_parameters->last_byte_bits, NULL, NULL); } - if (use_magsafe) { - if (wupa[0] == MAGSAFE_CMD_WUPA_4) { - wupa[0] = MAGSAFE_CMD_WUPA_1; - } else { - wupa[0]++; - } + if (frame_parameters->extra_delay) { + SpinDelay(frame_parameters->extra_delay); } - // Broadcast for a card, WUPA (0x52) will force response from all cards in the field - ReaderTransmitBitsPar(wupa, 7, NULL, NULL); // Receive the ATQA len = ReaderReceive(resp, resp_par); @@ -2568,28 +2556,35 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par, bool use_ecp, bool use_mags } first_try = false; + + // Go over frame configurations, loop back when we reach the end + current_frame = current_frame < (polling_parameters->frame_count - 1) ? current_frame + 1 : 0; } while (len == 0 && GetTickCountDelta(start_time) <= retry_timeout); iso14a_set_timeout(save_iso14a_timeout); return len; } + int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats) { - return iso14443a_select_cardEx(uid_ptr, p_card, cuid_ptr, anticollision, num_cascades, no_rats, false, false); + return iso14443a_select_cardEx(uid_ptr, p_card, cuid_ptr, anticollision, num_cascades, no_rats, &WUPA_POLLING_PARAMETERS); } + // performs iso14443a anticollision (optional) and card select procedure // fills the uid and cuid pointer unless NULL // fills the card info record unless NULL // if anticollision is false, then the UID must be provided in uid_ptr[] // and num_cascades must be set (1: 4 Byte UID, 2: 7 Byte UID, 3: 10 Byte UID) // requests ATS unless no_rats is true -int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, bool use_ecp, bool use_magsafe) { +int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, + bool anticollision, uint8_t num_cascades, bool no_rats, + iso14a_polling_parameters_t *polling_parameters) { uint8_t resp[MAX_FRAME_SIZE] = {0}; // theoretically. A usual RATS will be much smaller uint8_t resp_par[MAX_PARITY_SIZE] = {0}; - uint8_t sak; // cascade uid + uint8_t sak = 0; // cascade uid bool do_cascade = 1; int cascade_level = 0; @@ -2599,7 +2594,7 @@ int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint p_card->ats_len = 0; } - if (GetATQA(resp, resp_par, use_ecp, use_magsafe) == false) { + if (GetATQA(resp, resp_par, polling_parameters) == 0) { return 0; } @@ -2624,11 +2619,11 @@ int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint memcpy(p_card->uid, resp, 4); // select again? - if (GetATQA(resp, resp_par, false, false) == false) { + if (GetATQA(resp, resp_par, &WUPA_POLLING_PARAMETERS) == 0) { return 0; } - if (GetATQA(resp, resp_par, false, false) == false) { + if (GetATQA(resp, resp_par, &WUPA_POLLING_PARAMETERS) == 0) { return 0; } @@ -2827,7 +2822,7 @@ int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades) { uint8_t sak = 0x04; // cascade uid int cascade_level = 0; - if (!GetATQA(resp, resp_par, false, false)) { + if (GetATQA(resp, resp_par, &WUPA_POLLING_PARAMETERS) == 0) { return 0; } @@ -2854,7 +2849,9 @@ int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades) { ReaderTransmit(sel_uid, sizeof(sel_uid), NULL); // Receive the SAK - if (!ReaderReceive(resp, resp_par)) return 0; + if (!ReaderReceive(resp, resp_par)) { + return 0; + } sak = resp[0]; @@ -3035,7 +3032,12 @@ void ReaderIso14443a(PacketCommandNG *c) { // if failed selecting, turn off antenna and quite. if (!(param & ISO14A_NO_SELECT)) { iso14a_card_select_t *card = (iso14a_card_select_t *)buf; - arg0 = iso14443a_select_cardEx(NULL, card, NULL, true, 0, (param & ISO14A_NO_RATS), (param & ISO14A_USE_ECP), (param & ISO14A_USE_MAGSAFE)); + + arg0 = iso14443a_select_cardEx( + NULL, card, NULL, true, 0, (param & ISO14A_NO_RATS), + (param & ISO14A_USE_CUSTOM_POLLING) ? (iso14a_polling_parameters_t *)cmd : &WUPA_POLLING_PARAMETERS + ); + // TODO: Improve by adding a cmd parser pointer and moving it by struct length to allow combining data with polling params FpgaDisableTracing(); reply_mix(CMD_ACK, arg0, card->uidlen, 0, buf, sizeof(iso14a_card_select_t)); diff --git a/armsrc/iso14443a.h b/armsrc/iso14443a.h index 104d6b680..7957e6f48 100644 --- a/armsrc/iso14443a.h +++ b/armsrc/iso14443a.h @@ -121,7 +121,7 @@ typedef enum { #endif void printHf14aConfig(void); -void setHf14aConfig(hf14a_config *hc); +void setHf14aConfig(const hf14a_config *hc); hf14a_config *getHf14aConfig(void); void iso14a_set_timeout(uint32_t timeout); uint32_t iso14a_get_timeout(void); @@ -151,7 +151,7 @@ uint16_t ReaderReceive(uint8_t *receivedAnswer, uint8_t *par); void iso14443a_setup(uint8_t fpga_minor_mode); int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, uint8_t *res); int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats); -int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, bool use_ecp, bool use_magsafe); +int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, iso14a_polling_parameters_t *polling_parameters); int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades); void iso14a_set_trigger(bool enable); diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index e4f1e4e93..db20119d2 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -39,9 +39,14 @@ * Current timing issues with ISO14443-b implementation * Proxmark3 * Carrier Frequency 13.56MHz +* 1 / 13 560 000 = 73.74 nano seconds ( 0.07374 µs ) + * SSP_CLK runs at 13.56MHz / 4 = 3,39MHz +* 1 / 3 390 000 = 294.98 nano seconds ( 0.2949 µs ) * -* +* 1 ETU = 9.4395 µs = 32 SSP_CLK = 128 FC +* 1 SSP_CLK = 4 FC +* 1 µs 3 SSP_CLK about 14 FC * PROBLEM 1. * ---------- * one way of calculating time, that relates both to PM3 ssp_clk 3.39MHz, ISO freq of 13.56Mhz and ETUs @@ -106,6 +111,9 @@ * */ + + + #ifndef MAX_14B_TIMEOUT // FWT(max) = 4949 ms or 4.95 seconds. // SSP_CLK = 4949000 * 3.39 = 16777120 @@ -122,8 +130,8 @@ // ETU 14 * 9.4395 µS = 132 µS == 0.132ms // TR2, counting from start of PICC EOF 14 ETU. -#define DELAY_ISO14443B_PICC_TO_PCD_READER ETU_TO_SSP(14) -#define DELAY_ISO14443B_PCD_TO_PICC_READER ETU_TO_SSP(15) +#define DELAY_ISO14443B_PICC_TO_PCD_READER HF14_ETU_TO_SSP(14) +#define DELAY_ISO14443B_PCD_TO_PICC_READER HF14_ETU_TO_SSP(15) /* Guard Time (per 14443-2) in ETU * @@ -138,41 +146,41 @@ * TR0 */ #ifndef ISO14B_TR0 -# define ISO14B_TR0 ETU_TO_SSP(32) +# define ISO14B_TR0 HF14_ETU_TO_SSP(16) #endif #ifndef ISO14B_TR0_MAX -# define ISO14B_TR0_MAX ETU_TO_SSP(32) +# define ISO14B_TR0_MAX HF14_ETU_TO_SSP(32) // * TR0 - 32 ETU's maximum for ATQB only // * TR0 - FWT for all other commands -// TR0 max is 151/fsc = 151/848kHz = 302us or 64 samples from FPGA -// 32 ETU * 9.4395 µS == 302 µS -// 32 * 8 = 256 sub carrier cycles, -// 256 / 4 = 64 I/Q pairs. +// TR0 max is 159 µS or 32 samples from FPGA +// 16 ETU * 9.4395 µS == 151 µS +// 16 * 8 = 128 sub carrier cycles, +// 128 / 4 = 32 I/Q pairs. // since 1 I/Q pair after 4 subcarrier cycles at 848kHz subcarrier #endif // 8 ETU = 75 µS == 256 SSP_CLK #ifndef ISO14B_TR0_MIN -# define ISO14B_TR0_MIN ETU_TO_SSP(8) +# define ISO14B_TR0_MIN HF14_ETU_TO_SSP(8) #endif // Synchronization time (per 14443-2) in ETU -// 10 ETU = 94,39 µS == 320 SSP_CLK +// 16 ETU = 151 µS == 512 SSP_CLK #ifndef ISO14B_TR1_MIN -# define ISO14B_TR1_MIN ETU_TO_SSP(10) +# define ISO14B_TR1_MIN HF14_ETU_TO_SSP(16) #endif // Synchronization time (per 14443-2) in ETU // 25 ETU == 236 µS == 800 SSP_CLK #ifndef ISO14B_TR1_MAX -# define ISO14B_TR1 ETU_TO_SSP(25) +# define ISO14B_TR1 HF14_ETU_TO_SSP(25) #endif // Frame Delay Time PICC to PCD (per 14443-3 Amendment 1) in ETU // 14 ETU == 132 µS == 448 SSP_CLK #ifndef ISO14B_TR2 -# define ISO14B_TR2 ETU_TO_SSP(14) +# define ISO14B_TR2 HF14_ETU_TO_SSP(14) #endif // 4sample @@ -440,7 +448,7 @@ static void Uart14bInit(uint8_t *data) { // param timeout accepts ETU static void iso14b_set_timeout(uint32_t timeout_etu) { - uint32_t ssp = ETU_TO_SSP(timeout_etu); + uint32_t ssp = HF14_ETU_TO_SSP(timeout_etu); if (ssp > MAX_14B_TIMEOUT) ssp = MAX_14B_TIMEOUT; @@ -701,7 +709,7 @@ static void TransmitFor14443b_AsTag(const uint8_t *response, uint16_t len) { // Main loop of simulated tag: receive commands from reader, decide what // response to send, and send it. //----------------------------------------------------------------------------- -void SimulateIso14443bTag(uint8_t *pupi) { +void SimulateIso14443bTag(const uint8_t *pupi) { LED_A_ON(); // the only commands we understand is WUPB, AFI=0, Select All, N=1: @@ -1381,7 +1389,7 @@ static int Get14443bAnswerFromTag(uint8_t *response, uint16_t max_len, uint32_t } if (Demod.len > 0) { - uint32_t sof_time = *eof_time - ETU_TO_SSP( + uint32_t sof_time = *eof_time - HF14_ETU_TO_SSP( (Demod.len * (8 + 2)) // time for byte transfers // + (10) // time for TR1 + (10 + 2) // time for SOF transfer @@ -1399,8 +1407,11 @@ static void TransmitFor14443b_AsReader(uint32_t *start_time) { tosend_t *ts = get_tosend(); +#ifdef RDV4 + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4); +#else FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SEND_SHALLOW_MOD); - +#endif // TR2 minimum 14 ETUs if (*start_time < ISO14B_TR0) { @@ -1544,7 +1555,7 @@ static void CodeAndTransmit14443bAsReader(const uint8_t *cmd, int len, uint32_t // eof_time in ssp clocks, but bits was added here! // *eof_time = *start_time + (10 * ts->max) + 10 + 2 + 10; - *eof_time = *start_time + ETU_TO_SSP(8 * ts->max); + *eof_time = *start_time + HF14_ETU_TO_SSP(8 * ts->max); LogTrace(cmd, len, *start_time, *eof_time, NULL, true); } @@ -1579,6 +1590,12 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void CodeAndTransmit14443bAsReader(real_cmd, msg_len + 3, &start_time, &eof_time, true); eof_time += DELAY_ISO14443B_PCD_TO_PICC_READER; + +// Activation frame waiting time +// 65536/fc == 4833 µS +// SSP_CLK = 4833 µS * 3.39 = 16384 + + int len = Get14443bAnswerFromTag(rxdata, rxmaxlen, iso14b_timeout, &eof_time); FpgaDisableTracing(); @@ -1836,7 +1853,7 @@ int iso14443b_select_xrx_card(iso14b_card_select_t *card) { int slot; for (slot = 0; slot < 4; slot++) { - start_time = eof_time + ETU_TO_SSP(30); //(24); // next slot after 24 ETU + start_time = eof_time + HF14_ETU_TO_SSP(30); //(24); // next slot after 24 ETU retlen = Get14443bAnswerFromTag(x_atqb, sizeof(x_atqb), iso14b_timeout, &eof_time); @@ -2076,7 +2093,6 @@ void iso14443b_setup(void) { // allocate command receive buffer BigBuf_free(); - BigBuf_Clear_ext(false); // Initialize Demod and Uart structs Demod14bInit(BigBuf_malloc(MAX_FRAME_SIZE), MAX_FRAME_SIZE); @@ -2089,7 +2105,12 @@ void iso14443b_setup(void) { FpgaSetupSsc(FPGA_MAJOR_MODE_HF_READER); // Signal field is on with the appropriate LED +#ifdef RDV4 + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4); +#else FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SEND_SHALLOW_MOD); +#endif + SpinDelay(100); // Start the timer @@ -2395,6 +2416,7 @@ void SendRawCommand14443B_Ex(iso14b_raw_cmd_t *p) { if ((p->flags & ISO14B_CLEARTRACE) == ISO14B_CLEARTRACE) { clear_trace(); + BigBuf_Clear_ext(false); } set_tracing(true); diff --git a/armsrc/iso14443b.h b/armsrc/iso14443b.h index 2579e6f1c..afa21e9d1 100644 --- a/armsrc/iso14443b.h +++ b/armsrc/iso14443b.h @@ -41,7 +41,7 @@ int iso14443b_select_card(iso14b_card_select_t *card); int iso14443b_select_card_srx(iso14b_card_select_t *card); int iso14443b_select_xrx_card(iso14b_card_select_t *card); -void SimulateIso14443bTag(uint8_t *pupi); +void SimulateIso14443bTag(const uint8_t *pupi); void AcquireRawAdcSamplesIso14443b(uint32_t parameter); void ReadSTBlock(uint8_t blocknr); void SniffIso14443b(void); diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index a52b953ff..54aaa16bd 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -294,7 +294,12 @@ void CodeIso15693AsTag(const uint8_t *cmd, size_t len) { // Transmit the command (to the tag) that was placed in cmd[]. void TransmitTo15693Tag(const uint8_t *cmd, int len, uint32_t *start_time, bool shallow_mod) { +#ifdef RDV4 + FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | (shallow_mod ? FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4 : FPGA_HF_READER_MODE_SEND_FULL_MOD)); +#else FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | (shallow_mod ? FPGA_HF_READER_MODE_SEND_SHALLOW_MOD : FPGA_HF_READER_MODE_SEND_FULL_MOD)); +#endif + if (*start_time < DELAY_ARM_TO_TAG) { *start_time = DELAY_ARM_TO_TAG; @@ -2119,7 +2124,6 @@ void Iso15693InitTag(void) { StartCountSspClk(); } - void EmlClearIso15693(void) { // Resetting the bitstream also frees the BigBuf memory, so we do this here to prevent // an inconvenient reset in the future by Iso15693InitTag @@ -2128,16 +2132,6 @@ void EmlClearIso15693(void) { reply_ng(CMD_HF_ISO15693_EML_CLEAR, PM3_SUCCESS, NULL, 0); } -void EmlSetMemIso15693(uint8_t count, uint8_t *data, uint32_t offset) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - memcpy(emCARD + offset, data, count); -} - -void EmlGetMemIso15693(uint8_t count, uint8_t *output, uint32_t offset) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - memcpy(output, emCARD + offset, count); -} - // Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands // all demodulation performed in arm rather than host. - greg void SimTagIso15693(uint8_t *uid, uint8_t block_size) { @@ -2296,8 +2290,11 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { } // Block data if (block_size * (block_idx + j + 1) <= CARD_MEMORY_SIZE) { - EmlGetMemIso15693(block_size, resp_readblock + (work_offset + security_offset), - block_size * (block_idx + j)); + emlGet( + resp_readblock + (work_offset + security_offset), + block_size * (block_idx + j), + block_size + ); } else { memset(resp_readblock + work_offset + security_offset, 0, block_size); } @@ -2334,7 +2331,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { uint8_t *data = cmd + 3 + address_offset + multi_offset; // write data - EmlSetMemIso15693(block_count * block_size, data, block_idx * block_size); + emlSet(data, (block_idx * block_size), (block_count * block_size)); // Build WRITE_(MULTI_)BLOCK response int response_length = 3; @@ -2664,7 +2661,7 @@ void SetTag15693Uid(const uint8_t *uid) { switch_off(); } -static void init_password_15693_Slix(uint8_t *buffer, uint8_t *pwd, const uint8_t *rnd) { +static void init_password_15693_Slix(uint8_t *buffer, const uint8_t *pwd, const uint8_t *rnd) { memcpy(buffer, pwd, 4); if (rnd) { buffer[0] ^= rnd[0]; @@ -2692,7 +2689,7 @@ static bool get_rnd_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t return true; } -static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, uint8_t *password) { +static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, const uint8_t *password) { uint8_t rnd[2]; if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { @@ -2714,7 +2711,7 @@ static uint32_t disable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_ti return PM3_SUCCESS; } -static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, uint8_t *password, uint8_t *uid) { +static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, const uint8_t *password, uint8_t *uid) { uint8_t rnd[2]; @@ -2741,7 +2738,7 @@ static uint32_t set_pass_15693_Slix(uint32_t start_time, uint32_t *eof_time, uin return PM3_SUCCESS; } -static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password) { +static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password) { uint8_t rnd[2]; if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { return PM3_ETIMEOUT; @@ -2762,7 +2759,7 @@ static uint32_t set_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, return PM3_SUCCESS; } -static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd) { +static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd) { uint8_t uid[8]; get_uid_slix(start_time, eof_time, uid); @@ -2796,7 +2793,7 @@ static uint32_t disable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, } -static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd) { +static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd) { uint8_t uid[8]; get_uid_slix(start_time, eof_time, uid); @@ -2828,7 +2825,7 @@ static uint32_t enable_eas_15693_Slix(uint32_t start_time, uint32_t *eof_time, u return PM3_SUCCESS; } -static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pwd_id, uint8_t *password, uint8_t *uid) { +static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t pwd_id, const uint8_t *password, uint8_t *uid) { uint8_t new_pwd_cmd[] = { (ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS), ISO15693_WRITE_PASSWORD, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, pwd_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; @@ -2849,7 +2846,7 @@ static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_tim return PM3_SUCCESS; } -static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eof_time, bool set_option_flag, uint8_t *password) { +static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eof_time, bool set_option_flag, const uint8_t *password) { uint8_t flags; @@ -2888,7 +2885,7 @@ static uint32_t pass_protect_EASAFI_15693_Slix(uint32_t start_time, uint32_t *eo return PM3_SUCCESS; } -static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi) { +static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, const uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi) { if (!use_uid) { int res_getuid = get_uid_slix(start_time, eof_time, uid); @@ -2925,7 +2922,7 @@ static uint32_t write_afi_15693(uint32_t start_time, uint32_t *eof_time, uint8_t } /* -static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { +static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, const uint8_t *password) { uint8_t rnd[2]; if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { return PM3_ETIMEOUT; @@ -2946,7 +2943,7 @@ static uint32_t enable_privacy_15693_Slix(uint32_t start_time, uint32_t *eof_tim return PM3_SUCCESS; } -static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { +static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, const uint8_t *password) { uint8_t rnd[2]; if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { return PM3_ETIMEOUT; @@ -2969,7 +2966,7 @@ static uint32_t write_password_15693_Slix(uint32_t start_time, uint32_t *eof_tim return PM3_SUCCESS; } -static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t *password) { +static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, const uint8_t *password) { uint8_t rnd[2]; if (get_rnd_15693_Slix(start_time, eof_time, rnd) == false) { @@ -2993,7 +2990,7 @@ static uint32_t destroy_15693_Slix(uint32_t start_time, uint32_t *eof_time, uint */ -void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uint8_t pwd_id) { +void WritePasswordSlixIso15693(const uint8_t *old_password, const uint8_t *new_password, uint8_t pwd_id) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3018,7 +3015,7 @@ void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uin } -void DisablePrivacySlixIso15693(uint8_t *password) { +void DisablePrivacySlixIso15693(const uint8_t *password) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3033,7 +3030,7 @@ void DisablePrivacySlixIso15693(uint8_t *password) { switch_off(); } -void EnablePrivacySlixIso15693(uint8_t *password) { +void EnablePrivacySlixIso15693(const uint8_t *password) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3049,7 +3046,7 @@ void EnablePrivacySlixIso15693(uint8_t *password) { } -void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { +void DisableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3067,7 +3064,7 @@ void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { switch_off(); } -void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { +void EnableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3082,7 +3079,7 @@ void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd) { switch_off(); } -void PassProtextEASSlixIso15693(uint8_t *password) { +void PassProtextEASSlixIso15693(const uint8_t *password) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3091,7 +3088,7 @@ void PassProtextEASSlixIso15693(uint8_t *password) { reply_ng(CMD_HF_ISO15693_SLIX_PASS_PROTECT_EAS, res, NULL, 0); switch_off(); } -void PassProtectAFISlixIso15693(uint8_t *password) { +void PassProtectAFISlixIso15693(const uint8_t *password) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); @@ -3101,7 +3098,7 @@ void PassProtectAFISlixIso15693(uint8_t *password) { switch_off(); } -void WriteAFIIso15693(uint8_t *password, bool use_pwd, uint8_t *uid, bool use_uid, uint8_t afi) { +void WriteAFIIso15693(const uint8_t *password, bool use_pwd, uint8_t *uid, bool use_uid, uint8_t afi) { LED_D_ON(); Iso15693InitReader(); StartCountSspClk(); diff --git a/armsrc/iso15693.h b/armsrc/iso15693.h index b087edd2e..8a9e2fe82 100644 --- a/armsrc/iso15693.h +++ b/armsrc/iso15693.h @@ -47,8 +47,6 @@ int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeo void AcquireRawAdcSamplesIso15693(void); void ReaderIso15693(iso15_card_select_t *p_card); // ISO15693 reader void EmlClearIso15693(void); -void EmlSetMemIso15693(uint8_t count, uint8_t *data, uint32_t offset); -void EmlGetMemIso15693(uint8_t count, uint8_t *output, uint32_t offset); void SimTagIso15693(uint8_t *uid, uint8_t block_size); // simulate an ISO15693 tag void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI @@ -62,12 +60,12 @@ int SendDataTagEOF(uint8_t *recv, uint16_t max_recv_len, uint32_t start_time, ui void SetTag15693Uid(const uint8_t *uid); -void WritePasswordSlixIso15693(uint8_t *old_password, uint8_t *new_password, uint8_t pwd_id); -void DisablePrivacySlixIso15693(uint8_t *password); -void EnablePrivacySlixIso15693(uint8_t *password); -void DisableEAS_AFISlixIso15693(uint8_t *password, bool usepwd); -void EnableEAS_AFISlixIso15693(uint8_t *password, bool usepwd); -void PassProtextEASSlixIso15693(uint8_t *password); -void PassProtectAFISlixIso15693(uint8_t *password); -void WriteAFIIso15693(uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi); +void WritePasswordSlixIso15693(const uint8_t *old_password, const uint8_t *new_password, uint8_t pwd_id); +void DisablePrivacySlixIso15693(const uint8_t *password); +void EnablePrivacySlixIso15693(const uint8_t *password); +void DisableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd); +void EnableEAS_AFISlixIso15693(const uint8_t *password, bool usepwd); +void PassProtextEASSlixIso15693(const uint8_t *password); +void PassProtectAFISlixIso15693(const uint8_t *password); +void WriteAFIIso15693(const uint8_t *password, bool usepwd, uint8_t *uid, bool use_uid, uint8_t afi); #endif diff --git a/armsrc/ldscript b/armsrc/ldscript index 1dd09e937..0824205a2 100644 --- a/armsrc/ldscript +++ b/armsrc/ldscript @@ -53,7 +53,7 @@ SECTIONS .bss : { __bss_start__ = .; *(.bss) - *(.bss.*) + *(.bss.*) . = ALIGN(4); __bss_end__ = .; } >ram AT>ram :bss diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index c6af0dace..42d511875 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -528,7 +528,7 @@ OUT: StopTicks(); } -void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data) { +void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, const uint8_t *data) { // configure ARM and FPGA init_reader(); diff --git a/armsrc/legicrf.h b/armsrc/legicrf.h index 670688aab..02f20b536 100644 --- a/armsrc/legicrf.h +++ b/armsrc/legicrf.h @@ -25,7 +25,7 @@ void LegicRfInfo(void); int LegicRfReaderEx(uint16_t offset, uint16_t len, uint8_t iv); void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv); -void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data); +void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, const uint8_t *data); legic_card_select_t *getLegicCardInfo(void); #endif /* __LEGICRF_H */ diff --git a/armsrc/legicrfsim.c b/armsrc/legicrfsim.c index 58ca40320..1f6accf4a 100644 --- a/armsrc/legicrfsim.c +++ b/armsrc/legicrfsim.c @@ -91,18 +91,18 @@ static bool wait_for(bool value, const uint32_t timeout) { // - A bit length >80.2us is a 1 // - A bit length <80.2us is a 0 // - A bit length >148.6us is a code violation -static int8_t rx_bit(void) { +static int32_t rx_bit(void) { // backup ts for threshold calculation uint32_t bit_start = last_frame_end; // wait for pause to end - if (!wait_for(RWD_PULSE, bit_start + RWD_TIME_1 * 3 / 2)) { - return -1; + if (wait_for(RWD_PULSE, bit_start + RWD_TIME_1 * 3 / 2) == false) { + return PM3_ERFTRANS; } // wait for next pause - if (!wait_for(RWD_PAUSE, bit_start + RWD_TIME_1 * 3 / 2)) { - return -1; + if (wait_for(RWD_PAUSE, bit_start + RWD_TIME_1 * 3 / 2) == false) { + return PM3_ERFTRANS; } // update bit and frame end @@ -110,7 +110,7 @@ static int8_t rx_bit(void) { // check for code violation (bit to short) if (last_frame_end - bit_start < RWD_TIME_PAUSE) { - return -1; + return PM3_ERFTRANS; } // apply threshold (average of RWD_TIME_0 and ) @@ -215,7 +215,6 @@ static void tx_ack(void) { // - receive the frame // - detect end of frame (last pause) static int32_t rx_frame(uint8_t *len) { - int32_t frame = 0; // add 2 SSP clock cycles (1 for tx and 1 for rx pipeline delay) // those will be subtracted at the end of the rx phase @@ -235,23 +234,24 @@ static int32_t rx_frame(uint8_t *len) { // check for code violation if (i > RWD_CMD_TIMEOUT) { - return -1; + return PM3_ETIMEOUT; } } // backup ts for trace log uint32_t last_frame_start = last_frame_end; + int32_t frame = 0; // receive frame for (*len = 0; true; ++(*len)) { // receive next bit LED_B_ON(); - int8_t bit = rx_bit(); + int32_t bit = rx_bit(); LED_B_OFF(); // check for code violation and to short / long frame if ((bit < 0) && ((*len < RWD_MIN_FRAME_LEN) || (*len > RWD_MAX_FRAME_LEN))) { - return -1; + return PM3_ERFTRANS; } // check for code violation caused by end of frame @@ -353,7 +353,7 @@ static int32_t setup_phase(legic_card_select_t *p_card) { // wait for iv int32_t iv = rx_frame(&len); if ((len != 7) || (iv < 0)) { - return -1; + return PM3_ETIMEOUT; } // configure prng @@ -375,19 +375,19 @@ static int32_t setup_phase(legic_card_select_t *p_card) { // wait for ack int32_t ack = rx_frame(&len); if ((len != 6) || (ack < 0)) { - return -1; + return PM3_ETIMEOUT; } // validate data switch (p_card->tagtype) { case 0: - if (ack != 0x19) return -1; + if (ack != 0x19) return PM3_ERFTRANS; break; case 1: - if (ack != 0x39) return -1; + if (ack != 0x39) return PM3_ERFTRANS; break; case 2: - if (ack != 0x39) return -1; + if (ack != 0x39) return PM3_ERFTRANS; break; } @@ -399,7 +399,7 @@ static int32_t setup_phase(legic_card_select_t *p_card) { // the gap by one period. last_frame_end += TAG_BIT_PERIOD; - return 0; + return PM3_SUCCESS; } static uint8_t calc_crc4(uint16_t cmd, uint8_t cmd_sz, uint8_t value) { @@ -414,7 +414,7 @@ static int32_t connected_phase(legic_card_select_t *p_card) { // wait for command int32_t cmd = rx_frame(&len); if (cmd < 0) { - return -1; + return PM3_ETIMEOUT; } // check if command is LEGIC_READ @@ -425,8 +425,7 @@ static int32_t connected_phase(legic_card_select_t *p_card) { // transmit data tx_frame((crc << 8) | byte, 12); - - return 0; + return PM3_SUCCESS; } // check if command is LEGIC_WRITE @@ -441,7 +440,7 @@ static int32_t connected_phase(legic_card_select_t *p_card) { uint8_t calc_crc = calc_crc4(addr << 1, p_card->cmdsize, byte); if (calc_crc != crc) { Dbprintf("!!! crc mismatch: %x != %x !!!", calc_crc, crc); - return -1; + return PM3_ECRC; } // store data @@ -449,11 +448,10 @@ static int32_t connected_phase(legic_card_select_t *p_card) { // transmit ack tx_ack(); - - return 0; + return PM3_SUCCESS; } - return -1; + return PM3_ERFTRANS; } //----------------------------------------------------------------------------- @@ -466,26 +464,26 @@ void LegicRfSimulate(uint8_t tagtype, bool send_reply) { // configure ARM and FPGA init_tag(); - int res = PM3_SUCCESS; + int res = init_card(tagtype, &card); // verify command line input - if (init_card(tagtype, &card) != PM3_SUCCESS) { + if (res != PM3_SUCCESS) { DbpString("Unknown tagtype to simulate"); - res = PM3_ESOFT; goto OUT; } - uint16_t counter = 0; LED_A_ON(); - Dbprintf("Legic Prime, simulating uid: %02X%02X%02X%02X", legic_mem[0], legic_mem[1], legic_mem[2], legic_mem[3]); + Dbprintf("Legic Prime, simulating MCD... " _YELLOW_("%02X") " MSN... " _YELLOW_("%02X%02X%02X"), legic_mem[0], legic_mem[1], legic_mem[2], legic_mem[3]); + uint16_t counter = 0; while (BUTTON_PRESS() == false) { + WDT_HIT(); if (counter >= 2000) { if (data_available()) { res = PM3_EOPABORTED; - break; + goto OUT; } counter = 0; } @@ -497,12 +495,12 @@ void LegicRfSimulate(uint8_t tagtype, bool send_reply) { } // wait for connection, restart on error - if (setup_phase(&card)) { + if (setup_phase(&card) != PM3_SUCCESS) { continue; } // connection is established, process commands until one fails - while (connected_phase(&card) == false) { + while (connected_phase(&card) == PM3_SUCCESS) { WDT_HIT(); } } @@ -510,17 +508,19 @@ void LegicRfSimulate(uint8_t tagtype, bool send_reply) { OUT: if (g_dbglevel >= DBG_ERROR) { - Dbprintf("Emulator stopped. Tracing: %d trace length: %d ", get_tracing(), BigBuf_get_traceLen()); + Dbprintf("Emulator stopped. Trace length... " _YELLOW_("%d"), BigBuf_get_traceLen()); } - if (res == PM3_EOPABORTED) - DbpString("aborted by user"); + if (res == PM3_EOPABORTED) { + DbpString("Aborted by user"); + } switch_off(); StopTicks(); - if (send_reply) + if (send_reply) { reply_ng(CMD_HF_LEGIC_SIMULATE, res, NULL, 0); + } BigBuf_free_keep_EM(); } diff --git a/armsrc/lfops.c b/armsrc/lfops.c index c130d78e8..ed2a29378 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -287,7 +287,7 @@ void printT55xxConfig(void) { DbpString(""); } -void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c) { +void setT55xxConfig(uint8_t arg0, const t55xx_configurations_t *c) { for (uint8_t i = 0; i < 4; i++) { if (c->m[i].start_gap != 0) T55xx_Timing.m[i].start_gap = c->m[i].start_gap; @@ -1009,7 +1009,7 @@ void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool // prepare a waveform pattern in the buffer based on the ID given then // simulate a FSK tag until the button is pressed // arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock -void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, uint8_t *bits, bool ledcontrol, int numcycles) { +void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, const uint8_t *bits, bool ledcontrol, int numcycles) { FpgaDownloadAndGo(FPGA_BITSTREAM_LF); @@ -1045,7 +1045,7 @@ void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t cl // prepare a waveform pattern in the buffer based on the ID given then // simulate a FSK tag until the button is pressed // arg1 contains fcHigh and fcLow, arg2 contains STT marker and clock -void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, uint8_t *bits, bool ledcontrol) { +void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, const uint8_t *bits, bool ledcontrol) { CmdFSKsimTAGEx(fchigh, fclow, separator, clk, bitslen, bits, ledcontrol, -1); reply_ng(CMD_LF_FSK_SIMULATE, PM3_EOPABORTED, NULL, 0); } @@ -1866,9 +1866,9 @@ void T55xxResetRead(uint8_t flags, bool ledcontrol) { if (ledcontrol) LED_A_OFF(); } -void T55xxDangerousRawTest(uint8_t *data, bool ledcontrol) { +void T55xxDangerousRawTest(const uint8_t *data, bool ledcontrol) { // supports only default downlink mode - t55xx_test_block_t *c = (t55xx_test_block_t *)data; + const t55xx_test_block_t *c = (const t55xx_test_block_t *)data; uint8_t start_wait = 4; uint8_t bs[128 / 8]; @@ -2320,7 +2320,7 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, boo } // clone viking tag to T55xx -void CopyVikingtoT55xx(uint8_t *blocks, bool q5, bool em, bool ledcontrol) { +void CopyVikingtoT55xx(const uint8_t *blocks, bool q5, bool em, bool ledcontrol) { uint32_t data[] = {T55x7_BITRATE_RF_32 | T55x7_MODULATION_MANCHESTER | (2 << T55x7_MAXBLOCK_SHIFT), 0, 0}; if (q5) { diff --git a/armsrc/lfops.h b/armsrc/lfops.h index f1bc88b64..755afa88f 100644 --- a/armsrc/lfops.h +++ b/armsrc/lfops.h @@ -38,9 +38,9 @@ void CmdHIDsimTAGEx(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, boo void CmdHIDsimTAG(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool ledcontrol); void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, - uint8_t *bits, bool ledcontrol, int numcycles); + const uint8_t *bits, bool ledcontrol, int numcycles); void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, uint16_t bitslen, - uint8_t *bits, bool ledcontrol); + const uint8_t *bits, bool ledcontrol); void CmdASKsimTAG(uint8_t encoding, uint8_t invert, uint8_t separator, uint8_t clk, uint16_t size, const uint8_t *bits, bool ledcontrol); void CmdPSKsimTAG(uint8_t carrier, uint8_t invert, uint8_t clk, uint16_t size, @@ -54,7 +54,7 @@ int lf_em410x_watch(int findone, uint32_t *high, uint64_t *low, bool ledcontrol) int lf_io_watch(int findone, uint32_t *high, uint32_t *low, bool ledcontrol); void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT, bool q5, bool em, bool ledcontrol); // Clone an HID card to T5557/T5567 -void CopyVikingtoT55xx(uint8_t *blocks, bool q5, bool em, bool ledcontrol); +void CopyVikingtoT55xx(const uint8_t *blocks, bool q5, bool em, bool ledcontrol); int copy_em410x_to_t55xx(uint8_t card, uint8_t clock, uint32_t id_hi, uint32_t id_lo, bool ledcontrol); @@ -66,7 +66,7 @@ void T55xxReadBlock(uint8_t page, bool pwd_mode, bool brute_mem, uint8_t block, uint8_t downlink_mode, bool ledcontrol); void T55xxWakeUp(uint32_t pwd, uint8_t flags, bool ledcontrol); void T55xx_ChkPwds(uint8_t flags, bool ledcontrol); -void T55xxDangerousRawTest(uint8_t *data, bool ledcontrol); +void T55xxDangerousRawTest(const uint8_t *data, bool ledcontrol); void turn_read_lf_on(uint32_t delay); void turn_read_lf_off(uint32_t delay); @@ -78,7 +78,7 @@ void EM4xWriteWord(uint8_t addr, uint32_t data, uint32_t pwd, uint8_t usepwd, bo void EM4xProtectWord(uint32_t data, uint32_t pwd, uint8_t usepwd, bool ledcontrol); void Cotag(uint32_t arg0, bool ledcontrol); -void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c); +void setT55xxConfig(uint8_t arg0, const t55xx_configurations_t *c); t55xx_configurations_t *getT55xxConfig(void); void printT55xxConfig(void); void loadT55xxConfig(void); diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index a56e013ee..6c131e7f3 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -94,7 +94,7 @@ void setDefaultSamplingConfig(void) { * @brief setSamplingConfig * @param sc */ -void setSamplingConfig(sample_config *sc) { +void setSamplingConfig(const sample_config *sc) { // decimation (1-8) how many bits of adc sample value to save if (sc->decimation > 0 && sc->decimation < 9) diff --git a/armsrc/lfsampling.h b/armsrc/lfsampling.h index 11c03ca74..8a8e40868 100644 --- a/armsrc/lfsampling.h +++ b/armsrc/lfsampling.h @@ -110,7 +110,7 @@ void LFSetupFPGAForADC(int divisor, bool reader_field); * @brief setSamplingConfig * @param sc */ -void setSamplingConfig(sample_config *sc); +void setSamplingConfig(const sample_config *sc); void setDefaultSamplingConfig(void); sample_config *getSamplingConfig(void); diff --git a/armsrc/lfzx.c b/armsrc/lfzx.c index be09247ca..f086c2d71 100644 --- a/armsrc/lfzx.c +++ b/armsrc/lfzx.c @@ -115,7 +115,7 @@ static void zx8211_setup_read(void) { WDT_HIT(); } -static void zx_send(uint8_t *cmd, uint8_t clen) { +static void zx_send(const uint8_t *cmd, uint8_t clen) { if (clen == 0) return; diff --git a/armsrc/mifarecmd.c b/armsrc/mifarecmd.c index 145527a7e..32e90d56a 100644 --- a/armsrc/mifarecmd.c +++ b/armsrc/mifarecmd.c @@ -73,10 +73,11 @@ int16_t mifare_cmd_readblocks(uint8_t key_auth_cmd, uint8_t *key, uint8_t read_c struct Crypto1State *pcs = &mpcs; iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN); - clear_trace(); set_tracing(true); + uint32_t timeout = iso14a_get_timeout(); + LED_A_ON(); LED_B_OFF(); LED_C_OFF(); @@ -95,6 +96,10 @@ int16_t mifare_cmd_readblocks(uint8_t key_auth_cmd, uint8_t *key, uint8_t read_c goto OUT; }; + // frame waiting time (FWT) in 1/fc + uint32_t fwt = 256 * 16 * (1 << 7); + iso14a_set_timeout(fwt / (8 * 16)); + for (uint8_t i = 0; i < count; i++) { if (mifare_classic_readblock_ex(pcs, block_no + i, block_data + (i * 16), read_cmd)) { if (g_dbglevel >= DBG_ERROR) Dbprintf("Read block error"); @@ -112,11 +117,11 @@ int16_t mifare_cmd_readblocks(uint8_t key_auth_cmd, uint8_t *key, uint8_t read_c OUT: crypto1_deinit(pcs); + iso14a_set_timeout(timeout); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); set_tracing(false); BigBuf_free(); - return retval; } @@ -145,7 +150,7 @@ int16_t mifare_cmd_writeblocks(uint8_t key_auth_cmd, uint8_t *key, uint8_t write LED_B_OFF(); LED_C_OFF(); - uint8_t retval = PM3_SUCCESS; + int retval = PM3_SUCCESS; if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) { if (g_dbglevel >= DBG_ERROR) Dbprintf("Can't select card"); @@ -1805,8 +1810,8 @@ OUT: emlSetMem_xt(block, blockno, 1, sizeof(block)); } - MifareECardLoad(sectorcnt, 0); - MifareECardLoad(sectorcnt, 1); + MifareECardLoad(sectorcnt, MF_KEY_A); + MifareECardLoad(sectorcnt, MF_KEY_B); } } else { // partial/none keys found @@ -2014,15 +2019,6 @@ void MifareEMemClr(void) { emlClearMem(); } -void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain) { - FpgaDownloadAndGo(FPGA_BITSTREAM_HF); - - if (blockwidth == 0) - blockwidth = 16; // backwards compat... default bytewidth - - emlSetMem_xt(datain, blockno, blockcnt, blockwidth); // data, block num, blocks count, block byte width -} - void MifareEMemGet(uint8_t blockno, uint8_t blockcnt) { FpgaDownloadAndGo(FPGA_BITSTREAM_HF); @@ -2072,12 +2068,34 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) { int retval = PM3_SUCCESS; + // increase time-out. Magic card etc are slow + uint32_t timeout = iso14a_get_timeout(); + // frame waiting time (FWT) in 1/fc + uint32_t fwt = 256 * 16 * (1 << 6); + iso14a_set_timeout(fwt / (8 * 16)); + for (uint8_t s = 0; s < sectorcnt; s++) { + uint64_t ui64Key = emlGetKey(s, keytype); - // MFC 1K EV1 sector 16,17 don't use key A. - if ((sectorcnt == 18) && (keytype == 0) && s > 15) { - continue; + if (sectorcnt == 18) { + // MFC 1K EV1, skip sector 16 since its lockdown + if (s == 16) { + // unknown sector trailer, keep the keys, set only the AC + uint8_t st[16] = {0x00}; + emlGetMem(st, FirstBlockOfSector(s) + 3, 1); + memcpy(st + 6, "\x70\xF0\xF8\x69", 4); + emlSetMem_xt(st, FirstBlockOfSector(s) + 3, 1, 16); + continue; + } + + // ICEMAN: ugly hack, we don't want to trigger the partial load message + // MFC 1K EV1 sector 17 don't use key A. + // not mention we don't save signatures in our MFC dump files. + if (s == 17 && keytype == 0) { + ui64Key = 0x4B791BEA7BCC; + keytype = 1; + } } // use fast select @@ -2110,43 +2128,56 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) { // Auth if (mifare_classic_auth(pcs, cuid, FirstBlockOfSector(s), keytype, ui64Key, AUTH_FIRST)) { retval = PM3_EPARTIAL; - if (g_dbglevel > DBG_ERROR) { + if (g_dbglevel >= DBG_ERROR) { Dbprintf("Sector %2d - Auth error", s); } continue; } + #define MAX_RETRIES 2 uint8_t data[16] = {0x00}; for (uint8_t b = 0; b < NumBlocksPerSector(s); b++) { memset(data, 0x00, sizeof(data)); + uint8_t tb = FirstBlockOfSector(s) + b; + uint8_t r = 0; + for (; r < MAX_RETRIES; r++) { - for (uint8_t r = 0; r < MAX_RETRIES; r++) { - - if (mifare_classic_readblock(pcs, FirstBlockOfSector(s) + b, data)) { + int res = mifare_classic_readblock(pcs, tb, data); + if (res == 1) { retval |= PM3_EPARTIAL; - if (g_dbglevel > DBG_ERROR) { - Dbprintf("Error reading sector %2d block %2d", s, b); + if (g_dbglevel >= DBG_ERROR) { + Dbprintf("Error No rights reading sector %2d block %2d", s, b); } + break; + } + // retry if wrong len. + if (res != 0) { continue; } // No need to copy empty if (memcmp(data, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) == 0) { - continue; + break; } - if (b < NumBlocksPerSector(s) - 1) { - emlSetMem(data, FirstBlockOfSector(s) + b, 1); - } else { + if (IsSectorTrailer(b)) { // sector trailer, keep the keys, set only the AC uint8_t st[16] = {0x00}; - emlGetMem(st, FirstBlockOfSector(s) + b, 1); + emlGetMem(st, tb, 1); memcpy(st + 6, data + 6, 4); - emlSetMem(st, FirstBlockOfSector(s) + b, 1); + emlSetMem_xt(st, tb, 1, 16); + } else { + emlSetMem_xt(data, tb, 1, 16); } + break; + } + + // if we failed all retries, notify client + if (r == MAX_RETRIES) { + retval |= PM3_EPARTIAL; } } } @@ -2154,6 +2185,7 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype) { int res = mifare_classic_halt(pcs); (void)res; + iso14a_set_timeout(timeout); crypto1_deinit(pcs); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); @@ -2322,6 +2354,12 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) { set_tracing(true); } + // increase time-out. Magic card etc are slow + uint32_t timeout = iso14a_get_timeout(); + // frame waiting time (FWT) in 1/fc + uint32_t fwt = 256 * 16 * (1 << 7); + iso14a_set_timeout(fwt / (8 * 16)); + //loop doesn't loop just breaks out if error or done while (true) { if (workFlags & MAGIC_WUPC) { @@ -2343,7 +2381,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) { } // read block - if ((mifare_sendcmd_short(NULL, CRYPT_NONE, ISO14443A_CMD_READBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != 18)) { + if ((mifare_sendcmd_short(NULL, CRYPT_NONE, ISO14443A_CMD_READBLOCK, blockNo, receivedAnswer, receivedAnswerPar, NULL) != MAX_MIFARE_FRAME_SIZE)) { if (g_dbglevel >= DBG_ERROR) Dbprintf("read block send command error"); errormsg = 0; break; @@ -2371,6 +2409,8 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) { if (workFlags & MAGIC_OFF) OnSuccessMagic(); + + iso14a_set_timeout(timeout); } void MifareCIdent(bool is_mfc) { diff --git a/armsrc/mifarecmd.h b/armsrc/mifarecmd.h index b7f7d6379..52bc37f35 100644 --- a/armsrc/mifarecmd.h +++ b/armsrc/mifarecmd.h @@ -40,7 +40,6 @@ void MifareChkKeys_fast(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *da void MifareChkKeys_file(uint8_t *fn); void MifareEMemClr(void); -void MifareEMemSet(uint8_t blockno, uint8_t blockcnt, uint8_t blockwidth, uint8_t *datain); void MifareEMemGet(uint8_t blockno, uint8_t blockcnt); int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype); int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype); diff --git a/armsrc/mifaresim.c b/armsrc/mifaresim.c index 5aa1a054a..eddb59dc0 100644 --- a/armsrc/mifaresim.c +++ b/armsrc/mifaresim.c @@ -523,7 +523,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1 uint8_t rAUTH_NT_keystream[4]; uint32_t nonce = 0; - tUart14a *uart = GetUart14a(); + const tUart14a *uart = GetUart14a(); // free eventually allocated BigBuf memory but keep Emulator Memory BigBuf_free_keep_EM(); @@ -1272,7 +1272,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1 memcpy(receivedCmd_dec, response, 16); // don't change anything } } - emlSetMem(receivedCmd_dec, cardWRBL, 1); + emlSetMem_xt(receivedCmd_dec, cardWRBL, 1, 16); EmSend4bit(mf_crypto1_encrypt4bit(pcs, CARD_ACK)); // always ACK? FpgaDisableTracing(); diff --git a/armsrc/mifareutil.c b/armsrc/mifareutil.c index 5dfbfd26b..415c01183 100644 --- a/armsrc/mifareutil.c +++ b/armsrc/mifareutil.c @@ -116,7 +116,9 @@ uint16_t mifare_sendcmd_short(struct Crypto1State *pcs, uint8_t crypted, uint8_t uint16_t len = ReaderReceive(answer, par); - if (answer_parity) *answer_parity = par[0]; + if (answer_parity) { + *answer_parity = par[0]; + } if (pcs && (crypted == CRYPT_ALL)) { if (len == 1) { @@ -127,8 +129,9 @@ uint16_t mifare_sendcmd_short(struct Crypto1State *pcs, uint8_t crypted, uint8_t res |= (crypto1_bit(pcs, 0, 0) ^ BIT(answer[0], 3)) << 3; answer[0] = res; } else { - for (pos = 0; pos < len; pos++) + for (pos = 0; pos < len; pos++) { answer[pos] = crypto1_byte(pcs, 0x00, 0) ^ answer[pos]; + } } } return len; @@ -206,8 +209,8 @@ int mifare_classic_authex_cmd(struct Crypto1State *pcs, uint32_t uid, uint8_t bl uint32_t save_timeout = iso14a_get_timeout(); // set timeout for authentication response - if (save_timeout > 103) - iso14a_set_timeout(103); + if (save_timeout > 106) + iso14a_set_timeout(106); // Receive 4 byte tag answer len = ReaderReceive(receivedAnswer, receivedAnswerPar); @@ -238,11 +241,15 @@ int mifare_classic_readblock_ex(struct Crypto1State *pcs, uint8_t blockNo, uint8 uint16_t len = mifare_sendcmd_short(pcs, 1, iso_byte, blockNo, receivedAnswer, receivedAnswerPar, NULL); if (len == 1) { - if (g_dbglevel >= DBG_ERROR) Dbprintf("Cmd Error %02x", receivedAnswer[0]); + if (g_dbglevel >= DBG_ERROR) { + Dbprintf("Block " _YELLOW_("%3d") " Cmd 0x%02x Cmd Error %02x", blockNo, iso_byte, receivedAnswer[0]); + } return 1; } if (len != 18) { - if (g_dbglevel >= DBG_ERROR) Dbprintf("wrong response len %d (expected 18)", len); + if (g_dbglevel >= DBG_ERROR) { + Dbprintf("Block " _YELLOW_("%3d") " Cmd 0x%02x Wrong response len, expected 18 got " _RED_("%d"), blockNo, iso_byte, len); + } return 2; } @@ -610,32 +617,28 @@ uint8_t FirstBlockOfSector(uint8_t sectorNo) { return sectorNo * 4; else return 32 * 4 + (sectorNo - 32) * 16; - } // work with emulator memory -void emlSetMem(uint8_t *data, int blockNum, int blocksCount) { - emlSetMem_xt(data, blockNum, blocksCount, 16); -} - -void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - memcpy(emCARD + blockNum * blockBtWidth, data, blocksCount * blockBtWidth); +void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int block_width) { + uint32_t offset = blockNum * block_width; + uint32_t len = blocksCount * block_width; + emlSet(data, offset, len); } void emlGetMem(uint8_t *data, int blockNum, int blocksCount) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - memcpy(data, emCARD + blockNum * 16, blocksCount * 16); + uint8_t *mem = BigBuf_get_EM_addr(); + memcpy(data, mem + blockNum * 16, blocksCount * 16); } void emlGetMemBt(uint8_t *data, int offset, int byteCount) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - memcpy(data, emCARD + offset, byteCount); + uint8_t *mem = BigBuf_get_EM_addr(); + memcpy(data, mem + offset, byteCount); } int emlCheckValBl(int blockNum) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - uint8_t *data = emCARD + blockNum * 16; + uint8_t *mem = BigBuf_get_EM_addr(); + uint8_t *data = mem + blockNum * 16; if ((data[0] != (data[4] ^ 0xff)) || (data[0] != data[8]) || (data[1] != (data[5] ^ 0xff)) || (data[1] != data[9]) || @@ -649,8 +652,8 @@ int emlCheckValBl(int blockNum) { } int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - uint8_t *data = emCARD + blockNum * 16; + uint8_t *mem = BigBuf_get_EM_addr(); + uint8_t *data = mem + blockNum * 16; if (emlCheckValBl(blockNum)) return 1; @@ -661,8 +664,8 @@ int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) { } int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) { - uint8_t *emCARD = BigBuf_get_EM_addr(); - uint8_t *data = emCARD + blockNum * 16; + uint8_t *mem = BigBuf_get_EM_addr(); + uint8_t *data = mem + blockNum * 16; memcpy(data + 0, &blReg, 4); memcpy(data + 8, &blReg, 4); @@ -673,41 +676,43 @@ int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) { data[13] = blBlock ^ 0xff; data[14] = blBlock; data[15] = blBlock ^ 0xff; - return 0; } uint64_t emlGetKey(int sectorNum, int keyType) { uint8_t key[6] = {0x00}; - uint8_t *em = BigBuf_get_EM_addr(); - memcpy(key, em + 16 * (FirstBlockOfSector(sectorNum) + NumBlocksPerSector(sectorNum) - 1) + keyType * 10, 6); + uint8_t *mem = BigBuf_get_EM_addr(); + memcpy(key, mem + 16 * (FirstBlockOfSector(sectorNum) + NumBlocksPerSector(sectorNum) - 1) + keyType * 10, 6); return bytes_to_num(key, 6); } void emlClearMem(void) { const uint8_t trailer[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x80, 0x69, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; const uint8_t uid[] = {0xe6, 0x84, 0x87, 0xf3, 0x16, 0x88, 0x04, 0x00, 0x46, 0x8e, 0x45, 0x55, 0x4d, 0x70, 0x41, 0x04}; - uint8_t *emCARD = BigBuf_get_EM_addr(); - memset(emCARD, 0, CARD_MEMORY_SIZE); + uint8_t *mem = BigBuf_get_EM_addr(); + memset(mem, 0, CARD_MEMORY_SIZE); // fill sectors trailer data - for (uint16_t b = 3; b < MIFARE_4K_MAXBLOCK; ((b < MIFARE_2K_MAXBLOCK - 4) ? (b += 4) : (b += 16))) - emlSetMem((uint8_t *)trailer, b, 1); + for (uint16_t b = 3; b < MIFARE_4K_MAXBLOCK; ((b < MIFARE_2K_MAXBLOCK - 4) ? (b += 4) : (b += 16))) { + emlSetMem_xt((uint8_t *)trailer, b, 1, 16); + } // uid - emlSetMem((uint8_t *)uid, 0, 1); + emlSetMem_xt((uint8_t *)uid, 0, 1, 16); return; } uint8_t SectorTrailer(uint8_t blockNo) { if (blockNo <= MIFARE_2K_MAXBLOCK) { - if (g_dbglevel >= DBG_EXTENDED) + if (g_dbglevel >= DBG_EXTENDED) { Dbprintf("Sector Trailer for block %d : %d", blockNo, (blockNo | 0x03)); + } return (blockNo | 0x03); } else { - if (g_dbglevel >= DBG_EXTENDED) - Dbprintf("Sector Trailer for block %d : %d", blockNo, (blockNo | 0x0f)); - return (blockNo | 0x0f); + if (g_dbglevel >= DBG_EXTENDED) { + Dbprintf("Sector Trailer for block %d : %d", blockNo, (blockNo | 0x0F)); + } + return (blockNo | 0x0F); } } diff --git a/armsrc/mifareutil.h b/armsrc/mifareutil.h index 9a179a553..1e45d50be 100644 --- a/armsrc/mifareutil.h +++ b/armsrc/mifareutil.h @@ -113,8 +113,7 @@ uint8_t SectorTrailer(uint8_t blockNo); // emulator functions void emlClearMem(void); -void emlSetMem(uint8_t *data, int blockNum, int blocksCount); -void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth); +void emlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int block_width); void emlGetMem(uint8_t *data, int blockNum, int blocksCount); void emlGetMemBt(uint8_t *data, int offset, int byteCount); uint64_t emlGetKey(int sectorNum, int keyType); diff --git a/armsrc/spiffs.c b/armsrc/spiffs.c index e243b8ed1..3154bfc0f 100644 --- a/armsrc/spiffs.c +++ b/armsrc/spiffs.c @@ -196,17 +196,19 @@ int rdv40_spiffs_check(void) { ///// Base RDV40_SPIFFS_SAFETY_NORMAL operations//////////////////////////////// -void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size) { +void write_to_spiffs(const char *filename, const uint8_t *src, uint32_t size) { spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_CREAT | SPIFFS_TRUNC | SPIFFS_RDWR, 0); - if (SPIFFS_write(&fs, fd, src, size) < 0) { + // Note: SPIFFS_write() doesn't declare third parameter as const (but should) + if (SPIFFS_write(&fs, fd, (void *)src, size) < 0) { Dbprintf("wr errno %i\n", SPIFFS_errno(&fs)); } SPIFFS_close(&fs, fd); } -void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size) { +void append_to_spiffs(const char *filename, const uint8_t *src, uint32_t size) { spiffs_file fd = SPIFFS_open(&fs, filename, SPIFFS_APPEND | SPIFFS_RDWR, 0); - if (SPIFFS_write(&fs, fd, src, size) < 0) { + // Note: SPIFFS_write() doesn't declare third parameter as const (but should) + if (SPIFFS_write(&fs, fd, (void *)src, size) < 0) { Dbprintf("errno %i\n", SPIFFS_errno(&fs)); } SPIFFS_close(&fs, fd); @@ -310,10 +312,10 @@ static int is_valid_filename(const char *filename) { } */ static void copy_in_spiffs(const char *src, const char *dst) { - uint32_t size = size_in_spiffs((char *)src); + uint32_t size = size_in_spiffs(src); uint8_t *mem = BigBuf_malloc(size); - read_from_spiffs((char *)src, (uint8_t *)mem, size); - write_to_spiffs((char *)dst, (uint8_t *)mem, size); + read_from_spiffs(src, (uint8_t *)mem, size); + write_to_spiffs(dst, (uint8_t *)mem, size); } //////////////////////////////////////////////////////////////////////////////// @@ -434,7 +436,7 @@ int rdv40_spiffs_lazy_mount_rollback(int changed) { // TODO : forbid writing to a filename which already exists as lnk ! // TODO : forbid writing to a filename.lnk which already exists without lnk ! // Note: Writing in SPIFFS_WRITE_CHUNK_SIZE (8192) byte chucks helps to ensure "free space" has been erased by GC (Garbage collection) -int rdv40_spiffs_write(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_write(const char *filename, const uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( uint32_t idx; if (size <= SPIFFS_WRITE_CHUNK_SIZE) { @@ -457,7 +459,7 @@ int rdv40_spiffs_write(const char *filename, uint8_t *src, uint32_t size, RDV40S ) } -int rdv40_spiffs_append(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_append(const char *filename, const uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( uint32_t idx; // Append any SPIFFS_WRITE_CHUNK_SIZE byte chunks @@ -480,26 +482,26 @@ int rdv40_spiffs_read(const char *filename, uint8_t *dst, uint32_t size, RDV40Sp // TODO : forbid writing to a filename which already exists as lnk ! // TODO : forbid writing to a filename.lnk which already exists without lnk ! -int rdv40_spiffs_rename(char *old_filename, char *new_filename, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_rename(const char *old_filename, const char *new_filename, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( // rename_in_spiffs(old_filename, new_filename); // ) } -int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_remove(const char *filename, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( // remove_from_spiffs(filename); // ) } -int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_copy(const char *src_filename, const char *dst_filename, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( // - copy_in_spiffs(src, dst); // + copy_in_spiffs(src_filename, dst_filename); // ) } -int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_stat(const char *filename, uint32_t *size_in_bytes, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( // - *buf = size_in_spiffs(filename); // + *size_in_bytes = size_in_spiffs(filename); // ) } @@ -530,7 +532,7 @@ int rdv40_spiffs_is_symlink(const char *s) { // symlink ?") // ATTENTION : you must NOT provide the whole filename (so please do not include the .lnk extension) // TODO : integrate in read_function -int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_read_as_symlink(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( char linkdest[SPIFFS_OBJ_NAME_LEN]; @@ -538,7 +540,7 @@ int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RD sprintf(linkfilename, "%s.lnk", filename); if (g_dbglevel >= DBG_DEBUG) - Dbprintf("Linkk real filename is " _YELLOW_("%s"), linkfilename); + Dbprintf("Link real filename is " _YELLOW_("%s"), linkfilename); read_from_spiffs((char *)linkfilename, (uint8_t *)linkdest, SPIFFS_OBJ_NAME_LEN); @@ -561,11 +563,11 @@ int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RD // which you can then read back with : // rdv40_spiffs_read_as_symlink((uint8_t *)"world",(uint8_t *) buffer, orig_file_size, RDV40_SPIFFS_SAFETY_SAFE); // TODO : FORBID creating a symlink with a basename (before.lnk) which already exists as a file ! -int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_make_symlink(const char *linkdest, const char *filename, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( char linkfilename[SPIFFS_OBJ_NAME_LEN]; sprintf(linkfilename, "%s.lnk", filename); - write_to_spiffs((char *)linkfilename, (uint8_t *)linkdest, SPIFFS_OBJ_NAME_LEN); + write_to_spiffs(linkfilename, (const uint8_t *)linkdest, SPIFFS_OBJ_NAME_LEN); ) } @@ -575,15 +577,15 @@ int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyL // Still, this case won't happen when the write(s) functions will check for both symlink and real file // preexistence, avoiding a link being created if filename exists, or avoiding a file being created if // symlink exists with same name -int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) { +int rdv40_spiffs_read_as_filetype(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) { RDV40_SPIFFS_SAFE_FUNCTION( RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename); switch (filetype) { case RDV40_SPIFFS_FILETYPE_REAL: - rdv40_spiffs_read((char *)filename, (uint8_t *)dst, size, level); + rdv40_spiffs_read(filename, dst, size, level); break; case RDV40_SPIFFS_FILETYPE_SYMLINK: - rdv40_spiffs_read_as_symlink(filename, (uint8_t *)dst, size, level); + rdv40_spiffs_read_as_symlink(filename, dst, size, level); break; case RDV40_SPIFFS_FILETYPE_BOTH: case RDV40_SPIFFS_FILETYPE_UNKNOWN: diff --git a/armsrc/spiffs.h b/armsrc/spiffs.h index 5958e559b..7bbfb794b 100644 --- a/armsrc/spiffs.h +++ b/armsrc/spiffs.h @@ -46,18 +46,18 @@ typedef struct rdv40_spiffs_fsinfo { uint32_t usedPercent, freePercent; } rdv40_spiffs_fsinfo; -int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_read_as_filetype(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level); int rdv40_spiffs_check(void); int rdv40_spiffs_lazy_unmount(void); int rdv40_spiffs_lazy_mount(void); int rdv40_spiffs_lazy_mount_rollback(int changed); -int rdv40_spiffs_write(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_write(const char *filename, const uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level); int rdv40_spiffs_read(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level); -int rdv40_spiffs_rename(char *old_filename, char *new_filename, RDV40SpiFFSSafetyLevel level); -int rdv40_spiffs_remove(char *filename, RDV40SpiFFSSafetyLevel level); -int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level); -void write_to_spiffs(const char *filename, uint8_t *src, uint32_t size); +int rdv40_spiffs_rename(const char *old_filename, const char *new_filename, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_remove(const char *filename, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_read_as_symlink(const char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level); +void write_to_spiffs(const char *filename, const uint8_t *src, uint32_t size); void read_from_spiffs(const char *filename, uint8_t *dst, uint32_t size); void test_spiffs(void); void rdv40_spiffs_safe_print_tree(void); @@ -65,11 +65,11 @@ int rdv40_spiffs_unmount(void); int rdv40_spiffs_mount(void); int rdv40_spiffs_is_symlink(const char *s); void rdv40_spiffs_safe_print_fsinfo(void); -int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyLevel level); -void append_to_spiffs(const char *filename, uint8_t *src, uint32_t size); -int rdv40_spiffs_copy(char *src, char *dst, RDV40SpiFFSSafetyLevel level); -int rdv40_spiffs_append(const char *filename, uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level); -int rdv40_spiffs_stat(char *filename, uint32_t *buf, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_make_symlink(const char *linkdest, const char *filename, RDV40SpiFFSSafetyLevel level); +void append_to_spiffs(const char *filename, const uint8_t *src, uint32_t size); +int rdv40_spiffs_copy(const char *src_filename, const char *dst_filename, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_append(const char *filename, const uint8_t *src, uint32_t size, RDV40SpiFFSSafetyLevel level); +int rdv40_spiffs_stat(const char *filename, uint32_t *size_in_bytes, RDV40SpiFFSSafetyLevel level); uint32_t size_in_spiffs(const char *filename); int exists_in_spiffs(const char *filename); diff --git a/armsrc/usart.c b/armsrc/usart.c index 915d4a445..a205acb03 100644 --- a/armsrc/usart.c +++ b/armsrc/usart.c @@ -18,6 +18,34 @@ #include "usart.h" #include "proxmark3_arm.h" +#define Dbprintf_usb(...) {\ + bool tmpfpc = g_reply_via_fpc;\ + bool tmpusb = g_reply_via_usb;\ + g_reply_via_fpc = false;\ + g_reply_via_usb = true;\ + Dbprintf(__VA_ARGS__);\ + g_reply_via_fpc = tmpfpc;\ + g_reply_via_usb = tmpusb;} + +#define Dbprintf_fpc(...) {\ + bool tmpfpc = g_reply_via_fpc;\ + bool tmpusb = g_reply_via_usb;\ + g_reply_via_fpc = true;\ + g_reply_via_usb = false;\ + Dbprintf(__VA_ARGS__);\ + g_reply_via_fpc = tmpfpc;\ + g_reply_via_usb = tmpusb;} + +#define Dbprintf_all(...) {\ + bool tmpfpc = g_reply_via_fpc;\ + bool tmpusb = g_reply_via_usb;\ + g_reply_via_fpc = true;\ + g_reply_via_usb = true;\ + Dbprintf(__VA_ARGS__);\ + g_reply_via_fpc = tmpfpc;\ + g_reply_via_usb = tmpusb;} + + static volatile AT91PS_USART pUS1 = AT91C_BASE_US1; static volatile AT91PS_PIO pPIO = AT91C_BASE_PIOA; static volatile AT91PS_PDC pPDC = AT91C_BASE_PDC_US1; diff --git a/bootrom/Makefile b/bootrom/Makefile index cad3e17d1..b6825530d 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -53,10 +53,10 @@ INSTALLFW = $(OBJDIR)/bootrom.elf OBJS = $(OBJDIR)/bootrom.s19 -# version_pm3.c should be remade on every compilation +# version_pm3.c should be checked on every compilation version_pm3.c: default_version_pm3.c .FORCE - $(info [=] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@ + $(info [=] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ all: showinfo $(OBJS) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 91742b711..eaee2f0f0 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -96,11 +96,12 @@ if (CMAKE_TOOLCHAIN_FILE) endif (ANDROID) set(EMBED_READLINE ON) set(EMBED_BZIP2 ON) + set(EMBED_LZ4 ON) endif (CMAKE_TOOLCHAIN_FILE) -if (EMBED_READLINE OR EMBED_BZIP2) +if (EMBED_READLINE OR EMBED_BZIP2 OR EMBED_LZ4) include(ExternalProject) -endif (EMBED_READLINE OR EMBED_BZIP2) +endif (EMBED_READLINE OR EMBED_BZIP2 OR EMBED_LZ4) if (NOT SKIPREADLINE EQUAL 1) if (APPLE) @@ -162,6 +163,7 @@ if (NOT SKIPJANSSONSYSTEM EQUAL 1) endif (NOT SKIPJANSSONSYSTEM EQUAL 1) if(EMBED_BZIP2) + cmake_policy(SET CMP0114 NEW) set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2) # Specify SOURCE_DIR will cause some errors ExternalProject_Add(bzip2 @@ -183,6 +185,34 @@ else(EMBED_BZIP2) find_package (BZip2 REQUIRED) endif(EMBED_BZIP2) +if(EMBED_LZ4) + cmake_policy(SET CMP0114 NEW) + set(LZ4_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4) + # Specify SOURCE_DIR will cause some errors + ExternalProject_Add(lz4 + GIT_REPOSITORY https://android.googlesource.com/platform/external/lz4 + GIT_TAG platform-tools-30.0.2 + PREFIX deps/lz4 + # SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lz4 + CONFIGURE_COMMAND mkdir -p ${LZ4_BUILD_DIR} && git archive --format tar HEAD | tar -C ${LZ4_BUILD_DIR} -x + BUILD_IN_SOURCE ON + BUILD_COMMAND make -C ${LZ4_BUILD_DIR}/lib -j4 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} liblz4.a + INSTALL_COMMAND "" + LOG_DOWNLOAD ON + ) + ExternalProject_Add_StepTargets(lz4 configure build install) + set(LZ4_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4/lib) + set(LZ4_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4/lib/liblz4.a) + set(LZ4_FOUND ON) +else(EMBED_LZ4) + find_path(LZ4_INCLUDE_DIRS lz4frame.h) + find_library(LZ4_LIBRARIES lz4) +endif(EMBED_LZ4) + +if (LZ4_INCLUDE_DIRS AND LZ4_LIBRARIES) + set(LZ4_FOUND ON) +endif (LZ4_INCLUDE_DIRS AND LZ4_LIBRARIES) + if (NOT SKIPWHEREAMISYSTEM EQUAL 1) find_path(WHEREAMI_INCLUDE_DIRS whereami.h) find_library(WHEREAMI_LIBRARIES whereami) @@ -349,6 +379,7 @@ set (TARGET_SOURCES ${PM3_ROOT}/client/src/fileutils.c ${PM3_ROOT}/client/src/flash.c ${PM3_ROOT}/client/src/graph.c + ${PM3_ROOT}/client/src/iso4217.c ${PM3_ROOT}/client/src/jansson_path.c ${PM3_ROOT}/client/src/preferences.c ${PM3_ROOT}/client/src/pm3.c @@ -366,7 +397,7 @@ set (TARGET_SOURCES add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c - COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c + COMMAND sh ${PM3_ROOT}/tools/mkversion.sh ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c DEPENDS ${PM3_ROOT}/common/default_version_pm3.c ) @@ -456,6 +487,11 @@ if (BZIP2_FOUND) set(ADDITIONAL_LNK ${BZIP2_LIBRARIES} ${ADDITIONAL_LNK}) endif (BZIP2_FOUND) +if (LZ4_FOUND) + set(ADDITIONAL_DIRS ${LZ4_INCLUDE_DIRS} ${ADDITIONAL_DIRS}) + set(ADDITIONAL_LNK ${LZ4_LIBRARIES} ${ADDITIONAL_LNK}) +endif (LZ4_FOUND) + if (WHEREAMI_FOUND) set(ADDITIONAL_DIRS ${WHEREAMI_INCLUDE_DIRS} ${ADDITIONAL_DIRS}) set(ADDITIONAL_LNK ${WHEREAMI_LIBRARIES} ${ADDITIONAL_LNK}) @@ -488,11 +524,25 @@ else (SKIPBT EQUAL 1) endif (BLUEZ_FOUND) endif(SKIPBT EQUAL 1) -if (EMBED_BZIP2) - message(STATUS "Bzip2 library: embedded") -else (EMBED_BZIP2) - message(STATUS "Bzip2 library: system library found") -endif (EMBED_BZIP2) +if (BZIP2_FOUND) + if (EMBED_BZIP2) + message(STATUS "Bzip2 library: embedded") + else (EMBED_BZIP2) + message(STATUS "Bzip2 library: system library found") + endif (EMBED_BZIP2) +else (BZIP2_FOUND) + message(SEND_ERROR "Bzip2 library: Bzip2 not found") +endif (BZIP2_FOUND) + +if (LZ4_FOUND) + if (EMBED_LZ4) + message(STATUS "LZ4 library: embedded") + else (EMBED_LZ4) + message(STATUS "LZ4 library: system library found") + endif (EMBED_LZ4) +else (LZ4_FOUND) + message(SEND_ERROR "LZ4 library: LZ4 not found") +endif (LZ4_FOUND) if (SKIPJANSSONSYSTEM EQUAL 1) message(STATUS "Jansson library: local library forced") @@ -592,6 +642,9 @@ endif (EMBED_READLINE) if (EMBED_BZIP2) add_dependencies(proxmark3 bzip2) endif (EMBED_BZIP2) +if (EMBED_LZ4) + add_dependencies(proxmark3 lz4) +endif (EMBED_LZ4) if (MINGW) # Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z) @@ -603,21 +656,21 @@ if (MINGW) set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}") - # GCC 10 has issues with false positives on stringop-overflow, - # let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) - # beware these flags didn't exist for GCC < 7 - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) - set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") - endif() - endif(CMAKE_COMPILER_IS_GNUCXX) - # link Winsock2 set(ADDITIONAL_LNK ws2_32 ${ADDITIONAL_LNK}) endif (MINGW) +# GCC 10 has issues with false positives on stringop-overflow, +# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) +# beware these flags didn't exist for GCC < 7 +if(CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) + set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") + endif() +endif(CMAKE_COMPILER_IS_GNUCXX) + target_include_directories(proxmark3 PRIVATE ${PM3_ROOT}/common ${PM3_ROOT}/common_fpga diff --git a/client/Makefile b/client/Makefile index 8b9e469ba..b63fdf329 100644 --- a/client/Makefile +++ b/client/Makefile @@ -40,7 +40,7 @@ ifeq ($(USE_BREW),1) PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(BREW_PREFIX)/lib/pkgconfig:$(BREW_PREFIX)/opt/qt/lib/pkgconfig:$(BREW_PREFIX)/opt/qt5/lib/pkgconfig endif -ifdef ($(USE_MACPORTS),1) +ifeq ($(USE_MACPORTS),1) INCLUDES += -I$(MACPORTS_PREFIX)/include LDLIBS += -L$(MACPORTS_PREFIX)/lib PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(MACPORTS_PREFIX)/lib/pkgconfig @@ -242,6 +242,9 @@ endif ## BZIP2 LDLIBS += -lbz2 +## LZ4 +LDLIBS += -llz4 + ## Bluez (optional) ifneq ($(SKIPBT),1) BTINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags bluez 2>/dev/null) @@ -678,6 +681,7 @@ SRCS = mifare/aiddesfire.c \ generator.c \ graph.c \ jansson_path.c \ + iso4217.c \ iso7816/apduinfo.c \ iso7816/iso7816core.c \ loclass/cipher.c \ @@ -777,10 +781,14 @@ proxmark3: $(OBJS) $(STATICLIBS) lualibs/pm3_cmd.lua lualibs/mfc_default_keys.lu src/proxgui.cpp: src/ui/ui_overlays.h src/ui/ui_image.h +src/proxguiqt.cpp: src/proxguiqt.h + src/proxguiqt.moc.cpp: src/proxguiqt.h $(info [-] MOC $@) $(Q)$(MOC) -o$@ $^ +src/proxguiqt.h: src/ui/ui_overlays.h src/ui/ui_image.h + src/ui/ui_overlays.h: src/ui/overlays.ui $(info [-] UIC $@) $(Q)$(UIC) $^ > $@ @@ -910,10 +918,10 @@ src/pm3_pywrap.c: pm3.i .PHONY: all clean install uninstall tarbin .FORCE -# version_pm3.c should be remade on every compilation +# version_pm3.c should be checked on every compilation src/version_pm3.c: default_version_pm3.c .FORCE - $(info [=] GEN $@) - $(Q)$(SH) ../tools/mkversion.sh > $@ || $(CP) $< $@ + $(info [=] CHECK $@) + $(Q)$(SH) ../tools/mkversion.sh $@ || $(CP) $< $@ # easy printing of MAKE VARIABLES print-%: ; @echo $* = $($*) diff --git a/client/deps/hardnested/hardnested_bf_core.c b/client/deps/hardnested/hardnested_bf_core.c index 63eba8eba..a84ce0df9 100644 --- a/client/deps/hardnested/hardnested_bf_core.c +++ b/client/deps/hardnested/hardnested_bf_core.c @@ -371,7 +371,7 @@ uint64_t CRACK_STATES_BITSLICED(uint32_t cuid, uint8_t *best_first_bytes, statel for (uint32_t tests = 0; tests < nonces_to_bruteforce; ++tests) { // common bits with preceding test nonce uint32_t common_bits = next_common_bits; //tests ? trailing_zeros(bf_test_nonce_2nd_byte[tests] ^ bf_test_nonce_2nd_byte[tests-1]) : 0; - next_common_bits = tests < nonces_to_bruteforce - 1 ? trailing_zeros(bf_test_nonce_2nd_byte[tests] ^ bf_test_nonce_2nd_byte[tests + 1]) : 0; + next_common_bits = (tests < nonces_to_bruteforce - 1) ? trailing_zeros(bf_test_nonce_2nd_byte[tests] ^ bf_test_nonce_2nd_byte[tests + 1]) : 0; uint32_t parity_bit_idx = 1; // start checking with the parity of second nonce byte bitslice_value_t fb_bits = fbb[common_bits]; // start with precomputed feedback bits from previous nonce bitslice_value_t ks_bits = ksb[common_bits]; // dito for first keystream bits diff --git a/client/deps/hardnested/hardnested_bruteforce.c b/client/deps/hardnested/hardnested_bruteforce.c index 17edfaad0..f55d8885a 100644 --- a/client/deps/hardnested/hardnested_bruteforce.c +++ b/client/deps/hardnested/hardnested_bruteforce.c @@ -96,7 +96,7 @@ static uint32_t keys_found = 0; static uint64_t num_keys_tested; static uint64_t found_bs_key = 0; -inline uint8_t trailing_zeros(uint8_t byte) { +uint8_t trailing_zeros(uint8_t byte) { static const uint8_t trailing_zeros_LUT[256] = { 8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, @@ -304,12 +304,13 @@ static bool ensure_buckets_alloc(size_t need_buckets) { while (need_buckets > alloc_sz) { alloc_sz *= 2; } - - buckets = realloc(buckets, sizeof(statelist_t *) * alloc_sz); - if (buckets == NULL) { + statelist_t **new_buckets = realloc(buckets, sizeof(statelist_t *) * alloc_sz); + if (new_buckets == NULL) { + free(buckets); buckets_allocated = 0; return false; } + buckets = new_buckets; memset(buckets + buckets_allocated, 0, (alloc_sz - buckets_allocated) * sizeof(statelist_t *)); buckets_allocated = alloc_sz; } @@ -412,11 +413,14 @@ static bool read_bench_data(statelist_t *test_candidates) { return false; } free(path); - bytes_read = fread(&nonces_to_bruteforce, 1, sizeof(nonces_to_bruteforce), benchfile); - if (bytes_read != sizeof(nonces_to_bruteforce)) { + + // read 4 bytes of data ? + bytes_read = fread(&nonces_to_bruteforce, 1, sizeof(uint32_t), benchfile); + if (bytes_read != sizeof(uint32_t) || (nonces_to_bruteforce >= 256)) { fclose(benchfile); return false; } + for (uint32_t i = 0; i < nonces_to_bruteforce && i < 256; i++) { bytes_read = fread(&bf_test_nonce[i], 1, sizeof(uint32_t), benchfile); if (bytes_read != sizeof(uint32_t)) { @@ -430,11 +434,13 @@ static bool read_bench_data(statelist_t *test_candidates) { return false; } } + bytes_read = fread(&num_states, 1, sizeof(uint32_t), benchfile); if (bytes_read != sizeof(uint32_t)) { fclose(benchfile); return false; } + for (states_read = 0; states_read < MIN(num_states, TEST_BENCH_SIZE); states_read++) { bytes_read = fread(test_candidates->states[EVEN_STATE] + states_read, 1, sizeof(uint32_t), benchfile); if (bytes_read != sizeof(uint32_t)) { @@ -442,9 +448,11 @@ static bool read_bench_data(statelist_t *test_candidates) { return false; } } + for (uint32_t i = states_read; i < TEST_BENCH_SIZE; i++) { test_candidates->states[EVEN_STATE][i] = test_candidates->states[EVEN_STATE][i - states_read]; } + for (uint32_t i = states_read; i < num_states; i++) { bytes_read = fread(&temp, 1, sizeof(uint32_t), benchfile); if (bytes_read != sizeof(uint32_t)) { @@ -452,6 +460,7 @@ static bool read_bench_data(statelist_t *test_candidates) { return false; } } + for (states_read = 0; states_read < MIN(num_states, TEST_BENCH_SIZE); states_read++) { bytes_read = fread(test_candidates->states[ODD_STATE] + states_read, 1, sizeof(uint32_t), benchfile); if (bytes_read != sizeof(uint32_t)) { @@ -459,6 +468,7 @@ static bool read_bench_data(statelist_t *test_candidates) { return false; } } + for (uint32_t i = states_read; i < TEST_BENCH_SIZE; i++) { test_candidates->states[ODD_STATE][i] = test_candidates->states[ODD_STATE][i - states_read]; } diff --git a/client/deps/mbedtls.cmake b/client/deps/mbedtls.cmake index 162be9bc2..c1ab8d880 100644 --- a/client/deps/mbedtls.cmake +++ b/client/deps/mbedtls.cmake @@ -10,8 +10,8 @@ add_library(pm3rrg_rdv4_mbedtls STATIC ../../common/mbedtls/error.c ../../common/mbedtls/ecp.c ../../common/mbedtls/ecdh.c - ../../common/mbedtls/ecc_point_compression.c - ../../common/mbedtls/gcm.c + ../../common/mbedtls/ecc_point_compression.c + ../../common/mbedtls/gcm.c ../../common/mbedtls/ecp_curves.c ../../common/mbedtls/certs.c ../../common/mbedtls/camellia.c diff --git a/client/deps/tinycbor/cborencoder.c b/client/deps/tinycbor/cborencoder.c index 570319e67..ae034d727 100644 --- a/client/deps/tinycbor/cborencoder.c +++ b/client/deps/tinycbor/cborencoder.c @@ -232,21 +232,21 @@ static inline void put64(void *where, uint64_t v) { memcpy(where, &v, sizeof(v)); } -static inline bool would_overflow(CborEncoder *encoder, size_t len) { +static bool would_overflow(CborEncoder *encoder, size_t len) { ptrdiff_t remaining = (ptrdiff_t)encoder->end; remaining -= remaining ? (ptrdiff_t)encoder->data.ptr : encoder->data.bytes_needed; remaining -= (ptrdiff_t)len; return unlikely(remaining < 0); } -static inline void advance_ptr(CborEncoder *encoder, size_t n) { +static void advance_ptr(CborEncoder *encoder, size_t n) { if (encoder->end) encoder->data.ptr += n; else encoder->data.bytes_needed += n; } -static inline CborError append_to_buffer(CborEncoder *encoder, const void *data, size_t len) { +static CborError append_to_buffer(CborEncoder *encoder, const void *data, size_t len) { if (would_overflow(encoder, len)) { if (encoder->end != NULL) { len -= encoder->end - encoder->data.ptr; @@ -263,11 +263,11 @@ static inline CborError append_to_buffer(CborEncoder *encoder, const void *data, return CborNoError; } -static inline CborError append_byte_to_buffer(CborEncoder *encoder, uint8_t byte) { +static CborError append_byte_to_buffer(CborEncoder *encoder, uint8_t byte) { return append_to_buffer(encoder, &byte, 1); } -static inline CborError encode_number_no_update(CborEncoder *encoder, uint64_t ui, uint8_t shiftedMajorType) { +static CborError encode_number_no_update(CborEncoder *encoder, uint64_t ui, uint8_t shiftedMajorType) { /* Little-endian would have been so much more convenient here: * We could just write at the beginning of buf but append_to_buffer * only the necessary bytes. diff --git a/client/deps/tinycbor/cborparser.c b/client/deps/tinycbor/cborparser.c index 2dade3a0d..468fe5da2 100644 --- a/client/deps/tinycbor/cborparser.c +++ b/client/deps/tinycbor/cborparser.c @@ -142,19 +142,19 @@ * \endif */ -static inline uint16_t get16(const uint8_t *ptr) { +static uint16_t get16(const uint8_t *ptr) { uint16_t result; memcpy(&result, ptr, sizeof(result)); return cbor_ntohs(result); } -static inline uint32_t get32(const uint8_t *ptr) { +static uint32_t get32(const uint8_t *ptr) { uint32_t result; memcpy(&result, ptr, sizeof(result)); return cbor_ntohl(result); } -static inline uint64_t get64(const uint8_t *ptr) { +static uint64_t get64(const uint8_t *ptr) { uint64_t result; memcpy(&result, ptr, sizeof(result)); return cbor_ntohll(result); @@ -949,7 +949,7 @@ CborError cbor_value_calculate_string_length(const CborValue *value, size_t *len return _cbor_value_copy_string(value, NULL, len, NULL); } -static inline void prepare_string_iteration(CborValue *it) { +static void prepare_string_iteration(CborValue *it) { if (!cbor_value_is_length_known(it)) { /* chunked string: we're before the first chunk; * advance to the first chunk */ diff --git a/client/dictionaries/iclass_default_keys.dic b/client/dictionaries/iclass_default_keys.dic index d2d6489b2..c717cd88f 100644 --- a/client/dictionaries/iclass_default_keys.dic +++ b/client/dictionaries/iclass_default_keys.dic @@ -37,5 +37,5 @@ F41DAF58B20C8B91 66584C91EE80D5E5 C1B74D7478053AE2 # -# default iCLASS RFIDeas +# default iCLASS RFIDeas 6B65797374726B72 diff --git a/client/dictionaries/mfc_default_keys.dic b/client/dictionaries/mfc_default_keys.dic index d32346428..241581b69 100644 --- a/client/dictionaries/mfc_default_keys.dic +++ b/client/dictionaries/mfc_default_keys.dic @@ -36,6 +36,9 @@ D01AFEEB890A 2612C6DE84CA 707B11FC1481 # +# QL88 diversifed +03F9067646AE +2352C5B56D85 # B0B1B2B3B4B5 C0C1C2C3C4C5 @@ -68,8 +71,8 @@ B27CCAB30DBD D2ECE8B9395E # NSCP default key 1494E81663D7 -# -# NFC tools +# +# NFC tools 7c9fb8474242 # # Kiev keys @@ -133,6 +136,11 @@ F1D83F964314 199404281970 199404281998 # +# Data from http://www.proxmark.org/forum/viewtopic.php?pid=25925#p25925 +# Tengo Cards Key A +FFF011223358 +FF9F11223358 +# # more Keys from mfc_default_keys.lua 000000000001 000000000002 @@ -296,7 +304,7 @@ AAFB06045877 25094DF6F148 # # -# https://mattionline.de/fitnessstudio-armband-reverse-engineering/ +# https://mattionline.de/fitnessstudio-armband-reverse-engineering/ # https://mattionline.de/milazycracker/ # gym wistband A, same as Fysiken A # gym wistband B @@ -307,7 +315,7 @@ AAFB06045877 A05DBD98E0FC # # GoFit -AA4DDA458EBB +AA4DDA458EBB EAB8066C7479 # # Nordic Wellness A, same as Fysiken A @@ -597,6 +605,7 @@ BFB6796A11DB # Data from Salto A/B 6A1987C40A21 7F33625BC129 +6BE9314930D8 # # Data from forum 2338B4913111 @@ -868,7 +877,7 @@ AD4FB33388BF # # HID MIFARE Classic 1k Key 484944204953 -204752454154 +204752454154 # HID MIFARE SO 3B7E4FD575AD 11496F97752A @@ -935,9 +944,9 @@ FBF225DC5D58 # Data https://pastebin.com/BEm6bdAE # vingcard.txt # Note: most likely diversified +96A301BCE267 4708111C8604 3D50D902EA48 -96A301BCE267 6700F10FEC09 7A09CC1DB70A 560F7CFF2D81 @@ -1820,6 +1829,37 @@ E19504C39461 FA1FBB3F0F1F FF16014FEFC7 # +# +# Food GEM +6686FADE5566 +# +# Data from Discord, French pool +9B7C25052FC3 +494446555455 +# +# Data from Discord, seems to be related to ASSA +427553754D47 +# Keys found on Edith Cowan University Smart Riders +9A677289564D +186C59E6AFC9 +DDDAA35A9749 +9D0D0A829F49 +# Mercator Pika Card, Slovenia +97D77FAE77D3 +5AF445D2B87A +# +# Vilniečio/JUDU kortelė, Lithuania +# A +16901CB400BC +F0FE56621A42 +8C187E78EE9C +FE2A42E85CA8 +# B +6A6C80423226 +F4CE4AF888AE +307448829EBC +C2A0105EB028 +# # Keys from Flipper Zero Community # Last update: Aug 13, 2022 # @@ -2050,9 +2090,15 @@ D144BD193063 8627C10A7014 453857395635 # +# Unknown hotel system Sec 0 / A +353038383134 +# # Data from "the more the marriott" mifare project (colonelborkmundus) # aka The Horde # +# These keys seem to be from Vingcard / Saflok system which means they are diversified +# and not static default keys. To verify this, the UID from such a card is needed. +# # 20230125-01, Elite Member Marriott Rewards 43012BD9EB87 # 20230125-02, Elite Member Marriott Rewards @@ -2133,7 +2179,6 @@ D23C1CB1216E # 20230413-78, Caesars A1D92F808CAF # 20230413-79, The Cosmopolitan, Vegas -# 96A301BCE267 # 20230413-80, Aria 1153C319B4F8 # 20230413-81, Aria @@ -2164,14 +2209,19 @@ D201DBB6AB6E 09074A146605 151F3E85EC46 # -# -# Food GEM -6686FADE5566 -# -# Data from Discord, French pool -9B7C25052FC3 -494446555455 -# -# Data from Discord, seems to be related to ASSA -427553754D47 - +# Travelodge by Wyndham Berkeley +0000FFFFFFFF +4663ACD2FFFF +EDC317193709 +# Hotel Santa Cruz +75FAB77E2E5B +# saflok brand HOTEL key +32F093536677 +# A WaterFront Hotel in Oakland +3351916B5A77 +# Ballys (2018) +336E34CC2177 +# Random Hawaiian Hotel +A1670589B2AF +# SF Hotel (SoMa area) +2E0F00700000 diff --git a/client/dictionaries/mfdes_default_keys.dic b/client/dictionaries/mfdes_default_keys.dic index fbf3a459f..3989054f9 100644 --- a/client/dictionaries/mfdes_default_keys.dic +++ b/client/dictionaries/mfdes_default_keys.dic @@ -15,7 +15,7 @@ ffffffffffffffffffffffffffffffffffffffffffffffff 6AC292FAA1315B4D858AB3A3D7D5933A 404142434445464748494a4b4c4d4e4f 3112B738D8862CCD34302EB299AAB456 # Gallagher AES (https://pastebin.com/GkbGLz8r) -47454D5850524553534F53414D504C45 # Gemalto +47454D5850524553534F53414D504C45 # Gemalto 2b7e151628aed2a6abf7158809cf4f3c fbeed618357133667c85e08f7236a8de f7ddac306ae266ccf90bc11ee46d513b diff --git a/client/experimental_lib/CMakeLists.txt b/client/experimental_lib/CMakeLists.txt index ca8243dbb..a5caeb014 100644 --- a/client/experimental_lib/CMakeLists.txt +++ b/client/experimental_lib/CMakeLists.txt @@ -97,11 +97,12 @@ if (CMAKE_TOOLCHAIN_FILE) endif (ANDROID) set(EMBED_READLINE ON) set(EMBED_BZIP2 ON) + set(EMBED_LZ4 ON) endif (CMAKE_TOOLCHAIN_FILE) -if (EMBED_READLINE OR EMBED_BZIP2) +if (EMBED_READLINE OR EMBED_BZIP2 OR EMBED_LZ4) include(ExternalProject) -endif (EMBED_READLINE OR EMBED_BZIP2) +endif (EMBED_READLINE OR EMBED_BZIP2 OR EMBED_LZ4) if (NOT SKIPREADLINE EQUAL 1) if (APPLE) @@ -163,6 +164,7 @@ if (NOT SKIPJANSSONSYSTEM EQUAL 1) endif (NOT SKIPJANSSONSYSTEM EQUAL 1) if(EMBED_BZIP2) + cmake_policy(SET CMP0114 NEW) set(BZIP2_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/bzip2/src/bzip2) ExternalProject_Add(bzip2 GIT_REPOSITORY https://android.googlesource.com/platform/external/bzip2 @@ -183,6 +185,34 @@ else(EMBED_BZIP2) find_package (BZip2 REQUIRED) endif(EMBED_BZIP2) +if(EMBED_LZ4) + cmake_policy(SET CMP0114 NEW) + set(LZ4_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4) + # Specify SOURCE_DIR will cause some errors + ExternalProject_Add(lz4 + GIT_REPOSITORY https://android.googlesource.com/platform/external/lz4 + GIT_TAG platform-tools-30.0.2 + PREFIX deps/lz4 + # SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lz4 + CONFIGURE_COMMAND mkdir -p ${LZ4_BUILD_DIR} && git archive --format tar HEAD | tar -C ${LZ4_BUILD_DIR} -x + BUILD_IN_SOURCE ON + BUILD_COMMAND make -C ${LZ4_BUILD_DIR}/lib -j4 CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} LD=${CMAKE_C_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} ${CFLAGS_EXTERNAL_LIB} liblz4.a + INSTALL_COMMAND "" + LOG_DOWNLOAD ON + ) + ExternalProject_Add_StepTargets(lz4 configure build install) + set(LZ4_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4/lib) + set(LZ4_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/deps/lz4/src/lz4/lib/liblz4.a) + set(LZ4_FOUND ON) +else(EMBED_LZ4) + find_path(LZ4_INCLUDE_DIRS lz4frame.h) + find_library(LZ4_LIBRARIES lz4) +endif(EMBED_LZ4) + +if (LZ4_INCLUDE_DIRS AND LZ4_LIBRARIES) + set(LZ4_FOUND ON) +endif (LZ4_INCLUDE_DIRS AND LZ4_LIBRARIES) + if (NOT SKIPWHEREAMISYSTEM EQUAL 1) find_path(WHEREAMI_INCLUDE_DIRS whereami.h) find_library(WHEREAMI_LIBRARIES whereami) @@ -349,6 +379,7 @@ set (TARGET_SOURCES ${PM3_ROOT}/client/src/fileutils.c ${PM3_ROOT}/client/src/flash.c ${PM3_ROOT}/client/src/graph.c + ${PM3_ROOT}/client/src/iso4217.c ${PM3_ROOT}/client/src/jansson_path.c ${PM3_ROOT}/client/src/preferences.c ${PM3_ROOT}/client/src/pm3.c @@ -366,7 +397,7 @@ set (TARGET_SOURCES add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c - COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c + COMMAND sh ${PM3_ROOT}/tools/mkversion.sh ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c DEPENDS ${PM3_ROOT}/common/default_version_pm3.c ) @@ -456,6 +487,11 @@ if (BZIP2_FOUND) set(ADDITIONAL_LNK ${BZIP2_LIBRARIES} ${ADDITIONAL_LNK}) endif (BZIP2_FOUND) +if (LZ4_FOUND) + set(ADDITIONAL_DIRS ${LZ4_INCLUDE_DIRS} ${ADDITIONAL_DIRS}) + set(ADDITIONAL_LNK ${LZ4_LIBRARIES} ${ADDITIONAL_LNK}) +endif (LZ4_FOUND) + if (WHEREAMI_FOUND) set(ADDITIONAL_DIRS ${WHEREAMI_INCLUDE_DIRS} ${ADDITIONAL_DIRS}) set(ADDITIONAL_LNK ${WHEREAMI_LIBRARIES} ${ADDITIONAL_LNK}) @@ -488,11 +524,25 @@ else (SKIPBT EQUAL 1) endif (BLUEZ_FOUND) endif(SKIPBT EQUAL 1) -if (EMBED_BZIP2) - message(STATUS "Bzip2 library: embedded") -else (EMBED_BZIP2) - message(STATUS "Bzip2 library: system library found") -endif (EMBED_BZIP2) +if (BZIP2_FOUND) + if (EMBED_BZIP2) + message(STATUS "Bzip2 library: embedded") + else (EMBED_BZIP2) + message(STATUS "Bzip2 library: system library found") + endif (EMBED_BZIP2) +else (BZIP2_FOUND) + message(SEND_ERROR "Bzip2 library: Bzip2 not found") +endif (BZIP2_FOUND) + +if (LZ4_FOUND) + if (EMBED_LZ4) + message(STATUS "LZ4 library: embedded") + else (EMBED_LZ4) + message(STATUS "LZ4 library: system library found") + endif (EMBED_LZ4) +else (LZ4_FOUND) + message(SEND_ERROR "LZ4 library: LZ4 not found") +endif (LZ4_FOUND) if (SKIPJANSSONSYSTEM EQUAL 1) message(STATUS "Jansson library: local library forced") @@ -582,7 +632,7 @@ add_library(pm3rrg_rdv4 SHARED ) target_compile_definitions(pm3rrg_rdv4 PRIVATE LIBPM3) - + target_compile_options(pm3rrg_rdv4 PUBLIC -Wall -Werror -O3) if (EMBED_READLINE) if (NOT SKIPREADLINE EQUAL 1) @@ -592,6 +642,9 @@ endif (EMBED_READLINE) if (EMBED_BZIP2) add_dependencies(pm3rrg_rdv4 bzip2) endif (EMBED_BZIP2) +if (EMBED_LZ4) + add_dependencies(pm3rrg_rdv4 lz4) +endif (EMBED_LZ4) if (MINGW) # Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z) @@ -603,19 +656,19 @@ if (MINGW) set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}") - # GCC 10 has issues with false positives on stringop-overflow, - # let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) - # beware these flags didn't exist for GCC < 7 - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) - set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") - endif() - endif(CMAKE_COMPILER_IS_GNUCXX) - endif (MINGW) +# GCC 10 has issues with false positives on stringop-overflow, +# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) +# beware these flags didn't exist for GCC < 7 +if(CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) + set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") + endif() +endif(CMAKE_COMPILER_IS_GNUCXX) + target_include_directories(pm3rrg_rdv4 PRIVATE ${PM3_ROOT}/common ${PM3_ROOT}/common_fpga diff --git a/client/lualibs/utils.lua b/client/lualibs/utils.lua index 00103d6b4..03862ac29 100644 --- a/client/lualibs/utils.lua +++ b/client/lualibs/utils.lua @@ -262,14 +262,19 @@ local Utils = -- -- Converts DECIMAL to HEX - ConvertDecToHex = function(IN) - local B,K,OUT,I,D = 16, "0123456789ABCDEF", "", 0 - while IN > 0 do - I = I+1 - IN, D = math.floor(IN/B), math.modf(IN, B) + 1 - OUT = string.sub(K, D, D)..OUT + ConvertDecToHex = function(decimal) + if decimal == 0 then + return "0" end - return OUT + + local B,DIGITS,hex = 16, "0123456789ABCDEF", "" + + while decimal > 0 do + local remainder = math.fmod(decimal, B) + hex = string.sub(DIGITS, remainder + 1, remainder + 1) .. hex + decimal = math.floor(decimal / B) + end + return hex end, --- -- Convert Byte array to string of hex diff --git a/client/luascripts/hf_legic.lua b/client/luascripts/hf_legic.lua index cbec05f9f..fb98b777e 100644 --- a/client/luascripts/hf_legic.lua +++ b/client/luascripts/hf_legic.lua @@ -96,78 +96,6 @@ Known issues; needs to be fixed: * last byte in last segment is handled incorrectly when it is the last bytes on the card itself (MIM256: => byte 256) --]] -example = "script run hf_legic" -author = "Mosci, uhei" -version = "1.0.4" - -desc = -[[ - -This script helps you to read, create and modify Legic Prime Tags (MIM22, MIM256, MIM1024) -The virtual tag (and therefore the file to be saved) is always a MIM1024 tag. -it's kinda interactive with following commands in three categories: - - Data I/O Segment Manipulation Token-Data - ----------------- -------------------- ----------------- - rt => read Tag as => add Segment mt => make Token - wt => write Tag es => edit Segment Header et => edit Token data - ed => edit Segment Data tk => toggle KGH-Flag - File I/O rs => remove Segment - ----------------- cc => check Segment-CRC - lf => load bin File ck => check KGH - sf => save eml/bin File ds => dump Segments - xf => xor to File - - - (partially) known Segments Virtual Tags Script Output - --------------------------- ------------------------------- ------------------------ - dlc => dump Legic-Cash ct => copy mainTag to backupTag tac => toggle ansicolors - elc => edit Legic-Cash tc => copy backupTag to mainTag - d3p => dump 3rd-Party-Cash tt => switch mainTag & backupTag - e3p => edit 3rd-Party-Cash di => dump mainTag - do => dump backupTag - - - - rt: 'read tag' - reads a tag placed near to the PM3 - wt: 'write tag' - writes the content of the 'virtual inTag' to a tag placed near to th PM3 - without the need of changing anything - MCD,MSN,MCC will be read from the tag - before and applied to the output. - - lf: 'load file' - load a (xored) binary file (*.bin) from the local Filesystem into the 'virtual inTag' - sf: 'save file' - saves the 'virtual inTag' to the local Filesystem as eml and bin (xored with Tag-MCC) - xf: 'xor file' - saves the 'virtual inTag' to the local Filesystem (xored with chosen MCC - use '00' for plain values) - - ct: 'copy tag' - copy the 'virtual Tag' to a second 'virtual TAG' - not useful yet, but inernally needed - tc: 'copy tag' - copy the 'second virtual Tag' to 'virtual TAG' - not useful yet, but inernally needed - tt: 'toggle tag' - copy mainTag to BackupTag and backupTag to mainTag - - di: 'dump mainTag' - shows the current content of the 'virtual Tag' - do: 'dump backupTag' - shows the current content of the 'virtual outTag' - ds: 'dump Segments' - will show the content of a selected Segment - as: 'add Segment' - will add a 'empty' Segment to the inTag - es: 'edit Segment' - edit the Segment-Header of a selected Segment (len, WRP, WRC, RD, valid) - all other Segment-Header-Values are either calculated or not needed to edit (yet) - ed: 'edit data' - edit the Data of a Segment (ADF-Aera / Stamp & Payload specific Data) - et: 'edit Token' - edit Data of a Token (CDF-Area / SAM, SAM64, SAM63, IAM, GAM specific Data) - mt: 'make Token' - create a Token 'from scratch' (guided) - rs: 'remove segment' - removes a Segment (except Segment 00, but this can be set to valid=0 for Master-Token) - cc: 'check Segment-CRC'- checks & calculates (if check failed) the Segment-CRC of all Segments - ck: 'check KGH-CRC' - checks the and calculates a 'Kaba Group Header' if one was detected - 'Kaba Group Header CRC calculation' - tk: 'toggle KGH' - toggle the (script-internal) flag for kgh-calculation for a segment - xc: 'etra c' - show string that was used to calculate the kgh-crc of a segment - -dlc: 'dump Legic-Cash' - show balance and checksums of a Legic-Cash Segment -elc: 'edit Legic-Cash' - edit values of a Legic-Cash Segment - -d3p: 'dump 3rd Party' - show balance, history and checksums of a (yet) unknown 3rd-Party Cash Segment -e3p: 'edit 3rd Party' - edit Data in 3rd-Party Cash Segment - -tac: 'toggle ansicolors'- switch on and off the colored text-output of this script - default can be changed by setting the variable 'colored_output' to false -]] -currentTag="inTAG" --- -- requirements @@ -193,6 +121,10 @@ local acyellow = "" local acblue = "" local acmagenta = "" +local acy = ansicolors.yellow +local acc = ansicolors.cyan +local acr = ansicolors.reset + --- Helper --- --- -- default colors (change to whatever you want) @@ -206,6 +138,10 @@ function load_colors(onoff) acblue = ansicolors.blue acmagenta= ansicolors.magenta acoff = ansicolors.reset + + acy = ansicolors.yellow + acc = ansicolors.cyan + acr = ansicolors.reset else -- 'no color' acgreen = "" @@ -215,9 +151,84 @@ function load_colors(onoff) acblue = "" acmagenta= "" acoff = "" + + acy = "" + acc = "" + acr = "" end end + +example = "script run hf_legic" +author = "Mosci, uhei" +version = "1.0.5" +desc = +[[ + +This script helps you to read, create and modify Legic Prime Tags ( MIM22, MIM256, MIM1024 ) +The virtual tag (and therefore the file to be saved) is always a MIM1024 tag. +it's kinda interactive with following commands in three categories: + + Data I/O Segment Manipulation Token-Data + ----------------- -------------------- ----------------- + ]]..acy..[[rt]]..acr..[[ -> read Tag ]]..acy..[[as]]..acr..[[ -> add Segment ]]..acy..[[mt]]..acr..[[ -> make Token + ]]..acy..[[wt]]..acr..[[ -> write Tag ]]..acy..[[es]]..acr..[[ -> edit Segment Header ]]..acy..[[et]]..acr..[[ -> edit Token data + ]]..acy..[[ed]]..acr..[[ => edit Segment Data ]]..acy..[[tk]]..acr..[[ => toggle KGH-Flag + File I/O ]]..acy..[[rs]]..acr..[[ => remove Segment + ----------------- ]]..acy..[[cc]]..acr..[[ -> check Segment-CRC + ]]..acy..[[lf]]..acr..[[ -> load bin File ]]..acy..[[ck]]..acr..[[ -> check KGH + ]]..acy..[[sf]]..acr..[[ -> save eml/bin File ]]..acy..[[ds]]..acr..[[ -> dump Segments + ]]..acy..[[xf]]..acr..[[ -> xor to File + + + (partially) known Segments Virtual Tags Script Output + --------------------------- ------------------------------- ------------------------ + ]]..acy..[[dlc]]..acr..[[ -> dump Legic-Cash ]]..acy..[[ct]]..acr..[[ -> copy mainTag to backupTag ]]..acy..[[tac]]..acr..[[ -> toggle ansicolors + ]]..acy..[[elc]]..acr..[[ -> edit Legic-Cash ]]..acy..[[tc]]..acr..[[ -> copy backupTag to mainTag + ]]..acy..[[d3p]]..acr..[[ -> dump 3rd-Party-Cash ]]..acy..[[tt]]..acr..[[ -> switch mainTag & backupTag + ]]..acy..[[e3p]]..acr..[[ -> edit 3rd-Party-Cash ]]..acy..[[di]]..acr..[[ -> dump mainTag + ]]..acy..[[do]]..acr..[[ => dump backupTag + + rt: 'read tag' - reads a tag placed near to the PM3 + wt: 'write tag' - writes the content of the 'virtual inTag' to a tag placed near to th PM3 + without the need of changing anything - MCD,MSN,MCC will be read from the tag + before and applied to the output. + + lf: 'load file' - load a (xored) binary file (*.bin) from the local Filesystem into the 'virtual inTag' + sf: 'save file' - saves the 'virtual inTag' to the local Filesystem as eml and bin (xored with Tag-MCC) + xf: 'xor file' - saves the 'virtual inTag' to the local Filesystem (xored with chosen MCC - use '00' for plain values) + + ct: 'copy tag' - copy the 'virtual Tag' to a second 'virtual TAG' - not useful yet, but inernally needed + tc: 'copy tag' - copy the 'second virtual Tag' to 'virtual TAG' - not useful yet, but inernally needed + tt: 'toggle tag' - copy mainTag to BackupTag and backupTag to mainTag + + di: 'dump mainTag' - shows the current content of the 'virtual Tag' + do: 'dump backupTag' - shows the current content of the 'virtual outTag' + ds: 'dump Segments' - will show the content of a selected Segment + as: 'add Segment' - will add a 'empty' Segment to the inTag + es: 'edit Segment' - edit the Segment-Header of a selected Segment (len, WRP, WRC, RD, valid) + all other Segment-Header-Values are either calculated or not needed to edit (yet) + ed: 'edit data' - edit the Data of a Segment (ADF-Aera / Stamp & Payload specific Data) + et: 'edit Token' - edit Data of a Token (CDF-Area / SAM, SAM64, SAM63, IAM, GAM specific Data) + mt: 'make Token' - create a Token 'from scratch' (guided) + rs: 'remove segment' - removes a Segment (except Segment 00, but this can be set to valid=0 for Master-Token) + cc: 'check Segment-CRC' - checks & calculates (if check failed) the Segment-CRC of all Segments + ck: 'check KGH-CRC' - checks the and calculates a 'Kaba Group Header' if one was detected + 'Kaba Group Header CRC calculation' + tk: 'toggle KGH' - toggle the (script-internal) flag for kgh-calculation for a segment + xc: 'etra c' - show string that was used to calculate the kgh-crc of a segment + +dlc: 'dump Legic-Cash' - show balance and checksums of a Legic-Cash Segment +elc: 'edit Legic-Cash' - edit values of a Legic-Cash Segment + +d3p: 'dump 3rd Party' - show balance, history and checksums of a (yet) unknown 3rd-Party Cash Segment +e3p: 'edit 3rd Party' - edit Data in 3rd-Party Cash Segment + +tac: 'toggle ansicolors' - switch on and off the colored text-output of this script + default can be changed by setting the variable 'colored_output' to false +]] +currentTag="inTAG" + --- -- curency-codes for Legic-Cash-Segments (ISO 4217) local currency = { @@ -237,7 +248,11 @@ end --- -- Usage help function help() - print(desc) + -- the proxmark3 client can't handle such long strings + -- by breaking up at specific points it still looks good. + print(string.sub(desc, 0, 1961)) + print(string.sub(desc, 1962, 3925)) + print(string.sub(desc, 3926, #desc)) print("Version: "..version) print("Example usage: "..example) end @@ -254,7 +269,6 @@ local function padString(str) if (#str == 1) then return '0'..str end - return str end @@ -305,18 +319,6 @@ function xorBytes(inBytes, crc) end end ---- --- check availability of file -function file_check(file_name) - local file_found = io.open(file_name, "r") - if file_found == nil then - return false - else - file_found:close() - return true - end -end - --- -- split csv-string into table local function split(str, sep) @@ -330,6 +332,24 @@ local function split(str, sep) return fields end +--- +-- check availability of file +function file_check(file_name) + if not file_name then return false, "" end + + local arr = split(file_name, ".") + local path = core.search_file(arr[1], "."..arr[2]) + if (path == nil) then return false end + + local file_found = io.open(path, "r") + if file_found == nil then + return false, "" + else + file_found:close() + return true, path + end +end + --- -- put a string into a bytes-table function str2bytes(s) @@ -348,7 +368,7 @@ end function bytesToTable(bytes, bstart, bend) local t={} for i=0, (bend-bstart) do - t[i]=bytes[bstart+i] + t[i]=padString(bytes[bstart+i]) end return t end @@ -358,8 +378,13 @@ end function getInputBytes(infile) local line local bytes = {} - local fhi,err = io.open(infile,"rb") - if err then oops("failed to read from file ".. infile); return false; end + + local arr = split(infile, ".") + local path = core.search_file(arr[1], "."..arr[2]) + if (path == nil) then oops("failed to read from file ".. infile); return false; end + + local fhi,err = io.open(path,"rb") + if err then oops("failed to read from file ".. path); return false; end file_data = fhi:read("*a"); for i = 1, #file_data do @@ -367,7 +392,7 @@ function getInputBytes(infile) end fhi:close() if (bytes[7]=='00') then return false end - print(#bytes .. " bytes from "..infile.." loaded") + print(#bytes .. " bytes from "..path.." loaded") return bytes end @@ -613,12 +638,13 @@ local function readFile(filename) print(accyan) local bytes = {} local tag = {} - if file_check(filename) == false then + + local res, path = file_check(filename) + if not res then return oops("input file: "..acyellow..filename..acoff.." not found") end - bytes = getInputBytes(filename) - + bytes = getInputBytes(path) if bytes == false then return oops('couldnt get input bytes') end -- make plain bytes @@ -640,12 +666,14 @@ local function save_BIN(data, filename) local fn = filename..ext -- Make sure we don't overwrite a file - while file_check(fn) do + local res, path = file_check(fn) + while res == false do fn = filename..ext:gsub(ext, "-"..tostring(counter)..ext) counter = counter + 1 + res, path = file_check(fn) end - outfile = io.open(fn, 'wb') + outfile = io.open(path, 'wb') local i = 1 while data[i] do @@ -660,17 +688,19 @@ end -- write bytes to file function writeFile(bytes, filename) local emlext = ".eml" + local res, path if (filename ~= 'MyLegicClone') then - if (file_check(filename..emlext)) then - local answer = confirm("\nthe output-file "..filename..emlext.." already exists!\nthis will delete the previous content!\ncontinue?") + res, path = file_check(filename..emlext) + if res then + local answer = confirm("\nthe output-file "..path.." already exists!\nthis will delete the previous content!\ncontinue?") if not answer then return print("user abort") end end end local line local bcnt = 0 - local fho, err = io.open(filename..emlext, "w") + local fho, err = io.open(path, "w") if err then - return oops("OOps ... failed to open output-file ".. filename..emlext) + return oops("OOps ... failed to open output-file ".. path) end bytes = xorBytes(bytes, bytes[5]) @@ -692,11 +722,10 @@ function writeFile(bytes, filename) end fho:close() - -- save binary - local fn_bin, fn_bin_num = save_BIN(bytes, filename) - print("\nwrote "..acyellow..(#bytes * 3)..acoff.." bytes to " ..acyellow..filename..emlext..acoff) + -- save binary + local fn_bin, fn_bin_num = save_BIN(bytes, filename) if fn_bin and fn_bin_num then print("\nwrote "..acyellow..fn_bin_num..acoff.." bytes to BINARY file "..acyellow..fn_bin..acoff) end @@ -731,10 +760,16 @@ function readFromPM3() infile=getRandomTempName() core.console("hf legic dump -f "..infile) tag=readFile(infile..".bin") - os.remove(infile) - os.remove(infile..".bin") - os.remove(infile..".eml") - os.remove(infile..".json") + + res, path = file_check(infile..".bin") + if not res then return nil end + os.remove(path) + + res, path = file_check(infile..".eml") + os.remove(path) + + res, path = file_check(infile..".json") + os.remove(path) return tag end @@ -758,16 +793,20 @@ end --- -- save mapping to file local function saveTagMap(map, filename) + + local res, path + if #filename > 0 then - if file_check(filename) then - local answer = confirm("\nthe output-file "..acyellow..filename..acoff.." alredy exists!\nthis will delete the previous content!\ncontinue?") + res, path = file_check(filename) + if res then + local answer = confirm("\nthe output-file "..acyellow..path..acoff.." alredy exists!\nthis will delete the previous content!\ncontinue?") if not answer then return print("user abort") end end end local line - local fho,err = io.open(filename, "w") - if err then oops("OOps ... failed to open output-file "..acyellow..filename..acoff) end + local fho,err = io.open(path, "w") + if err then oops("OOps ... failed to open output-file "..acyellow..path..acoff) end -- write line to new file for k, v in pairs(map) do @@ -842,10 +881,13 @@ function loadTagMap(filename) local line, fields local temp={} local offset=0 - if not file_check(filename) then - return oops("input file: "..acyellow..filename..acoff.." not found") - else - local fhi,err = io.open(filename) + + local res, path = file_check(filename) + if not res then + return oops("input file: "..acyellow..filename..acoff.." not found") + else + + local fhi,err = io.open(path) while true do line = fhi:read() if line == nil then @@ -907,20 +949,21 @@ function dumpTagMap(tag, tagMap) end if (isPosCrc8(tagMap, v['start'])>0) then if ( checkMapCrc8(tagMap, bytes, isPosCrc8(tagMap, v['start']) ) ) then - io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..acgreen..v['name']..acoff..":") + io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..acgreen..v['name']..acoff) else - io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..acred..v['name']..acoff..":") + io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..acred..v['name']..acoff) end else - io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..((v['highlight']) and acmagenta or acyellow)..v['name']..acoff..":") - end - temp="" - for i=((string.len(v['name']))/10), 2 do - temp=temp.."\t" + io.write("("..("%04d"):format(v['start']).."-"..("%04d"):format(v['end'])..") "..((v['highlight']) and acmagenta or acyellow)..v['name']..acoff) end + + temp = "" + while (#v['name'] + temp:len()) < 20 do temp = temp.." " end + for i=v['start'], v['end'] do temp=temp..bytes[i].." " end + print(temp) lastend=v['end'] end @@ -966,11 +1009,23 @@ end -- edit existing Map function editTagMap(tag, tagMap) local t = [[ - Data: dm = show dr = dump raw -Mappings: im = insert am = add rm = remove - CRC8: ac8 = add sc8 = show rc8 = remove - : q = exit h = Help +]]..acc..[[Data]]..acr..[[ + + ]]..acy..[[dm]]..acr..[[ - show ]]..acy..[[dr]]..acr..[[ - dump raw + +]]..acc..[[Mappings]]..acr..[[ + + ]]..acy..[[im]]..acr..[[ - insert ]]..acy..[[am]]..acr..[[ - add + ]]..acy..[[rm]]..acr..[[ - remove ]]..acy..[[mas]]..acr..[[ - map all segments + +]]..acc..[[CRC8]]..acr..[[ + + ]]..acy..[[ac8]]..acr..[[ - add ]]..acy..[[sc8]]..acr..[[ - show + ]]..acy..[[rc8]]..acr..[[ - remove + + ]]..acy..[[q]]..acr..[[ - exit ]]..acy..[[h]]..acr..[[ - Help ]] + --if(#tagMap.mappings==0) then oops("no mappings in tagMap"); return tagMap end print("tagMap edit-mode submenu") repeat @@ -2293,25 +2348,25 @@ function modifyHelp() Data I/O Segment Manipulation Token-Data ----------------- -------------------- --------------------- - rt => read Tag as => add Segment mt => make Token - wt => write Tag es => edit Segment Header et => edit Token data - ed => edit Segment Data tk => toggle KGH-Flag - File I/O rs => remove Segment - ----------------- cc => check Segment-CRC - lf => load bin File ck => check KGH - sf => save eml/bin File ds => dump Segments - xf => xor to File + ]]..acy..[[rt]]..acr..[[ => read Tag ]]..acy..[[as]]..acr..[[ => add Segment ]]..acy..[[mt]]..acr..[[ => make Token + ]]..acy..[[wt]]..acr..[[ => write Tag ]]..acy..[[es]]..acr..[[ => edit Segment Header ]]..acy..[[et]]..acr..[[ => edit Token data + ]]..acy..[[ed]]..acr..[[ => edit Segment Data ]]..acy..[[tk]]..acr..[[ => toggle KGH-Flag + File I/O ]]..acy..[[rs]]..acr..[[ => remove Segment + ----------------- ]]..acy..[[cc]]..acr..[[ => check Segment-CRC + ]]..acy..[[lf]]..acr..[[ => load bin File ]]..acy..[[ck]]..acr..[[ => check KGH + ]]..acy..[[sf]]..acr..[[ => save eml/bin File ]]..acy..[[ds]]..acr..[[ => dump Segments + ]]..acy..[[xf]]..acr..[[ => xor to File Virtual Tags tagMap (partial) known Segments -------------------------------- --------------------- --------------------------- - ct => copy mainTag to backupTag mm => make (new) Map dlc => dump Legic-Cash - tc => copy backupTag to mainTag em => edit Map submenu elc => edit Legic-Cash - tt => switch mainTag & backupTag lm => load map from file d3p => dump 3rd-Party-Cash - di => dump mainTag sm => save map to file e3p => edit 3rd-Party-Cash - do => dump backupTag + ]]..acy..[[ct]]..acr..[[ => copy mainTag to backupTag ]]..acy..[[mm]]..acr..[[ => make (new) Map ]]..acy..[[dlc]]..acr..[[ => dump Legic-Cash + ]]..acy..[[tc]]..acr..[[ => copy backupTag to mainTag ]]..acy..[[em]]..acr..[[ => edit Map submenu ]]..acy..[[elc]]..acr..[[ => edit Legic-Cash + ]]..acy..[[tt]]..acr..[[ => switch mainTag & backupTag ]]..acy..[[lm]]..acr..[[ => load map from file ]]..acy..[[d3p]]..acr..[[ => dump 3rd-Party-Cash + ]]..acy..[[di]]..acr..[[ => dump mainTag ]]..acy..[[sm]]..acr..[[ => save map to file ]]..acy..[[e3p]]..acr..[[ => edit 3rd-Party-Cash + ]]..acy..[[do]]..acr..[[ => dump backupTag - h => this help q => quit + ]]..acy..[[h]]..acr..[[ => this help ]]..acy..[[q]]..acr..[[ => quit ]] return t end @@ -2325,8 +2380,10 @@ function modifyMode() --- -- helptext ["h"] = function(x) - print(" Version: "..version); - print(modifyHelp().."\n".."tags im Memory: "..(istable(inTAG) and ((currentTag=='inTAG') and acgreen.."*mainTAG"..acoff or "mainTAG") or "").." "..(istable(backupTAG) and ((currentTag=='backupTAG') and acgreen.."*backupTAG"..acoff or "backupTAG") or "")) + print(" Version: "..acgreen..version..acr); + print(modifyHelp()) + print("\n".."tags im Memory: "..(istable(inTAG) and ((currentTag=='inTAG') and acgreen.."*mainTAG"..acoff or "mainTAG") or "").." "..(istable(backupTAG) and ((currentTag=='backupTAG') and acgreen.."*backupTAG"..acoff or "backupTAG") or "")) + print("") end, --- -- read real Tag with PM3 into virtual 'mainTAG' @@ -2367,16 +2424,16 @@ function modifyMode() --- -- load file into mainTAG ["lf"] = function(x) - - if (type(x)=='string' and file_check(x)) then + if (x and not x=="" and type(x)=='string' and file_check(x)) then filename = x else filename = input("enter filename: ", "legic.temp") end inTAG=readFile(filename) -- check for existing tagMap - if (file_check(filename..".map")) then - if(confirm(accyan.."Mapping-File for "..acoff..filename..accyan.." found - load it also?"..acoff)) then + local res, path = file_check(filename..".map") + if res then + if(confirm(accyan.."Mapping-File for "..acoff..path..accyan.." found - load it also?"..acoff)) then tagMap=loadTagMap(filename..".map") end end @@ -2724,7 +2781,7 @@ function modifyMode() } repeat -- default message / prompt - ic=input("Legic command? ('h' for help - 'q' for quit)", "h") + ic=input("Legic command? ('"..acy.."h"..acr.."' for help - '"..acy.."q"..acr.."' for quit)", acy.."h"..acr) -- command actions decisions (first match, longer commands before shorter) if (type(actions[string.lower(string.sub(ic,0,3))])=='function') then actions[string.lower(string.sub(ic,0,3))](string.sub(ic,5)) @@ -2743,10 +2800,13 @@ end function main(args) -- set init colors/switch (can be toggled with 'tac' => 'toggle ansicolors') load_colors(colored_output) - if (#args == 0 ) then modifyMode() end + if (#args == 0 ) then modifyMode() end --- variables - local inTAG, backupTAG, outTAG, outfile, interactive, crc, ofs, cfs, dfs - -- just a spacer for better readability + local inTAG, backupTAG, outTAG, outfile, interactive, crc + local ofs=false + local cfs=false + local dfs=false + -- just a spacer for better readability print() --- parse arguments for o, a in getopt.getopt(args, 'hrmi:do:c:') do @@ -2755,7 +2815,7 @@ function main(args) -- read tag from PM3 if o == "r" then inTAG=readFromPM3() end -- input file - if o == "i" then inTAG=readFile(a) end + if o == "i" then inTAG=readFile(a) end -- dump virtual-Tag if o == "d" then dfs=true end -- interacive modifying @@ -2793,7 +2853,10 @@ function main(args) -- write to outfile if (bytes) then - writeFile(bytes, outfile) + + if (outfile) then + writeFile(bytes, outfile) + end --- read real tag into virtual tag -- inTAG=readFromPM3() end --- or simply use the bytes that where wriiten diff --git a/client/luascripts/hf_legic_clone.lua b/client/luascripts/hf_legic_clone.lua index d41046d65..d9a86dc81 100644 --- a/client/luascripts/hf_legic_clone.lua +++ b/client/luascripts/hf_legic_clone.lua @@ -168,7 +168,7 @@ local function help() print(example) end -- read LEGIC data -local function readlegicdata(offset, length, iv) +local function readlegicdata(offset, len, iv) -- Read data local d0 = ('%04X%04X%02X'):format(offset, len, iv) local c = Command:newNG{cmd = cmds.CMD_HF_LEGIC_READER, data = d0} diff --git a/client/luascripts/hf_mf_uidbruteforce.lua b/client/luascripts/hf_mf_uidbruteforce.lua index 4835ba03b..88dca4273 100644 --- a/client/luascripts/hf_mf_uidbruteforce.lua +++ b/client/luascripts/hf_mf_uidbruteforce.lua @@ -124,7 +124,7 @@ local function main(args) local c = string.format( command, n ) print('Running: "'..c..'"') core.console(c) - core.console('msleep '..timeout); + core.console('msleep -t'..timeout); core.console('hw ping') end diff --git a/client/luascripts/hf_mf_ultimatecard.lua b/client/luascripts/hf_mf_ultimatecard.lua index 4bb6034ee..819f68b40 100644 --- a/client/luascripts/hf_mf_ultimatecard.lua +++ b/client/luascripts/hf_mf_ultimatecard.lua @@ -737,7 +737,7 @@ local function set_type(tagtype) write_uid('04112233445566') write_otp('00000000') -- Setting OTP to default 00 00 00 00 write_version('0004030101000b03') -- UL-EV1 (48) 00 04 03 01 01 00 0b 03 - elseif tagtype == 12 then + elseif tagtype == 13 then print('Setting: Ultimate Magic card to UL-EV1 128') connect() send("CF".._key.."F001010000000003000978009102DABC19101011121314151644000000") diff --git a/client/pyscripts/pm3_help2list.py b/client/pyscripts/pm3_help2list.py index 7c27d23fe..a896e5546 100755 --- a/client/pyscripts/pm3_help2list.py +++ b/client/pyscripts/pm3_help2list.py @@ -12,7 +12,7 @@ This version - Iceman Note: - This script is used as a helper script to generate the pm3line_vocabulory.h file. + This script is used as a helper script to generate the pm3line_vocabulary.h file. It need a working proxmark3 client to extract the help text. Ie: this script can't be used inside the normal build sequence. @@ -65,8 +65,8 @@ def main(): // readline auto complete utilities //----------------------------------------------------------------------------- -#ifndef PM3LINE_VOCABULORY_H__ -#define PM3LINE_VOCABULORY_H__ +#ifndef PM3LINE_VOCABULARY_H__ +#define PM3LINE_VOCABULARY_H__ #ifdef __cplusplus extern "C" { @@ -74,12 +74,12 @@ extern "C" { #include -typedef struct vocabulory_s { +typedef struct vocabulary_s { bool offline; const char *name; -} vocabulory_t; +} vocabulary_t; -const static vocabulory_t vocabulory[] = {\n""") +const static vocabulary_t vocabulary[] = {\n""") for key, values in command_data.items(): offline = 0 @@ -88,7 +88,7 @@ const static vocabulory_t vocabulory[] = {\n""") cmd = values['command'] - args.output_file.write(' {{ {}, "{}" }}, \n'.format(offline, cmd)) + args.output_file.write(' {{ {}, "{}" }},\n'.format(offline, cmd)) args.output_file.write(""" {0, NULL}\n}; diff --git a/client/resources/aidlist.json b/client/resources/aidlist.json index 9173d0a10..6eeba5e28 100644 --- a/client/resources/aidlist.json +++ b/client/resources/aidlist.json @@ -2406,5 +2406,21 @@ "Name": "AirDrop connection negotiation", "Description": "Used by NFC-based AirDrop negotiation added in IOS17", "Type": "" + }, + { + "AID": "a0000004400001010001", + "Vendor": "HID Global", + "Country": "", + "Name": "SEOS", + "Description": "Used by both by physical cards and mobile implementations", + "Type": "access" + }, + { + "AID": "A00000054000060100010000FF", + "Vendor": "HID Global", + "Country": "", + "Name": "SEOS Mobile", + "Description": "Declared by some SEOS-compatible applications for HCE", + "Type": "access" } ] diff --git a/client/resources/ecplist.json b/client/resources/ecplist.json index 3902e2f2d..27db827f1 100644 --- a/client/resources/ecplist.json +++ b/client/resources/ecplist.json @@ -25,7 +25,6 @@ "description": "iPhones before IOS17 emit this frame so that other Apple devices don't react to the field during background reading. Also emitted during NFCReaderSession subtypes" }, - { "value": "6a02c801000300000000000000", "name": "Transit: Ventra", @@ -58,7 +57,7 @@ }, { - "value": "6a02c3020602ffff", + "value": "6a02c3020002ffff", "name": "Access: Hotel: Hilton", "description": "TCI might be a wildcard before a reservation is made" }, diff --git a/client/resources/hardnested_tables/bitflip_0_001_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_001_states.bin.bz2 deleted file mode 100644 index e65f22471..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_001_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_001_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_001_states.bin.lz4 new file mode 100644 index 000000000..b343718e7 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_001_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_003_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_003_states.bin.bz2 deleted file mode 100644 index 5ae156039..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_003_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_003_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_003_states.bin.lz4 new file mode 100644 index 000000000..61f52563f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_003_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_005_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_005_states.bin.bz2 deleted file mode 100644 index 473c32fca..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_005_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_005_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_005_states.bin.lz4 new file mode 100644 index 000000000..5e6ab2676 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_005_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_007_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_007_states.bin.bz2 deleted file mode 100644 index 0cfda87cb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_007_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_007_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_007_states.bin.lz4 new file mode 100644 index 000000000..8864efd2d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_007_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_009_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_009_states.bin.bz2 deleted file mode 100644 index 1103e29bc..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_009_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_009_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_009_states.bin.lz4 new file mode 100644 index 000000000..187763ee6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_009_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_00b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_00b_states.bin.bz2 deleted file mode 100644 index 2e1c29d87..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_00b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_00b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_00b_states.bin.lz4 new file mode 100644 index 000000000..085a4301c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_00b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_00d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_00d_states.bin.bz2 deleted file mode 100644 index c76301638..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_00d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_00d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_00d_states.bin.lz4 new file mode 100644 index 000000000..f88c681b5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_00d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_00f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_00f_states.bin.bz2 deleted file mode 100644 index 39e7afc47..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_00f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_00f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_00f_states.bin.lz4 new file mode 100644 index 000000000..65e43f158 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_00f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_010_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_010_states.bin.bz2 deleted file mode 100644 index 74890f1ff..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_010_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_010_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_010_states.bin.lz4 new file mode 100644 index 000000000..8309c3f1d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_010_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_014_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_014_states.bin.bz2 deleted file mode 100644 index b7fb646d1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_014_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_014_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_014_states.bin.lz4 new file mode 100644 index 000000000..44acd9e89 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_014_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_01c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_01c_states.bin.bz2 deleted file mode 100644 index c865be04e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_01c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_01c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_01c_states.bin.lz4 new file mode 100644 index 000000000..81d4d9de3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_01c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_021_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_021_states.bin.bz2 deleted file mode 100644 index b2fef5781..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_021_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_021_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_021_states.bin.lz4 new file mode 100644 index 000000000..fd5d540d7 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_021_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_023_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_023_states.bin.bz2 deleted file mode 100644 index 32c7adfd5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_023_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_023_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_023_states.bin.lz4 new file mode 100644 index 000000000..d3fd78ebb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_023_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_025_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_025_states.bin.bz2 deleted file mode 100644 index e21a5ee93..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_025_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_025_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_025_states.bin.lz4 new file mode 100644 index 000000000..d337d7303 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_025_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_027_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_027_states.bin.bz2 deleted file mode 100644 index 7b51fd6b1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_027_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_027_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_027_states.bin.lz4 new file mode 100644 index 000000000..b1816f47e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_027_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_029_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_029_states.bin.bz2 deleted file mode 100644 index b55556692..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_029_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_029_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_029_states.bin.lz4 new file mode 100644 index 000000000..c5599605a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_029_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_02b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_02b_states.bin.bz2 deleted file mode 100644 index f22242565..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_02b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_02b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_02b_states.bin.lz4 new file mode 100644 index 000000000..d0906edb9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_02b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_02d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_02d_states.bin.bz2 deleted file mode 100644 index 54170b83b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_02d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_02d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_02d_states.bin.lz4 new file mode 100644 index 000000000..3c1e1727b Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_02d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_02f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_02f_states.bin.bz2 deleted file mode 100644 index e20b10f3d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_02f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_02f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_02f_states.bin.lz4 new file mode 100644 index 000000000..883c4851e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_02f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_030_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_030_states.bin.bz2 deleted file mode 100644 index 8042c6366..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_030_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_030_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_030_states.bin.lz4 new file mode 100644 index 000000000..0abd4785a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_030_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_034_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_034_states.bin.bz2 deleted file mode 100644 index 06fc562c4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_034_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_034_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_034_states.bin.lz4 new file mode 100644 index 000000000..f6270b397 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_034_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_03c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_03c_states.bin.bz2 deleted file mode 100644 index 1a354ec8a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_03c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_03c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_03c_states.bin.lz4 new file mode 100644 index 000000000..f89025de1 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_03c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_040_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_040_states.bin.bz2 deleted file mode 100644 index 54b71e2ce..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_040_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_040_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_040_states.bin.lz4 new file mode 100644 index 000000000..016ecfe67 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_040_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_044_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_044_states.bin.bz2 deleted file mode 100644 index b268ec935..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_044_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_044_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_044_states.bin.lz4 new file mode 100644 index 000000000..a0513f75e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_044_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_04c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_04c_states.bin.bz2 deleted file mode 100644 index 26977703d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_04c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_04c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_04c_states.bin.lz4 new file mode 100644 index 000000000..0ee52357e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_04c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_051_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_051_states.bin.bz2 deleted file mode 100644 index 3c889d07c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_051_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_051_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_051_states.bin.lz4 new file mode 100644 index 000000000..ae0d8a050 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_051_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_053_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_053_states.bin.bz2 deleted file mode 100644 index 751724d3d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_053_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_053_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_053_states.bin.lz4 new file mode 100644 index 000000000..a1d8359ae Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_053_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_055_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_055_states.bin.bz2 deleted file mode 100644 index 1cf3f2ad9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_055_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_055_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_055_states.bin.lz4 new file mode 100644 index 000000000..a7e1e3522 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_055_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_057_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_057_states.bin.bz2 deleted file mode 100644 index 099cc0e38..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_057_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_057_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_057_states.bin.lz4 new file mode 100644 index 000000000..525db3d7e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_057_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_059_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_059_states.bin.bz2 deleted file mode 100644 index fea5cf3e8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_059_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_059_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_059_states.bin.lz4 new file mode 100644 index 000000000..3fb7f1f60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_059_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_05b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_05b_states.bin.bz2 deleted file mode 100644 index 4dd885ec3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_05b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_05b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_05b_states.bin.lz4 new file mode 100644 index 000000000..a7928ed6e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_05b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_05d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_05d_states.bin.bz2 deleted file mode 100644 index 7ea71a9c6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_05d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_05d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_05d_states.bin.lz4 new file mode 100644 index 000000000..f149660c5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_05d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_05f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_05f_states.bin.bz2 deleted file mode 100644 index bda71a64e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_05f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_05f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_05f_states.bin.lz4 new file mode 100644 index 000000000..472f2b854 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_05f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_064_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_064_states.bin.bz2 deleted file mode 100644 index 3bec7c36b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_064_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_064_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_064_states.bin.lz4 new file mode 100644 index 000000000..a596bd59c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_064_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_06c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_06c_states.bin.bz2 deleted file mode 100644 index ff80c2233..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_06c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_06c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_06c_states.bin.lz4 new file mode 100644 index 000000000..45cda4314 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_06c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_071_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_071_states.bin.bz2 deleted file mode 100644 index 6073d4e52..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_071_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_071_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_071_states.bin.lz4 new file mode 100644 index 000000000..15ebf5ea0 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_071_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_073_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_073_states.bin.bz2 deleted file mode 100644 index d1ae56fec..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_073_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_073_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_073_states.bin.lz4 new file mode 100644 index 000000000..bb38d5cb4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_073_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_075_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_075_states.bin.bz2 deleted file mode 100644 index 6c8258ae3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_075_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_075_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_075_states.bin.lz4 new file mode 100644 index 000000000..47dae45cf Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_075_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_077_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_077_states.bin.bz2 deleted file mode 100644 index acaf1e210..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_077_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_077_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_077_states.bin.lz4 new file mode 100644 index 000000000..4e9d451b5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_077_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_079_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_079_states.bin.bz2 deleted file mode 100644 index 427506dd8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_079_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_079_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_079_states.bin.lz4 new file mode 100644 index 000000000..3b71ddcd2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_079_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_07b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_07b_states.bin.bz2 deleted file mode 100644 index bcc281932..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_07b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_07b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_07b_states.bin.lz4 new file mode 100644 index 000000000..e8f500c82 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_07b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_07f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_07f_states.bin.bz2 deleted file mode 100644 index b56e0f7a0..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_07f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_07f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_07f_states.bin.lz4 new file mode 100644 index 000000000..38fe391be Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_07f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_081_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_081_states.bin.bz2 deleted file mode 100644 index c5426ace6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_081_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_081_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_081_states.bin.lz4 new file mode 100644 index 000000000..6cc5d4be6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_081_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_083_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_083_states.bin.bz2 deleted file mode 100644 index 3421417ed..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_083_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_083_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_083_states.bin.lz4 new file mode 100644 index 000000000..b9e06b240 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_083_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_085_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_085_states.bin.bz2 deleted file mode 100644 index 17f1aaeed..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_085_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_085_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_085_states.bin.lz4 new file mode 100644 index 000000000..33f0bdfef Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_085_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_087_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_087_states.bin.bz2 deleted file mode 100644 index 5b9302627..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_087_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_087_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_087_states.bin.lz4 new file mode 100644 index 000000000..859ab9b29 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_087_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_089_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_089_states.bin.bz2 deleted file mode 100644 index 9f37987c7..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_089_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_089_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_089_states.bin.lz4 new file mode 100644 index 000000000..046fef513 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_089_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_08b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_08b_states.bin.bz2 deleted file mode 100644 index 0f42f9246..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_08b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_08b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_08b_states.bin.lz4 new file mode 100644 index 000000000..693b2164a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_08b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_08d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_08d_states.bin.bz2 deleted file mode 100644 index f7e2d1674..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_08d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_08d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_08d_states.bin.lz4 new file mode 100644 index 000000000..a77eade5e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_08d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_08f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_08f_states.bin.bz2 deleted file mode 100644 index f66b803eb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_08f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_08f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_08f_states.bin.lz4 new file mode 100644 index 000000000..fb7224627 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_08f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_090_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_090_states.bin.bz2 deleted file mode 100644 index 7f559b40c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_090_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_090_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_090_states.bin.lz4 new file mode 100644 index 000000000..ad7aab465 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_090_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_094_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_094_states.bin.bz2 deleted file mode 100644 index bcdcbd26f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_094_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_094_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_094_states.bin.lz4 new file mode 100644 index 000000000..eb996434c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_094_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_09c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_09c_states.bin.bz2 deleted file mode 100644 index 4b0316dc3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_09c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_09c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_09c_states.bin.lz4 new file mode 100644 index 000000000..ffe57e55e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_09c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.bz2 deleted file mode 100644 index daa61d3b7..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.lz4 new file mode 100644 index 000000000..716e2ec82 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0a1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.bz2 deleted file mode 100644 index d7171c287..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.lz4 new file mode 100644 index 000000000..7f045d83f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0a3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.bz2 deleted file mode 100644 index 958b8ed3d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.lz4 new file mode 100644 index 000000000..bb045bb43 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0a5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.bz2 deleted file mode 100644 index 9992d1259..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.lz4 new file mode 100644 index 000000000..ba9fb4f9c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0a7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.bz2 deleted file mode 100644 index 5893a4938..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.lz4 new file mode 100644 index 000000000..dab0fdca9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0a9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.bz2 deleted file mode 100644 index 7deaece19..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.lz4 new file mode 100644 index 000000000..ef2177e62 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0ab_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.bz2 deleted file mode 100644 index 19c36b526..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.lz4 new file mode 100644 index 000000000..171ee0312 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0ad_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0af_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0af_states.bin.bz2 deleted file mode 100644 index 3e99de95c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0af_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0af_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0af_states.bin.lz4 new file mode 100644 index 000000000..cb3b19e44 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0af_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.bz2 deleted file mode 100644 index cb2ac918b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.lz4 new file mode 100644 index 000000000..4bf9b403e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0b0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.bz2 deleted file mode 100644 index f9c8c8183..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.lz4 new file mode 100644 index 000000000..8de773b3f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0b4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.bz2 deleted file mode 100644 index 19e1fe89a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.lz4 new file mode 100644 index 000000000..60ed53332 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0bc_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.bz2 deleted file mode 100644 index 87d8693df..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.lz4 new file mode 100644 index 000000000..2d542516a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0c0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.bz2 deleted file mode 100644 index 57823403b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.lz4 new file mode 100644 index 000000000..690f7419e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0c4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.bz2 deleted file mode 100644 index 38fc1e0ae..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.lz4 new file mode 100644 index 000000000..9880ccf01 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0cc_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.bz2 deleted file mode 100644 index 4d1b27593..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.lz4 new file mode 100644 index 000000000..0c9ca6ebd Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0d1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.bz2 deleted file mode 100644 index cb9afb002..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.lz4 new file mode 100644 index 000000000..dcf6b9deb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0d3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.bz2 deleted file mode 100644 index ae6e859a8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.lz4 new file mode 100644 index 000000000..17d19e8e9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0d5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.bz2 deleted file mode 100644 index 90c562613..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.lz4 new file mode 100644 index 000000000..400120c8f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0d7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.bz2 deleted file mode 100644 index ad2df6b55..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.lz4 new file mode 100644 index 000000000..79d6d49b6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0d9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0db_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0db_states.bin.bz2 deleted file mode 100644 index 353c48c88..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0db_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0db_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0db_states.bin.lz4 new file mode 100644 index 000000000..d89176694 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0db_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.bz2 deleted file mode 100644 index 2d2e19707..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.lz4 new file mode 100644 index 000000000..9e7ae0925 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0dd_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0df_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0df_states.bin.bz2 deleted file mode 100644 index 14ca3fcda..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0df_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0df_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0df_states.bin.lz4 new file mode 100644 index 000000000..b8cbfb9d6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0df_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.bz2 deleted file mode 100644 index 19e2e6109..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.lz4 new file mode 100644 index 000000000..07135ccf2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0e4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.bz2 deleted file mode 100644 index f376b1cd1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.lz4 new file mode 100644 index 000000000..a2ca8131c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0ec_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.bz2 deleted file mode 100644 index b263afc60..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.lz4 new file mode 100644 index 000000000..f54d02f01 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0f1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.bz2 deleted file mode 100644 index d18971ec8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.lz4 new file mode 100644 index 000000000..f9141026d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0f3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.bz2 deleted file mode 100644 index 7102292c4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.lz4 new file mode 100644 index 000000000..daee63044 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0f5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.bz2 deleted file mode 100644 index 4da9f8558..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.lz4 new file mode 100644 index 000000000..c1ff0c76b Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0f7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.bz2 deleted file mode 100644 index 476895cd1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.lz4 new file mode 100644 index 000000000..383b8a8f2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0f9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.bz2 deleted file mode 100644 index 39a913d64..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.lz4 new file mode 100644 index 000000000..157d035f2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0fb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.bz2 deleted file mode 100644 index ffc3cf539..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.lz4 new file mode 100644 index 000000000..d760dd764 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0fd_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.bz2 deleted file mode 100644 index 0c96f7625..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.lz4 new file mode 100644 index 000000000..86670f0b9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_0ff_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_104_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_104_states.bin.bz2 deleted file mode 100644 index a5c2ad9bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_104_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_104_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_104_states.bin.lz4 new file mode 100644 index 000000000..a52ca9770 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_104_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_10c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_10c_states.bin.bz2 deleted file mode 100644 index e3aa0c2b5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_10c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_10c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_10c_states.bin.lz4 new file mode 100644 index 000000000..8c633bac5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_10c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_111_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_111_states.bin.bz2 deleted file mode 100644 index 8cd2e0ba0..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_111_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_111_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_111_states.bin.lz4 new file mode 100644 index 000000000..199eb6377 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_111_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_113_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_113_states.bin.bz2 deleted file mode 100644 index c1b73e1cf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_113_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_113_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_113_states.bin.lz4 new file mode 100644 index 000000000..9b91cc4e2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_113_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_115_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_115_states.bin.bz2 deleted file mode 100644 index 464b2e5d6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_115_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_115_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_115_states.bin.lz4 new file mode 100644 index 000000000..062d0f4b8 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_115_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_117_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_117_states.bin.bz2 deleted file mode 100644 index 87f7542d3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_117_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_117_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_117_states.bin.lz4 new file mode 100644 index 000000000..8a5df1fc3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_117_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_119_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_119_states.bin.bz2 deleted file mode 100644 index 05620bba0..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_119_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_119_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_119_states.bin.lz4 new file mode 100644 index 000000000..4730414ad Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_119_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_11b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_11b_states.bin.bz2 deleted file mode 100644 index cce41a523..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_11b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_11b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_11b_states.bin.lz4 new file mode 100644 index 000000000..f147874a3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_11b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_11d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_11d_states.bin.bz2 deleted file mode 100644 index 6aa3f4638..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_11d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_11d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_11d_states.bin.lz4 new file mode 100644 index 000000000..b03da0135 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_11d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_11f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_11f_states.bin.bz2 deleted file mode 100644 index 5892009d2..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_11f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_11f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_11f_states.bin.lz4 new file mode 100644 index 000000000..cfa31da6f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_11f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_124_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_124_states.bin.bz2 deleted file mode 100644 index d3601defe..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_124_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_124_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_124_states.bin.lz4 new file mode 100644 index 000000000..5fe6d13ba Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_124_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_12c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_12c_states.bin.bz2 deleted file mode 100644 index 38dbdf227..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_12c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_12c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_12c_states.bin.lz4 new file mode 100644 index 000000000..18d8d20f2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_12c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_131_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_131_states.bin.bz2 deleted file mode 100644 index 0afa8f655..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_131_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_131_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_131_states.bin.lz4 new file mode 100644 index 000000000..f3993558a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_131_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_133_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_133_states.bin.bz2 deleted file mode 100644 index 400272bcc..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_133_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_133_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_133_states.bin.lz4 new file mode 100644 index 000000000..03c54fd52 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_133_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_135_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_135_states.bin.bz2 deleted file mode 100644 index 242ba30a6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_135_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_135_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_135_states.bin.lz4 new file mode 100644 index 000000000..84a6ba3af Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_135_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_137_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_137_states.bin.bz2 deleted file mode 100644 index 293c1f93f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_137_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_137_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_137_states.bin.lz4 new file mode 100644 index 000000000..e5a76bf33 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_137_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_139_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_139_states.bin.bz2 deleted file mode 100644 index 97761432b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_139_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_139_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_139_states.bin.lz4 new file mode 100644 index 000000000..e52835eaf Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_139_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_13b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_13b_states.bin.bz2 deleted file mode 100644 index fb869e7cb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_13b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_13b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_13b_states.bin.lz4 new file mode 100644 index 000000000..8bffa0f2e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_13b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_13d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_13d_states.bin.bz2 deleted file mode 100644 index 46b67bf83..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_13d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_13d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_13d_states.bin.lz4 new file mode 100644 index 000000000..79899c9f6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_13d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_13f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_13f_states.bin.bz2 deleted file mode 100644 index 33b2abfc2..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_13f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_13f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_13f_states.bin.lz4 new file mode 100644 index 000000000..29de4add8 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_13f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_141_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_141_states.bin.bz2 deleted file mode 100644 index 3be41189c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_141_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_141_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_141_states.bin.lz4 new file mode 100644 index 000000000..7df6d080b Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_141_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_143_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_143_states.bin.bz2 deleted file mode 100644 index 99328786c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_143_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_143_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_143_states.bin.lz4 new file mode 100644 index 000000000..d6fcf319d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_143_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_145_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_145_states.bin.bz2 deleted file mode 100644 index b31bd720a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_145_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_145_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_145_states.bin.lz4 new file mode 100644 index 000000000..aabd5fa31 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_145_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_147_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_147_states.bin.bz2 deleted file mode 100644 index fab2780c7..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_147_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_147_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_147_states.bin.lz4 new file mode 100644 index 000000000..ac70a06f5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_147_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_149_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_149_states.bin.bz2 deleted file mode 100644 index eda7650e5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_149_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_149_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_149_states.bin.lz4 new file mode 100644 index 000000000..d22b15e0e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_149_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_14b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_14b_states.bin.bz2 deleted file mode 100644 index c3c3dfaf3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_14b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_14b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_14b_states.bin.lz4 new file mode 100644 index 000000000..139d6cbb6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_14b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_14d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_14d_states.bin.bz2 deleted file mode 100644 index adf20a10f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_14d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_14d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_14d_states.bin.lz4 new file mode 100644 index 000000000..ed8fe08c6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_14d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_14f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_14f_states.bin.bz2 deleted file mode 100644 index f61babefa..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_14f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_14f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_14f_states.bin.lz4 new file mode 100644 index 000000000..3ce07c452 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_14f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_150_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_150_states.bin.bz2 deleted file mode 100644 index 612d6295e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_150_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_150_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_150_states.bin.lz4 new file mode 100644 index 000000000..798da8c6f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_150_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_154_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_154_states.bin.bz2 deleted file mode 100644 index 9efc40fd9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_154_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_154_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_154_states.bin.lz4 new file mode 100644 index 000000000..0ec51234e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_154_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_15c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_15c_states.bin.bz2 deleted file mode 100644 index 0180aa901..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_15c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_15c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_15c_states.bin.lz4 new file mode 100644 index 000000000..aea4d7a5f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_15c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_161_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_161_states.bin.bz2 deleted file mode 100644 index 5c12567e4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_161_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_161_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_161_states.bin.lz4 new file mode 100644 index 000000000..c0d488db2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_161_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_163_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_163_states.bin.bz2 deleted file mode 100644 index b68ad5995..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_163_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_163_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_163_states.bin.lz4 new file mode 100644 index 000000000..34af1d6f7 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_163_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_165_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_165_states.bin.bz2 deleted file mode 100644 index 69e051fbf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_165_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_165_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_165_states.bin.lz4 new file mode 100644 index 000000000..fc5eab951 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_165_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_167_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_167_states.bin.bz2 deleted file mode 100644 index bb2c8cc48..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_167_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_167_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_167_states.bin.lz4 new file mode 100644 index 000000000..438806c68 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_167_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_169_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_169_states.bin.bz2 deleted file mode 100644 index bbec52e26..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_169_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_169_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_169_states.bin.lz4 new file mode 100644 index 000000000..2ab3d7fe6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_169_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_16b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_16b_states.bin.bz2 deleted file mode 100644 index 0a34da2f6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_16b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_16b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_16b_states.bin.lz4 new file mode 100644 index 000000000..9b731604a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_16b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_16d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_16d_states.bin.bz2 deleted file mode 100644 index c6758b6a2..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_16d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_16d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_16d_states.bin.lz4 new file mode 100644 index 000000000..7df5b243e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_16d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_16f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_16f_states.bin.bz2 deleted file mode 100644 index fe936f3bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_16f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_16f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_16f_states.bin.lz4 new file mode 100644 index 000000000..0ad58f032 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_16f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_170_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_170_states.bin.bz2 deleted file mode 100644 index 5180aae93..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_170_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_170_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_170_states.bin.lz4 new file mode 100644 index 000000000..871544b77 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_170_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_174_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_174_states.bin.bz2 deleted file mode 100644 index 00e4f95b4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_174_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_174_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_174_states.bin.lz4 new file mode 100644 index 000000000..5db556ff5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_174_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_17c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_17c_states.bin.bz2 deleted file mode 100644 index 01c02bb2b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_17c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_17c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_17c_states.bin.lz4 new file mode 100644 index 000000000..08843ca7b Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_17c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_184_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_184_states.bin.bz2 deleted file mode 100644 index 5da967674..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_184_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_184_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_184_states.bin.lz4 new file mode 100644 index 000000000..8369142ee Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_184_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_18c_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_18c_states.bin.bz2 deleted file mode 100644 index 88f05ef65..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_18c_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_18c_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_18c_states.bin.lz4 new file mode 100644 index 000000000..b38580ae3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_18c_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_191_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_191_states.bin.bz2 deleted file mode 100644 index 7303065d9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_191_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_191_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_191_states.bin.lz4 new file mode 100644 index 000000000..3563685d6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_191_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_193_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_193_states.bin.bz2 deleted file mode 100644 index b9e3297c5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_193_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_193_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_193_states.bin.lz4 new file mode 100644 index 000000000..10d9b90fa Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_193_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_195_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_195_states.bin.bz2 deleted file mode 100644 index fa5060af8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_195_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_195_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_195_states.bin.lz4 new file mode 100644 index 000000000..b649fd709 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_195_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_197_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_197_states.bin.bz2 deleted file mode 100644 index 5de558643..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_197_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_197_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_197_states.bin.lz4 new file mode 100644 index 000000000..de5d1d9cb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_197_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_199_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_199_states.bin.bz2 deleted file mode 100644 index c4f58b53d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_199_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_199_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_199_states.bin.lz4 new file mode 100644 index 000000000..83cbb61fb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_199_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_19b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_19b_states.bin.bz2 deleted file mode 100644 index 9ad820f8c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_19b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_19b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_19b_states.bin.lz4 new file mode 100644 index 000000000..9be17ac56 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_19b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_19d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_19d_states.bin.bz2 deleted file mode 100644 index 54371d652..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_19d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_19d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_19d_states.bin.lz4 new file mode 100644 index 000000000..2ea815311 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_19d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_19f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_19f_states.bin.bz2 deleted file mode 100644 index b4a434889..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_19f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_19f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_19f_states.bin.lz4 new file mode 100644 index 000000000..0abb61eb4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_19f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.bz2 deleted file mode 100644 index ca79aa9b0..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.lz4 new file mode 100644 index 000000000..a8bc77435 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1a4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.bz2 deleted file mode 100644 index 944d52e07..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.lz4 new file mode 100644 index 000000000..bdee2aa73 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1ac_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.bz2 deleted file mode 100644 index 860f486bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.lz4 new file mode 100644 index 000000000..0c1bbe06d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1b1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.bz2 deleted file mode 100644 index 8afe0ffb9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.lz4 new file mode 100644 index 000000000..a6ed5254c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1b3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.bz2 deleted file mode 100644 index 804b581f8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.lz4 new file mode 100644 index 000000000..04723ba94 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1b5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.bz2 deleted file mode 100644 index 8d541ff7d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.lz4 new file mode 100644 index 000000000..864a67df5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1b7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.bz2 deleted file mode 100644 index 42269c116..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.lz4 new file mode 100644 index 000000000..a80815ec5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1b9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.bz2 deleted file mode 100644 index f1f353e41..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.lz4 new file mode 100644 index 000000000..026830879 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1bb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.bz2 deleted file mode 100644 index ce30db7be..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.lz4 new file mode 100644 index 000000000..5195b6cb0 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1bd_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.bz2 deleted file mode 100644 index 43164354d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.lz4 new file mode 100644 index 000000000..0136c6877 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1bf_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.bz2 deleted file mode 100644 index a805bf22a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.lz4 new file mode 100644 index 000000000..5c6f1d6ab Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1c1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.bz2 deleted file mode 100644 index 5ef2b8efa..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.lz4 new file mode 100644 index 000000000..4c8bc7add Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1c3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.bz2 deleted file mode 100644 index abc9ef501..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.lz4 new file mode 100644 index 000000000..7a03cca13 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1c5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.bz2 deleted file mode 100644 index 6d8d002e6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.lz4 new file mode 100644 index 000000000..10be732e1 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1c9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.bz2 deleted file mode 100644 index e9caa94a6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.lz4 new file mode 100644 index 000000000..df2ced6e2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1cb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.bz2 deleted file mode 100644 index 26a43e303..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.lz4 new file mode 100644 index 000000000..ae0fab92d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1d0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.bz2 deleted file mode 100644 index 15911b954..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.lz4 new file mode 100644 index 000000000..5734c0aa7 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1d4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.bz2 deleted file mode 100644 index ab5149491..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.lz4 new file mode 100644 index 000000000..0226241f9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1dc_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.bz2 deleted file mode 100644 index 7e4c4e5a8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.lz4 new file mode 100644 index 000000000..c3b856a36 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1e1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.bz2 deleted file mode 100644 index 887da78ed..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.lz4 new file mode 100644 index 000000000..49d5e69d4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1e3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.bz2 deleted file mode 100644 index 43b2cee21..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.lz4 new file mode 100644 index 000000000..6f2431a30 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1e5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.bz2 deleted file mode 100644 index 89ebe72a9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.lz4 new file mode 100644 index 000000000..c7f8fad60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1e7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.bz2 deleted file mode 100644 index 64ab8f4ce..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.lz4 new file mode 100644 index 000000000..1d1a9d20e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1e9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.bz2 deleted file mode 100644 index d76993719..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.lz4 new file mode 100644 index 000000000..cebb8c05e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1eb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.bz2 deleted file mode 100644 index 8574c08f7..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.lz4 new file mode 100644 index 000000000..7f18cb77d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1ed_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.bz2 deleted file mode 100644 index 7a9012f47..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.lz4 new file mode 100644 index 000000000..e534c2013 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1ef_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.bz2 deleted file mode 100644 index 058cbfd82..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.lz4 new file mode 100644 index 000000000..63b4270d1 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1f0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.bz2 deleted file mode 100644 index 69262a53f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.lz4 new file mode 100644 index 000000000..52ec12172 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1f4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.bz2 deleted file mode 100644 index c3d550787..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.lz4 new file mode 100644 index 000000000..3fd553268 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_1fc_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_210_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_210_states.bin.bz2 deleted file mode 100644 index fe85775bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_210_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_210_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_210_states.bin.lz4 new file mode 100644 index 000000000..35817b77d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_210_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_225_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_225_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_225_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_225_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_225_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_225_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_227_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_227_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_227_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_227_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_227_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_227_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_22d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_22d_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_22d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_22d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_22d_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_22d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_22f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_22f_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_22f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_22f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_22f_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_22f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_240_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_240_states.bin.bz2 deleted file mode 100644 index 6d1908e79..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_240_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_240_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_240_states.bin.lz4 new file mode 100644 index 000000000..e835ce417 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_240_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_275_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_275_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_275_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_275_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_275_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_275_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_277_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_277_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_277_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_277_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_277_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_277_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_27f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_27f_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_27f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_27f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_27f_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_27f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_294_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_294_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_294_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_294_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_294_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_294_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2a1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2a3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2a9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2ab_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2c4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2f1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2f3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2f9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_2fb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_335_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_335_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_335_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_335_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_335_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_335_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_337_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_337_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_337_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_337_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_337_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_337_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_33d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_33d_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_33d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_33d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_33d_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_33d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_33f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_33f_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_33f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_33f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_33f_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_33f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_350_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_350_states.bin.bz2 deleted file mode 100644 index fe85775bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_350_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_350_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_350_states.bin.lz4 new file mode 100644 index 000000000..35817b77d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_350_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_365_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_365_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_365_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_365_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_365_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_365_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_367_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_367_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_367_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_367_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_367_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_367_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_36d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_36d_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_36d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_36d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_36d_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_36d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_36f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_36f_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_36f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_36f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_36f_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_36f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_384_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_384_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_384_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_384_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_384_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_384_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3b1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3b3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3b9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3bb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3d4_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3e1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3e3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3e9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_0_3eb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_002_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_002_states.bin.bz2 deleted file mode 100644 index 4c9093b38..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_002_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_002_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_002_states.bin.lz4 new file mode 100644 index 000000000..067f3cc33 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_002_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_008_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_008_states.bin.bz2 deleted file mode 100644 index 89d88b572..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_008_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_008_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_008_states.bin.lz4 new file mode 100644 index 000000000..9230a93a4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_008_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_00a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_00a_states.bin.bz2 deleted file mode 100644 index 38af88dff..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_00a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_00a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_00a_states.bin.lz4 new file mode 100644 index 000000000..826825600 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_00a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_012_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_012_states.bin.bz2 deleted file mode 100644 index 492261923..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_012_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_012_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_012_states.bin.lz4 new file mode 100644 index 000000000..ead8e206e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_012_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_018_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_018_states.bin.bz2 deleted file mode 100644 index c0a592378..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_018_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_018_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_018_states.bin.lz4 new file mode 100644 index 000000000..03b98ebf8 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_018_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_01a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_01a_states.bin.bz2 deleted file mode 100644 index 98093a999..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_01a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_01a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_01a_states.bin.lz4 new file mode 100644 index 000000000..f9216c396 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_01a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_020_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_020_states.bin.bz2 deleted file mode 100644 index 333dab4c5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_020_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_020_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_020_states.bin.lz4 new file mode 100644 index 000000000..7b0d648cb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_020_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_028_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_028_states.bin.bz2 deleted file mode 100644 index 7f2e66c32..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_028_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_028_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_028_states.bin.lz4 new file mode 100644 index 000000000..e0e9538ca Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_028_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_02a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_02a_states.bin.bz2 deleted file mode 100644 index 18c04fa47..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_02a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_02a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_02a_states.bin.lz4 new file mode 100644 index 000000000..a1347c788 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_02a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_02e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_02e_states.bin.bz2 deleted file mode 100644 index 2ecb621b3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_02e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_02e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_02e_states.bin.lz4 new file mode 100644 index 000000000..16254a7e4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_02e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_032_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_032_states.bin.bz2 deleted file mode 100644 index 083f1f0a5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_032_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_032_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_032_states.bin.lz4 new file mode 100644 index 000000000..b3f9ccbfa Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_032_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_036_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_036_states.bin.bz2 deleted file mode 100644 index 7fa414bd8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_036_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_036_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_036_states.bin.lz4 new file mode 100644 index 000000000..843e1adee Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_036_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_038_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_038_states.bin.bz2 deleted file mode 100644 index 15f739f1b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_038_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_038_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_038_states.bin.lz4 new file mode 100644 index 000000000..7bb6d9648 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_038_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_03a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_03a_states.bin.bz2 deleted file mode 100644 index 61ef02268..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_03a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_03a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_03a_states.bin.lz4 new file mode 100644 index 000000000..0f3512d21 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_03a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_03e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_03e_states.bin.bz2 deleted file mode 100644 index 7dd251575..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_03e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_03e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_03e_states.bin.lz4 new file mode 100644 index 000000000..7d66dd7eb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_03e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_040_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_040_states.bin.bz2 deleted file mode 100644 index 87d8693df..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_040_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_040_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_040_states.bin.lz4 new file mode 100644 index 000000000..2d542516a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_040_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_042_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_042_states.bin.bz2 deleted file mode 100644 index b757bce02..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_042_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_042_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_042_states.bin.lz4 new file mode 100644 index 000000000..ad1bd544c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_042_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_046_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_046_states.bin.bz2 deleted file mode 100644 index b1454b4e8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_046_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_046_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_046_states.bin.lz4 new file mode 100644 index 000000000..d6bf32445 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_046_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_048_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_048_states.bin.bz2 deleted file mode 100644 index 99563f5db..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_048_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_048_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_048_states.bin.lz4 new file mode 100644 index 000000000..d8d050de5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_048_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_04a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_04a_states.bin.bz2 deleted file mode 100644 index b31851187..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_04a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_04a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_04a_states.bin.lz4 new file mode 100644 index 000000000..557f84698 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_04a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_04e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_04e_states.bin.bz2 deleted file mode 100644 index d0a946c4e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_04e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_04e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_04e_states.bin.lz4 new file mode 100644 index 000000000..6fa29a650 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_04e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_052_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_052_states.bin.bz2 deleted file mode 100644 index 95d0d7af7..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_052_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_052_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_052_states.bin.lz4 new file mode 100644 index 000000000..b5c4b3812 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_052_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_056_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_056_states.bin.bz2 deleted file mode 100644 index 92dee0efa..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_056_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_056_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_056_states.bin.lz4 new file mode 100644 index 000000000..609c9acc4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_056_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_058_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_058_states.bin.bz2 deleted file mode 100644 index ca2fe1a7a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_058_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_058_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_058_states.bin.lz4 new file mode 100644 index 000000000..88aee3f16 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_058_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_05a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_05a_states.bin.bz2 deleted file mode 100644 index 2771dced1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_05a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_05a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_05a_states.bin.lz4 new file mode 100644 index 000000000..18eedc09b Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_05a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_05e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_05e_states.bin.bz2 deleted file mode 100644 index 94c8612fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_05e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_05e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_05e_states.bin.lz4 new file mode 100644 index 000000000..c30a74316 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_05e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_060_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_060_states.bin.bz2 deleted file mode 100644 index edc274c4b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_060_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_060_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_060_states.bin.lz4 new file mode 100644 index 000000000..c440016cf Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_060_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_062_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_062_states.bin.bz2 deleted file mode 100644 index 5b50711b3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_062_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_062_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_062_states.bin.lz4 new file mode 100644 index 000000000..de48057f6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_062_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_066_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_066_states.bin.bz2 deleted file mode 100644 index e599d5318..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_066_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_066_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_066_states.bin.lz4 new file mode 100644 index 000000000..dfd8b4e9e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_066_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_068_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_068_states.bin.bz2 deleted file mode 100644 index d52f1573d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_068_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_068_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_068_states.bin.lz4 new file mode 100644 index 000000000..8ed807ea3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_068_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_06a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_06a_states.bin.bz2 deleted file mode 100644 index 05cdc3556..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_06a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_06a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_06a_states.bin.lz4 new file mode 100644 index 000000000..ccf2cf30a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_06a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_06e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_06e_states.bin.bz2 deleted file mode 100644 index f1087952d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_06e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_06e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_06e_states.bin.lz4 new file mode 100644 index 000000000..6adc3eead Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_06e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_072_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_072_states.bin.bz2 deleted file mode 100644 index 138c17c0f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_072_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_072_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_072_states.bin.lz4 new file mode 100644 index 000000000..8b2991446 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_072_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_076_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_076_states.bin.bz2 deleted file mode 100644 index db0df90a6..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_076_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_076_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_076_states.bin.lz4 new file mode 100644 index 000000000..08f0dfa3a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_076_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_078_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_078_states.bin.bz2 deleted file mode 100644 index 2c6f9cd4d..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_078_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_078_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_078_states.bin.lz4 new file mode 100644 index 000000000..d63ed136a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_078_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_07a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_07a_states.bin.bz2 deleted file mode 100644 index ea2f8386b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_07a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_07a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_07a_states.bin.lz4 new file mode 100644 index 000000000..ddd8741b0 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_07a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_07e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_07e_states.bin.bz2 deleted file mode 100644 index 00d59bf75..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_07e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_07e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_07e_states.bin.lz4 new file mode 100644 index 000000000..0d50053bc Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_07e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_080_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_080_states.bin.bz2 deleted file mode 100644 index 54b71e2ce..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_080_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_080_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_080_states.bin.lz4 new file mode 100644 index 000000000..016ecfe67 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_080_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_082_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_082_states.bin.bz2 deleted file mode 100644 index 9937ecd2a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_082_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_082_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_082_states.bin.lz4 new file mode 100644 index 000000000..3ebd8d8d5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_082_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_086_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_086_states.bin.bz2 deleted file mode 100644 index 30d232f69..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_086_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_086_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_086_states.bin.lz4 new file mode 100644 index 000000000..56a80b7e3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_086_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_088_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_088_states.bin.bz2 deleted file mode 100644 index cf826e416..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_088_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_088_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_088_states.bin.lz4 new file mode 100644 index 000000000..1dde249a5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_088_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_08a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_08a_states.bin.bz2 deleted file mode 100644 index b708bd851..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_08a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_08a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_08a_states.bin.lz4 new file mode 100644 index 000000000..2a3ee1493 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_08a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_08e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_08e_states.bin.bz2 deleted file mode 100644 index 79c5eec83..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_08e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_08e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_08e_states.bin.lz4 new file mode 100644 index 000000000..8cbee39df Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_08e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_092_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_092_states.bin.bz2 deleted file mode 100644 index 917b8cc2f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_092_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_092_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_092_states.bin.lz4 new file mode 100644 index 000000000..bf6423f2f Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_092_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_096_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_096_states.bin.bz2 deleted file mode 100644 index f5b0d1e39..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_096_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_096_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_096_states.bin.lz4 new file mode 100644 index 000000000..ac2ec4cd5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_096_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_098_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_098_states.bin.bz2 deleted file mode 100644 index 648c9f2b9..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_098_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_098_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_098_states.bin.lz4 new file mode 100644 index 000000000..ed3e88627 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_098_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_09a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_09a_states.bin.bz2 deleted file mode 100644 index 261c672de..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_09a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_09a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_09a_states.bin.lz4 new file mode 100644 index 000000000..0377fddff Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_09a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_09e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_09e_states.bin.bz2 deleted file mode 100644 index bddf5c91f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_09e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_09e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_09e_states.bin.lz4 new file mode 100644 index 000000000..8fc08c44e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_09e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.bz2 deleted file mode 100644 index fe09d19cb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.lz4 new file mode 100644 index 000000000..1feeb89e2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0a0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.bz2 deleted file mode 100644 index 8aa9c2542..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.lz4 new file mode 100644 index 000000000..0150dbd78 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0a2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.bz2 deleted file mode 100644 index aa6ec2408..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.lz4 new file mode 100644 index 000000000..b120016e2 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0a6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.bz2 deleted file mode 100644 index 6d8970c2e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.lz4 new file mode 100644 index 000000000..592af17d4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0a8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.bz2 deleted file mode 100644 index e23808553..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.lz4 new file mode 100644 index 000000000..21b477241 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0aa_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.bz2 deleted file mode 100644 index bfc6848dd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.lz4 new file mode 100644 index 000000000..ab5ece8cb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0ae_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.bz2 deleted file mode 100644 index 05a4d0fd5..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.lz4 new file mode 100644 index 000000000..e63a9862d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0b2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.bz2 deleted file mode 100644 index 34fd067ec..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.lz4 new file mode 100644 index 000000000..5f3d72c5e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0b6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.bz2 deleted file mode 100644 index f638e4e1b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.lz4 new file mode 100644 index 000000000..df41059c8 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0b8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.bz2 deleted file mode 100644 index 7be7169f4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.lz4 new file mode 100644 index 000000000..3467ef92e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0ba_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0be_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0be_states.bin.bz2 deleted file mode 100644 index 91e544e4c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0be_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0be_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0be_states.bin.lz4 new file mode 100644 index 000000000..6833be254 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0be_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.bz2 deleted file mode 100644 index 87d8693df..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.lz4 new file mode 100644 index 000000000..2d542516a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0c0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.bz2 deleted file mode 100644 index 05f424f30..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.lz4 new file mode 100644 index 000000000..8bd7ee05c Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0c2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.bz2 deleted file mode 100644 index c104fb1de..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.lz4 new file mode 100644 index 000000000..0906007e9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0c6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.bz2 deleted file mode 100644 index 6548e5270..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.lz4 new file mode 100644 index 000000000..b303d2141 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0c8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.bz2 deleted file mode 100644 index 8ceab191a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.lz4 new file mode 100644 index 000000000..a9f7fd045 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0ca_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.bz2 deleted file mode 100644 index 26fc3dcd4..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.lz4 new file mode 100644 index 000000000..45d798574 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0ce_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.bz2 deleted file mode 100644 index 9d6eaefdd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.lz4 new file mode 100644 index 000000000..db3b33de4 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0d2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.bz2 deleted file mode 100644 index d6b205973..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.lz4 new file mode 100644 index 000000000..d42480484 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0d6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.bz2 deleted file mode 100644 index 3a4e9b14c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.lz4 new file mode 100644 index 000000000..d52ee181d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0d8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0da_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0da_states.bin.bz2 deleted file mode 100644 index f59ffec93..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0da_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0da_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0da_states.bin.lz4 new file mode 100644 index 000000000..255006b82 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0da_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0de_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0de_states.bin.bz2 deleted file mode 100644 index 62759b5d1..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0de_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0de_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0de_states.bin.lz4 new file mode 100644 index 000000000..ff79d1fd6 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0de_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.bz2 deleted file mode 100644 index 904ba404c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.lz4 new file mode 100644 index 000000000..a8232844a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0e0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.bz2 deleted file mode 100644 index e969ed97c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.lz4 new file mode 100644 index 000000000..f99bdf117 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0e8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.bz2 deleted file mode 100644 index ebb53232e..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.lz4 new file mode 100644 index 000000000..2c9de9e5d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_0f8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_108_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_108_states.bin.bz2 deleted file mode 100644 index 2b87ca8f2..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_108_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_108_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_108_states.bin.lz4 new file mode 100644 index 000000000..8882c1f20 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_108_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_111_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_111_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_111_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_111_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_111_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_111_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_113_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_113_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_113_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_113_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_113_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_113_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_115_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_115_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_115_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_115_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_115_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_115_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_117_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_117_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_117_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_117_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_117_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_117_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_118_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_118_states.bin.bz2 deleted file mode 100644 index 2b2bf5915..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_118_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_118_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_118_states.bin.lz4 new file mode 100644 index 000000000..c1794bc03 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_118_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_11a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_11a_states.bin.bz2 deleted file mode 100644 index f7e2d1674..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_11a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_11a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_11a_states.bin.lz4 new file mode 100644 index 000000000..a77eade5e Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_11a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_11b_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_11b_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_11b_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_11b_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_11b_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_11b_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_120_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_120_states.bin.bz2 deleted file mode 100644 index fed958a7f..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_120_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_120_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_120_states.bin.lz4 new file mode 100644 index 000000000..746496cf3 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_120_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_122_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_122_states.bin.bz2 deleted file mode 100644 index 0e406a019..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_122_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_122_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_122_states.bin.lz4 new file mode 100644 index 000000000..7b1d7eee7 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_122_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_128_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_128_states.bin.bz2 deleted file mode 100644 index e02d0729a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_128_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_128_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_128_states.bin.lz4 new file mode 100644 index 000000000..4c620265d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_128_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_131_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_131_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_131_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_131_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_131_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_131_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_135_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_135_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_135_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_135_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_135_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_135_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_138_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_138_states.bin.bz2 deleted file mode 100644 index c12c2219a..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_138_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_138_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_138_states.bin.lz4 new file mode 100644 index 000000000..87e962761 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_138_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_145_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_145_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_145_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_145_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_145_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_145_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_147_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_147_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_147_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_147_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_147_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_147_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_148_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_148_states.bin.bz2 deleted file mode 100644 index f9760f6b2..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_148_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_148_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_148_states.bin.lz4 new file mode 100644 index 000000000..eeac62486 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_148_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_158_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_158_states.bin.bz2 deleted file mode 100644 index ceb8298d8..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_158_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_158_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_158_states.bin.lz4 new file mode 100644 index 000000000..8ee5757b9 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_158_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_160_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_160_states.bin.bz2 deleted file mode 100644 index 6264a1abb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_160_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_160_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_160_states.bin.lz4 new file mode 100644 index 000000000..089422698 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_160_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_161_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_161_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_161_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_161_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_161_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_161_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_163_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_163_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_163_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_163_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_163_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_163_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_165_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_165_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_165_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_165_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_165_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_165_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_168_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_168_states.bin.bz2 deleted file mode 100644 index e4ee8cdbb..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_168_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_168_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_168_states.bin.lz4 new file mode 100644 index 000000000..151d6c198 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_168_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_178_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_178_states.bin.bz2 deleted file mode 100644 index ce03d40d3..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_178_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_178_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_178_states.bin.lz4 new file mode 100644 index 000000000..05128e5d5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_178_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_180_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_180_states.bin.bz2 deleted file mode 100644 index 87d8693df..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_180_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_180_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_180_states.bin.lz4 new file mode 100644 index 000000000..2d542516a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_180_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_188_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_188_states.bin.bz2 deleted file mode 100644 index e6392a033..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_188_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_188_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_188_states.bin.lz4 new file mode 100644 index 000000000..01dacce88 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_188_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_191_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_191_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_191_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_191_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_191_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_191_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_198_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_198_states.bin.bz2 deleted file mode 100644 index f8e066f82..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_198_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_198_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_198_states.bin.lz4 new file mode 100644 index 000000000..1b64ec6b5 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_198_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_199_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_199_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_199_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_199_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_199_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_199_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_19d_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_19d_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_19d_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_19d_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_19d_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_19d_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_19f_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_19f_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_19f_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_19f_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_19f_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_19f_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.bz2 deleted file mode 100644 index da20250ec..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.lz4 new file mode 100644 index 000000000..18008b8bb Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1a0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.bz2 deleted file mode 100644 index 034c96abd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.lz4 new file mode 100644 index 000000000..483e921ff Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1a8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1b3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1b5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1b7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.bz2 deleted file mode 100644 index c57b7929b..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.lz4 new file mode 100644 index 000000000..77cf4f142 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1b8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1b9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1bd_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1c1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1c3_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.bz2 deleted file mode 100644 index 6ced4a199..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.lz4 new file mode 100644 index 000000000..3f7dd0f90 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1c8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1c9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1cd_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1cf_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.bz2 deleted file mode 100644 index bbc7f1d82..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.lz4 new file mode 100644 index 000000000..b77d70585 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1d8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.bz2 deleted file mode 100644 index d701fc285..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.lz4 new file mode 100644 index 000000000..c6e2f9438 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e0_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e1_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e5_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e7_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.bz2 deleted file mode 100644 index 19bb1cdac..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.lz4 new file mode 100644 index 000000000..42fb9d45d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1e9_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1eb_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.bz2 deleted file mode 100644 index 646198900..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.lz4 new file mode 100644 index 000000000..7ec52a440 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1ed_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.bz2 deleted file mode 100644 index b3ff47017..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.lz4 new file mode 100644 index 000000000..87fbc9d30 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_1f8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_208_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_208_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_208_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_208_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_208_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_208_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_220_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_220_states.bin.bz2 deleted file mode 100644 index fe85775bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_220_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_220_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_220_states.bin.lz4 new file mode 100644 index 000000000..35817b77d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_220_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_24a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_24a_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_24a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_24a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_24a_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_24a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_24e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_24e_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_24e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_24e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_24e_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_24e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_25a_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_25a_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_25a_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_25a_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_25a_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_25a_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_25e_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_25e_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_25e_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_25e_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_25e_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_25e_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_262_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_262_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_262_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_262_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_262_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_262_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_266_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_266_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_266_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_266_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_266_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_266_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_272_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_272_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_272_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_272_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_272_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_272_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_276_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_276_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_276_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_276_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_276_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_276_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_280_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_280_states.bin.bz2 deleted file mode 100644 index 6d1908e79..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_280_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_280_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_280_states.bin.lz4 new file mode 100644 index 000000000..e835ce417 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_280_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_2a8_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.bz2 deleted file mode 100644 index 15195d213..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.lz4 new file mode 100644 index 000000000..a5259b624 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_2c2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.bz2 deleted file mode 100644 index 18a6d4987..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.lz4 new file mode 100644 index 000000000..08c311533 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_2c6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.bz2 deleted file mode 100644 index fa1be58fd..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.lz4 new file mode 100644 index 000000000..b315cfd60 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_2d2_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.bz2 deleted file mode 100644 index b6c1eb54c..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.lz4 new file mode 100644 index 000000000..c7380444a Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_2d6_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_328_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_328_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_328_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_328_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_328_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_328_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_388_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_388_states.bin.bz2 deleted file mode 100644 index b01f02208..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_388_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_388_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_388_states.bin.lz4 new file mode 100644 index 000000000..e4074f984 Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_388_states.bin.lz4 differ diff --git a/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.bz2 b/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.bz2 deleted file mode 100644 index fe85775bf..000000000 Binary files a/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.bz2 and /dev/null differ diff --git a/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.lz4 b/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.lz4 new file mode 100644 index 000000000..35817b77d Binary files /dev/null and b/client/resources/hardnested_tables/bitflip_1_3a0_states.bin.lz4 differ diff --git a/client/src/atrs.c b/client/src/atrs.c index 0b22eb79b..d8f11587f 100644 --- a/client/src/atrs.c +++ b/client/src/atrs.c @@ -18,8 +18,8 @@ #include "atrs.h" #include #include -#include "commonutil.h" // ARRAYLEN -#include "ui.h" // PrintAndLogEx +#include "commonutil.h" // ARRAYLEN +#include "ui.h" // PrintAndLogEx // get a ATR description based on the atr bytes // returns description of the best match @@ -32,7 +32,7 @@ const char *getAtrInfo(const char *atr_str) { if (strlen(AtrTable[i].bytes) != slen) continue; - if (strstr(AtrTable[i].bytes, "..") != NULL) { + if (strstr(AtrTable[i].bytes, ".") != NULL) { char *tmp_atr = calloc(slen, sizeof(uint8_t)); if (tmp_atr == NULL) { PrintAndLogEx(FAILED, "failed to allocate memory"); @@ -40,7 +40,7 @@ const char *getAtrInfo(const char *atr_str) { } for (int j = 0; j < slen; j++) { - tmp_atr[j] = AtrTable[i].bytes[j] == '.' ? '.' : atr_str[j]; + tmp_atr[j] = (AtrTable[i].bytes[j] == '.') ? '.' : atr_str[j]; } if (strncmp(tmp_atr, AtrTable[i].bytes, slen) == 0) { @@ -50,9 +50,12 @@ const char *getAtrInfo(const char *atr_str) { free(tmp_atr); } else { - if (strncmp(atr_str, AtrTable[i].bytes, slen) == 0) return AtrTable[i].desc; + if (strncmp(atr_str, AtrTable[i].bytes, slen) == 0) { + return AtrTable[i].desc; + } } } + if (match >= 0) { return AtrTable[match].desc; } else { diff --git a/client/src/atrs.h b/client/src/atrs.h index 87171c523..2a6bc7521 100644 --- a/client/src/atrs.h +++ b/client/src/atrs.h @@ -43,6 +43,7 @@ const static atr_t AtrTable[] = { { "3B003B28003441454130323030", "Cryptoguard card used for pay tv Plustelka (DVB-T2 - Slovak) (Pay TV)\nhttps://www.plustelka.sk/" }, { "3B021050", "Visa (Bank)" }, { "3B02141C", "UAE (United Arab Emirates) (eID)" }, + { "3B021435", "cartao cidadao (eID)" }, { "3B021450", "Schlumberger Multiflex 3k" }, { "3B02145011", "Maste visa card (Bank)" }, { "3B021451", "8A (Bank)" }, @@ -54,7 +55,7 @@ const static atr_t AtrTable[] = { { "3B026F33", "Polish national PKI equivalent to national id card issued by Eurocert - 1 of 2 Polish authorized issuers (PKI)\nhttps://eurocert.pl/index.php/en-us/" }, { "3B0400000000", "Laundromat payment card\nSpanish ID ('DNIe: Documento Nacional de Identidad electronico).\nhttp://www.dnie.es/" }, { "3B0400000073", "ASE M2 Card (I2C) (Other)" }, - { "3B0400040000", "Italian healtcare card (TS) National Service Card (CNS) - Regione Lazio - (HealthCare)\nhttp://cns.regione.lazio.it" }, + { "3B0400040000", "Italian healthcare card (TS) National Service Card (CNS) - Regione Lazio - (HealthCare)\nhttp://cns.regione.lazio.it" }, { "3B0401020304", "SLE4442 - memory card (256) with write protection PIN. (Other)" }, { "3B0405D486C8", "Telstra (Telecom Australia) Pay Phone Phonecard (Telecommunication)\nhttps://www.telstra.com.au/home-phone/calling-cards" }, { "3B04073C8592", "OLD Spanish Prepaid phone cards (pesetas) provided by Telefonica" }, @@ -70,15 +71,18 @@ const static atr_t AtrTable[] = { { "3B0417D43000", "Gemalto BONZA game smart-card. (Other)" }, { "3B0417D46608", "Prepaid public telephone card from Antel, Uruguay. (Telecommunication)" }, { "3B0417D4C882", "prepaid payphone card, issued by Lietuvos Telekomas (now Teo LT)\nhttps://www.teo.lt/" }, + { "3B04190CF600", "USWest TeleCard for Millennium Payphones (Other)" }, { "3B041BF43F54", "German TelefonKarte 50DM. Memory card with Solaic chip (Other)" }, { "3B042AFF3200", "Mac Gray Intelligent Laundry Systems laundry card" }, + { "3B0437E409EC", "prepaid payphone card, issued by Deutsche Telekom 'Telefonkarte Comfort als klassische Karte' (Other)\nhttps://tkc.telekom-dienste.de/" }, { "3B0441117781", "Sample Mifare DESFire contactless smartcard from Phillips" }, { "3B04411177B1", "IBM JCOP 30 contactless" }, { "3B044932432E", "German Health Insurance Card\n'LogCard' from concept2.com (a indoor rower manufacturer)\nI2C card" }, - { "3B0450D7F30E", "Ukranian memory card for public phones. Manufacturer: 'Kvazar' (Other)" }, + { "3B0450D7F30E", "Ukrainian memory card for public phones. Manufacturer: 'Kvazar' (Other)" }, { "3B046089", "Smartcard 3.1 (JavaCard)" }, { "3B04696C2065", "ASE M2 Card 2Kbit (Other)" }, { "3B047F010000", "Russian memory card for payphones. Manufacturer: 'Exiton' (Other)" }, + { "3B0482231091", "VISA DEBIT (Bank)" }, { "3B0492231091", "Siemens SLE 4432/42 card" }, { "3B04989400C4", "Windsor and Maidenhead Advantage Card\nhttp://www.rbwm.gov.uk/web/advantage_index.htm" }, { "3B0499FFFF90", "Madrid prepaid parkimeters parking card" }, @@ -103,6 +107,7 @@ const static atr_t AtrTable[] = { { "3B06010022018227", "HID ProxCard II (Other)" }, { "3B06010100001073", "HID Prox 26-bit (eID)" }, { "3B06010102000001", "HID0009P (eID)" }, + { "3B06010118038209", "HID ProxKey III (125kHz) (eID)\nhttps://www.hidglobal.com/products/cards-and-credentials/hid-proximity/1346" }, { "3B06010210......", "ISOProx II Card:\nhttp://www.hidglobal.com/documents/isoprox_ds_en.pdf" }, { "3B0602..........", "HID Prox H10302 Format\n37 bit (CN)\nhttps://www.hidglobal.com/sites/default/files/omnikey_contactless_developer_guide.pdf" }, { "3B0604..........", "HID Prox H10304 Format\n37 bit (FAC+CN)\nhttps://www.hidglobal.com/sites/default/files/omnikey_contactless_developer_guide.pdf" }, @@ -136,6 +141,7 @@ const static atr_t AtrTable[] = { { "3B12953608", "EMTG56 0.8 (sub-version 0.1)" }, { "3B12953609", "EMTG56 0.9 (sub-version 0.1)" }, { "3B1396130917", "Teacher Card (Other)" }, + { "3B1411CA4DDEAD", "Tricolor (Telecommunication)" }, { "3B151112CA0700DB", "Tricolor TV center card (Pay TV)" }, { "3B151112CA0711CA", "DRE Crypt (Pay TV)" }, { "3B151112CA0714CF", "PlatformaHD (Russia) DRE Crypt 4AE1:14" }, @@ -165,12 +171,14 @@ const static atr_t AtrTable[] = { { "3B16959B0007011803", "Thai GSM UICC (Telecommunication)" }, { "3B1695D00045F70100", "Telefonica O2 Czech Republic, a.s. - O2 sim card - 173285 / SIM64ND.GO0\nhttp://www.o2.cz" }, { "3B1695D0016CFD0D00", "Virgin Mobile SIM card (SIM)" }, + { "3B1695D0017B010E00", "Vivo Brasil - SIM Card (Telecommunication)" }, { "3B1695D0017BDA0D00", "Verizon GSM SIM (Telecommunication)" }, { "3B1696417374726964", "Gemalto IDPrime v2+ .NET" }, { "3B1696770006010403", "AIS One-2-Call GSM UICC (Telecommunication)\nhttp://www.ais.co.th" }, { "3B1696BA000E010603", "Vinaphone Vietnam SIM" }, { "3B1696BA000E020A03", "Vietel (Telecommunication)" }, { "3B1696D000D4072C00", "Vodafone India Postpaid / Local Operator 3G" }, + { "3B1696D0016CA70D00", "Ukrainian Telecommunications Operator MTS (old simcard, now rebranded to Vodafone UA) (Telecommunication)\nhttps://www.vodafone.ua" }, { "3B17118065AF034200D8", "TELE2 SPB SIM Russia" }, { "3B17139C120201010740", "Schlumberger Cyberflex Access Developer 32k" }, { "3B179418010101014193", "T-Mobile SIM card" }, @@ -196,6 +204,7 @@ const static atr_t AtrTable[] = { { "3B1894451543DA0100FF02", "Airtel Tanzania Prepaid SIM Card (Telecommunication)" }, { "3B1894530D06772407FF02", "GSM SIM Tele2 Estonia, prepaid (Telecommunication)" }, { "3B1894532007AD0A05FF02", "GSM SIM Beeline Kazakhstan (Telecommunication)\nhttp://beeline.kz/" }, + { "3B18962621550401030001", "OBILedit Forensic SIM Cloning card (Telecommunication)\nhttps://www.mobiledit.com/connection-kit" }, { "3B19145590010101000508B0", "Schlumberger Multiflex 8k" }, { "3B19145590010201000504B0", "Schlumberger Multiflex 4k" }, { "3B19145901010F01000508B0", "Schlumberger Multiflex 8k" }, @@ -203,6 +212,7 @@ const static atr_t AtrTable[] = { { "3B19943303013145410602B6", "BASE Twin simcard (Telecommunication)" }, { "3B1994806794080125010101", "Mobiphone (Telecommunication)" }, { "3B1996806793270102020401", "Orange SIM card (Telecommunication)" }, + { "3B1996806794090101040104", "Morpho EIRENE GSM-R Card (Telecommunication)" }, { "3B1996806794160203010101", "Movistar Argentina Usim Card (Telecommunication)\nwww.movistar.com.ar" }, { "3B1996806798040101010101", "PLUS gsm (Telecommunication)" }, { "3B1A9692015493320103022501", "BEELINE (Telecommunication)" }, @@ -216,6 +226,7 @@ const static atr_t AtrTable[] = { { "3B1D9600230700000000000000009000", "emulator card prototype from ST" }, { "3B1D97434C5F53414D00143800009000", "CLSAM (Transport)\nhttp://www.planeta.inf.br" }, { "3B1E130069454D4345663228F86B009000", "ECHS (Ex-servicemen Contributory Health Scheme) Card (HealthCare)\nhttp://echs.gov.in/" }, + { "3B1E95806721544D4D04120E7132829F00", "SIM card of old Ukrainian Telecommunications Operator Ace&Base (deriving from Kyivstar) (Telecommunication)\nhttps://kyivstar.ua/uk/mm" }, { "3B1F110067424146495345535266FF819000", "Finnish student id card" }, { "3B1F110067804246495345105266FF819000", "Nokia branded SC (Setec)" }, { "3B1F11006A013846495345108C02FF079000", "GSM-SIM Saunalahti (from 2004)\nFinnish cell phone operator 'Sonera' SIM card (from 2002)" }, @@ -240,7 +251,7 @@ const static atr_t AtrTable[] = { { "3B23003513FF", "Schlumberger MicroPayflex" }, { "3B2300354180", "PayflexHID (idenfitied by Sun Ray Services)" }, { "3B2400......45", "Conax" }, - { "3B240000000000", "MultiChoice satelite TV Card Eutelsat 36B at 35.9degE\nhttp://www.lyngsat.com/Eutelsat-36B.html" }, + { "3B240000000000", "MultiChoice satellite TV Card Eutelsat 36B at 35.9degE\nhttp://www.lyngsat.com/Eutelsat-36B.html" }, { "3B240000E29267", "Health care (HealthCare)" }, { "3B240030423030", "ComHem Digital-TV smartcard (Sweden)\nTNK Telewizja Na Karte (Poland) - Conditional access system : Conax (Norway)\nhttp://telewizjanakarte.pl/" }, { "3B240080729443", "MPCOS-3DES 64K \\ EMV Filter (Gemplus)" }, @@ -258,6 +269,7 @@ const static atr_t AtrTable[] = { { "3B2600311A45039000", "Tajeta Sanitaria Individual (Spanish Insurance Card)\nfrom the 'Junta de Andalucia(Consejeria de Salud)'" }, { "3B2600311A51039000", "Andalusian Health Service identification card (HealthCare)" }, { "3B270011140003029000", "ITTAS CNA Smart Card Reader (PKI)\nhttps://www.ittas.by/en/solutions/cna-cryptographic-protection-of-information" }, + { "3B27002A2A4352595054", "PAY TV (Pay TV)" }, { "3B27008065A2..010137", "Gemplus GemSAFE Smart Card (4K)" }, { "3B27008065A200010137", "Gemplus GemSAFE Card CSP v1.0" }, { "3B27008065A202028237", "Gemplus GPK2000s" }, @@ -317,7 +329,6 @@ const static atr_t AtrTable[] = { { "3B3B13008066120401040158829000", "Schaffhauser Kantonalbank Switzerland (Bank)\nhttp://www.shkb.ch" }, { "3B3B7F380000006A444E496510024C", "dnie (eID)" }, { "3B3B7F380000006A444E496520024C", "DNI (eID)" }, - { "3B3B8E800180318066B1840C016E01830090001C021450", "all transport travel pass (Transport)\nhttp://www.metro.spb.ru/cnblt41.html" }, { "3B3B94000064053E030F31800E9000", "Slovenian national health insurance card" }, { "3B3B940000640E3E02F031800E9000", "HPC card 2\nZZZS Health care professional card- Slovenia (Healthcard) (HealthCare)\nhttps://partner.zzzs.si/wps/portal/portali/aizv/e-poslovanje/kartice_in_citalniki/prof_kartica/" }, { "3B3B940000640E3E030F31800E9000", "HIC card\nZZZS Health care card- Slovenia (HealthCare)\nhttps://partner.zzzs.si/wps/portal/portali/aizv/e-poslovanje/kartice_in_citalniki/kartica_zdravstvenega_zavarovanja/!ut/p/z1/04_Sj9CPykssy0xPLMnMz0vMAfIjo8ziTQxdPd2N_Q08LSyCDQ0cjZzMzXz8XQ3cXU30C7IdFQEohG-V/" }, @@ -400,8 +411,9 @@ const static atr_t AtrTable[] = { { "3B4F004932435F436172643D4E6F5F515452", "AT24C (Bank)" }, { "3B4F00536C653434322D34343DA2131091", "Debit card (Bank)" }, { "3B4F00536C65343433322D34323DA2131091", "VISA (Bank)" }, + { "3B501100", "JAVA (JavaCard)" }, { "3B57180293020101019000", "Easyflex FastOS 2.0 / Schlumberger" }, - { "3B5B96000031C064BAFC10000F9000", "SERGAS - Galician Healtcare Service (Spain) (HealthCare)\nhttps://www.sergas.gal" }, + { "3B5B96000031C064BAFC10000F9000", "SERGAS - Galician Healthcare Service (Spain) (HealthCare)\nhttps://www.sergas.gal" }, { "3B5B96000031C064C6FC1000019000", "Banking card (Oberthur C.S. 06 18710-04-10)" }, { "3B5B96000031C064C7FC1000019000", "EBanking card (Oberthur C.S. 03 1146821)" }, { "3B5E11FF4573744549442076657220312E30", "Estonian Identity Card (EstEID v1.0 2006 warm)" }, @@ -411,11 +423,16 @@ const static atr_t AtrTable[] = { { "3B5F9500807300010059434C5AC506117C9000", "Smart Card C5 68K CardLogix Corp (Other)\nhttps://www.cardlogix.com/products/most-card-c-series-microprocessor-smart-cards/" }, { "3B5F9500807300010059434C5AC50612C09000", "Republic of Liberia Civil Service Identification Card (eID)" }, { "3B5F9600805A2C1100101000FFFFFFFF829000", "Calypso (Transport)" }, + { "3B5F9600805A3F0608140101C546DEDC829000", "Navegante(r) Personalizado (Lisbon public transportation card) (Transport)\nhttps://www.navegante.pt/viajar/cartoes" }, + { "3B5F9600805A3F0608140101C546EBDC829000", "Multi-Transport Pass (Navegante) (Metro, Bus, Electric, Boat) Carris Metropolitano, PT (Transport)\nhttps://www.navegante.pt/" }, + { "3B600000", "Meano (Bank)" }, { "3B61000080", "blank A40CR card (JavaCard)" }, { "3B630000364180", "Schlumberger Payflex 4k User" }, { "3B64..FF8062..A2", "JCOP20" }, { "3B64000080620.51", "Setec SetCOS 5.1.0 EMV" }, { "3B6400FF806202A2", "VISA credit card (Nordea bank)" }, + { "3B6500002063CB3020", "CB / VISA La Banque Postale (IDEMIA) (Bank)" }, + { "3B6500002063CB3040", "Credit Mutuel Debit card (Bank)" }, { "3B6500002063CB4700", "Orga SmartyPlus DATA STORE issued by MORPHO CARDS PERU" }, { "3B6500002063CB6300", "Bank card from Societe Generale (Oberthur)" }, { "3B6500002063CB6400", "Bank card Caisse d'Epargne" }, @@ -460,21 +477,28 @@ const static atr_t AtrTable[] = { { "3B6500002063CBB020", "Credit Mutuel Arkea paycard (Bank)" }, { "3B6500002063CBB120", "Bank card 'Credit Agricole' (Bank)" }, { "3B6500002063CBB280", "Visa card distributed by 'Societe Generale' (French Bank) (Bank)\nVisa card distributed by 'Boursorama Banque' (French Bank) (Bank)\nhttps://www.visa.fr/" }, + { "3B6500002063CBB600", "Maestro Bank Card with chip (Bank)" }, { "3B6500002063CBB620", "MasterCard credit card, issued by Swedbank LT (Bank)" }, { "3B6500002063CBB680", "Visa bank card (Bank)" }, { "3B6500002063CBB700", "Lloyds Bank (UK) 'Avios Duo' Mastercard credit card (Bank)" }, - { "3B6500002063CBB720", "Lloyds Bank Platinum Mastercard Credit (Bank)" }, + { "3B6500002063CBB720", "Lloyds Bank Platinum Mastercard Credit (Bank)\nCredit Agricole Prepaid - Mastercard" }, { "3B6500002063CBB780", "VISA Credit Card (Bank)" }, { "3B6500002063CBB900", "Mastercard (Bank)" }, + { "3B6500002063CBBC", "jcop040 (JavaCard)" }, { "3B6500002063CBBC00", "Credit Agricole MasterCard Societaire (France) (Bank)\nhttps://www.ca-centrefrance.fr/moyens-de-paiement/carte-bancaire-societaire.html" }, { "3B6500002063CBBC10", "French 'Ticket Restaurant' Edenred payment card (Other)\nhttps://www.myedenred.fr/" }, { "3B6500002063CBBC80", "CB / Visa La Banque Postale (Gemalto SP)" }, { "3B6500002063CBBD00", "Credit Mutuel Arkea (Bank)" }, + { "3B6500002063CBBD80", "CARD ONEY BANQUE VISA CREDIT (Bank)\nhttps://www.oney.fr/" }, + { "3B6500002063CBBF00", "Credit Agricole SA (france) (Bank)" }, { "3B6500002063CBC000", "Nickel Credit Card (Bank)\nhttps://nickel.eu" }, { "3B6500002063CBC080", "VISA debit card (Bank)\nhttps://www.cic.fr/fr/banques/professionnels/gestion-courante/cartes-paiement-professionnelles.html" }, { "3B6500002063CBC100", "CIC (Bank)\nhttps://www.cic.fr/" }, + { "3B6500002063CBC300", "CIC Credit Card (Bank)" }, { "3B6500002063CBC310", "Pass Restaurant Sodexo Pass France (Bank)\nhttps://moncompte.sodexopass.fr/" }, { "3B6500002063CBC380", "Apetiz restaurant card (French luncheon vouchers) (Bank)\nhttps://www.apetiz.com/faq/?thematic=achats-apetiz-quoi-quand-combien" }, + { "3B6500002063CBC600", "AuMax / Credit Mutuel (Bank)\nhttps://www.aumaxpourmoi.fr/" }, + { "3B6500002063CBC680", "BNP Paribas Visa Classic Card (Bank)\nhttps://mabanque.bnpparibas/en/managing-your-accounts/cards-and-payment-methods/all-cards/visa-classic-card" }, { "3B6500002063CBFF00", "Credit Agricole business mastercard (Bank)" }, { "3B6500002640009000", "Alacard Petroltech (Transport)\nhttp://www.alacard.kz/" }, { "3B6500002905010201", "ActivCard (Schlumberger) CyberFlex 64K V1 SM 2.1" }, @@ -490,6 +514,7 @@ const static atr_t AtrTable[] = { { "3B660000009C11010103", "Axalto Cyberflex Access 32K V4 SM 1.3" }, { "3B660000009C11010301", "Axalto Cyberflex Access 64K V1 Bio SM 3.1" }, { "3B6600000512010101B1", "Lyon1 student card (Moneo compatible)" }, + { "3B660000112233445566", "Sodexo Restaurant Pass Card (Turkey) (Loyalty)\nhttps://www.sodexoavantaj.com/yemek-karti" }, { "3B660000314B01010080", "VISA credit card (Skandiabanken)" }, { "3B66000032D000300201", "Kazakhstan Kazkom Onlinebank (Homebank) PKI client key-card\nhttps://www.homebank.kz/" }, { "3B66000062C901010000", "safeview (Pay TV)\nhttps://safeviewmedia.com/" }, @@ -563,10 +588,10 @@ const static atr_t AtrTable[] = { { "3B6800000073C84010009000", "Icelandic Banking scheme Issued by the Ministry of Treasure in Iceland\nhttp://www.islandsrot.is/" }, { "3B6800000073C84011009000", "Woolworths Everyday Money prepaid Mastercard\nNordea Bank Norway Visa + national debet card [BankAxept]\nVISA Classic - Nordlandsbanken (Norway)\nCiti Double Cash MasterCard\nWescom Credit Union Visa Debit Card (Bank)\nhttps://www.wescom.org/CHECKING/CHECK-CARD.ASP" }, { "3B6800000073C84012009000", "Brazilian 'e-CPF' card" }, - { "3B6800000073C84013009000", "MASTERCARD issued by MLP (Marschollek, Lautenschlager and Partner)\nG&D 12696-GDM-10/11 DEBIT CARD issued by BANCO DE CREDITO DEL PERU\nVisa from Caisse populaire Desjardins (Canada) (Bank)\nhttps://www.desjardins.com/\nMasterCard issued by President's Choice Bank (Canada)\nhttp://pcfinancial.ca/mastercard\nMasterCard issued by CIBC (Canada)\nhttp://www.cibc.com/\nMasterCard issued by The Bank of Nova Scotia (Canada)\nhttp://www.scotiabank.com/\nMasterCard issued by JPMorgan Chase Bank, N.A.\nhttps://www.chase.com/\nCaixaBank Visa Electron (Bank)\nhttps://www.lacaixa.cat/\nAmerican Express Canada Credit Card (Bank)" }, + { "3B6800000073C84013009000", "MASTERCARD issued by MLP (Marschollek, Lautenschlager and Partner)\nG&D 12696-GDM-10/11 DEBIT CARD issued by BANCO DE CREDITO DEL PERU\nVisa from Caisse populaire Desjardins (Canada) (Bank)\nhttps://www.desjardins.com/\nMasterCard issued by President's Choice Bank (Canada)\nhttp://pcfinancial.ca/mastercard\nMasterCard issued by CIBC (Canada)\nhttp://www.cibc.com/\nMasterCard issued by The Bank of Nova Scotia (Canada)\nhttp://www.scotiabank.com/\nMasterCard issued by JPMorgan Chase Bank, N.A.\nhttps://www.chase.com/\nCaixaBank Visa Electron (Bank)\nhttps://www.lacaixa.cat/\nAmerican Express Canada Credit Card (Bank)\nAlfa-bank Russia Visa" }, { "3B6800000073C8401300907D", "NextCard - Mastercard Debit card - Intesa Sanpaolo Bank (Italy) (Bank)\nhttps://www.intesasanpaolo.com/it/persone-e-famiglie/prodotti/carte/carte-di-debito/next-card.html" }, { "3B68000000DE511001019000", "Itau Bank Mastercard Debit Card (Brazil) (Bank)\nhttps://www.itau.com.br" }, - { "3B6800000101309600009000", "Edenred - French Restauration e-Ticket card (2013) (Other)\nhttps://www.edenred.fr/ticket-restaurant" }, + { "3B6800000101309600009000", "Edenred - French Restoration e-Ticket card (2013) (Other)\nhttps://www.edenred.fr/ticket-restaurant" }, { "3B6800000101310000009000", "VISA ELECTRON Sberbank card (Bank)\nSubmarino MasterCard credit card (Brazil) (Bank)\nhttps://www.submarino.com.br/landingpage/ofertas-cartao-submarino" }, { "3B6800000102109600009000", "Italian BancoPostaClick Postamat Card (Poste Italiane) -\nMasterCard debit card\nmbna PLATINUM MasterCard\nFlash (Banca Fideuram) Italy prepaid Mastercard" }, { "3B6800000105200000009000", "Air Bank a.s. MasterCard debit card with PayPass (Bank)" }, @@ -589,7 +614,8 @@ const static atr_t AtrTable[] = { { "3B6800008066B00701010707", "Java Gemalto R7 (Bank)\nGemalto Santander Optelio TUI R7 with WG10 using Contact interface" }, { "3B6800008066B00701017707", "Tecnico Lisboa Student Card (Bank)\nhttp://www.tecnico.ulisboa.pt/\nOther Optelio Card (Santander)\nSantander Totta Student Card - Portugal (Bank)\nhttps://www.santandertotta.pt" }, { "3B68000081000350010F9000", "Holvi Payment Master Card (Bank)\nhttp://www.holvi.com" }, - { "3B680000990200D103042201", "N26 business debit card (Bank)\nhttps://n26.com/en-de/business-account" }, + { "3B680000990100C103042201", "Robinhood Debit (Bank)\nhttps://robinhood.com/us/en/" }, + { "3B680000990200D103042201", "N26 business debit card (Bank)\nhttps://n26.com/en-de/business-account\nVisa cards from Inecobank, Armenia" }, { "3B6800009D03020101564953", "Visa Card - SberBank / Russia" }, { "3B6800009D08010201564953", "Visa Card - bonus - DenizBank / Turkey" }, { "3B6800009D080103014F5453", "MasterCard Card - bonus - Garanti Bank / Turkey" }, @@ -605,7 +631,7 @@ const static atr_t AtrTable[] = { { "3B6900002494010000000001A9", "Kazakhstan Helios gas station debit card\nhttp://helios.kz/" }, { "3B6900002494010201000101A9", "Chipcard from SUN to be used in SunRay's\n370-4328-01 (31091)" }, { "3B6900002494010301000100A9", "Schlumberger MicroPayflex S card" }, - { "3B6900004944353056312E....", "eID Card to user authenticate and save paswords in the Card. Product ID50 Password manager from IDENTOS GmbH (eID)\nhttps://identos.com/id50-password-manager/" }, + { "3B6900004944353056312E....", "eID Card to user authenticate and save passwords in the Card. Product ID50 Password manager from IDENTOS GmbH (eID)\nhttps://identos.com/id50-password-manager/" }, { "3B6900004944363056312E....", "token appidkey ID60-USB (Other)\nhttps://identsmart.com/en/products/id60-datasafe/" }, { "3B6900004A434F503331563232", "Visa Europe Sample Card / Axalto" }, { "3B6900005001010401000101A9", "Sample card given to all attendees of the CTST 2004 SmartCard Conference" }, @@ -624,7 +650,7 @@ const static atr_t AtrTable[] = { { "3B690000F704010601800102A9", "Azeriqaz Smart Payment (eID)\nhttp://azeriqaz104.az/" }, { "3B690000F704010801800102A9", "Multinet (Other)" }, { "3B69000241434F534A76313031", "ACOSJ 40K Dual Interface (JavaCard)" }, - { "3B69000241434F534A76323033", "ACS ACOSJ Java Card (JavaCard)\nhttps://www.acs.com.hk/en/products/405/acosj-java-card-combi/" }, + { "3B69000241434F534A7632303.", "ACS ACOSJ Java Card (JavaCard)\nhttps://www.acs.com.hk/en/products/405/acosj-java-card-combi/" }, { "3B6900FF00644A100432059000", "NXP JCOP 20 V2.1 16K" }, { "3B6900FF3131313054434F5350", "Seven-Eleven Value Card / Smart Purse - Thailand (Other)\nhttp://www.7eleven.co.th/about7card.php" }, { "3B6900FF323332435343533336", "CSCS smart card. Must be read using CSCS go smart software.\nhttps://download.cscsreader.co.uk/" }, @@ -658,8 +684,10 @@ const static atr_t AtrTable[] = { { "3B6B00000031806443B002008C6127", "Bull Odyssey 1.2 (Javacard 2.0)" }, { "3B6B00000031C06400273400079000", "American Express Gold Air France - KLM (Bank)" }, { "3B6B00000031C064002734000F9000", "American Express Chip and Signature Card (Contact) ()\nhttps://americanexpress.com/chipandsignature" }, + { "3B6B00000031C06408046105079000", "TBC Bank Mastercard (Georgia) (Bank)\nhttps://www.tbcbank.ge/web/en/cards-and-subscription-plans" }, { "3B6B00000031C06408046112079000", "Visa Electron. BSB Bank. Belarus (Bank)" }, { "3B6B00000031C064080461120F9000", "Portuguese National Identity Card (eID)\nhttps://www.autenticacao.gov.pt/o-cartao-de-cidadao" }, + { "3B6B00000031C06408046114079000", "Belarusbank VISA credit card (Belarus) (Bank)" }, { "3B6B00000031C06408046120079000", "AMEX Bank DI Card (Bank)" }, { "3B6B00000031C06408046176079000", "Alliance Bank Debit Card (Bank)" }, { "3B6B00000031C064080461770F9000", "'Strelka' Russian Federation Travelcard (Transport)\nhttp://strelkacard.ru/" }, @@ -674,20 +702,24 @@ const static atr_t AtrTable[] = { { "3B6B00000031C064083981040F9000", "Visa Debit (Bank)" }, { "3B6B00000031C064083991080F9000", "MasterCard Bank Card (Bank)\nhttps://www.creditonebank.com/" }, { "3B6B00000031C064084403040F9000", "VISA debit card (ActivoBank, Portugal) (Bank)\nhttps://www.activobank.pt" }, + { "3B6B00000031C06408440305019000", "mastercard (Bank)" }, { "3B6B00000031C064084403050F9000", "Visa (Bank)" }, { "3B6B00000031C06408440312079000", "VISA (Bank)" }, { "3B6B00000031C064084403120F9000", "Debit Card/MasterCard shipped by electronic Bank N26 (Number26) (Bank)\nhttps://n26.com/de-de/\nBBVA (Spain) (MasterCard) debit card (Bank)\nhttps://www.bbva.es/eng/productos/ficha/tarjeta-ahora-bbva/0000009719" }, { "3B6B00000031C06408440313079000", "MasterCard, Alfa Bank (Russia) (Bank)\nhttps://alfabank.ru/everyday/debit-cards/perekrestok-prepaid/" }, { "3B6B00000031C064084403680F9000", "Credit card emitted by KBC Brussels, Belgium (Bank)\nAdvanzia Credit Card (Master Card gold), Germany (IDK if there is a difference between the german one and the other ones) (Bank)\nhttps://mastercard.gebuhrenfrei.com/\nItalian Intesa Sanpaolo Superflash Prepaid Mastercard (Bank)" }, { "3B6B00000031C06408440376079000", "Blu American Express Credit Card (Bank)\nhttps://www.americanexpress.com/it/content/carta-blu/" }, - { "3B6B00000031C064084403760F9000", "Maestro debit card, issued by Caixa Geral de Depositos (Bank)\nhttps://www.cgd.pt/Particulares/Cartoes/Cartoes-de-Debito/Pages/Cartao-Debito-Cauxautomatica-Maestro.aspx" }, + { "3B6B00000031C064084403760F9000", "Maestro debit card, issued by Caixa Geral de Depositos (Bank)\nhttps://www.cgd.pt/Particulares/Cartoes/Cartoes-de-Debito/Pages/Cartao-Debito-Cauxautomatica-Maestro.aspx\nCredit Agricole Bank Card - Bancomat / Maestro\nDanske Bank Mastercard Debit" }, + { "3B6B00000031C06408440377079000", "Sber bank VISA with Novacard chip (Bank)" }, + { "3B6B00000031C064084403930F9000", "MIR card (Bank)" }, { "3B6B00000031C064084841080F9000", "Monizze card. Card use to pay only meal. (Other)\nhttp://www.monizze.be" }, { "3B6B00000031C064131402000F9000", "UBA Card PREPAID (Bank)" }, { "3B6B00000031C0641F1801000F9000", "Portuguese Medical Association eID card (Cedula Profissional, Ordem dos Medicos, Portugal) (eID)\nhttp://www.omsul.pt/tabid/242/Default.aspx" }, { "3B6B00000031C0641F270100079000", "SOCCARDRT (HealthCare)" }, - { "3B6B00000031C0641F2701150F9000", "VISA Debit card for HSBC, Australia" }, + { "3B6B00000031C0641F2701150F9000", "VISA Debit card for HSBC, Australia\nDanske Bank Mastercard Debit" }, { "3B6B00000031C0641F27011C079000", "Raiffeizen Bank, Russia, MasterCard paypass card (Bank)" }, { "3B6B00000031C0641F2701350F9000", "V PAY (Bank)\nhttps://www.unicreditbulbank.bg/en/individual-clients/everyday-banking/payments/debit-cards/" }, + { "3B6B00000031C0643F680100079000", "JCOP empty card (JavaCard)" }, { "3B6B00000031C0643F6801020F9000", "dinacard (Bank)" }, { "3B6B00000031C0643F680103079000", "American Express Blue Cash (Bank)\nhttps://www.americanexpress.com/us/credit-cards/" }, { "3B6B00000031C0643F6801030F9000", "HSBC Credit Gold Card from VISA (Bank)" }, @@ -700,15 +732,25 @@ const static atr_t AtrTable[] = { { "3B6B00000031C064BE1B01030F9000", "dsafas (Telecommunication)" }, { "3B6B00000031C064D0100100079000", "Alfa-Bank (Russia) Master Card (Aeroflot bonus) (Bank)" }, { "3B6B00000031C16408603206079000", "HSBC (Bank)" }, + { "3B6B00000031C164086032060F90", "VISA (National Bank) (eID)" }, { "3B6B00000031C164086032060F9000", "Nationwide Building Society VISA Debit card (Bank)" }, + { "3B6B00000031C164086032090F9000", "Swedbank Estonia ISIC debit card (Bank)\nhttps://www.swedbank.ee/private/cards/debit/isic" }, { "3B6B00000031C164086032100F9000", "ICA Bank, Mastercard (Bank)\nhttps://www.icabanken.se/kort-och-betala/bankkort/" }, { "3B6B00000031C1640860321F079000", "NMRC Card (Transport)" }, { "3B6B00000031C1640860321F0F9000", "Fio bank, Mastercard, credit (Bank)\nhttps://www.fio.cz/bankovni-sluzby/platebni-karty/kreditni-karty" }, { "3B6B00000031C164086032200F9000", "Twisto (Bank)" }, { "3B6B00000031C16408603221079000", "DSK Bank Debit Mastercard (Bank)" }, + { "3B6B00000031C164086032220F9000", "Universidade de Aveiro (ID Card) (eID)\nhttps://www.ua.pt/pt/sas/cartao" }, + { "3B6B00000031C164086032420F9000", "Westpac Handybank EFTPOS/ATM Card (Bank)" }, { "3B6B00000031C164087771300F9000", "Apple Card (from launch) (Bank)\nhttps://www.apple.com/apple-card/" }, { "3B6B00000031C16408777156079000", "American Express UK Euro ICC charge card (Bank)\nhttps://www.americanexpress.com/icc/cards/the-basic-international-currency-card.html" }, + { "3B6B00000031C16408986200079000", "EquaBank Master Card (Bank)\nhttps://equabank.cz" }, + { "3B6B00000031C164089862000F9000", "NovaKBM Visa Debit (Bank)" }, { "3B6B00000031C164089862010F9000", "Sodexo Czech Gastro/Multipass (Other)\nhttps://www.sodexo.cz/" }, + { "3B6B00000031C1640924331E0F9000", "Cembra Money Bank - Certo! Mastercard credit card (Bank)\nhttps://certo-card.ch/certo/de/" }, + { "3B6B00000031C164092962250F9000", "SANTANDER BASIC CASH CARD (Bank)\nhttps://www.santander.co.uk/assets/s3fs-public/2018-09/Basic%20Current%20Account%20KFD.pdf" }, + { "3B6B00000031C16409644136079000", "HSBC UK Visa Debit Card (Bank)\nhttps://www.hsbc.co.uk/content/dam/hsbc/gb/pdf/help/hsbc-visa-debit-card-guide.pdf" }, + { "3B6B00000031C164096441360F9000", "VISA Business Folio AS /Norway (Sparebanken Vest) [IDEMIA] (Bank)\nhttps://folio.no/" }, { "3B6B000020900000000000B0A2BD69", "Fudan FM1280 (JavaCard)" }, { "3B6B0000426C756361726420344B42", "Blutronics Blucard 4K (Loyalty)\nhttp://blucard.blutronics.com" }, { "3B6B00004348495031342056312E30", "Swiss PostFinance Card (Bank)\nhttps://www.postfinance.ch/en/priv/prod/card/pfcard.html" }, @@ -739,7 +781,10 @@ const static atr_t AtrTable[] = { { "3B6C00004E544943339051024A030000", "Topas TV (Pay TV)" }, { "3B6C000080641134014873F741C08107", "Universal Electronic Card (UEC Russia) (eID)" }, { "3B6C0000806411650190730000008107", "Universal Electronic Card (UEC Russia) (eID)" }, + { "3B6C00008066B1A30401110B83009000", "NAVY F.C.U. (JavaCard)" }, + { "3B6C00008066B1A330401110B8300900", "Visa debit (Bank)" }, { "3B6C0002366186384B8C13046203598A", "Nagravision, Swiss mode" }, + { "3B6C00FF50564A434F50323156323331", "Al Etihad (Bank)" }, { "3B6C00FF8073C8211366010611590001", "Visa Crypto Business Electron by neyvabank.ru (Bank)\nhttps://neyvabank.ru/uploads/files/download/bankdirectvisacryptocardreader.pdf" }, { "3B6D0000", "PVT (Bank)" }, { "3B6D0000003180642DA0040C71968C6129", "UK Co-operative Bank Visa Debit (produced 2002)" }, @@ -756,6 +801,7 @@ const static atr_t AtrTable[] = { { "3B6D00000031C071D664A0010400849000", "Swiss Mastercard M-Budget (Bank)" }, { "3B6D00000031C071D66511223301839000", "UK Co-operative Bank Visa Debit (produced 2006)" }, { "3B6D000000664D453153050653036104F0", "FutureCard Ind. LLC / Feb-18 | Blank card for programming (JavaCard)" }, + { "3B6D00000073C800136447374237009000", "VISA DEBIT CLASSIC BANK OF AMERICA (Bank)" }, { "3B6D00000073C800136447374532009000", "Canada TD Bank Visa Debit/Interac Debit Card (Bank)" }, { "3B6D00000073C80013644A374237009000", "Sberbank Visa card (Bank)" }, { "3B6D00000073C800136454334433009000", "FirstBankcard issued for overstock.com (Bank)\nhttp://www.firstbankcard.com/overstock/" }, @@ -795,9 +841,10 @@ const static atr_t AtrTable[] = { { "3B6D000080318065B0872701BC83089000", "Kazcommertsbank\nhttp://en.kkb.kz/page/WhoWeAre\none of the biggest banks in Republic of Kazakhstan\nNordea (Finland) + Finnair MasterCard (credit)\nGXP7 T=0" }, { "3B6D000080318065B0873401D783009000", "Fidelity Investment Rewards (AMEX) (Bank)\nhttps://www.fidelity.com/cash-management/american-express-cards" }, { "3B6D000080318065B0893501F183009000", "Bank of America BankAmericard Travel Visa Chip Card (Gemalto)\nhttps://www.bankofamerica.com/credit-cards/products/bankamericard-travel-rewards-credit-card.go\nCredito Trevigiano - Banca di Credito Cooperativo - Carta BCC\nVISA Signature issued by RBC Bank (Georgia), N.A.\nhttps://www.rbcbank.com/\nBanca Popolare di Novara - (Bancomat Maestro)" }, - { "3B6D000080318065B0894001F283009000", "PSAM Card" }, + { "3B6D000080318065B0894001F283009000", "PSAM Card\nNordea Mastercard Card" }, { "3B6D00008067A1110101640855830E9000", "Italian Intesa SanPaolo Maestro" }, { "3B6D00FF003180718E6448D50200829000", "Blue for Business, American Express@Business" }, + { "3B6D00FF0031C173C8400052A1D8009000", "Discover it Credit Card (Bank)\nhttps://www.discover.com/credit-cards/cash-back/it-card.html" }, { "3B6D00FF80655343010D067394211B810[15]", "Giesecke & Devrient CardToken 350 (ICCD)" }, { "3B6D00FF8073002113574A544861314700", "ActiveKey SIM" }, { "3B6D00FF8073002113574A544861314800", "Spanish Medical College Card" }, @@ -824,7 +871,7 @@ const static atr_t AtrTable[] = { { "3B6E00000031C0657CB501018071D68C6121", "MUFG CARD (AMEX .jp) (Bank)\nhttp://www.cr.mufg.jp/mufgcard/support/webs/" }, { "3B6E00000031C065BCD002010671D68C612E", "Lloyds TSB Mastercard Credit Card" }, { "3B6E00000031C065BCD002010671D68C6133", "Lloyds TSB Visa Debit\nBarclays Visa DEBIT" }, - { "3B6E00000031C065BCD002010671D68C6143", "S-pankki (Finland) Visa Debit" }, + { "3B6E00000031C065BCD002010671D68C6143", "S-Pankki (Finland) Visa Debit" }, { "3B6E00000031C065BCD102010171D68C6133", "Travelex Cash Passport - Prepaid MasterCard Currency Card" }, { "3B6E00000031C065BCD102010171D68C6135", "MasterCard Card, issues by Rabobank in the Netherlands" }, { "3B6E00000031C065D3C102012871D68C6122", "Visa debit card" }, @@ -910,10 +957,11 @@ const static atr_t AtrTable[] = { { "3B6E0000626C756361726420344B422F7634", "eID Blutronics Blucard 4K\nhttp://blucard.blutronics.com" }, { "3B6E0000626C756361726420384B422F7634", "eID Blutronics Blucard 8K\nhttp://blucard.blutronics.com" }, { "3B6E00008025A00000002856801024000111", "Opencard, new card in Prague, Czech Republic (transport card)" }, + { "3B6E0000803108721422574458544B4E3031", "DX-Token (eID)\nhttps://www.dexon.ind.br/produtos-dxtoken" }, { "3B6E000080318065B00301015E8300009000", "FirstUSA Visa" }, { "3B6E000080318065B00302015E8300009000", "Gemplus GemXpresso 211is" }, { "3B6E000080318066B0070300AC0183009000", "e-payment card with topup system, propreteary by local bank\nhttp://www.klikbca.com/individual/silver/product.html?s=69" }, - { "3B6E000080318066B0840C016E0183009000", "Optelio Cards (D72 R4 WR)\nNordea (a Skandinavian bank) eID card\nhttp://linux.fi/wiki/Nordea_eID\nRBC Royal Bank Client Card (bank in Canada)\nBanco Santander TUI/USC R7\nGemalto Optelio/Desineo D72 (JavaCard) with WG10 and Maestro (JavaCard) (Bank)\nCarte Ticket Restaurant with MasterCard\nCitigold VISA Debit for Citibank, Australia\nPlatinum VISA card for Citibank, Australia\nVISA Infinite issued by RBC Royal Bank (Canada)\nhttp://www.rbc.com/\nPostepay Evolution - Poste Italiane (mastercard)\n'la Caixa' (Spain) (VISA Electron) debit card (Bank)\nhttps://www.lacaixa.es/\nItalian Webank.it BPM Banca Popolare di Milano Bancomat & Maestro Card (Bank)" }, + { "3B6E000080318066B0840C016E0183009000", "Optelio Cards (D72 R4 WR)\nNordea (a Skandinavian bank) eID card\nhttp://linux.fi/wiki/Nordea_eID\nNordea Mastercard card\nNordea Visa card\nRBC Royal Bank Client Card (bank in Canada)\nBanco Santander TUI/USC R7\nGemalto Optelio/Desineo D72 (JavaCard) with WG10 and Maestro (JavaCard) (Bank)\nCarte Ticket Restaurant with MasterCard\nCitigold VISA Debit for Citibank, Australia\nPlatinum VISA card for Citibank, Australia\nVISA Infinite issued by RBC Royal Bank (Canada)\nhttp://www.rbc.com/\nPostepay Evolution - Poste Italiane (mastercard)\n'la Caixa' (Spain) (VISA Electron) debit card (Bank)\nhttps://www.lacaixa.es/\nItalian Webank.it BPM Banca Popolare di Milano Bancomat & Maestro Card (Bank)\nSberbank of Russia MIR debit card (Bank)\nMasterCard bank card by OTP Bank (Hungary)" }, { "3B6E000080318066B08412016E0183009000", "Barclaycard Platinum VISA\nInteligo debit card\nVISA issued by ING (Poland)\nVISA Debit card for ING Direct, Australia\nVISA Gold issued by RBC Royal Bank (Canada)\nhttp://www.rbc.com/\nGas Natural Fenosa Visa (issued by CaixaBank) (Bank)\nhttp://www.clubfenosa.gasnaturalfenosa.es/ca/1285341160257/targeta+gas+natural+fenosa.html" }, { "3B6E000080318066B08416016E0183009000", "UK 'Barclaycard Gold VISA' with RFID" }, { "3B6E000080318066B0870C016E0183009000", "Banco Santander TUI/USC R7 - Gemalto Optelio/Desineo D72 (JavaCard)\nhttp://www.observatoriotui.com/home" }, @@ -927,17 +975,24 @@ const static atr_t AtrTable[] = { { "3B6E00FF00620000574156414E5410819000", "debit card (Visa Electron) issued by Nordea bank" }, { "3B6E00FF4573744549442076657220312E30", "Estonian Identity Card (EstEID v1.0 warm)" }, { "3B6E00FF47442D47502D333256342D444553", "Mastercard Ourocard Platinum from Banco do Brasil" }, + { "3B6F000000004A300A86454A5A231044433330", "Personal Card (eID)" }, { "3B6F00000031C068435350454D560300079000", "SOCCARDRT (HealthCare)" }, { "3B6F00000031C173C821106441443231009000", "Debit Card for Santander Universidades PT (Bank)\nhttps://www.santander.pt/pt_PT/Particulares/Universitarios.html" }, + { "3B6F00000031C173C821106441443530009000", "Discover Cashback Debit (Bank)\nhttps://www.discover.com/online-banking/" }, + { "3B6F00000031C173C8211064414D3347", "CHASE DEBIT VISA (JavaCard)" }, + { "3B6F00000031C173C8211064414D3347079000", "Java (JavaCard)" }, { "3B6F00000031C173C8211064474D3131009000", "Beutsche Bank Business mastercard credit (Bank)\nhttps://www.deutsche-bank.de/gk/zahlungsverkehr/zahlungsverkehr-im-ueberblick/kreditkarte.html" }, { "3B6F00000031C173C8211064474D3133009000", "Bank card from the Commonwealth Bank of Australia (Bank)\nhttps://www.commbank.com.au/business/pds/cbb127_eftpos_int_v7.pdf" }, { "3B6F00000031C173C8211064474D3134009000", "bancomat Banca Popolare Milano + maestro debit card + rfid (Bank)" }, + { "3B6F00000031C173C8211064474D3136009000", "Highest level of DNB AS (Norway (Bank)" }, { "3B6F00000031C173C8211064474D3331009000", "BBVA Antes Card (Spain) (VISA) prepaid card (Bank)\nhttps://www.bbva.es/eng/productos/ficha/tarjeta-antes-bbva/0T00000225" }, { "3B6F00000031C173C8211064474D3332009000", "td debit visa card (Bank)\nScotiabank ScotiaCard Interac/Visa debit card (Bank)\nhttps://www.scotiabank.com/ca/en/personal/ways-to-bank/debit-credit-prepaid-cards/debit-cards/scotiacards.html" }, { "3B6F00000031C173C8211064474D3338009000", "ING Direct Debit Card (Bank)" }, { "3B6F00000031C173C8211064474D3341009000", "Fineco debit card (Bancomat, Visa Debit) (Bank)\nhttps://finecobank.com/it/online/conto-e-carte/carte-e-bancomat/" }, - { "3B6F00000031C173C8211064474D3435009000", "VISA card, issued by OP Financial Group, Finland (Bank)" }, + { "3B6F00000031C173C8211064474D3435009000", "VISA card, issued by OP Financial Group, Finland (Bank)\nVISA card, issued by S-Pankki, Finland (Bank)" }, { "3B6F00000031C173C8211064474D3437009000", "Visa credit card, issued by Klarna (Bank) (Bank)\nhttps://www.klarna.com/se/kort/" }, + { "3B6F00000031C173C8211064474D3533009000", "American Express Platinum Card Mexico (Bank)\nhttps://www.americanexpress.com/mx/tarjetas-de-credito/the-platinum-credit-card/" }, + { "3B6F00000031C173C821106457493035009000", "Discover EMV Card (Bank)" }, { "3B6F00000031C173C821106457493036009000", "neat MasterCard (Bank)\nhttps://www.neatcommerce.com/" }, { "3B6F00000031C173C821106457493131009000", "Banca Popolare Di Sondrio (IT) - Ateneo+ Card for University of Brescia (Bank)\nhttps://www.ateneopiu.it/home" }, { "3B6F00000031C173C8211064574B3037009000", "NatWest VISA Debit card (Bank)\nhttps://personal.natwest.com/personal/current-accounts/select_account.html" }, @@ -945,7 +1000,7 @@ const static atr_t AtrTable[] = { { "3B6F00000031C173C821106457533430009000", "PNC Debit (Bank)" }, { "3B6F000000664D453161030153086104F09000", "Spanish University of Murcia smart ID card - Old version (M.Mar OS) - Also used by many others spanish universities" }, { "3B6F000000664D4531B1030153086104F09000", "Spanish UCAM University smart ID card - (M.Mar OS) - Also used by many others spanish universities" }, - { "3B6F000000664D45668003..53066103F09000", "Millenium Card (www.coruna.es/millennium) municipal city card for A Coruna, Spain.\nelectronic wallet for paying services like parking meter or public service (bus) transportation." }, + { "3B6F000000664D45668003..53066103F09000", "Millennium Card (www.coruna.es/millennium) municipal city card for A Coruna, Spain.\nelectronic wallet for paying services like parking meter or public service (bus) transportation." }, { "3B6F000000664D456680030C53066105F09000", "Transporte Metropolitano de Galicia (Transport)\nhttp://tmg.xunta.gal/" }, { "3B6F000000664D456680031453036104F09000", "Paypal Prepaid Card (YoUnique Money E.D.E.)" }, { "3B6F000000664D456680031653066105F09000", "Transport Metropolitano de Galicia (Transport)\nhttps://tmg.xunta.gal/" }, @@ -956,6 +1011,7 @@ const static atr_t AtrTable[] = { { "3B6F000000B854211004900000000000000000", "VIABUY Credit card (Bank)\nhttp://www.viabuy.de" }, { "3B6F000000B854311007900000000000000000", "Revolut Premium Mastercard (Bank)\nhttps://www.revolut.com/revolut-premium\nMonzo Bank (UK) Debit Mastercard\nhttps://monzo.com/\nLansforsakringar (SE) Debit Mastercard\nhttps://www.lansforsakringar.se/\nING Direct MasterCard (Bank)\nhttps://www.ing.es/tarjetas-ing" }, { "3B6F00000231B813FF000000000000000F9000", "Coverflex | Flexible Benefits Platform (Other)\nhttps://www.coverflex.com/" }, + { "3B6F00003101F1564011001900000000000000", "Postepay Evolution (Bank)\nhttps://postepay.poste.it/prodotti/postepay-evolution.html" }, { "3B6F0000626C75636172642031364B422F7634", "eID Blutronics Blucard 16K\nhttp://blucard.blutronics.com" }, { "3B6F00008031C0520083640219083283839000", "Bancomer Mexican Bank" }, { "3B6F00008031C05205B5640200647183839000", "Read Card in USB, used for application in Java. (JavaCard)" }, @@ -966,6 +1022,7 @@ const static atr_t AtrTable[] = { { "3B6F00008031C05211F46402B3023783839000", "VISA (Bank)" }, { "3B6F00008031C052132F640219083283839000", "Cajamadrid-UCM (Madrid, Spain) Cash/Visa Electron" }, { "3B6F00008031C05216B9640566803283839000", "Banorte Mexican Bank" }, + { "3B6F00008031C05216F5640569937083839000", "BANCO INTERAMERICANO DE FINANZAS, S.A.E.M.A. (Bank)" }, { "3B6F00008031C05220E2640562178083839000", "VISA MedicusMundi (VISA Classic Affinity credit card, issued by Laboral Kutxa) (Bank)\nhttps://www.medicusmundi.es/es/que-puedes-hacer-tu/tarjetas-affinity" }, { "3B6F00008031E05B4555520000000000070200", "Pre-loaded wallet card. 'Mondex is a smart card electronic cash system, implemented as a stored-value card' (Bank)\nhttps://en.wikipedia.org/wiki/Mondex" }, { "3B6F00008031E05B4E4F4B0000000000000200", "Norsk-Tipping (Buypass) Monodex card" }, @@ -994,6 +1051,7 @@ const static atr_t AtrTable[] = { { "3B6F00008031E06B04520502BB555555555555", "AlfaBROU - Mastercard (prepaid card emitted by Banco Republica - Uruguay) (Bank)\nhttps://www.brou.com.uy/personas/tarjetas/prepaga-alfabrou" }, { "3B6F00008031E06B04520502FD555555555555", "C6 Bank Mastercard Global Account (Bank)\nhttps://www.c6bank.com.br/conta-global\nC6 Bank Mastercard Brazil Account (Bank)\nhttps://www.c6bank.com.br/nossos-produtos" }, { "3B6F00008031E06B04520502FE555555555555", "CITIBanamex 'Perfiles' debit card (Bank)\nhttps://www.banamex.com/es/personas/cuentas/cuenta-perfiles.html" }, + { "3B6F00008031E06B04546B026D555555555555", "Mastercard Credit/Debit Card (Bank)" }, { "3B6F00008031E06B0505050280555555555555", "Banamex cuenta perfiles (Bank)\nhttp://banamex.com" }, { "3B6F00008031E06B0508050283555555555555", "Bank of Montreal debit card" }, { "3B6F00008031E06B0512050287555555555555", "American Express credit card" }, @@ -1047,8 +1105,11 @@ const static atr_t AtrTable[] = { { "3B6F0000805A080608201223C202795D829000", "OPUS is card for storing public transit passes and tickets (Transport)\nhttps://opusenligne.ca/" }, { "3B6F0000805A080608201223C2036347829000", "OPUS Card RTC Quebec's Bus system (Canada) (Transport)\nhttps://opusenligne.ca" }, { "3B6F0000805A080608201223C204D07F829000", "OPUS Card (Transport)\nhttps://en.wikipedia.org/wiki/OPUS_card" }, + { "3B6F0000805A080608201223C210E956829000", "Montreal Public transport Card (OPUS) (Transport)\nhttps://www.stm.info/en/info/fares/opus-cards-and-other-fare-media/opus-card" }, { "3B6F0000805A080608201223C21113A6829000", "OPUS (Montreal and Quebec transport card) (Transport) (Transport)\nhttps://www.stm.info/en/info/fares/opus-cards-and-other-fare-media/opus-card" }, { "3B6F0000805A080608201223C21290FD829000", "OPUS Montreal Societe des Transports de Montreal Metro and Bus card. (Transport)\nhttps://www.stm.info/en/info/fares/opus-cards-and-other-fare-media" }, + { "3B6F0000805A080608201223C215C411829000", "Montreal OPUS Transportation Card for the STM, STL, RTM and RTL (Transport) (Transport)" }, + { "3B6F0000805A080608201223C21BAFB4829000", "OPUS card (Transport)\nhttps://www.stm.info/en/info/fares/opus-cards-and-other-fare-media/opus-card" }, { "3B6F0000805A0A010120031103DCB31B829000", "Card Transport 'Lignes d'Azur' of 'Metropole Nice Cote d'Azur'" }, { "3B6F0000805A0A01012003119361D7D7829000", "Carte Tecely (Reseau TCL: metro, tramway, bus et funiculaire de Lyon) (Idemia)" }, { "3B6F0000805A0A0102200311........829000", "Card << Oura ! >> of region Rhone-Alpes, Calypso standard (TER, Transisere)" }, @@ -1072,10 +1133,16 @@ const static atr_t AtrTable[] = { { "3B6F0000805A0A070620042C031B899B829000", "Israeli public transport 'RavKav' card (ASK variant) (Transport)\nhttp://www.dannorth.co.il/" }, { "3B6F0000805A0A070620042C031C112A829000", "Peronalized RavKav (Transport)\nhttps://ravkavonline.co.il/he/" }, { "3B6F0000805A0A070620042C03288444829000", "rav-kav (Transport)\nhttp://nohal.mot.gov.il/%d7%94%d7%92%d7%93%d7%a8%d7%95%d7%aa%20%d7%91%d7%a0%d7%95%d7%a9%d7%90%20%d7%9b%d7%a8%d7%98%d7%95%d7%a1%20%d7%97%d7%9b%d7%9d.aspx" }, + { "3B6F0000805A0A070620042C0490EFCB829000", "Rav-Kav Israel (Transport)\nhttps://ravkavonline.co.il" }, { "3B6F0000805A0A070620042DC1660B73829000", "Rav-Kav: Israel's Travel Card (Transport)" }, { "3B6F0000805A0A070620042DC169517A829000", "Card for bus (Transport)" }, + { "3B6F0000805A0A070620042DC2E8E270829000", "ravkav (Transport)" }, + { "3B6F0000805A0A070620042DC3229072829000", "Israelian public transportation smartcard for all bus and rail services, called a Rav-Kav, RavKav, or Rav Kav. This variant is NFC capable. (Transport)\nhttps://ravkavonline.co.il/" }, { "3B6F0000805A28010220122103346577829000", "ONYGO! pass\nhttp://www.region-basse-normandie.fr/pass-onygo" }, + { "3B6F0000805A280102201221C12AD1C8829000", "SIMPLI CITES (Transport)\nhttps://www.fluo.eu/" }, + { "3B6F0000805A280102201221C365AF0F829000", "SIMPLI CITE Stan (France) (Transport)\nhttps://www.reseau-stan.com/" }, { "3B6F0000805A2811421010122B260CD45A829000", "French transport card Navigo (Transport)\nhttps://www.iledefrance-mobilites.fr/je-gere-ma-carte" }, + { "3B6F0000805A28114210122B03791BB9829000", "RATP Navigo Easy Paris France (Transport)\nhttps://www.transilien.com/fr/page-tarifs/navigo-easy" }, { "3B6F0000805A28114210122B037A89AA829000", "Ile-de-France Mobilites (Navigo Easy) (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/supports/passe-navigo-easy" }, { "3B6F0000805A28114210122B037AED59829000", "Navigo Easy (Paris) (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/supports/passe-navigo-easy" }, { "3B6F0000805A28114210122B23A9E229829000", "Navigo(French transport) (Transport)\nhttp://www.navigo.fr/je-gere-ma-carte/" }, @@ -1120,6 +1187,8 @@ const static atr_t AtrTable[] = { { "3B6F0000805A28130210122B03F80BC3829000", "Korrigo Card (Transport in Rennes Area in France ) (Transport)\nhttps://www.star.fr/titres-tarifs/carte-korrigo/" }, { "3B6F0000805A28130210122B7500559A829000", "Contact card to handle personal travel tickets in the Britany area. Used by several travel operators like SNCF TER Bretagne, STAR in Rennes, BIBUS in Brest,.... (Transport)" }, { "3B6F0000805A28130210122B75021B8A829000", "KorriGo, smart transport card in France region Brittany (Transport)\nhttps://www.ter.sncf.com/bretagne/offres/carte-korrigo" }, + { "3B6F0000805A28130210122B7503FB01829000", "origo (France) (Transport)\nhttps://www.breizhgo.bzh/se-deplacer-en-bretagne/KorriGo" }, + { "3B6F0000805A28130210122B750C7E79829000", "Transportation card delivered by STAR (Transportation service from the city of Rennes, France) (Transport)\nhttps://www.star.fr/titres-et-tarifs/carte-korrigo/" }, { "3B6F0000805A28130210122B9292E642829000", "Transport card in cote d'or France (mobigo)" }, { "3B6F0000805A28130210122B9292E829829000", "French transport card of the city of Dijon and Cote d'or department. (Transport)\nhttps://www.viamobigo.fr/fr/acheter-mes-titres-de-transport-mobigo-en-cote-dor/176" }, { "3B6F0000805A28130210122B92D663FC829000", "Card 'Korrigo' region Bretagne, France, Bibus Brest Metropole public transport (Transport)\nhttps://fr.wikipedia.org/wiki/KorriGo" }, @@ -1132,6 +1201,7 @@ const static atr_t AtrTable[] = { { "3B6F0000805A2C06081010059316213D829000", "Portuguese Viva Card (Transport)\nhttp://www.portalviva.pt" }, { "3B6F0000805A2C0608101005932268D0829000", "Public transport card lisbon (Transport)\nhttp://www.portalviva.pt" }, { "3B6F0000805A2C0608101005932346E2829000", "Lisboa Viva (Transport)" }, + { "3B6F0000805A2C060810100593237A11829000", "Portuguese Lisboa Viva Viagem Transport Card (Transport)" }, { "3B6F0000805A2C11C31010057B01004B829000", "French Military Circulation card (Transport)" }, { "3B6F0000805A2C11C31010057B0A1DBA829000", "French military discount on SNCF trains card (Transport)" }, { "3B6F0000805A2C11C31010057B120D53829000", "French military transport card (Transport)" }, @@ -1156,11 +1226,16 @@ const static atr_t AtrTable[] = { { "3B6F0000805A2D060810100278324D6F829000", "Lisboa Viva card, public transport card of Lisbon (Portugal) (Transport)\nhttps://www.portalviva.pt" }, { "3B6F0000805A2D06081010027835EDCE829000", "Lisbon Transportation SmartCard (Transport)" }, { "3B6F0000805A2D06081010027848BBCC829000", "Lisbon Metro Monthly Student Pass (Transport)\nhttps://www.metrolisboa.pt/" }, + { "3B6F0000805A2D0608101005935C42FB829000", "Comboios de Portugal Transit Card (Transport)\nhttps://www.cp.pt/passageiros/pt/consultar-horarios/precos/cartao-cp" }, { "3B6F0000805A3407061500017917A7E2829000", "Rav-Kav multi-line travel ticket used in the public transportation system in Israel (Transport)\nhttps://www.gov.il/en/departments/guides/multi_line_card" }, + { "3B6F0000805A340706150001792A4B5C829000", "Rav Kav Transit Payment Card (Israel) (Transport)\nhttps://ravkavonline.co.il/" }, { "3B6F0000805A3B0706150101793E797B829000", "Rav Kav (Transport)\nhttp://alhakav.mot.gov.il/he/rav-kav" }, { "3B6F0000805A3B070615010279537211829000", "Israeli public transport card ('RavKav') (Transport)\nhttps://ravkavonline.co.il" }, { "3B6F0000805A3B07061501027956C5F4829000", "RAVKAV - Israel dual interface transport card (Calypso standard) (Transport)\nhttps://en.wikipedia.org/wiki/Rav-Kav" }, + { "3B6F0000805A3B070615010279C3C331829000", "Rav-Kav Israel (Transport)\nhttps://ravkavonline.co.il" }, { "3B6F0000805A3C0608140101C3805E38829000", "Lisboa VIVA - Lisbon public transport card (Transport)\nhttps://www.portalviva.pt/" }, + { "3B6F0000805A3C0608140101C4D4FEC4829000", "Metropolitan Transports of Lisbon NAVEGANTE Card (Transport)\nhttps://www.navegante.pt/viajar/cartoes" }, + { "3B6F0000805A3C0608140101C4D522FB829000", "Navegant Perdonal Card - Transportes Metropolitanos de Lisboa (Transport)\nhttps://www.navegante.pt/" }, { "3B6F0000805A3C1142141001274AC890829000", "Gemalto Celego G1 (Transport)" }, { "3B6F0000805A3C114214100127A46D02829000", "Navigo decouverte Paris (Transport)\nhttp://www.navigo.fr/titres/le-forfait-navigo-semaine-presentation/" }, { "3B6F0000805A3C114214100127B3C81B829000", "Transport card for Paris (France) and its region. Market name is Navigo (Transport)" }, @@ -1172,8 +1247,10 @@ const static atr_t AtrTable[] = { { "3B6F0000805A3C1142141001C17BC993829000", "Navigo Easy (Transport)\nhttps://www.ratp.fr/titres-et-tarifs/passe-navigo-easy" }, { "3B6F0000805A3C1142141001C17DA8CA829000", "Navigo Easy (France) transport card (Transport)\nhttps://www.ratp.fr/titres-et-tarifs/passe-navigo-easy" }, { "3B6F0000805A3C1142141001C185D47B829000", "Navigo Liberte+ -- French (Paris region) transport card (Transport)" }, + { "3B6F0000805A3C1142141001C2A40D5F829000", "'Pass Navigo Decouverte' - Parisian transport card (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/supports/passe-navigo-decouverte" }, { "3B6F0000805A3C1142141001C2BF7B46829000", "Navigo RATP (Transport)" }, { "3B6F0000805A3C1330141001C3568397829000", "'oura' card for leman express and ter sncf rhone-alpes (Transport)" }, + { "3B6F0000805A3C1330141001C4F81130829000", "Oura card which allows to travel across many transport networks of France region: Auvergne-Rhone-Alpes (Transport)\nhttps://www.oura.com/" }, { "3B6F0000805A3C23C4141001C02EF7F8829000", "MOBIB basic Brussels (with NFC) (Transport)\nhttps://mobib.be/en.html" }, { "3B6F0000805A3C23C4141001C02EFA97829000", "Brussels STIB MOBIB Classic (Transport)\nhttps://www.stib-mivb.be/mobib.html" }, { "3B6F0000805A3C23C4141001C02FDEFA829000", "MOBIB public transport card (Belgium); contacted IC (Transport)" }, @@ -1187,7 +1264,9 @@ const static atr_t AtrTable[] = { { "3B6F0000805A3D0706150101792CB636829000", "RavKav (Transport)" }, { "3B6F0000805A3D23C41501027937D7AE829000", "MOBIB - Brussels (Transport)\nhttps://www.stib-mivb.be/article.html?_guid=d02c7fb6-3e9c-3810-248e-eec4ee5ebc8c&l=fr" }, { "3B6F0000805A3D23C41501027949789C829000", "MOBIB basic (Transport)\nhttp://www.stib-mivb.be/article.html?_guid=30af0085-2483-3410-5394-a71daf08acd1&l=en#contentBodyList1" }, + { "3B6F0000805A3D23C4150102795A863C829000", "mobib transportation card (Transport)" }, { "3B6F0000805A3D23C415010279748A25829000", "Mobib (Brussels transport card) for the STIB-MIVB network (Transport)\nhttps://www.stib-mivb.be/article.html?_guid=d02c7fb6-3e9c-3810-248e-eec4ee5ebc8c&l=fr" }, + { "3B6F0000805A3D23C415010279A9E567829000", "MoBIB card, a medium for the transport tickets of the four Belgian public transport operators (Transport)\nhttps://mobib.be/" }, { "3B6F0000805A434F4C44000000000000829000", "LBB Berlin, MasterCard (ADAC branding?)" }, { "3B6F0000805A4880C1205001AEC00295829000", "Calypso SAM C1 (Transport)" }, { "3B6F0000806645460138180353023110829000", "Fabrica Nacional de Moneda y Timbre FNMT WG10\nhttp://www.fnmt.es/es/html/tage/fichaTarjeta/fp1_ta_01.asp" }, @@ -1198,7 +1277,7 @@ const static atr_t AtrTable[] = { { "3B6F00008066A20302023D0753023110829000", "Electronic purse of the Universidad Politecnica of Madrid (provided by Banco Santander)" }, { "3B6F00008066B007010107............9000", "Gemalto Santander Optelio TUI R7 with WG10 customized using Contact interface" }, { "3B6F00008066B0070101070753023110829000", "Banco Santander TUI/USC R7 - Gemalto Optelio/Desineo D72 (JavaCard) with WG10 (JavaCard)" }, - { "3B6F00008066B0070101070753023124829000", "Banco Santander TUI/USC R7 - Gemalto Optelio/Desineo D72 (JavaCard) with WG10 and Maestro (JavaCard)" }, + { "3B6F00008066B0070101070753023124829000", "Banco Santander TUI/USC R7 - Gemalto Optelio/Desineo D72 (JavaCard) with WG10 and Maestro (JavaCard)\nClient bizness card (Bank)" }, { "3B6F00008066B007010177............9000", "Other Optelio Card (Santander)" }, { "3B6F00008066B0070101770753023110829000", "University ID card (issued by Banco Santander Central Hispano)\n.\nUniversidad Nacional de Educacion a Distancia (UNED, Spain)\nhttp://www.uned.es/tarjeta\n.\nUniversitat Politecnica de Catalunya (UPC.edu)\nhttps://www.upc.edu/identitatdigital\n.\nUniversitat Ramon Llull (URL)\nhttp://www.url.edu/cont/url/carnet.php" }, { "3B6F00008066B0070101770753023124829000", "Santander 4B Maestro\nUniversity of Santiago de Compostela. Spain\nPolytechnical University of Madrid, Spain" }, @@ -1227,7 +1306,7 @@ const static atr_t AtrTable[] = { { "3B76130000806207418181", "TransLink card (discontinued San Francisco Bay Area transit card)" }, { "3B76980000009C11010102", "CyberFlex Access 32" }, { "3B771800004B4153414B4944", "Identification Kazakhstan Republic (passport)\nhttps://egov.kz/" }, - { "3B7812000047C403008FF19000", "Sattelite bg 23.5 East cryptoworks card" }, + { "3B7812000047C403008FF19000", "Satellite bg 23.5 East cryptoworks card" }, { "3B7812000054C401078FF19000", "XtraMusic listening card (Pay TV)" }, { "3B7812000054C40204FFFF6F04", "UPC Direct Satellite TV Card (Pay TV)\nhttp://www.upcdirect.com/" }, { "3B7812000054C402078FF19000", "Polish WIZJA TV pay-tv card for satellite receivers (Pay TV)" }, @@ -1247,11 +1326,14 @@ const static atr_t AtrTable[] = { { "3B781400000073C8400000", "e-tazkira (eID)" }, { "3B781800000073C80140009000", "The Kyrgyz Republic eID (eID)" }, { "3B781800000073C840000000009000", "VERISOFT REWARDO LOYALTY CARD and CUSTOM PERSONALIZATION PROJECTS FOR EXTERNAL ENTITIES (Loyalty)\nhttp://www.verisoft.com" }, + { "3B781800000073C84013009000", "Mastercard (Bank)" }, { "3B781800005448204E4944203.", "Thailand National ID (eID)" }, { "3B7818000100000000C31E6919", "Storage for passwords (Bank)" }, { "3B781800FF0073C84000009000", "NAB Visa Debit - Contact I/F (Bank)" }, + { "3B789400008684044930310604", "bank of china Debit Card (Bank)" }, { "3B789600000073C84000009000", "SAM card for acquirer module by lanit.ru (Bank)" }, { "3B789600005343066001079000", "Bank of America Travel Rewards Credit Card (Bank)\nhttps://www.bankofamerica.com/credit-cards/products/travel-rewards-credit-card/" }, + { "3B789600005343066201079000", "ATM Card (Bank)" }, { "3B789600008100035001079000", "RMA BMCE BANK CARD (Bank)" }, { "3B791100008054434F4C44829000", "amazon.de / VISA / LBB Debit Card (Bank)" }, { "3B79130000806416030183829000", "Raiffeisen VPay Debit Card (Bank)\nhttp://raiffeisen.ch" }, @@ -1262,11 +1344,13 @@ const static atr_t AtrTable[] = { { "3B791800008054434F4C44829000", "LBB VISA Card" }, { "3B7918000080634B560283079000", "Pay charge of South Korean Highway Tollgate, It named hi-pass. This card is sales by 'SM hiplus', and card name is 'Greencar Postpaid hi-pass Card'. In this name, 'Greencar' means South Korea's Car Sharing Service. This card from Rented car. (Transport)\nhttps://www.lottecard.co.kr/" }, { "3B79180000806355500183079000", "TEST SAM Card (espark) (Other)" }, + { "3B79180000806355561183039000", "Hi-Pass (Other)" }, { "3B79180000806355561283079000", "'hi-pass+ Prepaid hi-pass Card' pay charge of South Korean Highway Tollgate. Sold by 'SM hiplus' (Transport)\nhttp://www.hipluscard.co.kr/" }, { "3B799400005901010E016B0102A9", "Vending machine payment card ('Necta' brand)" }, { "3B79940000EB03010102700102A9", "Sodexo - Spanish vending machines (Other)\nhttp://es.sodexo.com/home.html" }, { "3B79940000F704010103800102A9", "Pelican Rouge, vending machine (Other)\nhttp://colnect.com/es/functional_cards/functional_card/26065-Maquinas_Cafe_-_Pelican_Rouge-Pelican_Rouge-Vending-Espa%C3%B1a\nhttp://www.pelicanrouge.co.uk/en-uk/about-us" }, { "3B7995000054454C454D10211010", "Israeli Identity Card (eID)\nhttp://smartid.gov.il/English/Pages/default.aspx" }, + { "3B799600002001010601000100E9", "Casino (Other)" }, { "3B799600005448204E494420313.", "Thai National ID Card (eID)" }, { "3B799800005001010401000101A9", "Gemalto PayFlex used in Aristocrat System 7000 Casino Management System (South Africa only)" }, { "3B79980000EB03010000700101A9", "Casino Rio Patras, Greece" }, @@ -1287,16 +1371,17 @@ const static atr_t AtrTable[] = { { "3B7A9600008065A201200100303D72D641", "Oman eID (eID)" }, { "3B7A9600008065A20120013D72D641", "Oman eID (eID)" }, { "3B7A9700008065B08520040272D64.", "OMAN EID CARD (eID)" }, + { "3B7A9700008065B08521040272D641", "Oman eID (eID) (eID)\nhttps://idp.pki.ita.gov.om/" }, { "3B7B..000080620.515646696E454944", "Setec SetCOS 5.1.0" }, { "3B7B..00008065B083......83009000", "IDClassic 3XX Cards (without MPCOS Applet - FIPS)" }, - { "3B7B11000031FE45436F6D624F532000", "Debit card emmited by Societe Generale Morocco (Bank)" }, + { "3B7B11000031FE45436F6D624F532000", "Debit card emitted by Societe Generale Morocco (Bank)" }, { "3B7B1800000031C06477E30300829000", "Oberthur Cosmopolic 64K v5.2 D" }, { "3B7B1800000031C06477E91000019000", "Oberthur Card Systems: Cosmo 64 RSA V5.4 (ISK Key Set: 404142 .. 4E4F)" }, { "3B7B1800000031C06490E31100829000", "oberthur card in the middle http://postarca.posta.si/downloadfile.aspx?fileid=16918 (eID)\nhttp://postarca.posta.si/" }, { "3B7B1800000031C064C6FC1000079000", "Sberbank of the RUSSIAN federation" }, { "3B7B1800000031E85427E60000019000", "Oberthur ID-One COSMO 64k v.5" }, - { "3B7B180000806201545646696E454944", "FineID identity card for organizations\nhttp://fineid.fi/default.aspx?id=491\nhttp://www.opensc-project.org/opensc/wiki/FinnishEid" }, - { "3B7B94000080621[12]515646696E454944", "Finnish Electronic ID card (fineid card www.fineid.fi)" }, + { "3B7B180000806201545646696E454944", "FineID identity card for organizations\nhttps://dvv.fi/en/organisation-cards\nhttps://github.com/OpenSC/OpenSC/wiki/Finnish-FINEID" }, + { "3B7B94000080621[12]515646696E454944", "Finnish Electronic ID card for persons (Former FINeID card)\nhttps://dvv.fi/en/citizen-certificate-and-electronic-identity" }, { "3B7B9400008065521607865383009000", "Truemove H Thailand (Telecommunication)\nhttp://truemoveh.truecorp.co.th/" }, { "3B7B9400008065B083010[13]7483009000", "Gemplus GemXpresso Pro R3 (E64 PK)" }, { "3B7B9500008065B08301047483009000", "Gemplus GemXpresso Pro 64K R3 FIPS v2" }, @@ -1341,8 +1426,9 @@ const static atr_t AtrTable[] = { { "3B7D94000080318065B08311C0A983009000", "GemXpresso R4 72K\nNational ID card of Republic of Lithuania (2007-2012)" }, { "3B7D95000080318065B08302047E83009000", "Gemalto's Classic TPC HM CC Mifare 1K White PVC\n(Old name GemSafeXpresso 64K)" }, { "3B7D95000080318065B08311....83009000", "Portuguese ID Card (eID)\nhttp://www.cartaodecidadao.pt/" }, + { "3B7D96000080318065B07549170F83009000", "DoD CAC card issued ~October 2020, Gemalto TOP DL V2.1 144K, Geneva Conventions Identification Card (PKI)\nhttps://www.cac.mil/" }, { "3B7D96000080318065B0830201F383009000", "Gemalto IDClassic 340" }, - { "3B7D96000080318065B0831100C883009000", "GEMALTO Clasic TPC IM CC" }, + { "3B7D96000080318065B0831100C883009000", "GEMALTO Classic TPC IM CC" }, { "3B7D96000080318065B0831111AC83009000", "GEMALTO WM GX4 72 DHS TSA" }, { "3B7D96000080318065B0831111E583009000", "Gemalto TOP DL v2 StdR\neCPF (Cadastro de Pessoas Fisicas) from Imprensa Oficial do Brasil\nIdentidade digital (e-CPF) from Caixa\nhttp://www.caixa.gov.br/\nIngenico Sign/Kit Telium TETRA (Developer kit signature card)\nhttps://developer.ingenico.com/hc/en-gb\nBrazilian 'e-CNPJ' card, issued by Certisign (Safesign)" }, { "3B7D96000080318065B0831113AC83009000", "CAC card (GEMALTO GCX4 72K DI)" }, @@ -1375,7 +1461,7 @@ const static atr_t AtrTable[] = { { "3B7E9400008025A00000002856801021000114", "CryptoPlus ProID, students ISIC card at University of Zilina, Slovakia\nTOP GX4 72k contact chip using JavaCard v2.2.1. and GlobalPlatform 2.1.1" }, { "3B7E9400008025A00000002856801024000111", "'OpenCard' - card issued by Prague local authority\ndual card: chip used for electronic certificates" }, { "3B7E9400008025D20310010056000000010100", "Personal identity card (ID card) of Czech Republic" }, - { "3B7E9400008025D20310010056000000020200", "Official Czech Republic identity card issued since 7/2018 (eID)\nhttps://www.eidentita.cz/" }, + { "3B7E9400008025D20310010056000000020200", "Official Czech Republic identity card issued since 7/2018 (eID)\nhttps://info.identitaobcana.cz/eop/" }, { "3B7E94000080318066475091450313830F9000", "JTOP Trusted Logic" }, { "3B7E940000803180664750A4450511830F9000", "JTOP Trusted Logic" }, { "3B7E9500008031807334118082900000000000", "IAS (Identification, Authentication, and electronic Signature) Premium, profil DGME from Gemalto" }, @@ -1410,17 +1496,19 @@ const static atr_t AtrTable[] = { { "3B7F1300008031C0520B71640566983683839000", "OuroCard VISA International - Banco do Brasil" }, { "3B7F1300008031C0520BBB640566983683839000", "VISA OUROCARD Banco do Brasil S.A." }, { "3B7F1300008031C0520D1E640566946183839000", "Universitat Politecnica de Valencia ID Visa Electron Card\nhttp://www.upv.es" }, - { "3B7F1300008031C0520DEA640566946183839000", "Universitat Rovira i Virgili Identification Card\nThis card enables his/her propietary to sign documents and to access to rooms, laboratories and classes." }, + { "3B7F1300008031C0520DEA640566946183839000", "Universitat Rovira i Virgili Identification Card\nThis card enables his/her proprietary to sign documents and to access to rooms, laboratories and classes." }, { "3B7F1300008031C0520ED4640566966183839000", "BBVA Blue Card (VISA)\nwww.bluebbva.com" }, { "3B7F1300008031C05210496402B3027083839000", "Bank of Brazil (Bank)\nhttp://www.bb.com.br/pbb/pagina-inicial" }, { "3B7F1300008031C05210686402B3027083839000", "Santander VISA (Brazil) (Bank)" }, { "3B7F1300008031C05210A46402B3027083839000", "EMV Smartcard Reader (Other)\nSaraiva (Banco do Brasil) - VISA (Bank)\nhttps://www.bb.com.br/pbb/pagina-inicial/voce/produtos-e-servicos/cartoes#/" }, { "3B7F1300008031C052112F640569937083839000", "Banco do Brasil (Bank)\nhttp://www.bb.com.br/" }, { "3B7F1300008031C05212936402B3027083839000", "Visa Infinite issued by Banco do Brasil (www.bb.com.br)\nManufactured by Giesecke & Devrient (G&D www.gi-de.com)" }, + { "3B7F1300008031C05213076402B3023783839000", "Banco do Brasil ELO Debito (Brazil) (Bank)" }, { "3B7F1300008031C052130B6402B3023783839000", "Visa Ourocard Platinum from Banco do Brasil" }, { "3B7F1300008031C0521366640566983683839000", "VISA Platinum from Banco do Brasil" }, { "3B7F1300008031C05214D5640566966183839000", "Visa Electron Debit Card issued by Spain Caja Madrid (www.cajamadrid.es)" }, { "3B7F1300008031C0521554640566983683839000", "VISA Card from Banc Sabadell in Spain" }, + { "3B7F1300008031C0521563640200647183839000", "VISA CREDIT (Bank)" }, { "3B7F1300008031C05215B8640200647183839000", "Debit classic card banorte 'banco mercantilmdel norte' (Bank)\nhttps://www.banorte.com/" }, { "3B7F1300008031C05215C7640569937083839000", "Brazil Bank Debit Cart - Visa Electron (Banco do Brasil) (Bank)" }, { "3B7F1300008031C05215CB640566966183839000", "Bank, Spanish group BANKIA (www.bankia.es)\nVisa, Servired\nManufactured by Saetic\nhttp://www.saetic.es/" }, @@ -1488,13 +1576,16 @@ const static atr_t AtrTable[] = { { "3B7F960000006A444E4965200101550421039000", "DNI electronico (Spanish electronic ID card) (eID)\nhttp://www.dnielectronico.es" }, { "3B7F960000006A444E4965200177980311039000", "Spanish ID card (DNIe) (eID)\nwww.dnielectronico.es/" }, { "3B7F960000006A464E4D54030411430430039000", "CERES Spanish SmartCard from the 'Fabrica Nacional de Moneda y Timbre' (FNMT) (eID)\nhttp://www.cert.fnmt.es/" }, + { "3B7F960000006A54494633000101550422039000", "DNIe Spain (eID)\nhttps://www.dnielectronico.es/PortalDNIe/" }, { "3B7F96000000B854311007900000000000000000", "Mastercard (Bank)" }, { "3B7F96000000B854311107900000000000000000", "STPay-Gold (JavaCard)\nhttp://www.st.com/en/secure-mcus/stpay-gold.html" }, { "3B7F9600003100DE525001001500000000000000", "VALES (Bank)" }, + { "3B7F9600008031805843657274756D3031829000", "Certum Electronic Seal (PKI)" }, { "3B7F9600008031806555850300EF124140829000", "Civil ID (eID)" }, { "3B7F96000080318065B0842327E5120FFE829000", "Gemalto IDPrime MD 3810 dual interface smartcard ISO 7816, ISO 14443 and NFC (PKI)\nhttp://www.smartcardfocus.com/shop/ilp/id~672/gemalto-idprime-md-3810-dual-interface-smartcard/p/index.shtml" }, { "3B7F96000080318065B084413DF612004C829000", "Serasa Experian (Other)" }, { "3B7F96000080318065B084413DF6120FFE829000", "Gemalto IDPrime MD" }, + { "3B7F96000080318065B084413DF612FFFE829000", "THALES IDCore 30 B (JavaCard)\nhttps://cpl.thalesgroup.com/access-management/idcore-java-card" }, { "3B7F96000080318065B084534C0F12037B829000", "Serbian International Student Identity Card (ISIC) (eID)\nhttps://www.gpa.rs/kartice" }, { "3B7F96000080318065B0846160FB120FFD829000", "IDPrime 930/3930 FIPS Level 2 or Level 3 (T=0 CT=96) (BAI1, BAI2, BAI3, BAI5, BAI7) (PKI)" }, { "3B7F96000080318065B0850201F3120FFF829000", "Swedish National Identity Card (eID)\nhttps://polisen.se/tjanster-tillstand/pass-och-nationellt-id-kort/" }, @@ -1510,18 +1601,25 @@ const static atr_t AtrTable[] = { { "3B7F96000080318065B085040120120FFF829000", "Belgian eID v1.8 (eID)\nhttps://github.com/Fedict/eid-mw" }, { "3B7F96000080318065B085040120F20001829000", "Health Insurance Institute of Slovenia - Health Insurance Card Gen. 3 (HealthCare)" }, { "3B7F96000080318065B085040120F20002829000", "Health Insurance Institute of Slovenia - Professional Card Gen. 3 (HealthCare)" }, + { "3B7F96000080318065B085050011120FFF829000", "LuxTrust card (Luxembourg qualified electronic signature / authentication system) (Other)\nhttps://www.luxtrust.com/en/professionals/smartcard" }, + { "3B7F96000080318065B0855956FB120268829000", "qualified certificate (eID)\nhttps://www.elektronicznypodpis.pl/en/offer/qualified-certificates/" }, + { "3B7F96000080318065B0855956FB1202C1829000", "Gemalto USB (eID)" }, { "3B7F96000080318065B0855956FB12FFFE829000", "IDCORE 3140 (JavaCard)" }, { "3B7F9600008031B865B0850300EF1200F6829000", "Finnish identity card (eID)\nhttp://vrk.fi/en/citizen-certificate" }, { "3B7F9600008031B865B08504021B1200F6829000", "Finnish ID-card v5.0(?) (eID)\nhttps://dvv.fi/en/fineid-specifications" }, + { "3B7F9600008031B865B085050011122460829000", "wasim finnish id (eID)" }, { "3B7F960000EA5CBDF07AEB6541894B0400000000", "Gemalto TOP IM GX4 (Other)" }, + { "3B7F960080318065B084413DF612004C829000", "Black (PKI)\nhttps://certificadodigital.imprensaoficial.com.br" }, { "3B7F9700000031C173C821106457533430009000", "PNC Bank VISA card (Bank)" }, + { "3B7F97000080318065B08466693912FFFE829000", "IDCore3230 build 6.8, test APDU applet (JavaCard)" }, { "3B7F980000805A070404000102028458F2829000", "Mobili'carte (Angouleme mobility services card) (Transport)\nhttp://www.mobilite-grandangouleme.fr/" }, { "3B800181", "NXP Semiconductors VNG OpenPGP Card (Other)\nhttps://www.vng.com.vn/" }, - { "3B80800101", "ISO 14443 Type B without historical bytes\nElectronic Passport\nSpanish passport (2012)\nCanadian Passport\nVenez_Prox" }, + { "3B801FC78031E073FE211163407163830790009A", "Intertelecom UA RUIM card (Telecommunication)\nhttps://www.intertelecom.ua/" }, + { "3B80800101", "ISO 14443 Type B without historical bytes\nElectronic Passport\nSpanish passport (2012)\nCanadian Passport\nVenez_Prox\nCarta nazionale dei servizi\nhttps://www.agid.gov.it/it/piattaforme/carta-nazionale-servizi" }, { "3B810020", "Old MobilCOM GSM (Telecom D1) (Telecommunication)" }, { "3B81010080", "Rompetrol Romania Fill&Go Fuel Card (Other)" }, { "3B811F00CC52", "eToken R2 2242" }, - { "3B8180018080", "RFID - ISO 14443 Type A - NXP DESFire or DESFire EV1 or EV2\n'Reiner LoginCard' (or 'OWOK', how they name it) - they have been distributed by a german computer magazine ('Computer BILD')\nhttps://cardlogin.reiner-sct.com/\nBelgium A-kaart (Antwerp citycard)\nOyster card - Transport for London (second-gen 'D')\nhttps://en.wikipedia.org/wiki/Oyster_card\nKaba Legic Advant 4k\nSydney Opal card public transport ticket (Transport)\nhttps://www.opal.com.au\nTH Koln (University of Applied Sciences Cologne) - Student Identity Card\nhttps://www.th-koeln.de/en/academics/multica_5893.php\nGerman red cross blood donation service\nhttp://www.blutspende-nordost.de/\nGreater Toronto/Hamilton/Ottawa PRESTO contactless fare card\nhttp://en.wikipedia.org/wiki/Presto_card\nElectic vehicle charging card of the EMSP EnBW Energie Baden-Wurttemberg AG, Tarif ADAC e-Charge, Germany" }, + { "3B8180018080", "RFID - ISO 14443 Type A - NXP DESFire or DESFire EV1 or EV2\n'Reiner LoginCard' (or 'OWOK', how they name it) - they have been distributed by a german computer magazine ('Computer BILD')\nhttps://cardlogin.reiner-sct.com/\nBelgium A-kaart (Antwerp citycard)\nOyster card - Transport for London (second-gen 'D')\nhttps://en.wikipedia.org/wiki/Oyster_card\nKaba Legic Advant 4k\nSydney Opal card public transport ticket (Transport)\nhttps://www.opal.com.au\nTH Koln (University of Applied Sciences Cologne) - Student Identity Card\nhttps://www.th-koeln.de/en/academics/multica_5893.php\nGerman red cross blood donation service\nhttp://www.blutspende-nordost.de/\nGreater Toronto/Hamilton/Ottawa PRESTO contactless fare card\nhttp://en.wikipedia.org/wiki/Presto_card\nElectric vehicle charging card of the EMSP EnBW Energie Baden-Wurttemberg AG, Tarif ADAC e-Charge, Germany" }, { "3B8180018181", "Ticket (Transport)" }, { "3B82005518", "GSM SIM of TIM ITalian mobile company" }, { "3B82005519", "GSM card 'Hi' (KPN brand)" }, @@ -1575,9 +1673,12 @@ const static atr_t AtrTable[] = { { "3B8580012063CBAD0021", "NUMBER26 MasterCard (Bank)\nhttps://number26.eu" }, { "3B8580012063CBAD2001", "KBC Ireland MasterCard Debit Card (Bank)\nhttp://www.kbc.ie/" }, { "3B8580012063CBAD80A1", "VISA Caisse d'Epargne (Bank)\nVISA BNP Paribas (NFC) (Bank)" }, - { "3B8580012063CBB7201B", "Halifax Clarity Mastercard (Bank)" }, + { "3B8580012063CBB7003B", "Visa card issued by OTP Bank (Hungary) (Bank)\nhttps://www.otpbank.hu/portal/en/Retail/Bankcards" }, + { "3B8580012063CBB7201B", "Halifax Clarity Mastercard (Bank)\nCredit Agricole Prepaid - Mastercard" }, { "3B8580012063CBB780BB", "First Direct Debit (Bank)" }, { "3B8580012063CBB880B4", "VISA Cleo LCL (Bank)\nhttps://particuliers.lcl.fr/quotidien/cartes/carte-visa-cleo/" }, + { "3B8580012063CBC6004A", "Gold Mastercard Credit Agricole (Bank)" }, + { "3B858001300101301014", "German public health insurance card (,,Gesundheitskarte'), 2.1 generation (G2.1), issuer Techniker Krankenkasse (HealthCare) (HealthCare)\nhttps://www.gematik.de/telematikinfrastruktur/egk" }, { "3B858001300101303034", "German Health Insurance Card 'elektronische Gesundheitskarte' (eGK) / European Health Insurance Card (EHIC) (HealthCare)\nhttps://fachportal.gematik.de/karten-und-identitaeten/elektronische-gesundheitskarte" }, { "3B8580014A4D52544441", "JMRTD - Java Machine Readable Travel Document (ePassport emulator\nhttp://jmrtd.org/)" }, { "3B8580014D7945494478", "MyEID" }, @@ -1588,21 +1689,27 @@ const static atr_t AtrTable[] = { { "3B858001A000000000A4", "Italian Passport (passport)" }, { "3B85C0FA216380630101051B", "Public Distribution System\nhttp://cg.nic.in/pdsonline/corepds/" }, { "3B8640206801010204AC", "Activcard Gold, SchlumbergerSema Cryptoflex 8k" }, + { "3B8640FA808101520301", "SCOSTA (JavaCard)" }, { "3B86800100049AEE00CABD", "ASK CPL 528" }, { "3B86800103020211000015", "cash bee card. transportation and payment in south korea (seoul) (Transport)\nhttp://cashbee.co.kr" }, { "3B86800106757781028000", "NXP Mifare DESFire EV1 8K / MF3ICD81\n'OpenCard' - card issued by Prague local authority\ndual card: RFID (1k Mirfare) used for parkimeters and as public traffic ticket" }, { "3B86800106757781028F00", "Desfire (eID)" }, { "3B8680013930433032317E", "Chase Freedom VISA card" }, + { "3B86800143686970313733", "PostFinance Switzerland (Bank)\nhttp://www.postfinance.ch" }, { "3B86800144492030324D65", "Lufthansa Miles & More Gold MasterCard PayPass\nRaiffeizen Bank, Russia, MasterCard paypass card" }, { "3B8680014449203032567E", "DKB VISA paywave (Bank)\nhttp://www.visaeurope.com/en/cardholders/visa_paywave.aspx" }, { "3B8680014A434F50333012", "Mifare ProX T=CL" }, { "3B8680014A434F50333113", "JCOP BIO 31 Contactless Card" }, { "3B8680014B4F4E4112203E", "Citibank Russia, Mastercard paypass" }, + { "3B8680014B4F4E4113213E", "Vivid Money Visa Debit (Bank)\nhttps://vivid.money" }, { "3B8680014B4F4E41141109", "Mastercard paypass enabled credit card" }, { "3B8680015741524930310B", "Gusto Karta (Bank)\nhttps://www.gustokarta.cz" }, { "3B86800157575061737336", "WWPass Passkey (eID)\nhttps://www.wwpass.com/passkey" }, + { "3B8680018031C15211182C", "IDEMIA Cosmo V8.0 with a PIV applet (contactless) (PKI)" }, + { "3B8680018031C152411A7E", "IDEMIA Cosmo V8.1 with a PIV applet (contactless) (PKI)" }, { "3B86800180540410010FC9", "Nickel.eu prepaid account (Bank)\nhttps://nickel.eu" }, { "3B868001C1052F2F01BC7E", "Contactless interface to St. Petersburg unified card, Russia (Edinaia karta peterburzhtsa) (Other)\nhttps://ekp.spb.ru/" }, + { "3B868001F04938DE0C3064", "blyt mtrw (Transport)\nhttps://ezpay.ir/" }, { "3B868131703445504120454B08", "Austrian Quick E-purse 'Einreichkarte' (transfer card)\nhttp://www.quick.at/" }, { "3B8780014D49464152452B39", "PEKA CARD (JavaCard)" }, { "3B8780014D525444312E3026", "Russian Foreign Passport (passport)" }, @@ -1619,21 +1726,26 @@ const static atr_t AtrTable[] = { { "3B8780017743495002000128", "CIPURSE (transport)\nhttp://www.osptalliance.org/" }, { "3B8780018031807396128040", "Public transport: VRS Verkehrsverbund Rhein-Sieg (Germany, North_Rhine-Westphalia)\nhttp://www.vrsinfo.de/englisch/the-vrs/vrs-about-us.html" }, { "3B878001803198738401E039", "Austrian Passport" }, + { "3B878001803198738601E03B", "German passport (passport)" }, { "3B8780018031B8738401E019", "Personalausweis (German Identity Card) (eID)" }, - { "3B8780018031B973842160B8", "Hungarian eID (2016) (eID)\nhttp://kekkh.gov.hu/Eszemelyi/" }, + { "3B8780018031B8738601E01B", "Personalausweis (German Identity Card) (eID)\nhttps://www.personalausweisportal.de/" }, + { "3B8780018031B973842160B8", "Hungarian eID (2016) (eID)\nhttps://eszemelyi.hu/en/" }, { "3B8780018031C073D620C032", "RFID GeldKarte (girogo)" }, { "3B8780018031C073D621C033", "Sparkasse Hannover - German contactless GeldKarte (RFID, NFC, girogo)\nhttps://www.geldkarte.de/_www/en/pub/geldkarte/service_navigation/about_us.php" }, { "3B8780018031C073D631C023", "girocard contactless (Bank)\nhttps://www.girocard.eu/english.html" }, + { "3B8780018073842140900080", "Queensland drivers licence (eID)\nhttps://www.qld.gov.au/transport/licensing/driver-licensing" }, { "3B878001C10521300077C165", "Mifare Plus (Other)\nhttp://www.Mifare.net" }, { "3B878001C1052F2F0035C730", "MiFare Plus 2K 'S' (Other)" }, { "3B878001C1052F2F01BCD6A9", "RFID - ISO 14443 Type A - NXP Mifare Plus" }, { "3B87813140434D4643203133316F", "Telekom Paycard" }, { "3B88010003050668D06080D1", "125 Khz HID Proximity card (eID)\nhttps://www.hidglobal.com/product-display/cards-and-credentials/hid-proximity" }, { "3B88014B415A544F4B454E82", "Kaztoken (eID)\nhttp://kaztoken.kz/" }, + { "3B88018056536F6C6F203272", "SoloKeys Solo 2 Security Key (PKI)\nhttps://github.com/solokeys/solo2" }, { "3B888001000000000000000009", "Personalausweis (German Identity Card) (eID)" }, { "3B8880010000000000419100D9", "EffiTIC (Transport)\nwww.effitic.com" }, { "3B888001000000000071710009", "OPUS Public Transport card (Montreal, Quebec, Canada) - Oberthur based\nhttp://carteopus.info/\nACTV (Italy) transport card (RFID)" }, { "3B8880010000000000718100F9", "Navigo Decouverte (RFID interface) (Transport)" }, + { "3B8880010000000000817000F8", "Qantas Frequent Flyer Loyalty Card - Contactless (Loyalty)" }, { "3B8880010000000000817700FF", "KBC Maestro card (Bank)" }, { "3B88800100000000008187000F", "ING Bank Card (Bank)\nhttps://www.ing.nl/particulier/betalen/passen/betaalpas/contactloos-betalen-met-uw-betaalpas/index.html" }, { "3B888001000000000081911009", "Trenitalia (Italy) fidelity card 'CartaFreccia' (RFID)" }, @@ -1656,8 +1768,10 @@ const static atr_t AtrTable[] = { { "3B888001000005E0B381A1007F", "Japanese JPKI card (aka JINC card) (eID)\nhttps://github.com/jpki/myna" }, { "3B888001000014E0B38191005E", "'JUKICARD', the Basic Resident Registration Card in Japan (eID)" }, { "3B888001000041E0B381A1003B", "ID card issued by Japan government (eID)\nhttps://www.kojinbango-card.go.jp/mynumber/index.html" }, + { "3B8880010000C9047781730041", "D-TRUST Card 4.1, qualified signature card (eID)\nhttps://www.d-trust.net" }, { "3B8880010073C8400000900062", "NXP JCOP 31 V2.2 36K - RFID I/F\nBarclaycard Visa Wave & Pay - RFID I/F\nCIBC Visa" }, { "3B8880010073C8401300900071", "Nokia 6131 NFC phone\nhttp://wiki.forum.nokia.com/index.php/Nokia_6131_NFC_-_FAQs\nGiesecke & Devrient's (G&D) Sm@rtCafe Expert 3.1\nAmex Bank of Canada American Express\nTD Canada Trust Visa\nTD Canada Trust Access Card (Visa Debit)" }, + { "3B88800100883C1F77819500C1", "Polish Passport (passport)" }, { "3B88800100DDA611F771850060", " 'Pyrelis' card, PAU (France) public transport card. (Calypso card). (Transport)\n http://www.reseau-idelis.com/930-Billettique-IDELIS.html" }, { "3B888001040200200071C140DF", "Seoul Citypass+ T-Money Card" }, { "3B8880011000000000817000E8", "Tap&Go MasterCard Sim Card (Bank)\nhttps://www.tapngo.com.hk" }, @@ -1671,7 +1785,8 @@ const static atr_t AtrTable[] = { { "3B8880011CF0E111F771850016", "CEPAS Card (Concession card issued by Land Transport Authority Singapore) (Transport)" }, { "3B88800130415654000000077D", "Avtor ID Key (eID)\nhttp://avtor.ua/" }, { "3B888001304C47127783D50001", "elesec - TCOS 3.0 Signature Card (eID)\nhttps://www.telesec.de/de/tcos/support/downloadbereich/category/28-leistungsbeschreibung" }, - { "3B88800130ABAB017781B70079", "Italian healtcare card (TS) National Service Card (CNS) (HealthCare)" }, + { "3B88800130ABAB017781B70079", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare)" }, + { "3B888001310109000000000030", "Indonesian Electronic Driving License (e-SIM) (Other)\nhttps://polri.go.id/sim, https://www.digitalkorlantas.id/sim/" }, { "3B88800131CCCC017781C1000E", "Ideal v 1.4 (Transport)" }, { "3B88800131CCCC017783A1006C", "Chile RUT (eID)" }, { "3B88800131F35E110081950090", "Venez_Omnikey" }, @@ -1681,6 +1796,7 @@ const static atr_t AtrTable[] = { { "3B8880014241454944312E316C", "BiH eID card (eID)" }, { "3B88800143433169AA200000DB", "PostFinance Switzerland (Bank)\nhttp://www.postfinance.ch" }, { "3B888001434C6169726520360F", "VISA credit card with NFC payment function (Bank)\nhttp://www.visa.ca/en/personal/visa-paywave/index.jsp" }, + { "3B8880014431314352322E3070", "javacard.pro card (JavaCard)\nhttps://javacard.pro/" }, { "3B88800146494445534D4F3167", "Fidesmo card (install or uninstall JavaCard applets or Mifare-based services on the field, using the Fidesmo Android App. (JavaCard))\nhttps://developer.fidesmo.com/" }, { "3B8880014A434F50763234315E", "RFID - ISO 14443 Type A - NXP JCOP\nNXP J3A081 JavaCard (contactless interface)" }, { "3B88800150FFFF117783D50069", "Gematik TSYS eHBA G2.1 (HealthCare)" }, @@ -1694,19 +1810,23 @@ const static atr_t AtrTable[] = { { "3B888001990200D10304220167", "Debit card (Bank)" }, { "3B888001C91207520200811014", "electronic Tickes from the german Transport Association VGN (Verkehrsgemeinschaft Niederrhein)" }, { "3B888001D10386050080800058", "Resident Identity Card of People Republic of China (Second Generation with RF Feature) (eID)\nhttp://www.gov.cn/banshi/2005-08/02/content_19457.htm" }, + { "3B888001E1686C17778395009A", "Algerian ID card (eID)" }, { "3B888001E1E1F35E1377830043", "ePerso - German ID card (issued 2011) (eID)" }, + { "3B888001E1F35E113381970071", "DK passport (passport)" }, { "3B888001E1F35E117381A50003", "US passport (2007)" }, - { "3B888001E1F35E117781950037", "Belgian Passport (passport)" }, + { "3B888001E1F35E117781950037", "Belgian Passport (passport)\nFinnish Passport (passport)" }, { "3B888001E1F35E117781A10003", "Spanish ID know as DNIe (eID)\nhttp://www.dnielectronico.es" }, { "3B888001E1F35E117781A50007", "US passport (2012)" }, { "3B888001E1F35E117781C72045", "French passport (2007-2008)" }, { "3B888001E1F35E117781E10043", "DNIE Spain (eID) Contactless (eID)\nhttp://www.dnielectronico.es/PortalDNIe/" }, + { "3B888001E1F35E117781E16023", "DNIe v4 (Spanish eID) - contactless interface (PC/SC wrapped 14443 Type B ATR) (eID)\nhttps://www.dnielectronico.es" }, { "3B888001E1F35E1177830000A0", "Residence permit (eID)\nhttp://de.wikipedia.org/wiki/Aufenthaltstitel" }, { "3B888001E1F35E117783950035", "French biometric ePassport (issued in 2012)" }, { "3B888001E1F35E117783D50075", "German Passport (ePass) (issued June 2009)" }, { "3B888001E1F35E117783D70077", "Spanish Electronic Passport 2.0 (passport)\nhttps://www.dnielectronico.es/PortalDNIe/PRF1_Cons02.action?pag=REF_1080&id_menu=56" }, { "3B888001E1F35E117787950031", "Dutch Government Pilot E-rijbewijs (eID)\nhttps://www.digid.nl/over-digid/kaartlezer-pilot" }, { "3B888001E1F35E1180879500C6", "Irish Driver Learner Permit (Other)" }, + { "3B888001E1F35E11B381A500C3", "Australian Passport (passport)\nhttps://www.passports.gov.au/" }, { "3B888001E1F35E1377830000A2", "ePerso - German ID card (issued 2013)" }, { "3B888001E1F35E137783D50077", "ePerso - German ID card (issued 2011)" }, { "3B88813120550057696E4361726429", "SmartCard for Windows 1.0" }, @@ -1717,6 +1837,7 @@ const static atr_t AtrTable[] = { { "3B894014474732364D35323830", "GSM-SIM e-plus (1800MHz)" }, { "3B898001006404150102009000EE", "German Passport (issued Apr 2007)" }, { "3B898001006404280302009000D1", "TCOS 3.0 release 2 on Philips P5CD080 (PKI)\nhttps://www.digchip.com/datasheets/parts/datasheet/1019/P5CD080.php" }, + { "3B898001024D4B4D574B534B5411", "Polish National ID (eID)\nhttps://www.gov.pl/web/e-dowod/" }, { "3B8980013131313054434F535052", "Seven-Eleven Value Card / Smart Purse - Thailand (Contactless) (Other)\nhttp://www.7eleven.co.th/about7card.php" }, { "3B8980013233324353435333363E", "CSCS Smartcard (passport)\nhttp://getgosmart.io" }, { "3B89800141434F534A763130311A", "ACS ACOSJ (Combi) (JavaCard)\nhttp://www.acs.com.hk/en/products/405/acosj-java-card-combi/" }, @@ -1737,13 +1858,15 @@ const static atr_t AtrTable[] = { { "3B89800150565F4A33413034305D", "Java Card J3A040 (JavaCard)\nhttp://smartcardsource.com/contents/en-ca/d9_JCOP-NXP-cards.html" }, { "3B898001535049564B4559373044", "Taglio PIVkey C980 smart card (Other)\nhttps://pivkey.com/" }, { "3B89800153504B323544499000DA", "SPK 2.5 D1" }, + { "3B89800153776973735061737374", "SwissPass - key to mobility and leisure in Switzerland (Transport)\nhttps://www.swisspass.ch\nhttps://www.allianceswisspass.ch/de/informationen-ov-nutzende/SwissPass" }, { "3B89800166494658425332476F32", "Blockchain Security 2Go (JavaCard)\nhttps://github.com/Infineon/Blockchain" }, { "3B898001664A41434F53322E3016", "MasterCard, Credit Card by TargoBank, Germany -- (Bank)" }, - { "3B898001665257453250524F4D1C", "NFC enabled SIM card. (Telecommunication)\nElectic vehicle charging card of the EMSP Chargepoint" }, + { "3B898001665257453250524F4D1C", "NFC enabled SIM card. (Telecommunication)\nElectric vehicle charging card of the EMSP Chargepoint" }, { "3B8980016653434F4E454432307C", "Alioth 98886 chip (Bank)" }, { "3B8980018057454D5650524F438F", "BNP Paribas Visa Classic Card (NFC) (Bank)\nhttps://mabanque.bnpparibas/fr/notre-offre/comptes-cartes-et-services/cartes-et-moyens-de-paiement/decouvrir-toutes-les-cartes/carte-visa-classic" }, { "3B89800180574A4D5650726F33F0", "PayPal UK MasterCard Contacless" }, { "3B89800180574A4D5676352E30D3", "PayPal Access Business MasterCard (contactless) (Bank)\nCoinbase Card, Visa Debit (Paysafe / TCT FCU) (Bank)\nhttps://coinbase.com/card" }, + { "3B8980018064160401868290006B", "LUKB (Bank)\nhttps://www.lukb.ch" }, { "3B8980018064160402828290006C", "Maestro card (from Mastercard) used by BCGE (switzerland) bank (Bank)" }, { "3B89800180670412B0030501024C", "Austrian Passport" }, { "3B8A0091010016000116010096", "GSM-SIM T-Mobil D1 (900MHz)" }, @@ -1761,13 +1884,20 @@ const static atr_t AtrTable[] = { { "3B8A80010031C173C8400000900090", "NXP PN65o's Internal Secure Element in card emulation mode. (Other)" }, { "3B8A80010064055C02033180900016", "T-System Contactless Netkey Card" }, { "3B8A8001006405760203318090003C", "T-System Contactless TCOS Min" }, + { "3B8A80013037393134315F3030316F", "Electronic Citizen Identity Card (e-ID Card) (eID)\nhttps://www.e-ktp.com/" }, + { "3B8A800143323330302D4649505368", "Crescendo 2300 FIPS (contactless interface) (PKI)" }, { "3B8A80014A3341303831563234316B", "NXP JCOP CJ3A081 (NFC) (JavaCard)\nNXP JCOP 80K - J3A081V241" }, + { "3B8A80014A33523138302D32353506", "Cardlogix J3R180 NXP JCOP 4 Java Card 3.0.5 Classic Dual Interface (JavaCard)\nhttps://www.cardlogix.com/product/nxp-jcop-4-java-card-3-0-5-classic/" }, { "3B8A80014A434F503331563233327A", "Snapper New Zealand (JCOP)" }, { "3B8A80014A434F503431563232317F", "JCOP41 Cards (not supported, but recognized by Classic Client)\nNXP JCOP 41 v2.2.1 72k RFID I/F" }, + { "3B8A800150564A434F5033454D5676", "NXP JCOP3 J3H082 Java Card 3.0.4 Dual-Interface (JavaCard) (JavaCard)\nhttps://www.cardlogix.com/product/nxp-jcop3-j3h082-java-card-3-0-4-j3h081-dual-interface/" }, + { "3B8A800150564A434F503453494471", "J3R180 via ifdnfc (JavaCard)" }, + { "3B8A80015345204445534669726557", "NXP-Mifare DESFire EV1 2k (used as a company ID card) (eID)" }, { "3B8A8001534F535345020325010374", "Super SIM X-SIM 16-in-1 (Telecommunication)\nhttps://multi-com.eu/,details,id_pr,14881,key,super-sim-16-in-1-card,smenu,gsm.html" }, { "3B8A8001546963546F6B20332E3008", "Cryptas TicTok v3 (PKI)\nhttps://www.cryptas.com/en/products/tictok-card" }, { "3B8A80018031B8738401E082900006", "German ID Card - Personalausweis" }, { "3B8A80018031F873F741E082900075", "ePerso - German ID card" }, + { "3B8A800180641211111073C0C1801F", "Belarussian ID card (eID)" }, { "3B8A80018065A20101013D72D64397", "Gemplus GemXpresso Pro R3 E32 PK (combi)\nMultiApp ID Dual Citizen EAC 80K CC / IDClassic 3340 (old name: Classic TPC DM) (with MPCOS Applet installed by default) - Contactless Mode with Prox DU" }, { "3B8A80018065A20131013D72D641A5", "Resident Identity Card (eID)" }, { "3B8B005275746F6B656E6C745344E3", "Aktiv Rutoken Lite SD\nhttps://www.rutoken.ru/products/catalogue/info_52.html" }, @@ -1777,12 +1907,13 @@ const static atr_t AtrTable[] = { { "3B8B015275746F6B656E44534254D7", "Rutoken ECP Bluetooth (eID)\nhttp://www.rutoken.ru" }, { "3B8B015275746F6B656E6C697465C2", "Aktiv Rutoken Lite\nhttps://www.rutoken.ru/products/all/rutoken-lite/" }, { "3B8B80010012233F536549440F9000A0", "Estonian Identity Card (eID)\nhttp://id.ee/" }, + { "3B8B80010012428F536549440F900071", "Latvia eID card (eID)\nhttps://www.pmlp.gov.lv/en/identity-card-eid" }, { "3B8B80010031C0640804610000900062", "NUMBER26 Maestro Card (Bank)\nhttps://number26.eu\nAmerican Express credit card for corporations" }, { "3B8B80010031C0640844030400900044", "Credit Card Visa (Other)" }, { "3B8B80010031C0640844031200900052", "Tomorrow Debit Mastercard issued by solarisBank AG (Bank)\nhttps://www.tomorrow.one/" }, { "3B8B80010031C0640844031300900053", "Swedbank ISIC (eID)\nhttps://www.swedbank.ee/private/cards/debit/isic?language=EST" }, { "3B8B80010031C0640844036800900028", "Advanzia / Gebuhrenfrei.com Mastercard Gold (Bank)\nhttps://www.gebuhrenfrei.com/Home/" }, - { "3B8B80010031C0640844037600900036", "American Express Blue Card (Germany) (Bank)" }, + { "3B8B80010031C0640844037600900036", "American Express Blue Card (Germany) (Bank)\nMastercard issued by OTP Bank (Hungary) (Bank)\nhttps://www.otpbank.hu/portal/en/Retail/Bankcards\nCredit Agricole Bank Card - Bancomat / Maestro" }, { "3B8B80010031C06408440393009000D3", "Novacard pp0815-04/20 chip (Bank)" }, { "3B8B80010031C0641F18010000900009", "Student ID card in Poland (eID)" }, { "3B8B80010031C0641F27010000900036", "American Express Platinum (AU Issued) (Bank)" }, @@ -1792,10 +1923,15 @@ const static atr_t AtrTable[] = { { "3B8B80010031C1640840223000900054", "IDEMIA Cosmo v8.1-n (Other)" }, { "3B8B80010031C1640860320600900052", "Banco CTT (Portugal) contactless VISA Debit card (Bank) (Bank)\nhttps://www.bancoctt.pt/home/abrir-conta.html" }, { "3B8B80010031C1640860321200900046", "AMEX Silver Credit (Bank)" }, + { "3B8B80010031C1640860321F0090004B", "Hanseatic Bank Visa Card (Bank)\nhttps://www.hanseaticbank.de/kreditkarte/genialcard" }, { "3B8B80010031C1640860322000900074", "IDEMIA (Other)" }, - { "3B8B80010031C16408923354009000F3", "Italian healtcare card (TS) National Service Card (CNS) (HealthCare)\nhttp://www.salute.gov.it/portale/lea/dettaglioContenutiLea.jsp?lingua=italiano&id=4693&area=Lea&menu=leaEssn" }, + { "3B8B80010031C1640860324200900016", "Westpac Handybank EFTPOS/ATM Card - Contactless (Bank)" }, + { "3B8B80010031C16408923354009000F3", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare)\nhttp://www.salute.gov.it/portale/lea/dettaglioContenutiLea.jsp?lingua=italiano&id=4693&area=Lea&menu=leaEssn" }, + { "3B8B80010031C16408986200009000FC", "ERSTE Bank creditcard (mastercard) (Bank)" }, { "3B8B80010031C1640911213000900007", "SmartMX (Other)" }, + { "3B8B80010031C1640924331E0090000E", "Cumulus Mastercard (Bank)\nhttps://www.migros.ch/cumulus/mastercard" }, { "3B8B80010031C1640937721300900051", "French ID Card 2021 (contactless interface) (eID)\nhttps://ants.gouv.fr/Les-titres/Carte-nationale-d-identite/La-puce-de-la-nouvelle-carte-nationale-d-identite" }, + { "3B8B80010031C1640964413600900014", "Monzo (Bank)\nhttps://monzo.com/" }, { "3B8B800100640411010131800090005A", "German Passport (issued Nov 2006)\nUnited Kingdom e-Passport\nLuxembourg passport (2007)" }, { "3B8B80010B7880820244492030324D1B", "Mastercard Debit issued by Raiffeisen bank in Czech Republic" }, { "3B8B80012085008B030FE09AA0E04052", "Shanghai Public Transportation Card (Transport)\nhttp://www.sptcc.com/" }, @@ -1809,21 +1945,29 @@ const static atr_t AtrTable[] = { { "3B8B8001654B5450304432654B54504C", "NXP smart eID - Indonesia ektp (eID)" }, { "3B8B80018031C06305107F8300900061", "UAB Bank - Prepaid VISA Card (Bank)\nhttps://www.uab.com.mm/cards/" }, { "3B8B80018066475000B8007F8290002E", "Italian Card Identity (eID)\nhttps://www.cartaidentita.interno.gov.it/" }, + { "3B8B80018066475000B80094829000C5", "Italian Electronic Contactless Identity Card v. 3.0 (CIE 3.0) (eID)\nhttps://www.cartaidentita.interno.gov.it/" }, { "3B8B800180F9A00000030800001000C8", "Probably the same as 'JCOP3 SecID P60 CS (JavaCard)' but mated with a contactless Identiv reader (JavaCard)" }, { "3B8B80018688FF6F391E743C200800D3", "Chinese ICBC (bank)" }, { "3B8B81314034534D41525453434F5045316D", "Zeeland kaart (Telecommunication)" }, { "3B8C014D79536D6172744C6F676F6EA5", "EIDVirtual (USB key emulated as a virtual smart card) (PKI)\nhttp://www.mysmartlogon.com/eidvirtual/" }, + { "3B8C01805A4E6974726F6B657920337D", "'Nitrokey 3C NFC' USB authentication and security token (Other)\nhttps://shop.nitrokey.com/shop/product/nk3cn-nitrokey-3c-nfc-148" }, { "3B8C40FA808105520101A00000015001", "Algerian Postal Services Current Account Card (Bank)" }, { "3B8C80010443FD....................", "RFID - NFC Forum tag type 3 (FeliCa)" }, + { "3B8C80010C75778002C1052F2F0035C7B7", "Mifare Plus S (Other)\nhttps://www.nxp.com/products/no-longer-manufactured/mifare-plus-s-2k-4k:MIFARE_PLUS_S_2K_4K" }, { "3B8C80014F5449442894B3C00100900045", "Belgian passport (2009-2013)" }, { "3B8C80014F5449442894F7C00000900000", "French passport (2010-2013)" }, { "3B8C800150........E1F35E117781E1..", "Spanish eID, Documento Nacional de Identidad (DNIe) (eID)\nhttp://www.dnielectronico.es/" }, + { "3B8C800150000000000000000080814519", "a12 (Telecommunication)" }, { "3B8C80015000000000000000009181A0ED", "Belimo VAV-Compact NFC (Other)\nhttp://www.belimo.ch/pdf/e/flyer_nfc_en.pdf" }, { "3B8C8001500005022D0206000000819163", "Local Transport card for Trentino region (Italy) trentino trasporti esercizio (Transport)\nhttp://www.ttesercizio.it/" }, + { "3B8C80015000CA464D00000000808171EC", "Visa Classic (Bank)" }, + { "3B8C8001500197E9BE00000000808171EC", "VISA card from bank LA BANQUE POSTALE (Bank)" }, { "3B8C80015001A5CE19000000008081715E", "VISA Card from Bank BANQUE POPULAIRE (Bank)" }, { "3B8C80015001BA137E00000000B3717138", "Mobib (Brussels public transportation card)" }, + { "3B8C80015001C62E3900000000808171FD", "edenred (Loyalty)" }, { "3B8C80015003A129CF0000000011818108", "rav-kav, Israel transport card (Transport)\nhttp://www.egged.co.il/Article-786-Rav-Kav-Card.aspx" }, { "3B8C80015004463EC3E1F35E117781A1E8", "Spanish ID (eID)" }, + { "3B8C8001500509CE35000000003371A149", "Libertan transport card from Nantes (France), based on Calypso (Transport)\nhttps://www.tan.fr/fr/abonnements-libertan-1" }, { "3B8C80015005A966960000000080817171", "Hello bank! VISA CLASSIC Card (Bank)\nhttp://www.hellobank.fr/" }, { "3B8C80015006DCA8590000000080817106", "VISA Hello bank! (NFC) (Bank)\nhttps://www.hellobank.fr/" }, { "3B8C800150107331B400000000B3717108", "MiMuovo public transport card used in Italian region Emilia Romagna (Transport)" }, @@ -1831,6 +1975,7 @@ const static atr_t AtrTable[] = { { "3B8C80015010B9F98900000000B3717137", "Toulouse (France) city public transport card called TISSEO Pastel (Transport)\nhttps://www.tisseo.fr/les-tarifs/obtenir-une-carte-pastel" }, { "3B8C80015010D632A000000000B37171BA", "MOBIB (STIB) (Transport)\nhttps://www.stib-mivb.be/article.html?_guid=30af0085-2483-3410-5394-a71daf08acd1&l=en" }, { "3B8C800150186188CEE1F35E117781C70E", "French passport (2007-2008)" }, + { "3B8C800150191B6CC20000000000817707", "Rabobank bankcard (dutch) (Bank)\nhttps://www.rabobank.nl/particulieren/betalen/betaalpas" }, { "3B8C80015019E3BB3D00000000008177D7", "ING/Maestro bank card (Bank)\nhttps://www.ing.nl/particulier/betalen/passen/index.html" }, { "3B8C80015024AD64E10000000033819172", "Italian healthcare + public administration card (HealthCare)\nhttp://sistemats1.sanita.finanze.it/wps/portal" }, { "3B8C800150260DBB150000000000718128", "Navigo Card (Transport)\nhttp://www.navigo.fr/" }, @@ -1839,13 +1984,17 @@ const static atr_t AtrTable[] = { { "3B8C8001502724266400000000007181EC", "French Transport Card (Navigo Card) (Transport)\nhttps://fr.wikipedia.org/wiki/Passe_Navigo" }, { "3B8C8001502747D205000000000071811A", "Pass Navigo Decouverte (Transport)\nhttps://fr.wikipedia.org/wiki/Passe_Navigo" }, { "3B8C800150275038CE000000000071812C", "Paris transportation card (Pass Navigo) (Transport)\nhttps://fr.wikipedia.org/wiki/Passe_Navigo" }, + { "3B8C8001502752318100000000007181", "Calypso (Transport)\nhttps://www.innovatron.fr/CalypsoFuncSpecification.pdf" }, { "3B8C80015027B1F76B0000000000717157", "Navigo (public transportation in Ile-de-France), IDF Mobilites (Transport)\nhttps://www.iledefrance-mobilites.fr/l-innovation/navigo/" }, { "3B8C8001502C8D214B23180100778197CD", "Indonesian Driver License" }, + { "3B8C8001502FE0AFA1000000000081776A", "Rabo Wereldpas (Maestro) (Bank)\nhttps://www.rabobank.nl/" }, { "3B8C80015035A45B650000000080817182", "Trenitalia cartafreccia (Transport)\nhttp://www.trenitalia.com/tcom/Cartafreccia" }, { "3B8C800150370B16BD310106017781777C", "Driver License of Indonesia - SIM (Surat Izin Mengemudi) (Transport)" }, { "3B8C800150380EB25B00000000B3717131", "BIP (Biglietto Integrato Piemonte) Card, GTT (Gruppo Trasporti Torinese) (Transport)\nhttp://bip.piemonte.it/" }, { "3B8C8001503A88EC29E1F35E117781E160", "DNI electronico (Spanish electronic ID card) (eID)\nhttp://www.dnielectronico.es" }, { "3B8C8001503A964B0000000000008180BB", "Ventra Transit Pass (Transport)\nhttps://www.ventrachicago.com/how-to/ventra-cards/" }, + { "3B8C8001503BF0330B30ABAB017781B7DE", "Italian health card - national service card (HealthCare)\nhttps://sistemats1.sanita.finanze.it/portale/tessera-sanitaria" }, + { "3B8C800150438EAE7B30ABAB017781B735", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare) - Regione Liguria (HealthCare)" }, { "3B8C80015043E0F5F43101060077817748", "Indonesian Driver License" }, { "3B8C8001504553FFC6E1F35E117781A178", "Electronic DNI (eID)" }, { "3B8C80015046E570EC2318010077819739", "Indonesian Driver License" }, @@ -1853,6 +2002,7 @@ const static atr_t AtrTable[] = { { "3B8C8001504B75AF41E1F35E117781A583", "USA PASSPORT BOOK ICAO (passport)\nhttps://www.icao.int/publications/pages/publication.aspx?docnum=9303" }, { "3B8C8001505381573630AAAA017781D7FE", "Indonesian ektp (eID)" }, { "3B8C8001505467137900000000F781C1B3", "Tessera Sanitaria italian health care card (HealthCare)" }, + { "3B8C8001505C4B71A152745343778183D9", "RUTOKEN ECP 3.0 (PKI)\nhttps://www.rutoken.ru/products/catalogue/id_114.html" }, { "3B8C8001505CF5A94530AAAA017781D708", "Indonesia ektp (eID)" }, { "3B8C800150605F2EFA00000000778191D1", "Residence Permit (Switzerland) (eID)" }, { "3B8C80015064E65B000000000000818085", "Chicago CTA Ventra Transit card\nhttps://www.ventrachicago.com/" }, @@ -1863,9 +2013,12 @@ const static atr_t AtrTable[] = { { "3B8C8001507919600100DDA611F7718535", "Transport Traway Montpellier France (Transport)" }, { "3B8C8001507AA44007231801007781979F", "Indonesian Driver License" }, { "3B8C8001507E0071D20000000000717180", "Unica (= Just one) joined train and public transport card for Italian region Emilia Romagna (evolution of MiMuovo) (Transport)" }, + { "3B8C8001507E0A66C2000000000071718D", "'UNICA' card for the subscription to trains and buses of the Trenitalia TPER company (Transport)\nhttps://www.trenitalia.com/it/treni_regionali/smart-card-unica.html" }, + { "3B8C8001507EDE1E0600883C1F7781952D", "Bahrain CPR (eID)" }, { "3B8C8001507F9C668A0000000000818754", "NFC Mastercard issued by CSOB bank Czech Republic, first 4 digits 5168" }, { "3B8C80015089DCA96E00000000808171BF", "Cartafreccia VISA (Italian Railways Prepaid + Loyalty Card) (Bank)" }, { "3B8C800150915D7129E1F35E117781A1C3", "Spanish eID, Documento Nacional de Identidad (DNIe) (eID)\nhttp://www.dnielectronico.es/" }, + { "3B8C80015092BF3BC0000000000071718B", "Venice Public Transport Card (Transport)\nhttps://www.veneziaunica.it/" }, { "3B8C80015093195E3000000000007171B9", "OPUS STM CANADA (Transport)\nhttp://stm.info/" }, { "3B8C800150933CCC05000000000071713B", "OPUS Card, public transport (subway) of Montreal (Transport)\nhttp://www.stm.info/fr/infos/titres-et-tarifs/carte-opus-et-autres-supports/carte-opus" }, { "3B8C800150A221FAA031CCCC017781C183", "Morpho (eID)\nhttp://www.morpho.com/" }, @@ -1878,6 +2031,7 @@ const static atr_t AtrTable[] = { { "3B8C800150C0E450CA0000000091717172", "Transportation card for Lille (France) (Transport)" }, { "3B8C800150C0EA9CBB00000000B37171E3", "Tisseo (Toulouse) (Transport)\nhttp://www.tisseo.fr/les-tarifs/obtenir-une-carte-pastel" }, { "3B8C800150C0F1DE700000000091717153", "isodep, NfcB (Transport)" }, + { "3B8C800150C10D7D5E00000000B3717101", "Pastel transport card from Toulouse (France), based on Calypso (Transport)\nhttps://www.tisseo.fr/les-tarifs/ou-acheter/la-carte-pastel" }, { "3B8C800150C110BBA9000000009171710F", "Divia card (passport)" }, { "3B8C800150C11BA3F10000000091717144", "Tramway (PKI)" }, { "3B8C800150C14164E3000000000071715A", "Navigo Annuel (France) (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/detail/forfait-navigo-annuel" }, @@ -1886,6 +2040,9 @@ const static atr_t AtrTable[] = { { "3B8C800150C17B55BA0000000000717108", "Navigo Easy (Paris public transportation) (Transport)\nhttps://parisbytrain.com/navigo-easy/" }, { "3B8C800150C17DA8CA0000000000717183", "Navigo Easy (France) transport card (Transport)\nhttps://www.ratp.fr/titres-et-tarifs/passe-navigo-easy" }, { "3B8C800150C2B936860000000000717196", "Passe Navigo (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/supports/passe-navigo-decouverte" }, + { "3B8C800150C326AF0C000000000071711B", "Navigo Mobility Paris transport's Card (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/liste?d=forfaits" }, + { "3B8C800150C41466C30000000000717128", "Navigo easy (Transport)\nhttps://www.iledefrance-mobilites.fr/titres-et-tarifs/supports/passe-navigo-easy" }, + { "3B8C800150C51770F0000000008081717F", "SumUp Limited Apple Pay Virtual Card (Bank)\nhttps://sumup.co.uk" }, { "3B8C800150C7251C5A00000011F781811F", "MOBIB Belgian public transport Card (Transport)\nhttps://mobib.be/fr.html" }, { "3B8C800150CA24513E00000011F781813A", "belgian mobib transportation card (Transport)" }, { "3B8C800150CBFB077E000000008081E1F4", "Samsung Digital Center in Seul Access ID card for guests (eID)" }, @@ -1915,6 +2072,10 @@ const static atr_t AtrTable[] = { { "3B8C80019067464A0100360600000000C7", "A40CR (eID)" }, { "3B8D0180FBA000000397425446590401", "Microsoft Virtual Smart Card 0 (PKI)" }, { "3B8D0180FBA000000397425446590401CF", "Microsoft Virtual Smartcard Provider shared through VMWare Workstation. (Other)\nhttps://technet.microsoft.com/en-us/library/dn593708%28v=ws.11%29.aspx" }, + { "3B8D80010004D0842186640000000000009F", "ABC UnionPay card with QuickPass contactless interface (Bank)" }, + { "3B8D8001003180718E6452D90400829000BB", "AwesomeCard (Bank)" }, + { "3B8D80010031C173C8400052A51000900070", "NXP P71 SmartMX3 (JavaCard)\nhttps://www.nxp.com/products/security-and-authentication/security-controllers/smartmx3-p71d321-secure-and-flexible-microcontroller:SMARTMX3-P71D321" }, + { "3B8D80010031C173C8400052A5100090FF8F", "NXP Smart MX3 P71D321 (JavaCard)" }, { "3B8D80010073C80013644737423700900055", "TD Canada Trust Visa" }, { "3B8D80010073C8001364543741380090004A", "Visa Debit (ING-DiBa) (Bank)\nhttps://www.ing-diba.de/\nVisa Debit Card with NFC payment function (Consorsbank)\nhttps://www.consorsbank.de/" }, { "3B8D80010073C80013645437423700900046", "pay (Bank)" }, @@ -1940,6 +2101,7 @@ const static atr_t AtrTable[] = { { "3B8E8001005131631F5901739F20C0C0900017", "Identity card (eID) Republic of Latvia (eID)\nhttp://www.pmlp.gov.lv/en/home/services/personal-certificates-%28eid%29/\nFrench driving license (eID) (contactless)" }, { "3B8E80010E7833C4020064041501020090FF95", "Spanish Passport" }, { "3B8E8001103877A78091E165D0004200008272", "Czech Republic e-Passport (issued Feb 2009)" }, + { "3B8E8001107833D4020064041101013180FFBD", "Second generation German passport (passport)\nhttps://www.cs.bham.ac.uk/~tpc/Papers/PassportTrace.pdf" }, { "3B8E80011178B3C0024F5449442894B3FFFF0E", "Civilian passport NFC tag (passport)" }, { "3B8E8001137880720280318066B1840C01FF04", "Optelio Contactless Gemalto (Bank)" }, { "3B8E8001137880800246494F4D4B5F3030314E", "MasterCard/PayPass Card issued by Czech FIO Banka a.s. (contactless chip)\nnote the ASCII string 'FIOK_001N' embedded in ATR" }, @@ -1953,7 +2115,9 @@ const static atr_t AtrTable[] = { { "3B8E800180318066B08412016E018300900003", "Contactless Barclaycard Visa\nMyCiti Transport Card MasterCard PayPass (Cape Town, South Africa)" }, { "3B8E800180318066B08416016E018300900007", "Barclaycard Platinum VISA (Bank)" }, { "3B8E800180318066B1840C016E0183009000..", "Gemalto Santander Optelio TUI R7 using Contactless interface" }, - { "3B8E800180318066B1840C016E01830090001C", "UK Lloyds Bank Gold Visa Debit (Contact & Contactless)\nbPay by barclaycard - contactless pre-paid Visa\nBPP Digital pre-paid VISA card (Bank)\nhttps://bpp.com.br/" }, + { "3B8E800180318066B1840C016E01830090001C", "UK Lloyds Bank Gold Visa Debit (Contact & Contactless)\nbPay by barclaycard - contactless pre-paid Visa\nBPP Digital pre-paid VISA card (Bank)\nhttps://bpp.com.br/\nMastercard credit card for Standard Chartered Bank, Pakistan also Mastercard debit card for JS Bank, Pakistan (Bank)" }, + { "3B8E800180318066B1840C016E01830090001C021450", "all transport travel pass (Transport)\nhttp://www.metro.spb.ru/cnblt41.html" }, + { "3B8E800180318066B1C5240100ED83009000F7", "Mastercard (Bank)" }, { "3B8E80018031815448534D3173802140810718", "Smartcard-HSM (Contactless Interface) (PKI)\nhttp://www.cardcontact.de/products/sc-hsm.html" }, { "3B8E80018031815448534D3173802140FFFF9E", "SmartCard-HSM RFID (PKI)\nhttps://www.smartcard-hsm.com/" }, { "3B8E800180919131C06477E30300838290001C", "Belgian Passport (2005)\nThai Passport 2005" }, @@ -1963,19 +2127,34 @@ const static atr_t AtrTable[] = { { "3B8F01415642000000000000000001000000DA", "AVEST-SYSTEMS AvBign (PKI)" }, { "3B8F0145464B000000000000000004000000C2", "EfitKey (PKI)" }, { "3B8F018025A00000005657444B3430300600B7", "SafeNet IKey4000" }, + { "3B8F01805D4E6974726F6B657900000000006A", "Nitrokey Nitrokey 3 Mini (eID)\nhttps://shop.nitrokey.com/shop/product/nk3am-nitrokey-3a-mini-149" }, { "3B8F80010000000000000000000000000000000E", "Tangem card (Other)\nhttps://tangem.com/" }, { "3B8F80010000000000000000000000FF829000E3", "CIE (eID)" }, { "3B8F80010031B86404B0ECC1739401808290000E", "Contactless CPS v3 Card (Carte de Professionnel de Sante)" }, + { "3B8F80010031B86404B0ECC173940180FFFFFFE3", "Card used in public French hospital (Other)" }, + { "3B8F80010031B96409377213738401E0000000AB", "National Identity Card of Slovakia (NFC interface) (eID)\nhttps://en.wikipedia.org/wiki/Slovak_identity_card" }, { "3B8F80010031C173C800106457494943009000B5", "ICC Solutions Card for Certification (Other)\nhttps://www.iccsolutions.com/" }, + { "3B8F80010031C173C8211064414D31300790008A", "master card (Bank)" }, + { "3B8F80010031C173C8211064414D31370790008D", "AirPlus International Mastercard (Bank)\nhttps://www.airplus.com/" }, { "3B8F80010031C173C8211064414D333007900088", "ING-VISA-Card (Bank)\nhttps://www.ing.de/girokonto/karten-bargeld/" }, + { "3B8F80010031C173C8211064414D333107900089", "NAB VISA Debit (Bank)\nhttps://www.nab.com.au/" }, + { "3B8F80010031C173C8211064414D3341079000F9", "Ukrainian International resere bank (ex Sberbak RF) debit card (Bank)\nhttps://www.sbrf.com.ua/" }, + { "3B8F80010031C173C8211064474D34350090008B", "S-Etukortti Visa (Bank)\nhttps://www.s-pankki.fi/fi/s-etukortti-visa" }, { "3B8F80010031C173C8211064474D343700900089", "SpareBank Visa Card, Norway (Bank)" }, + { "3B8F80010031C173C8211064574B31330090009E", "TIM Pay - HYPE (Mastercard debit card) (Bank)\nhttps://www.tim.it/fisso-e-mobile/mobile/servizi/tim-pay" }, { "3B8F80010031C173C8211064574B313400900099", "G&D Sm@rtCafe Card embedded in a wristband (Bank)\nhttps://www.gi-de.com/en/au/mobile-security/industries/financial-institutions/wearables/" }, { "3B8F800100664653051000FF71DF000000000039", "JavaCOS A40 dual interface Java card - 64K (JavaCard)" }, { "3B8F800100B85421000090000000000000000053", "netbank Germany, Mastercard (Bank)\nhttps://netbank.de" }, { "3B8F800100B85431000090000000000000000043", "Monzo MasterCard Contactless (Bank)\nhttps://monzo.com/" }, { "3B8F800100B854310000900000000000FFFFFFBC", "VISA Debit issued by WIREX. card made by CONTIS / TAG SYSTEMS (Bank)\nhttps://wirexapp.com/" }, + { "3B8F80013101F1564011001900000000000000D1", "Revolut Mastercard (Bank)" }, + { "3B8F80013101F1564011001900000000FFFFFF2E", "BVG Guthabenkarte (Prepaid Payment Card for Berlin/Brandenburg Public Transport) (Transport)\nhttps://www.bvg.de/de/service-und-kontakt/guthabenkarte" }, { "3B8F800141434F53204449616E6131204C63365B", "DKB-VISA-Card (Bank)\nhttps://produkte.dkb.de/?&page=girokonto#kreditkarte" }, { "3B8F800141434F53204449616E613120FFFFFFBD", "DKB Visa Credit Card (Bank)\nhttps://www.dkb.de" }, + { "3B8F800141434F53204449616E6132204C633658", "comdirect Visa debit (Bank)\nhttps://www.comdirect.de" }, + { "3B8F800141434F53204449616E613220FFFFFFBE", "comdirect, VISA Debit (Bank)\nhttps://www.comdirect.de/konto/karten.html#bankkarte" }, + { "3B8F800141434F532046696F6E6131204C633677", "DKB Visa (Debit) (Bank)\nhttps://www.dkb.de/" }, + { "3B8F800143433169A920000020202020202020FF", "Reka (Bank)\nhttps://reka.ch" }, { "3B8F800143443269AB41202020202020FFFFFF47", "BKB VISA Card Switzerland (Bank)\nhttps://www.bkb.ch/de/privatkunden/konten-und-karten/kreditkarten/world-mastercard-silber-oder-visa-classic/factsheet" }, { "3B8F800143553269AA20202020202020202020E9", "UBS Access Card (Mobile Online Banking, NFC, Switzerland)" }, { "3B8F800145504100000000........00........", "Austrian Quick E-purse contactless\nhttp://www.quick.at/" }, @@ -1984,6 +2163,8 @@ const static atr_t AtrTable[] = { { "3B8F800152464944494F74204A434F5020373276", "RFIDIOt JCOP 72K Blank\nhttp://rfidiot.org" }, { "3B8F800152464944494F74204A434F5037327224", "RFIDIOt JCOP 72K RANDOM_UID Blank\nhttp://rfidiot.org" }, { "3B8F800156696E5061795379732050757273652F", "JCOP (Other)" }, + { "3B8F80018031806549544A3442120FFF829000", "Italian Identity Card CIE (eID) (eID)\nhttps://www.cartaidentita.interno.gov.it/en/home/" }, + { "3B8F80018031806549544A3442120FFF8290008B", "Identity Card (eID)" }, { "3B8F800180318065B0........120FFE829000..", "IDPrime MD 3810 T=Contactless (Prox DU)" }, { "3B8F800180318065B0842327E5120FFE8290007E", "Gemalto IDPrime MD 3810 Blank Card (Other)\nhttp://www.gemalto.com/products/IDPrime_MD/index.html" }, { "3B8F800180318065B0846160FB120FFD82900066", "IDPrime 3930 FIPS Level 2 (Contactless TypeA) (BAI5, BAI7) (PKI)" }, @@ -1991,8 +2172,13 @@ const static atr_t AtrTable[] = { { "3B8F800180318065B0850300EF120FFF82900073", "Grand Duchy of Luxembourg / Identity card with LuxTrust certificate (eID)\nhttp://www.guichet.public.lu/citoyens/fr/citoyennete/papiers-identite/carte-identite/nouv-carte-identite-adulte-EN/index.html" }, { "3B8F800180318065B085040011120FFF8290008A", "Dutch driver licence (eID)\nItalian electronic identity card (eID)\nhttps://en.wikipedia.org/wiki/Italian_electronic_identity_card" }, { "3B8F80018031B865B0850300EF1200F68290004D", "Finnish electronic identity card (eID)\nhttps://vrk.fi/en/electronic-identity-and-certificates" }, + { "3B8F80018031B865B08504021B1200F6829000BC", "Finnish identity card (eID)" }, + { "3B8F80018031D865B08505001112752082900076", "Swedish national ID card (eID)\nhttps://polisen.se/en/services-and-permits/passport-and-national-id-card/check-validity-online-for-passports-and-national-id-cards/" }, { "3B8F80018031E06B042105027255555555555564", "Banamex/Citi Bank Bsmart MasterCard Paypass (Bank)\nhttps://www.banamex.com/es/personas/tarjetas_credito/ver_tarjetas/puntos_efectivo/bsmart.htm" }, { "3B8F80018031E06B04310502D1555555........", "Revolut Prepaid Mastercard (Contactless) (Bank)\nhttps://revolut.com/" }, + { "3B8F80018031E06B04520502FD555555FFFFFF32", "C6 Bank Card (Bank)" }, + { "3B8F80018031E06B0453F5025B555555555555CF", "Mastercard debit card for Askari Bank, Pakistan (Bank)" }, + { "3B8F80018031E06B04546B026D55555555555560", "Mastercard Credit/Debit Card - Contactless (Bank)" }, { "3B8F80018031E06B061605028C555555555555AF", "Air Miles American Express card (contactless) (Bank)" }, { "3B8F8001804F0CA000000306..000000000000..", "Card name not given (as per PCSC std part3)" }, { "3B8F8001804F0CA000000306..000100000000..", "MIFARE Classic 1K (as per PCSC std part3)" }, @@ -2060,10 +2246,10 @@ const static atr_t AtrTable[] = { { "3B8F8001804F0CA00000030601....00000000..", "RFID - ISO 14443 Type A Part 1 (as per PCSC std part3)" }, { "3B8F8001804F0CA00000030602....00000000..", "RFID - ISO 14443 Type A Part 2 (as per PCSC std part3)" }, { "3B8F8001804F0CA00000030603....00000000..", "RFID - ISO 14443 Type A Part 3 (as per PCSC std part3)" }, - { "3B8F8001804F0CA000000306030000000000006B", "buss/train pass for use with Skanetrafiken (www.skanetrafiken.se) busses and trains.\npublic library of Dusseldorf\nhttp://www.duesseldorf.de/stadtbuechereien/\nspecialized Mifare Ultralight card" }, - { "3B8F8001804F0CA000000306030001000000006A", "NXP/Philips MIFARE Classic 1K (as per PCSC std part3)\nhttp://www.nxp.com/#/pip/pip=[pfp=41863]|pp=[t=pfp,i=41863]\nOyster card - Transport for London (first-gen)\nhttps://en.wikipedia.org/wiki/Oyster_card\nACOS5/1k Mirfare\nvivotech ViVOcard Contactless Test Card\nBangkok BTS Sky SmartPass\nMifare Classic 1K (block 0 re-writeable)\nElectic vehicle charging card of the German Telekom, acting as EMSP GetCharge\nElectic vehicle charging card of the EMSP Stadtwerke Muenchen (SWM), ladenetz.de, Germany\nElectic vehicle charging card of the EMSP EinfachStromLaden of Maingau-Energie, Germany\nScouter carsharing customer card in Germany\nhttps://scouter.de/" }, - { "3B8F8001804F0CA0000003060300020000000069", "RFID - ISO 14443 Type A - NXP Mifare card with 4k EEPROM" }, - { "3B8F8001804F0CA0000003060300030000000068", "RFID - ISO 14443 Type A - NXP Mifare Ultralight or UltralightC" }, + { "3B8F8001804F0CA000000306030000000000006B", "bus/train pass for use with Skanetrafiken (www.skanetrafiken.se) buses and trains.\npublic library of Dusseldorf\nhttp://www.duesseldorf.de/stadtbuechereien/\nspecialized Mifare Ultralight card" }, + { "3B8F8001804F0CA000000306030001000000006A", "NXP/Philips MIFARE Classic 1K (as per PCSC std part3)\nhttp://www.nxp.com/#/pip/pip=[pfp=41863]|pp=[t=pfp,i=41863]\nOyster card - Transport for London (first-gen)\nhttps://en.wikipedia.org/wiki/Oyster_card\nACOS5/1k Mirfare\nvivotech ViVOcard Contactless Test Card\nBangkok BTS Sky SmartPass\nMifare Classic 1K (block 0 re-writeable)\nElectric vehicle charging card of the German Telekom, acting as EMSP GetCharge\nElectric vehicle charging card of the EMSP Stadtwerke Muenchen (SWM), ladenetz.de, Germany\nElectric vehicle charging card of the EMSP EinfachStromLaden of Maingau-Energie, Germany\nScouter carsharing customer card in Germany\nhttps://scouter.de/\nDKV Euro Service +charge (Transport)\nhttps://www.dkv-mobility.com/en/fuelling/fuel-card/dkv-card-charge/\nAndante (Transport)\nKazakhstan 'Onay' transport card (Transport)\nhttps://onay.kz" }, + { "3B8F8001804F0CA0000003060300020000000069", "RFID - ISO 14443 Type A - NXP Mifare card with 4k EEPROM\nOV Chipkaart\nhttps://www.ov-chipkaart.nl/home.htm" }, + { "3B8F8001804F0CA0000003060300030000000068", "RFID - ISO 14443 Type A - NXP Mifare Ultralight or UltralightC\nTempmate S1 Data Logger (Other)\nhttps://www.tempmate.com/\nprepaid bus card (Transport)\nhttps://www.t-l.ch/abos-billets/billets/carte-prepayee\nGamestate rechargable play card (Other)\nhttps://shop.gamestate.com/" }, { "3B8F8001804F0CA0000003060300FF0000000094", "ACTV (Italy) prepaid transport ticket\n'NFC Tag' -- Sony's 'Smart Tags'" }, { "3B8F8001804F0CA00000030603F004000000009F", "NFC FORUM TYPE 1 TAG\nwww.inovision-group.com/topaz\nISO/IEC 14443A - 96 Bytes read/write NFC/RFID IC mandated by NFC Forum as the Type 1 NFC Forum Tag Format." }, { "3B8F8001804F0CA00000030603F011000000008A", "Bangkok Metro (MRT)\nHTC One X Android phone (European edition 'endaevoru')" }, @@ -2074,8 +2260,10 @@ const static atr_t AtrTable[] = { { "3B8F8001804F0CA00000030607....00000000..", "RFID - ISO 14443 Type B Part 3 (as per PCSC std part3)" }, { "3B8F8001804F0CA000000306070000000000006F", "Atmel AT88RF04C CryptoRF" }, { "3B8F8001804F0CA000000306074344600201E4EF", "'Andante' Card, Porto (Portugal) metro card. (ISO14443 B CTS/CTM512B) (Transport)\nhttp://www.transportespublicos.pt/en/glossary/andante-ticket-system/" }, + { "3B8F8001804F0CA00000030607FFB00000000020", "Chinese ID Card (eID)\nhttps://en.wikipedia.org/wiki/Resident_Identity_Card" }, { "3B8F8001804F0CA00000030609....00000000..", "RFID - ISO 15693 Part 1 (as per PCSC std part3)" }, { "3B8F8001804F0CA0000003060A....00000000..", "RFID - ISO 15693 Part 2 (as per PCSC std part3)" }, + { "3B8F8001804F0CA0000003060A0018000000007A", "HID ICLASS DL (eID)" }, { "3B8F8001804F0CA0000003060A001C000000007E", "RFID - HID iCLASS 16K CL" }, { "3B8F8001804F0CA0000003060B....00000000..", "RFID - ISO 15693 Part 3 (as per PCSC std part3)" }, { "3B8F8001804F0CA0000003060B00000000000063", "RFID - ISO 15693 - EM Microelectronic-Marin SA" }, @@ -2098,6 +2286,7 @@ const static atr_t AtrTable[] = { { "3B8F8001805A08030400020024E279788290000C", "Paris Navigo card 14443 B' (Innovatron - Calypso)" }, { "3B8F80018066B007010107............9000..", "Gemalto Santander Optelio TUI R7 with WG10 customized using Contactless interface" }, { "3B8F80018073CC91CBF9A0000003080000100029", "NIST demo PIV card (eID)" }, + { "3B8F8001809100318065B08405002583019000CD", "Contactless IDCore3230 build 6.8, test APDU applet (JavaCard)" }, { "3B8F80018091E1318065B0831100AC83009000B7", "TOP DM GX4 Cards [TOP DM GX4 - contact interface]\nGemCombiXpresso R4 72K (contactless interface)" }, { "3B8F80018091E1318065B0831111AC83009000A6", "TOP DM GX4 Cards [TOP DM GX4 on Omnikey]\nGEMALTO WM GX4 72 DHS TSA (contactless interface)" }, { "3B8F80018091E1318065B0831111E583009000EF", "TOP DL V2 Cards" }, @@ -2115,6 +2304,7 @@ const static atr_t AtrTable[] = { { "3B90958011FE6A", "JC30M48CR JavaCard (JavaCard)" }, { "3B9095801FC359", "Dai Nippon Printing Co., DNP Standard-J T3.1" }, { "3B90968111FE68", "Xirka (eID)" }, + { "3B90969181B1FE551FC7D4", "iClass SE Processor (Other)\nhttps://www.hidglobal.com/products/embedded-modules/iclass-se/sio-processor" }, { "3B9194801F0323BA", "China black(COS) SIM, does not support clock stop" }, { "3B931100003200", "01-3936b2013 (Pay TV)\nhttp://www.lripl.com" }, { "3B941881B1807D1F0319C80050DC", "GoldKey Security PIV Token" }, @@ -2138,21 +2328,25 @@ const static atr_t AtrTable[] = { { "3B959640F001130A0A1D", "xcrypt (Pay TV)" }, { "3B959640F00F100A096A", "Zain Usim Card (Telecommunication)\nwww.qariya.com" }, { "3B959680B1FE551FC7477261636513", "IClass SE Processor (Other)\nhttps://www.hidglobal.com/products/embedded-modules/iclass-se/sio-processor" }, + { "3B90969181B1FE551FC7D4", "IClass SE Processor (Other)\nhttps://www.hidglobal.com/products/embedded-modules/iclass-se/sio-processor"}, { "3B9596C0F01FC20F100A0A16", "viettel (Telecommunication)" }, { "3B959740F01A160A1941", "SG50 (Samsung Chip) (Telecommunication)" }, + { "3B96004121920000622433339000", "Ukrainian Telecommunications Operator Kyivstar (old simcard) (Telecommunication)\nhttps://kyivstar.ua/uk/mm" }, { "3B961880018051006110309F006110309E", "Atmel/Athena T0 PC/SC Compliance Test Card No. 1 (warm reset)" }, + { "3B9694801FC6D0019FCB1000CE", "jawwal (Telecommunication)" }, { "3B9695801FC3D007830254005D", "au IC-card ver.001 (for CDMA2000) (Telecommunication)\nhttps://ja.wikipedia.org/wiki/Au_IC%E3%82%AB%E3%83%BC%E3%83%89" }, { "3B97110002020422003F03", "China Unicom (Telecommunication)" }, { "3B9711801F418031A073BE2100A6", "Comprion UT3 simulator SIM (Other)" }, { "3B9711801F428031A073BE2100A6", "ETSI 102 230 Test case 5.2.5.3. Comprion IT3 SIM emulator (Telecommunication)" }, - { "3B9711C0FFB1FE351F83A505010102A3015F", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controler et atelier/workshop, 2006-2010\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, - { "3B9713C0FFB1FE351F83A505010102A3015D", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controler et atelier/workshop, 2005-2006\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, + { "3B9711C0FFB1FE351F83A505010102A3015F", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controller et atelier/workshop, 2006-2010\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, + { "3B9713C0FFB1FE351F83A505010102A3015D", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controller et atelier/workshop, 2005-2006\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, { "3B9794801F438031E073FE211B39", "Telenor SIM card (Hungary) (Telecommunication)\nhttps://www.telenor.hu" }, { "3B9794803F44908031A073BE210095", "Comprion Simulated card that indicate Low Impedance support: TB(3) = 0x90 (Telecommunication)" }, { "3B9795801F438031E073FE211B38", "JIO (Telecommunication)" }, { "3B9795801F478031E073FE211B3C", "iFree MOGO SIM Card for test (Telecommunication)" }, { "3B9795801FC78031A073B6211BB4", "DNP Local5G (Telecommunication)" }, - { "3B9795C02A31FE35D000480105A3113C", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controler et atelier/workshop, 2010-2015\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, + { "3B9795C02A31FE35D000480105A3113C", "digital chronotachygraphe card: conducteur/driver, entreprise, controleur/controller et atelier/workshop, 2010-2015\nmanufactured by Imprimerie Nationale, distributed by Chronoservices" }, + { "3B97978171FE24007743534D01020300", "Infineon CIPURSE SAM SLF 9630 (Other)" }, { "3B9811000205013242030500", "Sino 3G Nano-sim ordered off Alie Express (Telecommunication)\nhttp://goo.gl/rSEi4N" }, { "3B9813400AA503010101AD1311", "Belgium Electronic ID card (eID)" }, { "3B981801524D4D2076312E32A8", "Ericsson Mini-Link RYS 110 243/1 (Other)" }, @@ -2176,6 +2370,7 @@ const static atr_t AtrTable[] = { { "3B999400910891060001060600", "GSM-SIM Orange-UK (1800)" }, { "3B999400911691080001250100", "GSM SIM E-plus, Germany (Telecommunication)" }, { "3B999400919993120001160200", "ORGA test systems - GSM Phase 2+ Test SIM" }, + { "3B999500001506030105040100", "Skylink CDMA R-UIM card (Telecommunication)\nhttps://en.wikipedia.org/wiki/Sky_Link_(Russia)" }, { "3B9A180082627593110001020200", "Supersim 6 in 1 (Telecommunication)" }, { "3B9A18801FC731425243442E312E3538C0", "HP StorageWorks (Other)\nhttps://hpe.com" }, { "3B9A940091010017000123100096", "GSM-SIM Victorvox D1 (900MHz)" }, @@ -2200,22 +2395,28 @@ const static atr_t AtrTable[] = { { "3B9C110068868D0C86980256408B0500", "China Mobile (Telecommunication)" }, { "3B9C131181647265616D6372797074000408", "XPlusTV & INXCT Access Card-9 (FIRECrypt)" }, { "3B9C131181647265616D6372797074900599", "FireCrypt, access card 9 (Pay TV)" }, + { "3B9C188121455A43332E333420524556204467", "MS-Protect safecard for access system (eID)" }, { "3B9C940068868D0A86980256C2000500", "G3 & GSM & Blank SIM card: to be programmed for OpenBTS with pySim-prog (Telecommunication)" }, { "3B9C940068868D0C86980245A1000500", "China Mobile (Telecommunication)" }, { "3B9C940068868D0C86980256408B0500", "mobiledit (Telecommunication)" }, { "3B9C948011405275746F6B656E4543507363C3", "Aktiv Rutoken ECP SC T1\nhttps://www.rutoken.ru/products/all/rutoken-ecp-sc/" }, + { "3B9C94801F478031E073FE211B545015740152", "VI india (Telecommunication)" }, + { "3B9C94801F478031E073FE211B545015745003", "SIM Card (Telecommunication)" }, { "3B9C94801F478031E073FE211B5450845450B2", "cambodia (Telecommunication)\nhttps://www.smart.com.kh/" }, + { "3B9C94801F478031E073FE211B545085745291", "Airtel india (Telecommunication)" }, { "3B9C94801F478031E073FE211B54538974509C", "China Unicom 128K M2M Card (Telecommunication)" }, { "3B9C94801F478031E073FE211B545983795091", "Vodafone Ukraine (Telecommunication)" }, { "3B9C95801FC78031E073FE211B6457444946CF", "MTC (Moscow) phone SIM card (Telecommunication)\nhttps://moskva.mts.ru/personal" }, { "3B9C9580811F039067464A01005404F272FE00C0", "Feitian Technologies Java Card A22CR (JavaCard)\nhttps://www.javacardos.com/store/javacard-a22cr.php" }, { "3B9C9580811F039067464A01011706F2727E0000", "A40CR (JavaCard)" }, + { "3B9C958131FE9F9067464A010253050172FE00FB", "Feitian Biopass K27 (PKI)\nhttps://www.ftsafe.com/Products/FIDO/Bio" }, { "3B9C96005275746F6B656E4543507363", "Aktiv Rutoken ECP SC T0\nhttps://www.rutoken.ru/products/all/rutoken-ecp-sc/" }, { "3B9C960058442403020020010A009005", "Ticket Restaurant Card (Other)\nhttp://www.edenred.it/buoni-pasto-welfare-benefit/ticket-restaurant-card/" }, { "3B9C978011405275746F6B656E4543507363C0", "Aktiv Rutoken ECP 3.0 NFC (PKI)\nhttps://www.rutoken.ru/products/all/rutoken-ecp-nfc/" }, { "3B9D114023006810114D696F434F53009000", "MioCOS 1.0" }, { "3B9D13813160378031C0694D54434F537302020440", "DPI Card Guatemala (eID)\nhttp://www.masktech.de/" }, { "3B9D13813160378031C0694D54434F537302020541", "MTCOS (eID)\nhttp://www.masktech.com/Products/MTCOS-Professional/11/en" }, + { "3B9D188131FC358031C0694D54434F5373020505D3", "Lithuanian e-ID Card (eID)\nhttps://www.nsc.vrm.lt/default_en.htm" }, { "3B9D944023006820014D696F434F53009000", "Miotec smartcard running Miocos 2.0 on an Atmel AT90SC646\nhttp://www.miotec.fi" }, { "3B9D95801FC38031E0524B5462110373FE211B8F", "KT WiBro UICC (2.3 GHz mobile WiMAX in South Korea)" }, { "3B9D95801FC38031E073FE211B65D00057026230", "Gemalto NFC enabled (acquired through the Simagine contest)" }, @@ -2228,16 +2429,21 @@ const static atr_t AtrTable[] = { { "3B9D95801FC780731A211B63AF09A9830F9000F3", "Estonian GSM operator TELE2 (WPKI eID support)" }, { "3B9D95803FC7A08031A073BE21135105830590007C", "NTT docomo Xi(LTE) DN05(DNP) Pink SIM (Telecommunication)" }, { "3B9D960053492303030020000400F59000", "shell (Transport)" }, + { "3B9D96801FC78031E073FE2113654C0404020096", "China umion 5G SIM (Telecommunication)" }, + { "3B9D96813160378031C0694D54434F5373020204C5", "Mozambique ID Card (eID)" }, { "3B9E94801F4280310073BE211066545953044C25CF", "MCI (Mobile Communication Company of Iran) SIM" }, + { "3B9E94801F478031A073BE21106686880212204027", "americamobile (Telecommunication)" }, { "3B9E94801F478031A073BE21136686880210421014", "Airspan USIM (Telecommunication)" }, { "3B9E94801F478031A073BE21136686880210731025", "module (JavaCard)" }, { "3B9E94801F478031E073BE211366868882183942F5", "China Unicom 128K Mini USIM (Telecommunication)" }, + { "3B9E94801F478031E073FE21136686880212653213", "MTS Moscow (Russia) SIM card (Telecommunication)\nhttps://moskva.mts.ru/personal" }, { "3B9E94801FC38031E073FE211B66D00017B40000A5", "Vodafone Ireland SIM card" }, { "3B9E94801FC78031E073FE211366425454423031DB", "XLB.5G CTC Test Card (Telecommunication)\nhttps://xielibo.com" }, { "3B9E94801FC78031E073FE211B66D0006C025F0033", "Vivo Brasil SIM Card" }, { "3B9E94801FC78031E073FE211B66D0006C0634005C", "SIM card SFR 250 128ko" }, { "3B9E94801FC78031E073FE211B66D0007A00000078", "GaduAIR (Poland) - Subscriber Identity Module (SIM)" }, { "3B9E94801FC78031E073FE211B66D0016DE80C008A", "Mobile TeleSystems (MTS) GSM SIM\nhttp://www.mts.ru/" }, + { "3B9E94801FC78031E073FE211B66D001A16B0F00C6", "Proximus (Belgium) SIM, unactivated (Telecommunication)" }, { "3B9E94801FC78031E073FE211B66D001A18D0F0020", "StarHub Happy Prepaid SIM (Telecommunication)\nhttp://www.starhub.com/personal/mobile/mobile-phones-plans/prepaid-cards.html" }, { "3B9E94801FC78031E073FE211B66D00217F71300F3", "VIETTEL Telecom 4G SIM 128KB (Vietnam) (Telecommunication)\nhttp://vietteltelecom.vn/" }, { "3B9E94801FC78031E073FE211B66D002195C130056", "SIM Card of the French mobile carrier 'La Poste Mobile' (Telecommunication)" }, @@ -2273,6 +2479,7 @@ const static atr_t AtrTable[] = { { "3B9E95801FC78031E073FE211B66D001A0C3120073", "3G MTN IRANCELL Sim Card. (Telecommunication)" }, { "3B9E95801FC78031E073FE211B66D001A1141100A6", "Globe (Telecommunication)" }, { "3B9E95801FC78031E073FE211B66D001A1721000C1", "Vodafone Hungary SIM Card (Telecommunication)\nhttp://vodafone.hu" }, + { "3B9E95801FC78031E073FE211B66D001A17C0F00D0", "Cricket SIM card (Telecommunication)" }, { "3B9E95801FC78031E073FE211B66D001A18C12003D", "Telkomsel SIM card (Telecommunication)\nhttps://www.telkomsel.com/en/kartu-as" }, { "3B9E95801FC78031E073FE211B66D001A1B810000B", "abc mobile prepaid sim card (serviced by CSL) (Telecommunication)\nhttps://www.hkcsl.com/en/abc-Mobile-Prepaid-SIM-Cards/" }, { "3B9E95801FC78031E073FE211B66D0021702130007", "AT&T prepaid nano iphone/android sim card (Telecommunication)" }, @@ -2336,12 +2543,16 @@ const static atr_t AtrTable[] = { { "3B9E96801FC78031E073FE211B66D001A0DD12006E", "USIM (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A0EC11005C", "Boost Mobile Prepaid Micro SIM Card (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A1121000A2", "OpenAirInerface (Telecommunication)" }, + { "3B9E96801FC78031E073FE211B66D001A1181100A9", "WinEMP NRI License Card (Other)" }, + { "3B9E96801FC78031E073FE211B66D001A122110093", "Lebara (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A1581100E9", "Vodafone CZ: SIMPLUS V128 LTE (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A1680F00C7", "Free Mobile SIM card (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A1721000C2", "Vodafone (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D001A1731000C3", "Prepaid public telephone card from Lidl Connect, Germany (Telecommunication)\nhttps://www.lidl.de/de/lidl-connect/s7373597" }, + { "3B9E96801FC78031E073FE211B66D001A1771000C7", "SIM Card Model X1 for Ting Mobile Carrier (Telecommunication)\nhttps://tingmobile.com/" }, { "3B9E96801FC78031E073FE211B66D001A1A70F0008", "Spanish Movistar Mobile phone SIM card (Telecommunication)\nhttp://www.movistar.es/" }, { "3B9E96801FC78031E073FE211B66D001A1E60F0049", "SIM O2 CZ (Telecommunication)" }, + { "3B9E96801FC78031E073FE211B66D002170912000E", "SIM/USIM (SPAIN) - ORANGE ESPAGNE VIRTUAL, S.A.U. (Orange / Jazztel / SIMYO) (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D0021759140058", "USIM card of of Ukrainian Telecommunications Operator Kyivstar, emitted after 2016 (Kyivstar GSM) (GSM/UMTS/LTE services) (Telecommunication) (Telecommunication)\nhttps://kyivstar.ua/uk/4g" }, { "3B9E96801FC78031E073FE211B66D002175B12005C", "Cellcom Israel USIM (micro FF) (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D0021760130066", "Vodafone spain barcelona (Telecommunication)" }, @@ -2353,12 +2564,20 @@ const static atr_t AtrTable[] = { { "3B9E96801FC78031E073FE211B66D00217D91200DE", "telenor (swedish mobile provider) SIM card (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D00217F41200F3", "SIM card for Swedish operator Vimla! (Telecommunication)\nhttps://www.vimla.se" }, { "3B9E96801FC78031E073FE211B66D002194B120042", "halebop (swedish mobile provider) SIM card (Telecommunication)" }, + { "3B9E96801FC78031E073FE211B66D0022436140004", "SIM (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D0022A72130049", "SIM Card OI (Brazil) (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D0022A861300BD", "Mobile Vikings SIM Card (Telecommunication)\nhttps://mobilevikings.com" }, + { "3B9E96801FC78031E073FE211B66D0022A8F1400B3", "Telefonica USIM (Telecommunication)" }, { "3B9E96801FC78031E073FE211B66D0022AD31300E8", "sim card from Mobilcom Debitel Telefonica (Telecommunication)\nhttps://md.de" }, { "3B9E96801FC78031E073FE211B66D0022AD91300E2", "sim (Telecommunication)" }, + { "3B9E96801FC78031E073FE211B66D0022AE81300D3", "Twilio Super SIM card (Telecommunication)\nhttps://www.twilio.com/iot/super-sim-card" }, + { "3B9E96801FC78031E073FE211B66D0022AF21400CE", "Tello (Telecommunication)\nhttps://tello.com/" }, { "3B9E96801FC78031E073FE211B66D00233AD140088", "4G-LTE (Telecommunication)" }, { "3B9E96803FC3A08031E073FE211B630801140F9000D3", "KT Olleh LTE Warp SA-L 1670 (Telecommunication)" }, + { "3B9E97801FC68031E073FE211B66D0019F7A1200F6", "Spectrun USA Sim Card (Telecommunication)" }, + { "3B9E97801FC68031E073FE211B66D002401D15004A", "Telia Sim card for IoT (Telecommunication)" }, + { "3B9E97801FC68031E073FE211B66D0024027150070", "verymobile wind 3 (Telecommunication)\nhttps://verymobile.it/" }, + { "3B9E97801FC68031E073FE211B66D0025E7315003A", "Twilio Super SIM (Telecommunication)\nhttps://www.twilio.com/iot/super-sim-card" }, { "3B9E97801FC78031E073FE211B66D0006B951100EE", "TracFone SIM Verizon Wireless LTE supported (Telecommunication)\nhttps://www.tracfone.com" }, { "3B9E97801FC78031E073FE211B66D0022AB3130089", "SIM T-MObile (Telecommunication)" }, { "3B9F..801FC300681.4405014649534531C8..9000..", "Setec SetCOS 4.4.1" }, @@ -2406,6 +2625,7 @@ const static atr_t AtrTable[] = { { "3B9F94401E0067114346495345105266FF819000", "Setec / FINEID\nSETEC Instant EID" }, { "3B9F94401E0067164346495345105266FF819000", "RSA SecurID 3100 or Utimaco Safeware Smartcard\nSetCOS 4.3.1 Revision Unknown" }, { "3B9F94801FC30068104405014649534531C807900018", "SetCOS 4.3.0 32K RSA\nInstant EID IP2\nSETEC SetCard 32K PKI Evaluated SetCOS 4.4.1a2" }, + { "3B9F94801FC38031A07320210805500940095E010274", "Yemen Mobile SIM Card Yemen (YE) (Telecommunication)" }, { "3B9F94801FC38031A073B6A10067CF3251CC9E6EC015", "OYEITIMES 2G GSM Blank SIM Card (Other)\nhttps://www.aliexpress.com/item/32972705510.html?spm=a2g0s.9042311.0.0.5a564c4daKCdcQ" }, { "3B9F94801FC38031E073FE21136301030283079000CE", "Programmable SIM card as one of the requirement for free5GC testing procedure (Telecommunication)" }, { "3B9F94801FC78031E073FE2100644090610082900069", "softsim (Telecommunication)" }, @@ -2420,6 +2640,7 @@ const static atr_t AtrTable[] = { { "3B9F94801FC78031E073FE21135749050C86986018CC", "China Unicom USIM 128K 6131H" }, { "3B9F94801FC78031E073FE21135786810586984018AE", "China Unicom USIM Card (Telecommunication)" }, { "3B9F94801FC78031E073FE211357868107869862188E", "OYEITIMES MCR3516 SIM Card (Telecommunication)" }, + { "3B9F94801FC78031E073FE2113578681098698621880", "Oyeitimes 5G ISIM R16 (Telecommunication)\nhttps://www.oyeitimes.com/detail.php?id=535&ids=565&idt=&ide=&dd=1410" }, { "3B9F94801FC78031E073FE21135786850686984218AB", "4G LTE blank USIM Green Card (Telecommunication)\nhttp://grcard.en.alibaba.com/product/60076835567-209365843/4G_LTE_blank_usim_card_for_4G_network.html" }, { "3B9F94801FC78031E073FE21136321150683079000F8", "Maroc Telecom 4G+ (Telecommunication)" }, { "3B9F94801FC78031E073FE21136761210D10000070F7", "Celcom XPAX (Telecommunication)\nhttps://www.celcom.com.my/personal/prepaid" }, @@ -2427,6 +2648,7 @@ const static atr_t AtrTable[] = { { "3B9F94801FC78031E073FE2119573C8660CFBA02A0ED", "Gotanet DK USIM (Telecommunication)" }, { "3B9F94801FC78031E073FE211B573786609B3289B2A1", "China Unicom Travel SIM (Telecommunication)\nhttps://www.cuniq.com/hk/data-card/asia/asia-12days.html" }, { "3B9F94801FC78031E073FE211B573786609BA182109B", "U Mobile POWER Prepaid (Telecommunication)\nhttp://www.u.com.my/prepaid" }, + { "3B9F94801FC78031E073FE211B573C8660CDA1001246", "Beeline SIM card (RUS) (Telecommunication)\nhttps://beeline.ru" }, { "3B9F94801FC78031E073FE211B573F86604D03000075", "Prepaid SIM card MOCHE (Portugal) (Telecommunication)" }, { "3B9F94801FC78031E073FE211B573F866083020000BA", "GSM-SIM Beeline RU (Telecommunication)\nhttp://beeline.ru" }, { "3B9F94801FC78031E073FE211B573F866096A100000C", "Lycamobile UICC/SIM card. (Telecommunication)\nhttps://www.lycamobile.com.au" }, @@ -2436,6 +2658,7 @@ const static atr_t AtrTable[] = { { "3B9F94801FC78031E073FE211B640681010082900045", "Mobicarte Orange" }, { "3B9F94801FC78031E073FE211B6407564200829000D0", "SIM mobi orange" }, { "3B9F94801FC78031E073FE211B649F4F002082900033", "USIM (3G DF) Orange (French Mobile Network) (Telecommunication)" }, + { "3B9F94801FC78031E073FE211B674B004A5503060083", "CU esim thd89 (Telecommunication)" }, { "3B9F95801F038031A073B6A10067CF97F9E063689957", "Telestial OneRate International SIM card (Telecommunication)\nhttp://www.amazon.com/gp/product/B004GV13VY/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1" }, { "3B9F95801F438031E073362113574A330E09314100A9", "GSM-SIM Elisa (Estonia, WPKI eID support)" }, { "3B9F95801F438031E073362113574A330E0C314100AC", "Vodafone SIM (mobile phone)" }, @@ -2449,6 +2672,7 @@ const static atr_t AtrTable[] = { { "3B9F95801FC38031A073BE21005302E232830590003C", "NTT docomo FOMA(W-CDMA) GE02(Japan Gemplus) Green SIM (Telecommunication)\nhttps://ja.wikipedia.org/wiki/%E3%83%89%E3%82%B3%E3%83%A2UIM%E3%82%AB%E3%83%BC%E3%83%89" }, { "3B9F95801FC38031A073BE2113674701030102000099", "T-Mobile (UK) SIM\nFresh Mobile (UK) SIM" }, { "3B9F95801FC38031A073BE2113674701050104000099", "T-Mobile Nederlands\nhttp://www.tmobile.nl" }, + { "3B9F95801FC38031A073BE2113674701050904000091", "SIM card (Telecommunication)" }, { "3B9F95801FC38031A073BE2113674701090901000098", "German SIM card (T-Mobile) (Telecommunication)" }, { "3B9F95801FC38031A073BE211367D002030901000006", "GSM, T-Mobile (Germany)" }, { "3B9F95801FC38031A073BE211367D002031901000016", "GSM SIM card from congstar (a no-frills service provider of Deutsche Telekom)" }, @@ -2464,11 +2688,14 @@ const static atr_t AtrTable[] = { { "3B9F95801FC38031E073FE211B649B4D011182900000", "Singular (now AT&T) 3G GSM SIM Card" }, { "3B9F95801FC38031E073FE211BB3E20174830F900088", "Gemplus GemXplore 3G USIM" }, { "3B9F95801FC78031A073B6A10067CF1713C41D2D3649", "Idemia card (Telecommunication)" }, - { "3B9F95801FC78031A073B6A10067CF1794AA28993F28", "Glaier Programable LTE USIM Card (Telecommunication)" }, + { "3B9F95801FC78031A073B6A10067CF1794AA28993F28", "Glaier Programmable LTE USIM Card (Telecommunication)" }, { "3B9F95801FC78031A073B6A10067CF3211B252C679F3", "open5gs (Telecommunication)" }, { "3B9F95801FC78031A073B6A10067CF3215A98FD70950", "LTE Card (Telecommunication)" }, + { "3B9F95801FC78031A073B6A10067CF3215CA9CD70920", "Gialer LTE USIM (Telecommunication)\nhttps://www.gialer.com/collections/writable-sim-card/products/gialer-writable-programmable-sim-card-4g-lte-wcdma-gsm-nano-micro-2ff-3ff-4ff-blank-usim-card-for-telecom-operator?variant=40982030090394" }, + { "3B9F95801FC78031A073B6A10067CF3216C3F1484998", "LTE USIM as used for Private LTE Networks. Manufacturer 'Huahong' in China (Telecommunication)" }, { "3B9F95801FC78031A073BE21005304D08083059000BE", "NTT_DoCoMo (Telecommunication)" }, { "3B9F95801FC78031A073BE211367D002040901000005", "T-Mobile SIM card issued in Germany 2012" }, + { "3B9F95801FC78031E073F62100000086538300900061", "Zong (Telecommunication)" }, { "3B9F95801FC78031E073F62113674D451500390102F4", "Vivo 4G LTE SIM Card (Telecommunication)" }, { "3B9F95801FC78031E073F62113674D4516004301008F", "VALID USIM (Telecommunication)" }, { "3B9F95801FC78031E073FE21135712291102010000C2", "sysmocom sysmoUSIM-GR1\nhttp://sysmocom.de/" }, @@ -2481,11 +2708,13 @@ const static atr_t AtrTable[] = { { "3B9F95801FC78031E073FE2113574A330E1932330084", "WIND Mobile SIM Card" }, { "3B9F95801FC78031E073FE2113574A330E1A32330087", "Rohde and Schwarz CMW-Z04. Mini-UICC Test Card (Telecommunication)" }, { "3B9F95801FC78031E073FE2113574A330E1A32360082", "TELUS 3G SIM Card" }, + { "3B9F95801FC78031E073FE2113574A330E1E32360086", "SIM Enreach (Telecommunication)" }, { "3B9F95801FC78031E073FE2113635510888307900006", "SHOW or UPlus USIM (Telecommunication)" }, { "3B9F95801FC78031E073FE2113635510AA8307900024", "2degrees NFC (Telecommunication)\nhttp://www.2degreesmobile.co.nz/home" }, { "3B9F95801FC78031E073FE2113672228004001000191", "Lycamobile Prepaid SIM-Card (Telecommunication)\nhttp://lycamobile.at" }, { "3B9F95801FC78031E073FE211367940311000002035C", "AT&T (US) GSM SIM" }, { "3B9F95801FC78031E073FE211B573C8660BEB7002010", "Kyivstar SIM (Telecommunication)\nhttps://kyivstar.ua/" }, + { "3B9F95801FC78031E073FE211B573F866096AE000002", "Kazakhstan 'Beeline' 4G SIM card (Telecommunication)\nhttps://beeline.kz" }, { "3B9F95801FC78031E073FE211B63E20394830F9000BE", "Telenet N.V. Walk & Talk SIM Card Belgium" }, { "3B9F95801FC78031E073FE211B63E204A5830F900088", "Cingular '64Ksmartchip' GSM SIM\nTelia GSM/3G (Swedish operator)" }, { "3B9F95801FC78031E073FE211B63E206A6830F900089", "TracFone (US) Net10 GSM SIM card\nSimyo (Germany) GSM SIM card\nH3G (Italy) UMTS USIM card" }, @@ -2498,6 +2727,7 @@ const static atr_t AtrTable[] = { { "3B9F95801FC78031E073FE211B640752930282900006", "AT&T GO PHONE 2G (Telecommunication)\nhttps://www.att.com/shop/wireless/gophone.html" }, { "3B9F95801FC78031E073FE211B6407536301829000F4", "AT&T UICC with USIM and ISIM (Telecommunication)" }, { "3B9F95801FC78031E073FE211B6440614100829000A2", "SIM card (Telecommunication)" }, + { "3B9F95801FC78031E073FE211B644067620082900087", "ATT SIM card (Telecommunication)" }, { "3B9F95801FC78031E073FE211B644112010082900090", "MTS SIM card (Russia) (Telecommunication)\nhttp://www.mts.ru/" }, { "3B9F95801FC78031E073FE211B6441132100829000B1", "AT&T SIM card (Telecommunication)" }, { "3B9F95801FC78031E073FE211B644132310082900080", "Telefonica | Vivo Brazil M2M SIM Card (Telecommunication)" }, @@ -2505,6 +2735,8 @@ const static atr_t AtrTable[] = { { "3B9F95801FC78031E073FE211B659F010902048105C4", "2degrees mobile SIM card\nhttp://www.2degreesmobile.co.nz/" }, { "3B9F95801FC78031E073FE211B65B4010E01028105ED", "USIM Card by Maroc Telecom Morocco (Telecommunication)" }, { "3B9F95801FC78031E073FE211B675348434F5F01019B", "baicells sim card (Telecommunication)\nhttp://www.baicells.com/" }, + { "3B9F95801FC78031E073FE211B675744534C45393794", "SIM card MTS Russia (Telecommunication)\nhttps://moskva.mts.ru/personal" }, + { "3B9F95801FC78031E073FEA11F6441805100829000D6", "AT&T SIM Card (Telecommunication)" }, { "3B9F95803FC3A08031E073FE2113638D434283F0900034", "Taisys Java Csrd (Telecommunication)" }, { "3B9F95803FC7A08031A073BE211B5305D0808305900024", "NTT docomo Xi(LTE) AX05(Gemalto) Pink SIM (Telecommunication)\nhttps://ja.wikipedia.org/wiki/%E3%83%89%E3%82%B3%E3%83%A2UIM%E3%82%AB%E3%83%BC%E3%83%89" }, { "3B9F95803FC7A08031E073FE211363554022830790007C", "Ubivelox (JavaCard)" }, @@ -2515,6 +2747,8 @@ const static atr_t AtrTable[] = { { "3B9F958131FE9F006646530510043171DF000000000026", "ePass2003 (PKI)" }, { "3B9F958131FE9F006646530510043171DF000006000020", "FEITIAN ePASS 2003 Auto (PKI)" }, { "3B9F958131FE9F006646530510043171DF00003900001F", "Feitian ePass2003 (PKI)" }, + { "3B9F958131FE9F006646530510063171DF000000000024", "FT ePass2003Auto USB Token (PKI)" }, + { "3B9F958131FE9F006646530510323871DF00000600001F", "token (PKI)" }, { "3B9F958131FE9F006646530520032571DF000000000005", "Feitian ePass2003 token" }, { "3B9F958131FE9F006646530520032571DF000003900096", "Feitian ePass2003 token (PKI)" }, { "3B9F958131FE9F006646530523002571C39F0000000086", "Feitian ePass2003 token" }, @@ -2522,6 +2756,10 @@ const static atr_t AtrTable[] = { { "3B9F958131FE9F006646530523002571DF000003900096", "Feitian USB Cryptographic token (FIPS 140-2 Level 3) (PKI)\nhttp://www.ftsafe.com/product/epass/epass2003" }, { "3B9F958131FE9F006646530532022571DF000006000010", "ePass 3003 Auto (PKI)\nhttps://www.ftsafe.com/products/PKI/Standard/Specification" }, { "3B9F958131FE9F006646530534002571DF0000036A82F9", "Feitian ePass2003Auto (PKI)\nhttps://www.ftsafe.com/Products/PKI/Standard/Specification" }, + { "3B9F958131FE9F006646530551003371DF000000000061", "FT ePass2003Auto 00 00 (PKI)" }, + { "3B9F958131FE9F006646530551003371DF0000036A828A", "Feitian epass2003 Auto (PKI)" }, + { "3B9F958131FE9F006646530551003371DF0000039000F2", "HyperPKI USB Token (PKI)\nhttps://www.hypersecu.com/hyperpki" }, + { "3B9F958131FE9F006646530551003371DF000006000067", "Epass2003 (PKI)" }, { "3B9F95C00A1F078031E073FE211B63F100AD830F90001D", "EMT WPKI USIM (2014, Estonia, JavaCard) (Telecommunication)" }, { "3B9F95C00A1FC78031E073FE211B63F100AD830F9000DD", "Telenor SIM card (Norway)" }, { "3B9F96400A8031E06B0420050258555555555555", "BuyPass identification card. It can also possibly be used to hold e-currency." }, @@ -2532,31 +2770,40 @@ const static atr_t AtrTable[] = { { "3B9F96801F438031E073362113574A330E0C314100AF", "GSM, Vodafone (Germany)" }, { "3B9F96801F478031E073362113574A330E0C314100AB", "NATEL SIM-Card swisscom\nVodafone Germany Micro-SIM from 2010" }, { "3B9F96801F478031E073FE2113574A330E253332003B", "SMART prepaid card, Estonia (Telecommunication)" }, + { "3B9F96801F878031A073BE2111630000018305900089", "jio sim card (Telecommunication)" }, { "3B9F96801F878031E073FE2119674A555473300948DB", "nano sim/usim card (Telecommunication)" }, { "3B9F96801F878031E073FE2119674A555475300662F8", "SIM Card (Telecommunication)" }, { "3B9F96801F878031E073FE2119674A557330310746BE", "Hologram Developer Global IoT SIM Card (Telecommunication)\nhttps://hologram.io/store/global-iot-sim-card/17" }, { "3B9F96801F878031E073FE211B674A4C5275310451D5", "Test card provided with 4G/5G network from Amarisoft (Telecommunication)" }, { "3B9F96801F878031E073FE211B674A4C7530300248A9", "Cardcentrics (Telecommunication)" }, - { "3B9F96801F878031E073FE211B674A4C753034054BA9", "Test Card (Telecommunication)" }, + { "3B9F96801F878031E073FE211B674A4C753034054BA9", "sysmoISIM-SJA2 (Telecommunication)\nhttps://osmocom.org/projects/cellular-infrastructure/wiki/SysmoISIM-SJA2" }, + { "3B9F96801F878031E073FE211B674A55527531054BD7", "Softbank (C2) USIM card (Telecommunication)" }, + { "3B9F96801F878031E073FE211B674A55733031094BBF", "NB-IoT SIM (Telecommunication)" }, { "3B9F96801FC30068104405014649534531C80790001A", "SETEC SetCard 32K PKI Evaluated SetCOS 4.4.1" }, { "3B9F96801FC38031E073FA21006331602383109000BE", "TAISYS SIMoME JAR (JavaCard)\nhttp://www.taisys.com/p-detail?id=39beTne-hf4u2Y5DnWghweplyFR-dUUf1-xpy55cWQ" }, + { "3B9F96801FC38031E073FE2100671101674006007789", "Beni's UICC 4G LTE (Telecommunication)\nhttps://cslgroup.co.id/" }, { "3B9F96801FC38031E073FE211BB3E2027E830F900082", "Vodafone SIM Card (D2, 1800Mhz, Germany, Twincard, possibly others too?), manufactured by Gemplus (See stamp on the chip)\nMobileOne (Singaporean 3G/GSM operator) SIM card 'II(3G-64) M1 3G '" }, { "3B9F96801FC68031E073F62113674D45220079020080", "TMobile (Telecommunication)" }, { "3B9F96801FC68031E073F62113674D4522008001007A", "ORANGE SPAIN GSM 4G SIM (Telecommunication)" }, { "3B9F96801FC68031E073F62113675602220080010127", "giffgaff USIM (Telecommunication)" }, { "3B9F96801FC68031E073F62113675603220121010087", "Rain 4G 5G Internet Service provider (Telecommunication)\nhttps://www.rain.co.za" }, + { "3B9F96801FC68031E073F62113675603220121020084", "T-Mobile Sim Card (Telecommunication)" }, { "3B9F96801FC68031E073FE2111633F011183079000E4", "VR-Bank VRNetworld HBCI Card (Bank)" }, { "3B9F96801FC68031E073FE2113574A330577333300E2", "USIM issued by Moldcell mobile operator in Moldova (Telecommunication)\nhttp://www.moldcell.md/" }, + { "3B9F96801FC68031E073FE211B6300850083819000C2", "Vodafone IoT USIM (Telecommunication)" }, { "3B9F96801FC68031E073FE211B6441024100829000C2", "Empire Bank ltd (Bank)\nFinnish Telia SIM-card (Telecommunication)" }, { "3B9F96801FC68031E073FE211B644104810082900004", "SAP Leonardo IoT Connect 365 SIM card (Telecommunication)\nhttps://www.sap.com/uk/products/enterprise-iot-connect.html" }, { "3B9F96801FC68031E073FE211B644115010082900095", "Telia LT prepaid Ezys USIM (Telecommunication)\nhttps://www.ezys.lt" }, { "3B9F96801FC68031E073FE211B6441177300829000E5", "Prixtel SIM card over OrangeF network (Telecommunication)\nhttps://www.prixtel.com" }, { "3B9F96801FC68031E073FE211B6441193100829000A9", "Taiwan Star Telecom Corporation Limited (Telecommunication)\nhttps://www.tstartel.com/CWS/" }, + { "3B9F96801FC68031E073FE211B6441247100829000D4", "RWG Mobile SIM Card (Telecommunication)\nhttps://www.rwgmobile.wales/rates-plans-eng-per/" }, { "3B9F96801FC68031E073FE211B644124910082900034", "Fido Canada (Telecommunication)" }, { "3B9F96801FC68031E073FE211B6441255100829000F5", "R&S CMW-Z06 Multi Test SIM (Telecommunication)" }, { "3B9F96801FC68031E073FE211B644130320082900083", "SFR (Telecommunication)" }, { "3B9F96801FC68031E073FE211B6441346100829000D4", "Ting X1 GSM SIM Card (4G, T-Mobile network) (Telecommunication)\nhttps://ting.com/shop/gsmSIM" }, + { "3B9F96801FC68031E073FE211B65CA010E0209810599", "Liquid Telecom Zambia (Telecommunication)\nhttps://zm.liquidhome.tech/" }, { "3B9F96801FC68031E073FE211B66D00206131218031E", "SIM card (Telecommunication)" }, + { "3B9F96801FC68031E073FE211B66D002061312180419", "T-Mobile NL SIM only (Telecommunication)" }, { "3B9F96801FC68031E073FE211B66D00206E20F1801F0", "Telekom Sim card (Telecommunication)" }, { "3B9F96801FC68031E073FE211B66D00206E20F1803F2", "Vulcan 0502 T-Mobile SIM (Telecommunication)" }, { "3B9F96801FC68031E073FE211B66D00206E20F1804F5", "T-Mobile Nederlands (Telecommunication)\nhttps://t-mobile.nl/" }, @@ -2565,6 +2812,7 @@ const static atr_t AtrTable[] = { { "3B9F96801FC68031E073FE211B66D00221AB11180180", "Telekom Germany Triple SIM issued in 2018 (Telecommunication)" }, { "3B9F96801FC68031E073FE211B66D00221AB11180786", "telekom HU nano sim card (Telecommunication)\nhttps://www.telekom.hu" }, { "3B9F96801FC68031E073FE211C6441193100829000AE", "SORACOM SIM (plan unknown) (Telecommunication)" }, + { "3B9F96801FC78031A073BE21136742470111000001CC", "Bank of Hawai'i (Bank)\nhttps://www.boh.com/" }, { "3B9F96801FC78031A073BE2113674320071800000100", "sysmoUSIM-SJS1 (Telecommunication) (Telecommunication)\nhttp://www.sysmocom.de/products/sysmousim-sjs1-sim-usim" }, { "3B9F96801FC78031A073BE21136743200718000001A5", "sysmoUSIM-SJS1 (Telecommunication)\nhttp://www.sysmocom.de/products/sysmousim-sjs1-sim-usim" }, { "3B9F96801FC78031A073BE21136744220610000001A9", "Fairwaves test SIM card (Telecommunication)\nhttp://fairwaves.co" }, @@ -2576,6 +2824,9 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073F62113675603270089010228", "TMobile Prepaid USIM (Telecommunication)" }, { "3B9F96801FC78031E073F621136756032701010203A3", "USIM LTE MOVISTAR (Telecommunication)" }, { "3B9F96801FC78031E073F621136756032701020100A0", "vivo (Other)" }, + { "3B9F96801FC78031E073F62113675603270120020081", "VALID brand SIM card from T-Mobile (Telecommunication)" }, + { "3B9F96801FC78031E073F6211367560346014901008A", "T-Mobile Poland pre-paid SIM card (Telecommunication)" }, + { "3B9F96801FC78031E073F6A157574A4D020B6110005B", "G+D Mobile Security for private 5G USIM (Telecommunication)\nhttps://www.gi-de.com/en/connectivity/mobile-network-operator/5g#5g-sim" }, { "3B9F96801FC78031E073FE21..63......83..9000..", "TIM (Italy) 128KB GSM SIM\nH3G (Italy) UMTS USIM\nVodafone (UK) SIM" }, { "3B9F96801FC78031E073FE211163407262830790009A", "GSM SIM / LTE UICC card issued by Omnitel, Lithuania (Telecomunications)" }, { "3B9F96801FC78031E073FE2111634082918307900099", "Chunghwa Telecom (Taiwan) 3G/4G PrePaid card\nhttps://www.twgate.net/prepaidcard/product_en.html" }, @@ -2591,6 +2842,8 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE2113574A330E25333200BB", "Sintel hi! Tourist prepaid (Telecommunication)\nhttp://www1.singtel.com/personal/phones-plans/mobile/prepaid/hitouristsimcards.html" }, { "3B9F96801FC78031E073FE2113574A330E26333200B8", "Vodafone sim card (Telecommunication)" }, { "3B9F96801FC78031E073FE2113574A330E3F333400A7", "SIM Card (Telecommunication)" }, + { "3B9F96801FC78031E073FE2113574A338101330017", "Telefonica M2M Global SIM (Telecommunication)" }, + { "3B9F96801FC78031E073FE2113574A33810433330014", "PureTalk SIM Card (Telecommunication)" }, { "3B9F96801FC78031E073FE2113679118020406060651", "USIM (3G PF) Orange" }, { "3B9F96801FC78031E073FE211367931801010401095F", "Telstra 128K Universal Orange SIM Card (Telecommunication)" }, { "3B9F96801FC78031E073FE2113679319010401010750", "Telefonica m2m simcard, Movistar o2 vivo (Telecommunication)" }, @@ -2600,6 +2853,7 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE211367933001030301047F", "T-Mobile US SIM card (Telecommunication)" }, { "3B9F96801FC78031E073FE211367933001030403027C", "Comprion test U(SIM): model 128K/J LTE Test (U)SIM - Mini-UICC, product number Prod. No.: 10432006 (Telecommunication)\nhttp://www.comprion.com/en/products/test__u_sims/3g_test_usim_cards" }, { "3B9F96801FC78031E073FE211367933001060201027D", "Morpho USIM (Telecommunication)" }, + { "3B9F96801FC78031E073FE2113679330010802010273", "Bouygues Telecom SIM (Telecommunication)" }, { "3B9F96801FC78031E073FE211367933001110201026A", "R&S CMW-Z04 Mini-UICC Test Card (Telecommunication)\nhttp://www.rhode-schwartz.com" }, { "3B9F96801FC78031E073FE2113679331010801010172", "Morpho (Telecommunication)" }, { "3B9F96801FC78031E073FE2113679403030A02020244", "Digi mobil Romania (old sim card version) (Telecommunication)" }, @@ -2609,6 +2863,7 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE211367940401070202024C", "Orange Mobicarte (France)" }, { "3B9F96801FC78031E073FE211367940404030505054A", "Claro operator SIM" }, { "3B9F96801FC78031E073FE211367941602070502025A", "CSL Mobile / PCCW SIM Card (Telecommunication)\nhttp://www.hkcsl.com/" }, + { "3B9F96801FC78031E073FE211367941602120101014B", "Airtel India Sim Card (Telecommunication)" }, { "3B9F96801FC78031E073FE2113679801010202030142", "Telenor SIM card (Hungary) (Telecommunication)\nhttps://www.telenor.hu" }, { "3B9F96801FC78031E073FE2113679801010402030247", "ReadySIM / T-Mobile USA USIM (2013) (Telecommunication)\nhttp://www.readysim.com/" }, { "3B9F96801FC78031E073FE2113679801010803010349", "Yesss! SIM card (Austria) (Telecommunication)\nhttps://www.yesss.at" }, @@ -2629,8 +2884,11 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE2115574A330E3B333400A5", "O2 Spain phone SIM (Telecommunication)\nhttps://o2online.es/" }, { "3B9F96801FC78031E073FE2115574A330E3F333500A0", "Telefonica (Germany) SIM Card (Telecommunication)" }, { "3B9F96801FC78031E073FE2117574A330E3F333400A3", "Telecommunication (SIM or USIM card) T-Mobile Communications (Telecommunication)" }, + { "3B9F96801FC78031E073FE2117574A330E3F333500A2", "Megafon (RUS) SIM Card (Telecommunication)\nhttps://megafon.ru" }, { "3B9F96801FC78031E073FE2117574A330E3F333600A1", "Bell Mobility MULTI SIM (Telecommunication)\nhttps://bell.ca" }, { "3B9F96801FC78031E073FE2117574A33810433360015", "HoT Austria SIM Card (Telecommunication)\nhttps://hot.at/" }, + { "3B9F96801FC78031E073FE2117574A3382033339001E", "Sm@rtSIM Zeta (Giesecke & Devrient SIM) (Telecommunication)" }, + { "3B9F96801FC78031E073FE2117574A33820433390019", "NB-IoT SIM (Telecommunication)" }, { "3B9F96801FC78031E073FE211B57318660B21A0C0C9F", "SIM CARD (JavaCard)" }, { "3B9F96801FC78031E073FE211B630057008381900011", "3 (3g microUSIM) Italian subsidiary H3G" }, { "3B9F96801FC78031E073FE211B634041918307900050", "giffgaff UK 3G SIM\nnetzclub sponsored mobile\no2 Loop GSM SIM Germany (PREPAID) from 2013" }, @@ -2655,7 +2913,10 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE211B6441447300829000B7", "Bouygues Telecom (French Mobile Provider SIM card) (Telecommunication)\nhttps://www.bouyguestelecom.fr" }, { "3B9F96801FC78031E073FE211B6441503100829000E1", "telcel sim card (Telecommunication)" }, { "3B9F96801FC78031E073FE211B6441725100829000A3", "Free Mobile (French wireless service provider) SIM card (mini-SIM with micro-SIM cutout) received in 2020-09 (Telecommunication)\nhttps://mobile.free.fr/" }, + { "3B9F96801FC78031E073FE211B6441725200829000A0", "Woolworths Mobile Prepaid SIM (Telecommunication)\nhttps://mobile.woolworths.com.au/" }, { "3B9F96801FC78031E073FE211B6441763200829000C4", "T-Mobile SIM card issued April 2021 (Telecommunication)" }, + { "3B9F96801FC78031E073FE211B6450040100826A82EC", "SIM (Telecommunication)" }, + { "3B9F96801FC78031E073FE211B6450055100829000C5", "Sim card Team Telecom Armenia (Telecommunication)\nhttps://www.telecomarmenia.am/hy/" }, { "3B9F96801FC78031E073FE211B65240109010081057B", "Lycamobile (UK) GSM SIM card" }, { "3B9F96801FC78031E073FE211B65260109000781057F", "EMT WPKI 2015 (ECC) subscription (Telecommunication)\nhttps://www.emt.ee/en/pakkumised/mobiil-id" }, { "3B9F96801FC78031E073FE211B65270109010381057B", "slarmy (Telecommunication)" }, @@ -2663,8 +2924,12 @@ const static atr_t AtrTable[] = { { "3B9F96801FC78031E073FE211B652A010A0102810574", "Thailand AIS SIM Card (Telecommunication)" }, { "3B9F96801FC78031E073FE211B652A010E0201810570", "gsm (Telecommunication)" }, { "3B9F96801FC78031E073FE211B652D010C0400810572", "Tri Indonesia Bima+ SIM Card (Telecommunication)\nhttps://beta.tri.co.id/3digiworld/Bimaplus" }, + { "3B9F96801FC78031E073FE211B652F0109020A810579", "cellcom israel sim (Telecommunication)" }, { "3B9F96801FC78031E073FE211B652F010A0301810570", "SMART Prepaid SIM (Telecommunication)" }, + { "3B9F96801FC78031E073FE211B652F010A0304810575", "Smart Telecom (PH) (Telecommunication)\nhttps://smart.com.ph/Prepaid/sim-and-phones/lte-prepaid-sim" }, + { "3B9F96801FC78031E073FE211B652F010D0100810574", "vodacom_sim (Pay TV)" }, { "3B9F96801FC78031E073FE211B6556544C017481056D", "Viettel LTE SIM (Telecommunication)" }, + { "3B9F96801FC78031E073FE211B6556544C017681056F", "Viettel Telecom (Telecommunication)" }, { "3B9F96801FC78031E073FE211B65630109020181053E", "2degrees Mobile SIM Card New Zealand (Telecommunication)\nhttp://2degreesmobile.co.nz" }, { "3B9F96801FC78031E073FE211B65BA010904048100E1", "Blank SIM (Telecommunication)" }, { "3B9F96801FC78031E073FE211B66D0016B820E1801FE", "Telekom Deutschland GmbH - Xtra Data Karte (3G SIM)" }, @@ -2678,11 +2943,17 @@ const static atr_t AtrTable[] = { { "3B9F96803FC7008031E073FE211F6441262100829000A3", "Smartjac SMAOT100A234FF (Telecommunication)\nhttps://smartjac.com" }, { "3B9F96803FC7828031E073F62157574A330581053000CE", "COMPRION M2M eUICC (Telecommunication)" }, { "3B9F96803FC7828031E073F62157574A4D020B60010069", "eSIM GSMA Card (Telecommunication)\nhttps://www.gsma.com/newsroom/wp-content/uploads/SGP.22_v2.2.pdf" }, + { "3B9F96803FC7828031E073F62157574A4D020B60610009", "ting (Telecommunication)" }, + { "3B9F96803FC7828031E073FE211B57AA8660F0010011EE", "eSIM.me pluggable eSIM (Telecommunication)\nhttps://esim.me/" }, + { "3B9F96803FC7828031E073FE211B633A204E8300900031", "eSIM (Telecommunication)" }, + { "3B9F96803FC7828031E075F62157210355020B60500019", "st33g1m2 (Telecommunication)\nhttps://www.st.com/en/secure-mcus/st33g1m2.html" }, + { "3B9F96803FC7A08031E073F62116574A4D020233456377", "ISIS-Ready T-Mobile Sim Card (Telecommunication)" }, { "3B9F96803FC7A08031E073F62156574A4D020B3444005B", "Norwegian telenor (Telecommunication)\nhttp://www.telenor.no" }, { "3B9F96803FC7A08031E073F62157574A4D020B34546329", "Orange FR - opa (Telecommunication)" }, { "3B9F96803FC7A08031E073FE211B63F100E8830090005E", "UICC CARD (Telecommunication)" }, { "3B9F96803FC7A08031E073FE211B6407689A00829000B4", "Orange SIM Card (Telecommunication)" }, { "3B9F96803FC7A08031E073FE211B64080503008290004F", "NFC-enabled SIM card of MTS Russia. (Telecommunication)" }, + { "3B9F96803FC7A08031E073FE211F6300690083819000AB", "GSM file system and SWP sample supplied with STMicro development kit (Other)" }, { "3B9F96803FC7A08031E073FE211F6441269100829000B3", "LTE Lab SIM Ver 1.3 (Telecommunication)" }, { "3B9F968131FE458065544312210831C073F6218081059A", "Scientific and Technological Research Council of Turkey (test card) (eID)" }, { "3B9F968131FE45806755454B41451212318073B3A180EA", "AKiS v1.2 on nxp chip" }, @@ -2691,10 +2962,12 @@ const static atr_t AtrTable[] = { { "3B9F968131FE45806755454B41451292318073B3A1806A", "AKiS v1.2.2 on infineon chip" }, { "3B9F968131FE45806755454B41451293318073B3A1806B", "AKiS v1.3 on infineon chip" }, { "3B9F968131FE5D00640428010231C073F701D000900065", "German eTicketing SAM (Transport)\nhttps://www.eticket-deutschland.de/" }, + { "3B9F968131FE6D00640428010231C073F701D000900055", "VDV-KA Secure Access Module (German Public Transport) (Transport)\nhttps://www.eticket-deutschland.de/" }, { "3B9F968131FE9D006405A0030431C073F701D000900028", "Deutsche Telekom AG, TeleSec PKS ECC Signature Card (PKI)\nhttps://www.telesec.de/en/signaturecard" }, { "3B9F9681B1FE451F070064051EB20031B0739621DB0590005C", "SignTrust (www.signtrust.de)\nInfinion SLE66CX680PE with Starcos 3.2\nhttp://www.deutschepost.de/dpag?xmlFile=link1015459_49595" }, { "3B9F9681B1FE451F070064051EB20331B0739621C005900044", "German Dentist ID (eID)" }, { "3B9F96C00A1FC38031E073FE211B63F100AD830F9000DA", "SIM SFR Pro (French Mobile Operator)" }, + { "3B9F96C00A1FC68031E073FE211F65D00233131B810FFA", "Tinkoff SIM card (Telecommunication)" }, { "3B9F96C00A1FC78031E073FE211B63F100AD830F9000DE", "H3G (Italy) UMTS USIM card" }, { "3B9F96C00A1FC78031E073FE211B65D0011009228100F3", "Verizon 4G LTE SIM Card (Telecommunication)\nhttp://www.verizonwireless.com/support/information/4gsim.html" }, { "3B9F96C00A1FC78031E073FE211B65D0018E0E3281007A", "Rogers 3G SIM card" }, @@ -2702,6 +2975,7 @@ const static atr_t AtrTable[] = { { "3B9F96C00A1FC78031E073FE211F65D0020B11A4810F7E", "Telia Finland Oyj, network operator LTE (Telecommunication)" }, { "3B9F96C00A1FC78031E073FE211F65D013370F3B810FD2", "Gemalto Security Element (PKI)" }, { "3B9F96C00A31FE45435431690B010001000000000000000D", "EU smart tachograph card (driver/company/control/workshop)\nhttps://dtc.jrc.ec.europa.eu/" }, + { "3B9F96C00A31FE45754A6176656C696E2D4F5320312E3051", "Vietnam ID Card (eID)" }, { "3B9F96C00A3FC6A08031E073FE211B65D001740EEB810FD7", "Verizon '4G LTE' USIM (Telecommunication)" }, { "3B9F96C00A3FC6A08031E073FE211B65D001740F50810F6D", "5G (Telecommunication)" }, { "3B9F96C00A3FC6A08031E073FE211F65D001900F3B810FE6", "Verizon US USIM card (Telecommunication)" }, @@ -2715,6 +2989,7 @@ const static atr_t AtrTable[] = { { "3B9F97801FC68031E073FE211B6441442100829000E5", "SAKURA Internet SIM (Telecommunication)\nhttps://www.sakura.ad.jp/services/sim/" }, { "3B9F97801FC68031E073FE211B65CA010E060B81059E", "rain Networks - R15 4G Sim Card (Telecommunication)\nhttp://www.rain.co.za" }, { "3B9F97801FC78031E073FE211367980801120401045B", "Tmobile Sim card (Telecommunication)" }, + { "3B9F97801FC78031E073FE2113679814010202010257", "Orange SIM from Egypt (Telecommunication)" }, { "3B9F97803FC7828031E073FE211F640856210082900019", "eSIM card (Telecommunication)" }, { "3B9F97803FC7828031E073FE211F6409069200829000FB", "Ubigi Transatel esim (Telecommunication)" }, { "3B9F978131FE458065544312210831C073F621808105", "Republic of Turkey Identity Card (eID)\nhttps://bilgem.tubitak.gov.tr/en/icerik/national-identity-card-tr-nc-identity-card" }, @@ -2761,6 +3036,7 @@ const static atr_t AtrTable[] = { { "3BB7110081319043A5..............", "Siemens CardOS/M V1.4 (SLE44C80S)" }, { "3BB7110081319043C517B09D19221E1F", "CryptoTech blank access/authentication card (Other)\nhttp://www.cryptotech.com.pl/" }, { "3BB7110081319053B5..............", "CardOS EM/V1.4 (SLE44CR80S)" }, + { "3BB711008131FE432025854702202866", "Research Institute of Applied Information Technologies (Other)\nhttp://dodatok.osvita.net/" }, { "3BB711008131FE4320283FB50320313B", "Research Institute of Applied Information Technologies (Other)\nhttp://dodatok.osvita.net/" }, { "3BB718008131704310434E5452563253", "Avtor SecureToken (PKI)" }, { "3BB718008131FE6553504B323490005A", "Giesecke & Devrient Starcos 2.4" }, @@ -2770,6 +3046,8 @@ const static atr_t AtrTable[] = { { "3BB794008131FE6553504B32339000D1", "Giesecke & Devrient Starcos 2.3\nDeutsche Bank WebSign (RSA-Card)\nG&D StarSign Token\nOsakidetza ONA (eID)\nhttp://www.osakidetza.euskadi.eus/r85-ckserv01/es/contenidos/nota_prensa/ruedasanidad35/es_rs/ruedasanidad35_c.html" }, { "3BB813008131205D0057696E4361726402", "SmartCard for Windows 1.1" }, { "3BB813008131FA524348544D4F494341A5", "citizen digital certificate (PKI)\nhttp://moica.nat.gov.tw/" }, + { "3BB897008131FE45FFFF148230502300F1", "UAE Emirates ID (eID)\nhttps://www.icp.gov.ae" }, + { "3BB89700C00831FE45FFFF148230502300B8", "Infineon SECORA ID X (JavaCard)" }, { "3BB918008131FE9E8073FF614083000000DF", "Serbian Identity Card\nThis is the new Serbian biometric identity card (every adult cityzen\nmust have). The chip contains owners picture, name, date and place\nof birth, current address, unique ID number and fingerprint." }, { "3BB9940040144747334D4838353330", "T D1 GSM card (Telecommunication)" }, { "3BB9940040144747334E4838363430", "GSM-SIM card of the Austrian mobile phone provider One\nhttp://www.one.at\nProximus SIM - Belgium (SetCOS?)\no2 GSM-SIM card Germany 2003" }, @@ -2790,6 +3068,7 @@ const static atr_t AtrTable[] = { { "3BBA96008131865D0064056002033180900066", "Telesec TCOS 2 (SLE66P)\nTCOS 2.0 (on CX320P)\nTeleSec Netkey Card" }, { "3BBA96008131865D00640560020331809000667001040530C9", "TeleSec Netkey E4 Card" }, { "3BBA96008131865D0064057B0203318090007D", "TeleSec NetKey Card\nDeutsche Post card (tcos)" }, + { "3BBB18008131FE4580670518B1020184008105E0", "STARCOS Smart Card (Other)\nhttps://www.gi-de.com/de/identities/unternehmenssicherheit/signaturkarte" }, { "3BBB1800C01031FE4580670412B003030000810138", "Giesecke & Devrient Star Sign Card, STARCOS 3.0 DI, 72 KB, RSA2048 bit\nGiesecke & Devrient Smartc@fe Expert 32K v2.0" }, { "3BBB1800C01031FE4580670412B00303000081053C", "Philips Smart MX\nSzczecin University of Technology in Poland student identity card (Elektroniczna Legitymacja Studencka = student identity card)\nCSOB bank, Czech Republic\nCATCert (Agencia Catalana de Certificacio) catalan government workers identity card" }, { "3BBB1800C03E31FE654726442054534D20312E30B7", "Italian Tachograph Driver Card" }, @@ -2873,9 +3152,9 @@ const static atr_t AtrTable[] = { { "3BD0A8FF81F1FB24001FC3F4", "Philips DESFire SAM" }, { "3BD218008131FE450101C1", "Dutch License Plate Card (RDW)\nhttps://commons.wikimedia.org/wiki/File:Kentekencard_voorzijde_1_december_2013.jpg" }, { "3BD218008131FE58C90114", "Atos CardOS5 (PKI)\nhttp://atos.net/NR/rdonlyres/17C7BDD0-225B-4A58-B9A4-438EA3F3238A/0/74743_20120830_160149_cardos_v5_0__datenblatt_en.pdf" }, - { "3BD218008131FE58C90217", "WVDP (West Valley Demonstration Project?) (PKI)" }, + { "3BD218008131FE58C90217", "Atos CardOS 5.3 (PKI)\nhttp://www.atos.net/cardos" }, { "3BD218008131FE58C90316", "Austrian 'RKS-Card' issued by GlobalTrust (PKI)\nhttps://secure.globaltrust.eu/info-rksv.html" }, - { "3BD218008131FE58C90411", "Identity Card in Slovakia with security chip and e-signature issued after 2021-06-21 (eID)" }, + { "3BD218008131FE58C90411", "Identity Card in Slovakia with security chip and e-signature issued after 2021-06-21 (eID)\nD-TRUST Card 4.1 Standard, qualified signature card" }, { "3BD218008131FE58CA6076", "CardOS IoT V5.4 (PKI)\nhttps://atos.net/wp-content/uploads/2018/11/ct_181127_lpm_cardos_iot_v5-4_fs_en4_web.pdf" }, { "3BD21802C10A31FE58C80D51", "Siemens Card CardOS M4.4" }, { "3BD396FF81B1FE451F078081052D", "German public health insurance card (Elektronische Gesundheitskarte eGK), 2nd generation (G2) (HealthCare)" }, @@ -2886,6 +3165,7 @@ const static atr_t AtrTable[] = { { "3BD518FF8191FE1FC38073C8211309", "Athena IDProtect Key (v2)\nhttp://www.athena-scs.com/product.asp?pid=33" }, { "3BD5950400AE01020101", "Axalto Cyberflex Access 64K v2b SM 1.1" }, { "3BD595FF8091FE1FC38073C8211385", "Athena IDProtect - Cryptographic Java Card\nhttp://www.athena-scs.com/product.asp?pid=32" }, + { "3BD596028031FE654F734549441F", "AVR128DA32 microcontroller based open source EID smartcard with RSA and ECC. (eID)\nhttps://oseid.sourceforge.io/" }, { "3BD596FF8191FE1FC34332333030CC", "HID Global - Crescendo C2300 (PKI)\nhttps://www.hidglobal.com/products/cards-and-credentials/crescendo/c2300" }, { "3BD6180080B1806D1F038051006110309E", "Atmel/Athena T0 PC/SC Compliance Test Card No. 1" }, { "3BD618008131FE7D415350204F5383", "ASP FIXED CHAL1, 2, 3 and 4 (Other)" }, @@ -2893,14 +3173,17 @@ const static atr_t AtrTable[] = { { "3BD6960081B1FE451F078031C1521118F8", "smart card from NASA, 2019 (PKI)" }, { "3BD6960081B1FE451F878031C152211949", "DHS CAC card (PKI)" }, { "3BD6960081B1FE451F878031C152411A2A", "Identiv SCR3310 v2.0 (eID)" }, - { "3BD6970081B1FE451F078031C1521118F9", "NASA Personal Identity Verification (PIV) card (eID)" }, + { "3BD6970081B1FE451F078031C1521118F9", "NASA Personal Identity Verification (PIV) card (eID)\nIDEMIA Cosmo V8.0 with a PIV applet" }, { "3BD6970081B1FE451F078031C1521119F8", "Secure badge (PKI)" }, { "3BD6970081B1FE451F878031C152211948", "DOS PIV (PKI)" }, { "3BD6970081B1FE451F878031C152211A4B", "ID-One PIV 2.4 (P/N 1501381) from IDEMIA (Other)" }, - { "3BD6970081B1FE451F878031C152411A2B", "Oberthur Technologies ID-One PIV/CIV on V8 Device (eID)\nhttps://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2986.pdf" }, + { "3BD6970081B1FE451F878031C152411A2B", "Oberthur Technologies ID-One PIV/CIV on V8 Device (eID)\nhttps://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2986.pdf\nIDEMIA Cosmo V8.1 with a PIV applet" }, + { "3BD81800801F078031C1640806920F", "US Government CAC (PKI) / IDEMIA Cosmo v8 (PKI)\nhttps://www.idemia.com/id-one-piv-card" }, + { "3BD81800801F078031C1640806920FDF", "US DoD Common Access Card (IDEMIA Cosmo v8) (PKI)" }, { "3BD8180080B1FE451F078031C1640806920FD5", "Oberthur Cosmo v8 (PKI)" }, { "3BD818FF8131FE458064041BB42A8105D5", "Schweizerische Krankenversicherungskarte KVG (HealthCare)" }, { "3BD818FF81B1FE451F038064041AB403810561", "D-Trust multicard advanced 3.1\nGerman public health insurance card ('Gesundheitskarte'), issuer SBK 'Siemens Betriebskrankenkasse'" }, + { "3BD896008031FE4400531200840F90001F", "Cape Verde National Identity Card (CNI) (eID)\nhttps://sniac.cv/cartao-nacional-de-identificacao/" }, { "3BD8960081B1FE451F0743485447504B494ADD", "Citizen Digital Certificate, Taiwan (PKI)\nhttp://moica.nat.gov.tw/" }, { "3BD896FF8131FE458064041BB42A81055B", "Swiss LAMal health insurance card" }, { "3BD911008131FE8D0000464F4D53312E3132", "TFOMS (eID)\nhttp://www.samtfoms.ru" }, @@ -2919,13 +3202,17 @@ const static atr_t AtrTable[] = { { "3BDA13FF8131FB468012392F31C173C601C03B", "My Number Card (The Social Security and Tax Number System in JAPAN) (eID)\nhttp://www.cas.go.jp/jp/seisaku/bangoseido/english.html" }, { "3BDA1802C10A31FE584B53776973735369676EA9", "SuisseID Post - ATOS CardOS 4.x (eID)\nhttps://postsuisseid.ch/" }, { "3BDA18FF8191FE1FC350564A434F503353494472", "J3H145 (P6 SecID) purchased from FUTAKO Ltd., Taiwan (JavaCard)\nhttp://www.javacardsdk.com" }, + { "3BDA18FF8191FE1FC380641211111073C0C1801B", "Belarus national identity card (passport)\nhttps://eng.belta.by/infographica/view/id-cards-in-belarus-7095/" }, { "3BDA18FF81B1FE451FC3546963546F6B20322E3068", "TikTok 2.0 (PKI)" }, { "3BDA18FF81B1FE451FC3546963546F6B20332E3069", "TicTok 3.0 (PKI) (PKI)\nhttps://en.cryptoshop.com/products/cryptas-tictok-v3-basisartikel.html" }, { "3BDA18FF81B1FE751F030031C573C001400090000C", "OpenPGP Card V2" }, { "3BDA18FF81B1FE751F030031F573C001600090001C", "OpenPGP Card V3" }, { "3BDA9400004D4D41524A2B33399000", "SIM card from Vodafone Spain" }, { "3BDA9500400A2508004053434F535441", "Card used for issuing commodity to benificiary for rice, wheat and more (Other)" }, + { "3BDA96FF8031FE454D696E694C6F61646572AB", "iClass SE Processor (Miniloader Mode) (Other)\nhttps://www.hidglobal.com/products/embedded-modules/iclass-se/sio-processor" }, + { "3BDA96FF8031FE45536E6D704C6F61646572A8", "iClass SE Processor (SNMP Loader Mode) (Other)\nhttps://www.hidglobal.com/products/embedded-modules/iclass-se/sio-processor" }, { "3BDA96FF8131FE45805631B85349434181057B", "STARCOS 3.5 ID ECC C1R (PKI)\nhttps://www.gi-de.com/fileadmin/user_upload/MS/Certificates/STARCOS35_ID_ECC_TABLES.pdf" }, + { "3BDA96FF8191FE1FC343323330302D46495053E2", "Crescendo 2300 FIPS (JavaCard)" }, { "3BDA96FF81B1FE451F0780584943412056322E30E9", "Starcos chip card from Giesecke & Devrient (PKI)\nhttps://ica.cz/functionality-smart-card" }, { "3BDB11FF5000FF0000000000000007921603", "NEC V-WAY64 v2.1" }, { "3BDB1800801F030031C06477E303008290004F", "Oberthur ID-One Cosmo 64K V5.2" }, @@ -2948,9 +3235,10 @@ const static atr_t AtrTable[] = { { "3BDB960080B1FE451F830031C064102301000F900063", "Extremenian Health Service target (HealthCare)\nhttps://saludextremadura.ses.es/web/preguntas-frecuentes" }, { "3BDB960080B1FE451F830031C0641A1801000790005A", "Ercom CRYPTOSMART\nhttp://www.ssi.gouv.fr/entreprise/qualification/gamme-cryptosmart-pour-la-securisation-des-smartphones-et-des-tablettes/" }, { "3BDB960080B1FE451F830031C0641A1801000F900052", "Serbian Car registration ID card\nhttp://blog.goranrakic.com/archives/2011/07/citanje_saobracajne_dozvole_sa_cipom.html" }, - { "3BDB960080B1FE451F830031C0641A71010007900033", "ChamberSign Gemalto USB Shell Token V2 - Certificat Audacio ** (eID)\nhttp://www.chambersign.fr/certificat-rgs-audacio/" }, + { "3BDB960080B1FE451F830031C0641A71010007900033", "ChamberSign Gemalto USB Shell Token V2 - Certificate Audacio ** (eID)\nhttp://www.chambersign.fr/certificat-rgs-audacio/" }, { "3BDB960080B1FE451F830031C064B0FC100007900005", "Oberthur Cosmo V7 debug card (SDK)" }, { "3BDB960080B1FE451F830031C064B0FC10000F90000D", "ID-One PIV (that's the only non-numeric identifying mark) (PKI)" }, + { "3BDB960080B1FE451F830031C064BAFC10000790000F", "Oberthur ID-One Cosmo v7.0 80K (eID)\nhttps://www.ssi.gouv.fr/uploads/IMG/certificat/ANSSI-CC-cible_2011-64en.pdf" }, { "3BDB960080B1FE451F830031C064BE1B0100019000FB", "Bank card" }, { "3BDB960080B1FE451F830031C064C30801000F90009B", "SIM Aruba (Italian provider)" }, { "3BDB960080B1FE451F830031C064C7FC100001900074", "Oberthur Cosmo (eID)\nhttp://www.stampit.org" }, @@ -2962,7 +3250,8 @@ const static atr_t AtrTable[] = { { "3BDB960081B1FE451F0380F9A0000003080000100018", "Oberthur CS PIV End Point v1.08 FIPS201 Certified" }, { "3BDB960081B1FE451F0380F9A0000003480000000149", "Fly Clear card" }, { "3BDB960081B1FE451F8380F9A0000003080000100098", "Oberthur Cosmo v7 128K with PIV applet\nhttp://www.smartcardfocus.com/shop/ilp/id~410/p/index.shtml" }, - { "3BDB96FF80B1FE451F870031C164093772130F9000F4", "French ID Card 2021 (eID)\nhttps://ants.gouv.fr/Les-titres/Carte-nationale-d-identite/La-puce-de-la-nouvelle-carte-nationale-d-identite" }, + { "3BDB96FF80B1FE451F870031C164093364490F9000BC", "cnie Carte Nationale d'Identite Electronique (eID)" }, + { "3BDB96FF80B1FE451F870031C164093772130F9000F4", "French ID Card 2021 (eID)\nhttps://ants.gouv.fr/nos-missions/les-titres-produits-par-l-ants/les-documents-d-identite/la-puce-de-la-nouvelle-carte-nationale-didentite" }, { "3BDB96FF8131FE4580670534B50201064081051B", "SINA STARCOS 3.5 BX-CombiCard+HSB (Other)" }, { "3BDB96FFC01031FE4580671501B403000900810521", "Digital Tachograph Card for Professional Driver\nolish driver card for digital tachograph" }, { "3BDC1802C10A31FE588031A873B0019B2460071320AA", "Public Services Card | Ireland (Other)\nhttps://psc.gov.ie/" }, @@ -2972,6 +3261,7 @@ const static atr_t AtrTable[] = { { "3BDC18FF8111C18073C821136605036351000233", "GoTrust Idem Key (Other)\nhttps://www.gotrustid.com/idem-key" }, { "3BDC18FF8111FE8073C82113660106013080018D", "Aladdin R.D. JaCarta LT (eID)" }, { "3BDC18FF8191FE1FC3060A2B06010401E910050203D1", "Caregiver card for Dutch Medical System called UZI (Unieke Zorgverlener Identificatie, Caring Unique Identification) (HealthCare)\nhttps://www.uziregister.nl/" }, + { "3BDC18FF8191FE1FC3060A2B06010401E910050204D6", "UZI (HealthCare)" }, { "3BDC18FF8191FE1FC38073C821136601060130040155", "Athena IDProtect Key Laser" }, { "3BDC18FF8191FE1FC38073C821136601061159000128", "JaCarta (PKI)\nhttp://www.aladdin-rd.ru" }, { "3BDC18FF8191FE1FC38073C8211366010B0352000538", "Athena IDProtect Smart Card Logon Card" }, @@ -2979,10 +3269,14 @@ const static atr_t AtrTable[] = { { "3BDC18FF8191FE1FC38073C821136605036057000255", "NXP IDProtect (X) (JavaCard)" }, { "3BDC18FF8191FE1FC38073C821136605036351000250", "JCOP3 SecID P60 CS (JavaCard)" }, { "3BDC96FF8111FE8031C8544356300573FFA1C03B", "NXP Javacard with Athena SCS OS (JavaCard)" }, + { "3BDC96FF8111FE8031C8544356350773FFA1C03C", "NXP JCOP 4, J3R200P0X3U/0ZA16CP NXD6.2 (JavaCard)" }, { "3BDC96FF81B1FE431FC30B46415245474F53414D5632CC", "Multismartcard SAM (used in proprietary Scheidt&Bachmann Smartcard Reader v2)" }, { "3BDD18008131FE4580F9A0000000770100700A90008B", "National ID Card of Peru issued by RENIEC from Oberthur" }, { "3BDD18008131FE4580F9A000000077010800079000FE", "Oberthur Cosmo v7 IAS ECC\nBrazilian 'e-CNPJ' card, issued by Certisign (Oberthur)" }, { "3BDD18008131FE45904C41545649412D65494490008C", "Identity card (eID) Republic of Latvia\nhttp://www.pmlp.gov.lv/lv/pakalpojumi/passes/eid.html" }, + { "3BDD18008191FE1FC3006646530803003671DF00008097", "Feitian K9Plus - ePass FIDO-NFC with PIV (Other)\nhttps://ftsafe.com/products/FIDO/NFC" }, + { "3BDD18FF8191FE1FC3006646530803003671DF00008068", "Feitian FIDO NFC Plus K9 Security Key (Other)\nhttps://www.ftsafe.com/products/FIDO/NFC" }, + { "3BDD18FF8191FE1FC3FF4F70656E506879736963616CF6", "Open Physical PIV-Compatible NXP SECID P60 (eID)\nhttps://openphysical.org/" }, { "3BDD18FFC080B1FE451FC30068D276000028040411009000C9", "Russian Federation driver card for the digital tachograph\nPolish driver card for digital tachograph" }, { "3BDD18FFC080B1FE451FC30068D276000028040971009000A4", "Worktime/driving style monitoring card (Transport)\nhttp://www.paetronics.fi/en/" }, { "3BDD96008010FE8031806301FFC073B3211B8105", "BIFIT iBank 2 USB Key (Bank)\nhttp://bifit.ua" }, @@ -3012,10 +3306,11 @@ const static atr_t AtrTable[] = { { "3BDF18008131FE588031B05202046405C903AC73B7B1D422", "Austrian 'e-Card' (=Health Card) of the 4th generation. (HealthCare)" }, { "3BDF18008131FE58AC31B05202046405C903AC73B7B1D422", "e-Card Austria (HealthCare)" }, { "3BDF18008131FE67005C49434DD49147D276000038330058", "Infineon SICRYPT Card Module D4 PC/SC Compliance Test Card" }, - { "3BDF18008131FE7D006B020C0182011101434E53103180FC", "Italian healtcare card (TS) National Service Card (CNS) (HealthCare)" }, - { "3BDF18008131FE7D006B040C0184011101434E53103180FC", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare)\nhttp://www.regione.toscana.it/cartasanitaria" }, + { "3BDF18008131FE7D006B020C0182011101434E53103180FC", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare)" }, + { "3BDF18008131FE7D006B040C0184011101434E53103180FC", "Italian healthcare card (TS) National Service Card (CNS) (HealthCare)\nhttp://www.regione.toscana.it/cartasanitaria\nhttps://www.agid.gov.it/it/piattaforme/carta-nazionale-servizi" }, { "3BDF18008131FE7D006B150C0180011101434E53103180E9", "Provider: Actalis S.p.A.\ncode: AT00006181\nhttp://www.actalis.it" }, { "3BDF18008131FE7D006B150C0181011101434E53103180E8", "Italian healthcare card (TS) National Service Card (CNS)\nCarta Regionale dei Servizi - Regione Lombardia\nTuscany TS-CNS\nhttp://www.regione.toscana.it/cartasanitaria" }, + { "3BDF18FF8091FE1FC3003138644790ECC273140150829000BB", "Ministry of Interior - France 'Agent Card' (Other)" }, { "3BDF18FF8131FE4580590180484944433730307300011B33", "Crescendo C700 + MiFare 4K\nhttp://www.smartcardfocus.com/shop/ilp/id~265/p/index.shtml" }, { "3BDF18FF8191FE1FC3003138644790ECC273140150829000BA", "Card store authentication and signature keys (JavaCard)\nhttps://ants.gouv.fr/Les-titres/Cartes-Agents/Adhesion/Telechargement-et-support" }, { "3BDF18FF8191FE1FC30031B8640000EC0073940000829000FE", "NXP Jcop3 P60 ChipDoc v7b4 (JavaCard)\nhttps://www.javacardos.com/store/products/10029" }, @@ -3025,6 +3320,7 @@ const static atr_t AtrTable[] = { { "3BDF18FF81F1FE43003F03834D494641524520506C75732053414D3B", "NXP SAM AV2 module" }, { "3BDF18FF81F1FE43003F03834D4946506C75732053414D3B53414D3B", "Mifare SAM -AV2 (PKI)" }, { "3BDF18FF81F1FE43003F07834D49464152452053414D204156333011", "NXP SAM AV3 module" }, + { "3BDF18FF910131FE4680319052410264050200AC73D622C099", "Acos-ID (AUSTRIACARD's Operating System) (Other)\nhttps://www.austriacard.com/digital-security/solutions/card-solutions/acos-id/" }, { "3BDF94FFC080B1FE451F03006AD2760000280415FA10040090006B", "UK Digital Tacho card (Other)" }, { "3BDF94FFC080B1FE451F03006AD2760000280415FA40040090003B", "DVLA Company Card (Transport)" }, { "3BDF9500801F878031A073FF21006345B105830F900060", "FUTURE CARD Normal ISO SIM (Telecommunication)" }, @@ -3038,11 +3334,14 @@ const static atr_t AtrTable[] = { { "3BDF960080B1FE451F838073BC9180F9A00000007780080201A4", "Latvian eSignature card (eID)\nhttps://www.lvrtc.lv/e-signature.html" }, { "3BDF960080B1FE451F870031C16408923201738421E0059000C5", "Company Card for Transport companies (Transport)" }, { "3BDF96008131FE4541434F532D4944303032382E3031366F", "Sri Lankan driving license [ web: motortraffic.gov.lk ] (eID)\nhttp://www.motortraffic.gov.lk/web/index.php?option=com_content&view=article&id=83&Itemid=140&lang=en" }, + { "3BDF96008131FE588031B05202056405A100AC73D622C020", "Austrian health insurance card 'e-card' (HealthCare)\nhttps://de.wikipedia.org/wiki/E-card_(Chipkarte)" }, { "3BDF960081B1FE451F838073CC91CBF9A0000003080000100079", "Test PIV Cards available for sale from NIST\nhttp://csrc.nist.gov/groups/SNS/piv/testcards.html" }, { "3BDF96FF8131FE455A018048494443313158587300011B09", "HID Crescendo iCLASS Px G8H" }, { "3BDF96FF8131FE4580590180504956434C41537300011BDE", "HID Global pivCLASS v1.0 (PKI)\nhttp://www.hidglobal.com/products/cards-and-credentials/pivclass/pivclass-smart-card" }, { "3BDF96FF8131FE45805B44452E42415F53433335328105B5", "Employee ID card from the Federal Employment Agency (Germany) (PKI)\nhttps://www.pki.arbeitsagentur.de/" }, { "3BDF96FF8131FE45805B44452E424E4F544B3130308105A0", "BeA - Certification Card for German Solicitors (Other)\nhttps://bea.bnotk.de/" }, + { "3BDF96FF81B1FE451F870031B96409377213738401E000000000", "National Identity Card of Slovakia (eID) (eID)\nhttps://en.wikipedia.org/wiki/Slovak_identity_card" }, + { "3BDF96FF910131FE4680319052410264050200AC73D622C017", "Acos-ID (AUSTRIACARD's Operating System) (Other)\nhttps://www.austriacard.com/digital-security/solutions/card-solutions/acos-id/" }, { "3BDF97008131FE588031B05202056405A100AC73D622C021", "Austrian healthcare insurance identification card (HealthCare)\nhttps://www.chipkarte.at" }, { "3BDF970081B1FE451F838073CC91CBF9A0000003080000100078", "NASA PIV Card (Other)" }, { "3BE000008131204030", "SmarTEC" }, @@ -3056,6 +3355,7 @@ const static atr_t AtrTable[] = { { "3BE500008121459C100100800D", "BIN 470132 -- BANK OF AMERICA VISA DEBIT -- GEMALTO MGY 0 U1090788B - 12/14 F8 00 89 (Bank)" }, { "3BE500008131FE45D00037008089", "ATM card for Standard Chartered, Taiwan" }, { "3BE500FF8131FE458073C601082D", "MUFG (.jp) (Bank)" }, + { "3BE6000080318066B1A30401110B83", "Java Jcop J2A040 (JavaCard)" }, { "3BE6000080318066B1A30401110B83009000", "VISA Credit Card (Bank)" }, { "3BE60000812145324B010101017A", "Axalto Cyberflex Palmera V5" }, { "3BE600FF8131FE4544492030324D70", "Alior Sync (Poland) - MasterCard Debit Card with PayPass (Bank)\nMasterCard Contactless Debit Card issued by Raiffeisen Bank in Czech Republic\nDebit MasterCard with paypass issued by Bank Zachodni WBK (Poland)\nDebit MasterCard with paypass issued by AliorSync" }, @@ -3075,6 +3375,7 @@ const static atr_t AtrTable[] = { { "3BE700FF8131FE458031C073C62148BE", "Japanese ETC (Electronic Toll Collection System) card (Transport) and Credit card (Issuer: Toyota) (Transport)" }, { "3BE700FF81B1FE451F018031C073C6214820", "Japanese ETC (Electronic Toll Collection System) card (Transport)" }, { "3BE8000040FA0073C84011009000", "KEBTechnology KONA USB SmartCard (Other)" }, + { "3BE800008031FE450073C8401300907DE7", "National Health System of Spain - Consejeria de Sanidad y Servicios Sociales - JUNTA DE EXTREMADURA (HealthCare)\nhttps://www.juntaex.es/es/lajunta/consejo-de-gobierno/vicepresidencia-segunda-y-consejeria-de-sanidad-y-servicios-sociales/servicio-extremeno-de-salud" }, { "3BE80000813120450073C8400000900056", "Visa credit card for Standard Chartered, Taiwan" }, { "3BE800008131FE00506572736F53696DAA", "Simulated virtual smartcard, from project PersoSim (eID)\nhttps://persosim.de/?q=node/33" }, { "3BE800008131FE450073C8400000900088", "VISA Card (Skandinaviska Enskilda Banken) with Swedish BankID\nVISA card (Chinatrust Bank (Taiwan), dual-interface card with a Taipei Metro e-purse function)" }, @@ -3102,7 +3403,7 @@ const static atr_t AtrTable[] = { { "3BE900FFC11031FE55C80120504E34303132AD", "Siemens CardOS/M 3.0 (SLE66CX160S)" }, { "3BEA0000813120438065A2........72D6....", "IDClassic 3XX Cards (with MPCOS Applet)" }, { "3BEA0000813120438065A20101013D72D643A5", "GemXpresso Pro R3 32PK (MPCOS, T=1) (warn reset)" }, - { "3BEA00008131FE450031C173C840000090007A", "Nigerian eID Card (cold reset)\nChip is NXP JCOP 2.4.1R3" }, + { "3BEA00008131FE450031C173C840000090007A", "Nigerian eID Card (cold reset)\nChip is NXP JCOP 2.4.1R3\nDual BCR Signum Mastercard (bank) + Digital Signature Costa Rica (eID)\nhttps://bancobcr.com/wps/portal/bcr/bancobcr/personas/tarjetas/signum_firma_digital/" }, { "3BEA00008131FE45436F6D624F5320494900FE", "UBS VISA Gold Card\nMasterCard from lhv.ee\nNordea Bank Finland PLC Estonian Branch (ABnote)" }, { "3BEA00008131FE454A434F5033315632333290", "NAB VISA Debit card" }, { "3BEA00008131FE454A434F5034315632323195", "HID Crescendo C700\nhttps://www.hidglobal.com/products/cards-and-credentials/crescendo/c700" }, @@ -3173,6 +3474,7 @@ const static atr_t AtrTable[] = { { "3BEF00FF813166456563202049424D20332E3120202020", "IBM eCash" }, { "3BEF00FF813166456563202049424D20332E3120202020CF", "IBM eCash" }, { "3BEF00FF8131864549424D204D4643343030303038333143", "ComCard MFC 4.1" }, + { "3BEF00FF8131FE4141434F532046696F6E6131204C633666", "EUROBANK GR (Bank)\nNBG BANK (Bank)" }, { "3BEF00FF8131FE4541434F53204449616E6131204C63364E", "comdirect VISA card (Bank)\nhttps://www.comdirect.de/konto/karten.html#Visa-Karte" }, { "3BEF00FF8131FE4541434F53204449616E6132204C63364D", "Alior Bank SA (Bank)\nhttps://www.aliorbank.pl/" }, { "3BEF00FF8131FE4565630D12810156001F00006686080122", "Commerzbank signature card SECCOS (6 or 7) providing RAH security profile (Bank)\nhttps://www.chipkartenleser-shop.de/commerzbank/electronic-banking-chipkarten/commerzbank-signaturkarte-2710050006" }, @@ -3219,11 +3521,12 @@ const static atr_t AtrTable[] = { { "3BEF00FF8131FE458031C06B49424D204A65745A204D3239", "UBS Internet Card (IBM JetZ M2)" }, { "3BEF00FF8131FE458031E06B042105026B55555555555568", "MasterCard credit card for Mega International Commercial Bank, Taiwan (Bank)\nhttps://www.megabank.com.tw/creditcard/index.asp" }, { "3BEF00FF8131FF6549424D204D4643393232393238393017", "IBM MFC 4.22 (University of Cambridge smartchip card)" }, + { "3BF01100FF01", "Not a physical smart card. But a JavaCard simulator ATR with default configuration. (JavaCard)" }, { "3BF01200FF9181B17C451F019B", "Japanese Chijou Digital B-CAS Card (pay TV) (Pay TV)" }, { "3BF01200FF9181B17C451F0399", "Japanese Chijou Digital B-CAS Card (pay TV)" }, { "3BF01200FF9181B1EF451F030A", "Japanese Digital CATV C-CAS card" }, { "3BF01300001000", "MasterCard ETEC InterOp 27. This is an dual-app Maestro/MasterCard Credit EMV test card" }, - { "3BF01300008131FE45E8", "Healt care card Romania (HealthCare)\nhttp://www.cnas.ro/casmb/national-page/cardul-national-de-asigurari-de-sanatate-2.html" }, + { "3BF01300008131FE45E8", "Healthcare card Romania (HealthCare)\nhttp://www.cnas.ro/casmb/national-page/cardul-national-de-asigurari-de-sanatate-2.html" }, { "3BF01300FF9181B1FE461F0319", "Japan BS/CS 4K Satellite Broadcasting A-CAS Card (Pay TV)\nhttp://www.acas.or.jp/index.html" }, { "3BF2180000C10A31FE55C80675", "HID iCLASS P16K C4H\nproximity card used for both door locks and keystore" }, { "3BF2180002C10A31FE55C80776", "Siemens CardOS V4.3" }, @@ -3278,6 +3581,7 @@ const static atr_t AtrTable[] = { { "3BF711000140967071090E6CB6D6", "Carte pour decodeur tele de Neuf Telecom TV" }, { "3BF71300008131FE45464F4D534F4D53A9", "Health card Russian Federation" }, { "3BF71300008131FE454A434F503234....", "NXP JCOP v2.4.x (see hist bytes for more info)" }, + { "3BF71300008131FE4580654A5030310415", "Nichizeiren Denshi-shomei (eID)\nhttps://www.nichizeiren.or.jp/taxaccount/auth/fifth/" }, { "3BF71800008031FE45736674652D6E66C4", "SmartCafe Expert 3.2 72K" }, { "3BF71800008031FE45FE42475265494424", "Bulgarian eID PKI card pilot on IFX SLE78 jTOP (PKI)" }, { "3BF71800008131FE458055433776706B28", "Only labeled 'J35110', dual interface (JavaCard)" }, @@ -3292,13 +3596,15 @@ const static atr_t AtrTable[] = { { "3BF81300008131FE15597562696B657934D4", "Yubico Yubikey 4 OTP+CCID" }, { "3BF81300008131FE4546494445534D4F318E", "Fidesmo Card with Dual Interface (JavaCard)\nhttp://shop.fidesmo.com/product/fidesmo-card-dual-interface" }, { "3BF81300008131FE454A434F50763234....", "NXP JCOP v2.4.x (see hist bytes for more info)" }, - { "3BF81300008131FE454A434F5076323431B7", "Nigerian eID Card (blank card)\nChip is NXP JCOP 2.4.1R3" }, + { "3BF81300008131FE454A434F5076323431B7", "Nigerian eID Card (blank card)\nChip is NXP JCOP 2.4.1R3\nBank of Hawaii (Bank)\nhttps://www.boh.com/\nLA BANQUE POSTALE (Bank)\nhttps://www.labanquepostale.fr/\nbnpparibas (Bank)\nhttp://www.bnpparibas.com/\nJcop040 (JavaCard)\nJcop21 (JavaCard)\nVisa debit classic (Bank)\nhttp://www.jpmorganchase.com/\nJPMorgan Chase (Bank)\nVisa (Bank)\nhttps://unitedfcu.com/" }, { "3BF81300008131FE454A4F5076323431B7", "Nigerian eID card (eID)" }, { "3BF81300008131FE455049564B45593730FF", "PIVKey CP70 (PKI)\nhttps://pivkey.com/" }, { "3BF81300008131FE455241414B43327635CB", "Raak C2 Smart Card (PKI)\nhttp://www.raaktechnologies.com/software-downloads-documentation/" }, { "3BF81300008131FE45534B555001000000FC", "Silesian Card of Public Services (Transport)\nhttps://portal.kartaskup.pl/" }, { "3BF81300008131FE45536D617274417070F8", "national Lithuania ID card" }, { "3BF81300008131FE45FF4A32413034300012", "MIDAS Card Diversification Key JavaCard (J2A040) (Bank)\nhttps://github.com/kategray/midas" }, + { "3BF81300FF108053430663010F900000", "Affinity CUIA Debit (JavaCard)\nhttps://www.affinitycuia.org" }, + { "3BF81300FF910131FE41534C4A01305023100D", "Walden Mutual Bank (Bank)\nhttps://www.waldenmutual.com/sustainable-bank-for-individuals#footnote-s0-4" }, { "3BF81800008031FE450073C8401300900092", "G&D StarSign Token" }, { "3BF81800008131FE450073C8400000900080", "NXP JCOP 31 V2.2 36K - S/C I/F" }, { "3BF81800008131FE450073C8401300900093", "Giesecke & Devrient Sm@rtCafe Expert 3.0" }, @@ -3306,6 +3612,7 @@ const static atr_t AtrTable[] = { { "3BF81800008131FE454A434F5076323431BC", "NXP J2A080 JavaCard" }, { "3BF81800FF8131FE450073C840000090007F", "NXP JCOP 10\nNXP JCOP 31 (contact interface)" }, { "3BF81800FF8131FE454A434F507632343143", "VIVOtech SAM\nNXP JCOP V241\nNXP J3A081 JavaCard (contact interface)" }, + { "3BF89600008031FE470073C840000090000D", "Italian driver tachograph smartcard (Transport)\nhttps://www.to.camcom.it/cartatachigrafica" }, { "3BF89600008131FE4400739401C00F9000DD", "fourth-generation Hong Kong permanent identity card (Other)\nhttps://en.wikipedia.org/wiki/Hong_Kong_identity_card" }, { "3BF89600008131FE454A434F507632343132", "NXP JCOP 2.4.1 (JavaCard)" }, { "3BF91100008131FE45436F6D624F53205600AA", "VISA Card (Bank)" }, @@ -3334,6 +3641,9 @@ const static atr_t AtrTable[] = { { "3BF99600008031FE4553434537200000202027", "G&D SmartCafe Expert 7 (JavaCard)" }, { "3BF99600008031FE4553434537200300204642", "ActivIdentity Activkey Sim (PKI)\nhttps://www.hidglobal.com/products/cards-and-credentials/activid/usb-tokens" }, { "3BF99600008031FE4553434537200F0020464E", "Giesecke & Devrient (DoD Alternate Token) G+D Sm@rtCafe Expert v7.0 144K DI #3 (PKI)" }, + { "3BF99600008031FE4553434537202000202007", "Serbian Identity Card (eID) (eID)" }, + { "3BF99600008031FE45534345372047434E335E", "Serbian Identity Card (eID)" }, + { "3BF99600008031FE455343453720474E335E", "Serbian Identity Card (eID)" }, { "3BF99600008131FE45454F4E43617264563173", "eONCard V1 (PKI)" }, { "3BF99600008131FE4553434537200E00202028", "Giesecke & Devrient GmbH StarSign CUT S" }, { "3BF99600008131FE45535049564B4559373028", "Taglio PIVKey C980 (PKI)\nhttps://www.pivkey.com" }, @@ -3348,25 +3658,32 @@ const static atr_t AtrTable[] = { { "3BFA1300008131FE450031C173C8400000900079", "Nigerian eID Card (warm reset)\nChip is NXP JCOP 2.4.1R3" }, { "3BFA1300008131FE454465786120434620763198", "Dexa Systems Crossfire Card (PKI)\nhttp://www.dexasystems.com/products-services/products/dexa-smartcards-credential-tokens-peripherals" }, { "3BFA1300008131FE454A434F503.3.56323332..", "JCOPxx/yy v2.3.2 (see hist bytes for more info)" }, + { "3BFA1300008131FE454A434F50323156323331", "J2A040 JCOP (JavaCard)" }, { "3BFA1300008131FE454A434F5032315632333191", "NXP JCOP 21 V2.3.1 36K" }, { "3BFA1300008131FE454A434F5032315632343196", "NXP JCOP 2.1 V 2.4.1 (JavaCard)" }, { "3BFA1300008131FE454A434F50343156", "JCOP41 V221" }, { "3BFA1300008131FE454A434F5034315632333197", "JCOP41 /72K (eID)" }, { "3BFA1300008131FE454A434F50763234........", "NXP JCOP v2.4.x (see hist bytes for more info)" }, + { "3BFA1300008131FE54A434F503233191", "Jcop (JavaCard)" }, { "3BFA1300FF813180450031C173C00100009000B1", "OpenPGP" }, { "3BFA1800008031FE45FE654944202F20504B4903", "Estonian Identity Card (EstEID v3.5 (10.2014) cold) (eID)\nhttp://id.ee/" }, { "3BFA1800008131FE4506082A841001876E0805BC", "Dutch Rijkspas (eID)" }, - { "3BFA1800008131FE4506082A841001876E0807BE", "Rijkspas (identification card dutch government employees) (eID)\nhttps://nl.wikipedia.org/wiki/Rijkspas\nDutch goverment multifunctional smartcard (Other)\nhttps://nl.wikipedia.org/wiki/Rijkspas" }, - { "3BFA1800008131FE45060860841001876F0602FE", "Card used by the Dutch health insurers to give medical personell access to patient insurance information" }, + { "3BFA1800008131FE4506082A841001876E0807BE", "Rijkspas (identification card dutch government employees) (eID)\nhttps://nl.wikipedia.org/wiki/Rijkspas\nDutch government multifunctional smartcard (Other)\nhttps://nl.wikipedia.org/wiki/Rijkspas" }, + { "3BFA1800008131FE45060860841001876F0602FE", "Card used by the Dutch health insurers to give medical personnel access to patient insurance information" }, + { "3BFA1800008131FE4546534A434F503453494480", "NXP Java Card JCOP4 P71 GP2.3 JC3.0.5 (JavaCard)\nhttps://www.javacardsdk.com/product/j3r180sim/" }, { "3BFA1800008131FE454A33413034305632343184", "NXP J3A 40K\nJava Card v2.2.2 - Global Platform v2.2.1\nDual-interface functionality (features 1K Mifare emulation)" }, { "3BFA1800008131FE454A33413038315632343189", "NXP JCOP CJ3A081\nhttp://www.usmartcards.com/media/downloads/492/NXP%20P5CX012%2002X%2040%2073%2080%20144%20%20%202011.pdf" }, + { "3BFA1800008131FE454A3344303831563234328F", "AustriaCard Dual Interface Unpersonalized EMV Cards (Bank)\nhttps://www.austriacard.com" }, { "3BFA1800008131FE454A434F503431563232319D", "NXP JCOP 41 v2.2.1 72k SmartCard I/F" }, { "3BFA1800008131FE454A546178436F72655631B2", "Taxpayer Portal Authentication for Fiji Revenue & Customs Service taxpayer portal (PKI)" }, { "3BFA1800008131FE454D4F54494F4E0000900760", "SIM card (Telecommunication)" }, { "3BFA1800008131FE4550564A434F5033454D5694", "NXP JCOP3 J3H082 Java Card 3.0.4 Dual-Interface (JavaCard)\nhttps://www.cardlogix.com/product/nxp-jcop3-j3h082-java-card-3-0-4-j3h081-dual-interface/" }, + { "3BFA1800008131FE4550564A434F503453494493", "National Health Insurance (Taiwan) (HealthCare)" }, { "3BFA180000910131FE4550564A434F503453494482", "Supposed P71 SecID purchased from a Chinese manufacturer (JavaCard)" }, + { "3BFA180000910131FE456BD1936AC2F28547E164CC", "J3R180, NXP JCOP4 JC3.0.5 Classic, GP2.3, SECID (JavaCard)\nhttps://www.cardlogix.com/product/nxp-jcop-4-java-card-3-0-5-classic/" }, { "3BFA180002C10A31FE584B53776973735369676E89", "SuisseId card (used for qualified signatures)\nhttp://postsuisseid.ch/de/suisseid\nhttp://www.suisseid.ch/" }, { "3BFA1800FF10004A546178436F72655631", "NXP JCOP4 J3R200 P71 (JavaCard)" }, + { "3BFA1800FF8031FE450031807394410000900090", "Kazakhstan Identity Card 2022 (eID)" }, { "3BFA1800FF8131FE454A434F5032315632333165", "TrubDemax healthcare card\nJCOP 21 / 72k" }, { "3BFA1800FF8131FE454A434F5034314332303074", "HID Crescendo C200\nhttps://www.hidglobal.com/sites/hidglobal.com/files/resource_files/crescendo-c200-c700-smart-card-ds-en.pdf" }, { "3BFA1800FF8131FE454A434F5034315632323162", "JCOP41\nHID Crescendo C700\nhttp://www.hidcorp.com/\nShould be compatible to RAAK\nhttp://www.raaktechnologies.com/\nMarx CrypToken MX2048-JCOP USB Token" }, @@ -3385,6 +3702,9 @@ const static atr_t AtrTable[] = { { "3BFB1300FF10800031C164086032060F9000", "Stripe Issuing Card (Bank)" }, { "3BFB1300FF10800031C164086032100F9000", "Varo (Bank)" }, { "3BFB1300FF10800031C164089862210F9000", "Visa Debit (Bank)" }, + { "3BFB1300FF10800031C164089862290F9000", "Bank Card (Bank)" }, + { "3BFB1300FF10800031C1640924331E0F9000", "TransferWise Debit Card (Bank)\nhttps://wise.com/" }, + { "3BFB1300FF10800031C164096441360F9000", "Truist Business Debit (Bank)" }, { "3BFB1300FF813180755A43352E3520524556204763", "ZeitControl BasicCard 5.5" }, { "3BFB1300FF813180755A43352E3620524556204D6A", "ZeitControl BasicCard ZC5.6 user-programmable smart card\nhttp://www.basiccard.com/index.html?overview.htm" }, { "3BFB1300FF813180755A43362E3520524556204364", "ZeitControl BasicCard 6.5, multiapplication with 30 kByte EEPROM" }, @@ -3423,7 +3743,9 @@ const static atr_t AtrTable[] = { { "3BFD1300008131FE4541373030364347203234325231D6", "YubiKey NEO (token)" }, { "3BFD1300008131FE454A434F50323176323331474454E1", "National Health Insurance Card, Taiwan" }, { "3BFD1300008131FE45543D314A323133364B56323331DC", "ic Card (JavaCard)" }, + { "3BFD1300008131FE4580318153534431738421C0810730", "Personal Info Card (eID)" }, { "3BFD1300FF10000031C173C8400052A1C5009000", "IBKR Prepaid MasterCard, Issued by Peoples Trust Company (Bank)\nhttps://www.interactivebrokers.com/en/index.php?f=26451" }, + { "3BFD1300FF10000031C173C8400052A1D5009000", "PayPal Business Debit Mastercard (Bank)\nhttps://www.paypal.com/merchantapps/appcenter/makepayments/bdmc" }, { "3BFD1800008031FE45003180718E6452D904008190005B", "Oberthur Card Systems, authentIC" }, { "3BFD1800008031FE4553434536302D43443038312D46C4", "Panama Electronic Signature (JavaCard)" }, { "3BFD1800008031FE45736674652063643134342D6E66D8", "SmartCafe Expert 3.2 144K Dual is a contact and contactless technology Java card from G&D with 144K on-board EEPROM for application and data storage. Certified to FIPS 140-2 Level 3 and Common Criteria EAL 5+. Supports specifications ISO 14443A T=CL and ISO 7816 T=1/0. (PKI)\nhttp://www.smartcardfocus.us/shop/ilp/id~523/smartcafe-expert-3-2-144k-dual/p/index.shtml" }, @@ -3449,7 +3771,10 @@ const static atr_t AtrTable[] = { { "3BFD9600008131FE4500000152332980000000000000A9", "DPI Guatemala (eID)\nhttp://www.renap.gob.gt/" }, { "3BFD9600008131FE450000015233672000000000000047", "DPI Guatemala (eID)\nhttps://www.renap.gob.gt/servicios/que-es-el-dpi" }, { "3BFD9600008131FE4500000161638620000000000000C5", "Renap Guatemala (eID)" }, + { "3BFD9600008131FE450000016687038000000000000003", "DPI (Documento Personal de Identificacion) Guatemala (eID)" }, { "3BFD9600008131FE45534C4A353247444C313238435257", "Universal JCard (Contact) with Infineon SLE78 (JavaCard)\nhttp://www.usmartcards.co.uk/cards/universal-jcard-contact-with-infineon-sle78-white-gloss-pvc-card.html" }, + { "3BFD9600008131FE45534C4A35324778787979797A5224", "J3R180 (JavaCard)" }, + { "3BFE130000108080318066B0840C016E0183009000", "Sberbank of Russia MIR debit card (Bank)" }, { "3BFE1300008131FE454A434F5076323431204C4F542057B1", "LOT test card (JavaCard)\nwww.lotgroup.eu" }, { "3BFE1800008031FE454573744549442076657220312E30A8", "Estonian Identity Card (EstEID 3.0 'JavaCard' cold)" }, { "3BFE1800008031FE4553434536302D43443038312D6E46A9", "G&D Sm@rtCafe Expert 6.0 (JavaCard)\nhttp://www.smartcardfocus.com/shop/ilp/id~684/smartcafe-expert-6-0-80k-dual-/p/index.shtml" }, @@ -3484,7 +3809,8 @@ const static atr_t AtrTable[] = { { "3BFF1100008171404200002101314252000[05]63........9000.*", "Smart Card 'The Smart Way to Login'\nUsed on Acer TravelMate to secure boot" }, { "3BFF11000240648069A2070103570000FF0083009000", "Gemplus GemXpresso" }, { "3BFF1100FF8131FE9580F9D2760000255444010083000000A0", "GiroCard Haspa Hamburger Sparkasse (Bank)\nhttps://www.haspa.de/privatkunden/ihr-online-banking/unser-angebot/haspa-digital-services-96198/" }, - { "3BFF13000010003101F1564011001900000000000000", "BVG Guthabenkarte (Prepaid Payment Card for Berlin/Brandenburg Public Transport) (Transport)\nhttps://www.bvg.de/de/service-und-kontakt/guthabenkarte" }, + { "3BFF13000010003100DE525001001500000000000000", "wisely debit (Bank)\nhttps://www.mywisely.com/" }, + { "3BFF13000010003101F1564011001900000000000000", "BVG Guthabenkarte (Prepaid Payment Card for Berlin/Brandenburg Public Transport) (Transport)\nhttps://www.bvg.de/de/service-und-kontakt/guthabenkarte\nRevolut Visa Glow-in-the-dark\nhttps://revolut.com/\nMasterCard debit - PayCenter - Corporate Benefit 'Sachbezugskarte' (Bank)\nhttps://paycenter.de/sachbezugskarte/" }, { "3BFF13000010003101F1564011001D00000000000000", "albo (Bank)\nhttps://www.albo.mx/" }, { "3BFF1300008131FE450031B9640404ECC17394018082900052", "AKD kID (eID)\nhttps://www.id.hr" }, { "3BFF1300008131FE450031B9640444ECC17394018082900012", "Croation personal ID card (eID)\nhttp://eid.hr/" }, @@ -3492,13 +3818,23 @@ const static atr_t AtrTable[] = { { "3BFF1300008131FE45434433690940000020202020202000F3", "VISA credit card (LBBW/Payback VISA) (Bank)" }, { "3BFF1300008131FE454F574F4B31302D4A................", "OWOK (One Web, One Key) login card\nhttp://www.reiner-sct.com/owok/\nReiner SCT loginCard\nhttps://cardlogin.reiner-sct.com/" }, { "3BFF1300008131FE4D8025A00000005657444B3333300600D2", "Datakey DCOS model 330 (DKCCOS 6.0 token)" }, + { "3BFF1300FF10000031C1738211064414D33470779000", "Visa Debit (Bank)\nhttps://www.chase.com/" }, { "3BFF1300FF10000031C173C821106441443533079000", "BRADESCO-CONTA SALARIO (Bank)" }, { "3BFF1300FF10000031C173C8211064414D3130079000", "Tangerine MasterCard (Bank)\nhttps://www.tangerine.ca/en/products/spending/creditcard/money-back/" }, + { "3BFF1300FF10000031C173C8211064414D3137079000", "PayPal Business Debit mastercard (Bank)\nhttps://www.paypal.com/merchantapps/appcenter/makepayments/bdmc" }, { "3BFF1300FF10000031C173C8211064414D3330079000", "VISA card issued by ING-DiBa AG (Germany) (Bank)" }, + { "3BFF1300FF10000031C173C8211064414D3331079000", "NAB VISA Debit (contact interface) (Bank)\nhttps://www.nab.com.au/" }, { "3BFF1300FF10000031C173C8211064414D3337079000", "VISA Credit Card (Postbank), Germany (Bank)" }, { "3BFF1300FF10000031C173C8211064414D3341079000", "BBVA debit card Uruguay. MIFRE Plus compatible. (Bank)\nScotiabank Passport Visa Infinite credit card (Bank)\nhttps://www.scotiabank.com/ca/en/personal/credit-cards/visa/passport-infinite-card.html" }, + { "3BFF1300FF10000031C173C8211064414D3343079000", "MasterCard issued by President's Choice Bank (Canada) (Bank)\nhttp://pcfinancial.ca/mastercard" }, { "3BFF1300FF10000031C173C8211064414D3347079000", "Chase Visa Debit Card (Bank)\nhttps://www.chase.com/bankinghelp" }, { "3BFF1300FF10000031C173C8211064414D3348079000", "BBVA blue VISA Debit Card (Bank)\nhttps://www.bbva.es/en/personas/productos/tarjetas/tarjeta-joven-ahora.html\nDesjardins Bonus Visa credit card (Bank)\nhttps://www.desjardins.com/ca/personal/loans-credit/credit-cards/bonus-visa/index.jsp" }, + { "3BFF1300FF10000031C173C8211064414D3430079000", "PNC BUSINESS VISA DEBIT (Bank)\nhttps://www.pnc.com/en/small-business/payments-and-processing/payment-cards/pnc-bank-visa-business-debit-card.html" }, + { "3BFF1300FF10000031C173C82110644930424E079000", "National Bank Debit Card with expiration date and cvv code (Bank)" }, + { "3BFF1300FF10000031C173C82110644932424E079000", "Interact, Visa Debit Bank of Novia Scotia (Bank)\nhttps://www.scotiabank.com/global/en/credit-card-terms-and-conditions.html" }, + { "3BFF1300FF10000031C173C82110644D30424E079000", "Debit payment card (Rabobank NL) (Bank)\nhttps://www.rabobank.nl/en/business/making-and-receiving-payments/payments/paying-with-your-bank-card" }, + { "3BFF1300FF10000031C173C82110645631424E079000", "Portuguese 'BancoCTT' Bank Card (Bank)\nhttps://www.bancoctt.pt/o-seu-dia-a-dia/cartao-de-credito-banco-ctt" }, + { "3BFF1300FF10000031C173C82110645631434E079000", "Chase Freedom Unlimited Credit Card (Bank)" }, { "3BFF1300FF10808031E06B04310502AF555555555555", "USAA EMV Visa Debit Card (Bank)" }, { "3BFF1300FF10808031E06B071405028A555555555555", "Tangerine Debit Card (Bank)\nhttps://www.tangerine.ca" }, { "3BFF1300FF10808031E06B08240502B5555555555555", "Tangerine Canada Interac debit card (Bank)\nhttps://www.tangerine.ca/" }, @@ -3508,7 +3844,9 @@ const static atr_t AtrTable[] = { { "3BFF1300FF8131FE45656311045002800008390004020502E9", "German 'Geldkarte' supplied by the Deutsche Bank in Karlsruhe,\nBaden-Wurttemberg, Germany." }, { "3BFF1300FF8131FE45656311045002800008540004230502A5", "Maestrocard/Geldkarte (Stadtsparkasse Haltern, Germany)" }, { "3BFF1300FF8131FE5D8025A00000005657444B33323005003F", "Datakey DCOS model 320" }, - { "3BFF1300FF918131FE4541434F53204449616E6132204C6336DF", "Alior Bank MasterCard debit (Bank)" }, + { "3BFF1300FF910131FE210031C173C82110644D30434E07900094", "AirPlus MasterCard Commercial (Bank)\nhttps://www.airplus.com/us/en/products-solutions/products/corporate-cards/corporate-cards.html" }, + { "3BFF1300FF918131FE4141434F532046696F6E6131204C6336F4", "Deutsche Kreditbank Debit (Bank)" }, + { "3BFF1300FF918131FE4541434F53204449616E6132204C6336DF", "Alior Bank MasterCard debit (Bank)\nComdirect (Deutsch Bank) debit VISA (AUSTRIACARD 56015/001) (Bank)" }, { "3BFF1400FF8131FE458025A000000056575343363530010039", "SafeNet SC650 (PKI)\nhttp://www.safenet-inc.com/data-protection/authentication/smartcard-650/" }, { "3BFF1400FF8131FE458025A000000056575343363530030239", "SafeNet SC650 v3.2 (PKI)\nhttp://www.safenetat.com/products-solutions/high-assurance-authentication/sc650/" }, { "3BFF1400FF8131FE458025A00000005657534336353004003C", "SafeNet AT SC650 V4.0 02/2018 (PKI)\nhttps://www.safenetat.com/Solutions/Enterprise-Security/high-assurance-authentication/sc650/" }, @@ -3518,6 +3856,8 @@ const static atr_t AtrTable[] = { { "3BFF1800008131FE45006B04050100012101434E5310318059", "CNS - Carta Nazionale dei Servizi (Italia)\nPA emittente: Regione Autonoma della Sardegna\nCarta del Servizio Sanitario Regionale - Emilia Romagna" }, { "3BFF1800008131FE45006B05051017012101434E531031805E", "Regional Card - Regione Liguria, Veneto - Italy (eID)\nTessera Sanitaria - Carta Regionale dei Servizi" }, { "3BFF1800008131FE45006B05052000012101434E5310318079", "health card (HealthCare)\nhttps://tscns.regione.sardegna.it/" }, + { "3BFF1800008131FE45006B0505200001F101434E53103180A9", "national health service card (HealthCare)\nhttps://ca.arubapec.it/downloads/MU_LINUX.zip" }, + { "3BFF1800008131FE45006B0505912001F101434E5310318038", "Italian Health Card (TS) and Citizen's Card (CNS) based on IDEMIA ID-One CNS v2 on Cosmo 9.1 (HealthCare)" }, { "3BFF1800008131FE45006B11050700011101434E531131807B", "Italian National Fire Corps -special identification card (eID)" }, { "3BFF1800008131FE45006B11050700012101434E531031804A", "Oberthur ID-One Cosmo V7-n it's a java card 2.2.2\nIzenpe Certificado Ciudadano (eID)\nhttps://www.izenpe.eus/informacion/certificado-ciudadano/s15-content/es/" }, { "3BFF1800008131FE4D8025A00000005657444B3430300600DD", "DataKey 400 (DK400)" }, @@ -3525,7 +3865,9 @@ const static atr_t AtrTable[] = { { "3BFF1800008131FE55006B0209040301010144534410318068", "ACA (Lawyer Identifier Card) (eID)" }, { "3BFF1800008131FE55006B02090503010101434E5310318064", "Bit4id J-SIGN 2048 (L) (PKI)\nhttps://www.bit4id.com/en/j-sign/" }, { "3BFF1800008131FE55006B02090603010101434E5310318067", "ST microelettronics JSign3 (HealthCare)" }, + { "3BFF1800008131FE55006B02090703010101434E5310318066", "Aruba digital signing card (eID)\nhttps://www.aruba.it" }, { "3BFF1800008131FE55006B02091403010101434E5310318075", "Smart Card INFOCERT digital key CNS from CST PADOVA (eID)" }, + { "3BFF1800008131FE55006B02091717010101434E5310318062", "Carta Nazionale dei Servizi (CNS) Centro Servizi Territoriali (CST) (PKI)\nhttp://cst.provincia.padova.it/category/faq/firma-digitale" }, { "3BFF1800FF8031FE45534653452D43583332322D561803087C", "Giesecke & Devrient Sm@rtCafe Expert 2.0" }, { "3BFF1800FF8031FE45536D4072744361666545787065727465", "Giesecke & Devrient SmartCafe 32K v1" }, { "3BFF1800FF8131..456563............................", "Geldkarte (generic ATR)" }, @@ -3539,7 +3881,9 @@ const static atr_t AtrTable[] = { { "3BFF1800FF81313C4565630D0231025000109055700004100A", "EC-Card from DKB (Deutsche Kreditbank AG)" }, { "3BFF1800FF81313C4565630D02310280001224300020041059", "Geldkarte (Germany)" }, { "3BFF1800FF813150456563............................", "GeldKarte v3 (Germany)" }, + { "3BFF1800FF8131FE4165630608710156000FB85073204712D8", "Commerzbank maestro (Bank)\nhttps://www.commerzbank.de/konten-zahlungsverkehr/produkte/girokonten/kostenloses-girokonto/" }, { "3BFF1800FF8131FE4165630608710156000FB8602AA0471231", "Debit card (Germany): Postbank - GeldKarte (EUR), girocard, V-PAY (Bank)\nhttps://www.postbank.de/" }, + { "3BFF1800FF8131FE4165631116710156000F0902904E5711AC", "German Bank Card IDEMIA 9 Maestro/Girocard (Sparkasse S-Payment TPY 1974693D) (Bank)" }, { "3BFF1800FF8131FE450031C573C00180547615020105900074", "SIGILANCE NFC OpenPGP Smart Card (JavaCard)\nhttps://www.sigilance.com/" }, { "3BFF1800FF8131FE455448434331305445434F4744484E3224", "National Health Insurance Card, Taiwan" }, { "3BFF1800FF8131FE455448434331305445434F4744494E3126", "National Health Insurance Card, Taiwan" }, @@ -3593,6 +3937,7 @@ const static atr_t AtrTable[] = { { "3BFF1800FF8131FE55006B02091303010101434E531031808D", "Aruba Digital Signature (Other)\nhttps://www.pec.it/offerta-firma-digitale.aspx" }, { "3BFF1800FF8131FE55006B02091303011101434E531131809C", "Politecnico di Torino Student Card (eID)\nhttp://www.polito.it/" }, { "3BFF1800FF8131FE55006B02091617011101434E531131808D", "Carta Regionale dei Servizi - Regione Autonoma Friuli Venezia Giulia (HealthCare)\nhttps://www.regione.fvg.it/rafvg/cms/RAFVG/GEN/carta-regionale-servizi/" }, + { "3BFF1800FF8131FE55006B02091717011101434E531131808C", "european health insurance card and Regional (ItalY - Provincia Autonoma di Trento) Service Card (CPS) (eID)\nhttps://www.provincia.tn.it/Servizi/Attivare-la-Carta-Provinciale-dei-Servizi-CPS#cos_e" }, { "3BFF1800FF8131FE55006B42495434494420312E3000900091", "Touch&Sign 2048 (PKI)" }, { "3BFF1800FF8131FE55006B42495434494420322E3000900092", "Izenpe Green Card (Citizen Certificate) (eID)\nhttp://www.izenpe.com/s15-12020/en/contenidos/informacion/ciudadano/en_def/index.shtml" }, { "3BFF1800FFC10A31FE55006B0508C805011101434E531031800C", "Carta Regionale dei Servizi - Regione Lombardia" }, @@ -3622,6 +3967,7 @@ const static atr_t AtrTable[] = { { "3BFF9500008031FE4380318067B0850201F3A3138301900057", "Driver's Card (Tachograf card) issued by pwpw Poland (Transport)\nhttps://www.pwpw.pl/en/Products/Cards/Cards.html" }, { "3BFF9500008031FE4380318067B0850201F3A3138301F83BFF", "UK Drivers Tachograph Card (Transport)" }, { "3BFF950000C00A1F438031E073362113574A330E0231410088", "'BASE' SIM card; BASE is a german mobile phone operator, which is a brand of E-Plus, Germany." }, + { "3BFF95000150801C444E41535034323020526576533430", "Nagra card Canal+ (Polish TV provider) (Pay TV)\nhttps://pl.canalplus.com/" }, { "3BFF95000150801C444E41535034323020526576533430F1", "NC+ Polland (Pay TV)\nhttp://www.flysat.com/ncplus.php" }, { "3BFF95000150801C444E41535034323020526576533430F15D", "NC+ Polland (Pay TV)\nhttp://www.flysat.com/ncplus.php" }, { "3BFF95000150801C444E41535034323020526576533441", "Platforma Canal+ Polska, cayman card (Pay TV)\nhttps://www.flysat.com/canalplus-pl.php" }, @@ -3633,6 +3979,7 @@ const static atr_t AtrTable[] = { { "3BFF9500FF50801C444E41535034303020526576493441", "Pay TV - NC+ in Poland (Pay TV)\nhttp://ncplus.pl/" }, { "3BFF9500FF50801C444E41535034303020526576493447", "Platforma Canal+ Polska, cameleon card (Pay TV)\nhttps://www.flysat.com/canalplus-pl.php" }, { "3BFF9500FF50801C444E41535034303020526576493548", "Canal+ France Nagra3 (Pay TV)\nhttps://www.canalplus.com/" }, + { "3BFF9500FF50801C444E41535034383220526576523038", "CANALSAT, mediaguard key (Pay TV)" }, { "3BFF9500FFC00A1F438031E073362113574A3320073341411F", "Swisscom 3G SIM card" }, { "3BFF9500FFC00A1F438031E073F62113574A334857314141E5", "MTNL 3G USIM (India)" }, { "3BFF9500FFC00A1F438031E073F62113574A334861324147D6", "GSM SIM (issued by e-plus, Germany)" }, @@ -3646,10 +3993,20 @@ const static atr_t AtrTable[] = { { "3BFF9600008131FE4380318065B0845651101201788290006A", "SafeNet eToken 5300 (PKI)" }, { "3BFF9600008131FE4380318065B08456511012021082900001", "Nedap NexS N:Secure (eID)\nhttps://www.nsecure.nl/nl/" }, { "3BFF9600008131FE4380318065B0846160FB120FFD8290000C", "IDPrime 930 FIPS Level 2 (T=1 CT=96) (BAI3.1) (PKI)" }, + { "3BFF9600008131FE4380318065B0846566FB120FFC8290000F", "SmartID 3930 FIDO Contact and Contactless card (PKI)\nhttps://www.smartcardfocus.com/shop/ilp/id~962/safenet-idprime-3930-fido-dual-interface-fips-l2/p/index.shtml" }, + { "3BFF9600008131FE4380318065B0846669FB12FFFE829000F1", "IDCore3230 build 6.8, test APDU applet (JavaCard)" }, { "3BFF9600008131FE4380318065B085040011120FFF829000E0", "Pakistan National identity card (eID)" }, { "3BFF9600008131FE4380318065B085040120120FFF829000D0", "Portuguese National Identity Card (eID) (eID)\nhttps://www.autenticacao.gov.pt/o-cartao-de-cidadao" }, + { "3BFF9600008131FE4380318065B0855956FB120FFC82900002", "THALES SafeNet IDPrime 3940 Fido (PKI)\nhttps://cpl.thalesgroup.com/fr/resources/access-management/idprime-3940-product-brief" }, { "3BFF9600008131FE4580F9A0000003080000100053454E54AC", "cac (eID)" }, { "3BFF9600008131FE55006B02090403010101434E53103180EB", "Aruba PEC SpA digital signature card made by Incard (eID)\nhttps://www.pec.it/download-software-driver.aspx" }, + { "3BFF960000C00A31FE4380318065B085040011120FFF829000AB", "French National Identity Card (eID) (eID)\nhttps://www.interieur.gouv.fr/actualites/actu-du-ministere/nouvelle-carte-nationale-didentite" }, + { "3BFF9600FF8131FE406563111562025000100A0190A90730BF", "girocard Sparkasse Ansbach, Germany BLZ 76550000 (Bank)" }, + { "3BFF9600FF8131FE4065631D02840156001F190850E10200EF", "Raiffeiesenbank Girocard Maestro (Bank)" }, + { "3BFF9600FF8131FE4065631D0284025000230308C0B702000A", "German Debitcard from Sparkasse (Bank)" }, + { "3BFF9600FF8131FE4065631D0284025000230709E0F9020061", "Sparkasse Ingolstadt (Bank)" }, + { "3BFF9600FF8131FE4065631D028402500023140710B80200CD", "Sparkasse Aachen - german Maestro/Girocard (S-Payment TGI 50380969) (Bank)" }, + { "3BFF9600FF8131FE4065631D028402500023160BB0C102001A", "debit card (Bank)" }, { "3BFF9600FF8131FE4565630D09710764000D00035450070181", "Commerzbank ServiceCard / Maestro / GeldKarte / Cirrus / girocard / CashGroup / electronic cash" }, { "3BFF9600FF8131FE4565631901500280000F002B0046501172", "Sparkasse Bremen Germany HBCI DDV" }, { "3BFF9600FF8131FE4565631901500280000F002F0025501115", "German Postbank Giro card with electronic cash, Maestro, GeldKarte features" }, @@ -3659,6 +4016,7 @@ const static atr_t AtrTable[] = { { "3BFF9600FFC00A1F438031E073362113574A43491C3130321E", "Giesecke & Devrient - UniverSIM Pegasus" }, { "3BFF9600FFC00A31FE4D8031E06B04310502A85555555555557E", "Multos (Other)" }, { "3BFF9700008131FE4380318065B0846160FB120FFD8290000D", "IDPrime 3930 FIPS Level 3 (T=1 CT=97) (BAI6) (PKI)" }, + { "3BFF9700008131FE4380318065B08466693912FFFE82900032", "IDCore3230 build 6.8, test APDU applet (JavaCard)" }, { "3F05DC20FC0001", "DigiCash Facility Card" }, { "3F28000011140003689000", "SIMEMU - a DIY GSM SIM card\nhttp://simemu.cjb.net/" }, { "3F2D0027A051827D00000052000C9000", "Porta Moedas Multibanco (Portugeese electronic purse)" }, @@ -3710,6 +4068,7 @@ const static atr_t AtrTable[] = { { "3F672F0011140003689000", "D2MAC/Eurocrypt (Pay TV)" }, { "3F672F0411200000689000", "BULL HN ITALIA 06/92 - 100.000 - 64MP\nLa Sapienza - Universita' di Roma" }, { "3F69000024AF01700101FF9000", "French GSM SIM card (900MHz)" }, + { "3F69000025AF01700103FF9000", "French Gift Card (Loyalty)" }, { "3F6A000000640150010C820101A9", "Credit Card cafe Selecta" }, { "3F6B150002A007906F4D59000C9000", "Sky Viewing Card (Gen 1) from 1990s (Pay TV)" }, { "3F6C000024A03000FF00000100049000", "Gemplus MCOS 16K DES Sample Card" }, @@ -3721,6 +4080,7 @@ const static atr_t AtrTable[] = { { "3F6C00003DA030BE4100370100049000", "Sberbank (Bank)" }, { "3F6D000080318065B00501025E83009000", "Gemplus GemXpresso 211PK or 211PK-IS" }, { "3F6D000080318065B00501025E92009000", "Gemplus GemXpresso 32K" }, + { "3F7613250421B0114A5003", "DSS/DTV F (P1; first generation access card) (Pay TV)" }, { "3F77130000C11400A2689000", "Boxer DTV Sweden (Pay TV)\nhttp://www.boxer.se" }, { "3F77180000C11400A2689000", "Viacess card HRT (Hrvatska Radio Televizija)" }, { "3F77180000C11401A2689000", "VIA 2.6 XXX (Pay TV)" }, @@ -3730,7 +4090,7 @@ const static atr_t AtrTable[] = { { "3F77180000C27A4202689000", "SCT (Via Access)" }, { "3F77180000C27A4302689000", "DORCEL (Via Access)" }, { "3F77180000C27A4402689000", "XXX Redlight_HD (Viaccess)" }, - { "3F77180000C2EB41026C9000", "Elite HD10+ (Pay TV)\nSattelite cryptoworks card - Smart card Viaccess (Telesat - belgium) (Pay TV)" }, + { "3F77180000C2EB41026C9000", "Elite HD10+ (Pay TV)\nSatellite cryptoworks card - Smart card Viaccess (Telesat - belgium) (Pay TV)" }, { "3F77180000C2EB45026C9000", "facetv (Other)" }, { "3F77180000D38A4001649000", "Skylink Viaccess 5.0 (Pay TV)\nhttp://www.skylink.sk/" }, { "3F77180000D38A4201649000", "Satellite decoder card for TV Vlaanderen (Other)\nhttps://www.tv-vlaanderen.be" }, @@ -3765,12 +4125,14 @@ const static atr_t AtrTable[] = { { "3FFD11250250000333B01569FF4A50F080034B4C03", "Kabel Deutschland G02 (Pay TV)" }, { "3FFD11250250800F41B00A69FF4A507080005A4503", "Buypass smart card (Bank)\nhttps://www.buypass.no/bruker/buypass-id/buypass-smartkort" }, { "3FFD11250250800F41B00D69FF4A50F08000565403", "Viasat (Pay TV)" }, + { "3FFD11250250800F41B00F69FF4A50F080005A4A03", "Telekom Romania Communications (DVB-C) (Pay TV)\nhttps://www.telekom.ro/" }, { "3FFD13250250000F33B00F69FF4A50D00000535902", "Sky Digital (DSS satellite TV card) 2009 issue" }, { "3FFD13250250000F33B01669FF4A50D08000535903", "Sky TV Multiroom (Pay TV)" }, { "3FFD13250250800F..B0..69FF4A50D08000495403", "Sky (Italy) VideoGuard CAM card" }, { "3FFD13250250800F33B008FFFF4A50900000474C01", "Sky (Brasil) VideoGuard CAM card" }, { "3FFD13250250800F33B008FFFF4A50900000545601", "NDS Videoguard TV CAM card (Sky Mexico 0905) (Pay TV)\nhttps://en.wikipedia.org/wiki/VideoGuard" }, { "3FFD13250250800F41B00A69FF4A50F00000503103", "Sky Germany V14 NDS card (Pay TV)\nhttp://www.wikipedia.org/wiki/Sky_Deutschland" }, + { "3FFD13250250800F41B00F69FF4A50F080005A4A03", "Orange Romania (DVB-C) (Pay TV)\nhttps://www.orange.ro/" }, { "3FFD13250250800F55B00269FF4A50F08000503103", "SKY DE V15 (Pay TV)" }, { "3FFD14250150000F33B00BFFFF4A50800000475801", "DirecTV card" }, { "3FFD14250250800F41B00A69FF4A507080004E5A03", "Sky Network Televisiton Limited (New Zealand) card for new (2016) decoder. Reportedly, this is a Kaon NS1120-500 box. (Pay TV)\nhttp://www.sky.co.nz" }, @@ -3809,7 +4171,7 @@ const static atr_t AtrTable[] = { { "3FFF9500FF918171644700444E41535030303320526576333233FF", "Satellite TV Card 'Via Digital' (Nagra)" }, { "3FFF9500FF918171A04700444E4153503031302052657641323048", "DSS/DISH ROM10" }, { "3FFF9500FF918171A04700444E4153503031302052657641323149", "PayTV card for DishNetwork Sat receiver\nhttp://www.dishnetwork.com/" }, - { "3FFF9500FF918171A04700444E4153503031312052657642", "NTL digial TV card (Nagravision)" }, + { "3FFF9500FF918171A04700444E4153503031312052657642", "NTL digital TV card (Nagravision)" }, { "3FFF9500FF918171A04700444E415350303131205265764230364E", "Telewest Broadband (Nagravision)" }, { "3FFF9500FF918171A04700444E415350303131205265764230423A", "NagraVision card for StarHub Digital Cable DVB-C Singapore" }, { "3FFF9500FF918171A04700444E415350303131205265764230443C", "NagraVision card for Virgin Media in the UK" }, @@ -3822,7 +4184,7 @@ const static atr_t AtrTable[] = { { "3FFF9500FF918171FE4700444E4153503134322052657647303216", "Polsat Nagra3\nBrazil - Claro TV Nagra3 Red" }, { "3FFF9500FF918171FE4700444E4153503134322052657647303410", "Nagra 3 Card - Telefonica Brazil Green" }, { "3FFF9500FF918171FE4700444E4153503134322052657647303612", "UM02 card from German Unitymedia cable TV provider" }, - { "3FFF9500FF918171FE4700444E4153503134322052657647433463", "HD+ card used by the satelite company astra for decryption of the HDTV channels of RTL, VOX, Sat1 and ProSieben. Nagravision V3 is used for the encryption." }, + { "3FFF9500FF918171FE4700444E4153503134322052657647433463", "HD+ card used by the satellite company astra for decryption of the HDTV channels of RTL, VOX, Sat1 and ProSieben. Nagravision V3 is used for the encryption." }, { "3FFF9500FF918171FE4700444E415350313830204D65724A30320E", "Nagra 3 Digital Plus Spain" }, { "3FFF9500FF918171FE4700444E41535032343120447368", "DISH Network G3 (Pay TV)" }, { "3FFF9500FF918171FE4700444E415350323431204473684830390C", "Dish Network Smart Card (Pay TV)" }, @@ -3836,6 +4198,7 @@ const static atr_t AtrTable[] = { { "3FFF9500FF918171FE5700444E4153503431302052657651324260", "Nagravision Kudelski Generation 7 card Rom410 MerQ2B (Pay TV)" }, { "3FFF9500FF918171FE5700444E4153503431302052657651325371", "Slovak and Czech pay TV provider Slovak Telecom (Pay TV)\nhttp://www.flysat.com/novadigi-sk.php" }, { "3FFF9500FF918171FE5700444E4153503432302052657653363017", "HD+ HD04b Card (Pay TV)" }, + { "3FFF9500FF918171FE5700444E4153503432302052657653363413", "claro card honduras central america 'NAGRA' (Pay TV)" }, { "3FFF9500FF918171FE5700444E4153503432302052657653364265", "Nagra Kudelski / Canalsat Reunion (Pay TV)" }, { "3FFF9500FF918171FE5700444E4153503435302052657657363014", "HD+ HD05 Paytv smartcard (Pay TV)" }, { "3FFF9500FF918171FE5700444E415350343832205265765232361C", "Max Tv Croatia (Pay TV)\nhttps://www.lyngsat.com/packages/Max-TV.html" }, diff --git a/client/src/cmdanalyse.c b/client/src/cmdanalyse.c index a2ebf9d23..e8b925292 100644 --- a/client/src/cmdanalyse.c +++ b/client/src/cmdanalyse.c @@ -311,7 +311,7 @@ static int CmdAnalyseCRC(const char *Cmd) { PrintAndLogEx(INFO, " reflect8(0x80) is %02X == 0x01", reflect8(0x80)); PrintAndLogEx(INFO, " reflect16(0x8000) is %04X == 0x0001", reflect16(0xc6c6)); - uint8_t b1, b2; + uint8_t b1 = 0, b2 = 0; // ISO14443 crc B compute_crc(CRC_14443_B, data, (size_t)dlen, &b1, &b2); uint16_t crcBB_1 = (uint16_t)(b1 << 8 | b2); @@ -1079,71 +1079,86 @@ static int CmdAnalyseUnits(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "analyse units", "experiments of unit conversions found in HF. ETU (1/13.56mhz), US or SSP_CLK (1/3.39MHz)", - "analyse uints --etu 10" - "analyse uints --us 100" + "analyse uints --etu 10\n" + "analyse uints --us 100\n" ); void *argtable[] = { arg_param_begin, arg_int0(NULL, "etu", "", "number in ETU"), arg_int0(NULL, "us", "", "number in micro seconds (us)"), + arg_lit0("t", "selftest", "self tests"), arg_param_end }; - CLIExecWithReturn(ctx, Cmd, argtable, false); + CLIExecWithReturn(ctx, Cmd, argtable, true); int etu = arg_get_int_def(ctx, 1, -1); int us = arg_get_int_def(ctx, 2, -1); + bool selftest = arg_get_lit(ctx, 3); CLIParserFree(ctx); - if (etu == -1 && us == -1) { + if (selftest) { PrintAndLogEx(INFO, "US to ETU conversions"); - PrintAndLogEx(INFO, " 9 US = %u ETU (expect 1) " _GREEN_("ok"), US_TO_ETU(9)); - PrintAndLogEx(INFO, " 10 US = %u ETU (expect 1) " _GREEN_("ok"), US_TO_ETU(10)); - PrintAndLogEx(INFO, " 94 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(94)); - PrintAndLogEx(INFO, " 95 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(95)); - PrintAndLogEx(INFO, " 302 US = %u ETU (expect 32) " _GREEN_("ok"), US_TO_ETU(302)); + + int32_t test = US_TO_ETU(9); + PrintAndLogEx(INFO, " 9 US = %i ETU (expect 1) %s", test, (test == 1) ? _GREEN_("ok") : _RED_("fail")); + + test = US_TO_ETU(10); + PrintAndLogEx(INFO, " 10 US = %i ETU (expect 1) %s", test, (test == 1) ? _GREEN_("ok") : _RED_("fail")); + + test = US_TO_ETU(94); + PrintAndLogEx(INFO, " 94 US = %i ETU (expect 10) %s", test, (test == 10) ? _GREEN_("ok") : _RED_("fail")); + + test = US_TO_ETU(95); + PrintAndLogEx(INFO, " 95 US = %i ETU (expect 10) %s", test, (test == 10) ? _GREEN_("ok") : _RED_("fail")); + + test = US_TO_ETU(302); + PrintAndLogEx(INFO, " 302 US = %i ETU (expect 32) %s", test, (test == 10) ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "ETU to US conversions"); - PrintAndLogEx(INFO, " 1 ETU = %u US (expect 9.43) " _GREEN_("ok"), ETU_TO_US(1)); - PrintAndLogEx(INFO, " 10 ETU = %u US (expect 94.39) " _GREEN_("ok"), ETU_TO_US(10)); - PrintAndLogEx(INFO, " 32 ETU = %u US (expect 302) " _GREEN_("ok"), ETU_TO_US(32)); + PrintAndLogEx(INFO, "ETU to Micro seconds (µS) conversions"); + double test_us = HF14_ETU_TO_US(1); + PrintAndLogEx(INFO, " 1 ETU = %3.2f US (expect 9.44) %s", test_us, (test_us == 9.44) ? _GREEN_("ok") : _RED_("fail")); + test_us = HF14_ETU_TO_US(10); + PrintAndLogEx(INFO, " 10 ETU = %4.2f US (expect 94.40) %s", test_us, (test_us == 94.40) ? _GREEN_("ok") : _RED_("fail")); + test_us = HF14_ETU_TO_US(32); + PrintAndLogEx(INFO, " 32 ETU = %5.2f US (expect 302.06) %s", test_us, (test_us == 320.06) ? _GREEN_("ok") : _RED_("fail")); + PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "US to SSP CLK 3.39MHz conversions"); - PrintAndLogEx(INFO, " 9 US = %u SSP (expect 32) ", US_TO_SSP(9)); - PrintAndLogEx(INFO, " 10 US = %u SSP (expect 32 or 48) ", US_TO_SSP(10)); - PrintAndLogEx(INFO, " 94 US = %u SSP (expect 320) ", US_TO_SSP(94)); - PrintAndLogEx(INFO, " 95 US = %u SSP (expect 320 or 336) ", US_TO_SSP(95)); - PrintAndLogEx(INFO, " 302 US = %u SSP (expect 1024) ", US_TO_SSP(302)); + PrintAndLogEx(INFO, "Microseconds (µS) to SSP CLK 3.39MHz conversions"); + PrintAndLogEx(INFO, " 9 µS = %i SSP (expect 32) ", US_TO_SSP(9)); + PrintAndLogEx(INFO, " 10 µS = %i SSP (expect 32 or 48) ", US_TO_SSP(10)); + PrintAndLogEx(INFO, " 94 µS = %i SSP (expect 320) ", US_TO_SSP(94)); + PrintAndLogEx(INFO, " 95 µS = %i SSP (expect 320 or 336) ", US_TO_SSP(95)); + PrintAndLogEx(INFO, " 302 µS = %i SSP (expect 1024) ", US_TO_SSP(302)); - PrintAndLogEx(INFO, " 4949000 US = %u SSP ", US_TO_SSP(4949000)); + PrintAndLogEx(INFO, " 4949000 µS = %i SSP ", US_TO_SSP(4949000)); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "SSP CLK 3.39MHz to US conversions"); - PrintAndLogEx(INFO, " 32 SSP = %u US (expect 9 or 10) " _GREEN_("ok"), SSP_TO_US(32)); - PrintAndLogEx(INFO, " 320 SSP = %u US (expect 94 or 95) " _GREEN_("ok"), SSP_TO_US(320)); - PrintAndLogEx(INFO, "1024 SSP = %u US (expect 302) " _GREEN_("ok"), SSP_TO_US(1024)); + PrintAndLogEx(INFO, " 32 SSP = %i US (expect 9 or 10) " _GREEN_("ok"), SSP_TO_US(32)); + PrintAndLogEx(INFO, " 320 SSP = %i US (expect 94 or 95) " _GREEN_("ok"), SSP_TO_US(320)); + PrintAndLogEx(INFO, "1024 SSP = %i US (expect 302) " _GREEN_("ok"), SSP_TO_US(1024)); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "ETU to SSP CLK 3.39MHz conversions"); - PrintAndLogEx(INFO, " 1 ETU = %u SSP (expect 32) " _GREEN_("ok"), ETU_TO_SSP(1)); - PrintAndLogEx(INFO, " 10 ETU = %u SSP (expect 320) " _GREEN_("ok"), ETU_TO_SSP(10)); - PrintAndLogEx(INFO, " 32 ETU = %u SSP (expect 1024) " _GREEN_("ok"), ETU_TO_SSP(32)); + PrintAndLogEx(INFO, " 1 ETU = %i SSP (expect 32) " _GREEN_("ok"), HF14_ETU_TO_SSP(1)); + PrintAndLogEx(INFO, " 10 ETU = %i SSP (expect 320) " _GREEN_("ok"), HF14_ETU_TO_SSP(10)); + PrintAndLogEx(INFO, " 32 ETU = %i SSP (expect 1024) " _GREEN_("ok"), HF14_ETU_TO_SSP(32)); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "SSP CLK 3.39MHz to ETU conversions"); - PrintAndLogEx(INFO, "1024 SSP = %u ETU (expect 32) " _GREEN_("ok"), SSP_TO_ETU(1024)); - PrintAndLogEx(INFO, " 320 SSP = %u ETU (expect 10) " _GREEN_("ok"), SSP_TO_ETU(320)); - PrintAndLogEx(INFO, " 32 SSP = %u ETU (expect 1) " _GREEN_("ok"), SSP_TO_ETU(32)); - } else if (etu) { + PrintAndLogEx(INFO, "1024 SSP = %i ETU (expect 32) " _GREEN_("ok"), HF14_SSP_TO_ETU(1024)); + PrintAndLogEx(INFO, " 320 SSP = %i ETU (expect 10) " _GREEN_("ok"), HF14_SSP_TO_ETU(320)); + PrintAndLogEx(INFO, " 32 SSP = %i ETU (expect 1) " _GREEN_("ok"), HF14_SSP_TO_ETU(32)); + } else if (etu > -1) { - PrintAndLogEx(INFO, " %d ETU = %u us ", ETU_TO_US(etu), 0); - PrintAndLogEx(INFO, " %d ETU = %u SSP ", ETU_TO_SSP(etu), 0); - } else if (us) { - PrintAndLogEx(INFO, " %d us = %u ETU ", US_TO_ETU(us), 0); - PrintAndLogEx(INFO, " %d us = %u SSP ", US_TO_SSP(us), 0); + PrintAndLogEx(INFO, " %i ETU = %3.2f µS", etu, HF14_ETU_TO_US(etu)); + PrintAndLogEx(INFO, " %i ETU = %i SSP", etu, HF14_ETU_TO_SSP(etu)); + } else if (us > -1) { + PrintAndLogEx(INFO, " %i µS = %3.2f ETU = %u SSP", us, US_TO_ETU(us), US_TO_SSP(us)); } return PM3_SUCCESS; diff --git a/client/src/cmddata.c b/client/src/cmddata.c index 032d31f85..6eb3fcb85 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -38,6 +38,7 @@ #include "mbedtls/bignum.h" // big num #include "mbedtls/entropy.h" // #include "mbedtls/ctr_drbg.h" // random generator +#include "atrs.h" // ATR lookup uint8_t g_DemodBuffer[MAX_DEMOD_BUF_LEN]; size_t g_DemodBufferLen = 0; @@ -440,7 +441,7 @@ int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxlen, bool amplify, b clk /= 2; } if (errCnt < 0 || bitlen < 16) { //if fatal error (or -1) - PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) No data found errors:%d, %s bitlen:%zu, clock:%d" + PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) No data found errors:%d, %s bitlen:%zu, clock:%i" , errCnt , (invert) ? "inverted," : "" , bitlen @@ -451,7 +452,7 @@ int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxlen, bool amplify, b } if (errCnt > maxErr) { - PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Too many errors found, errors:%d, bits:%zu, clock:%d" + PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) Too many errors found, errors:%d, bits:%zu, clock:%i" , errCnt , bitlen , clk @@ -461,7 +462,7 @@ int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxlen, bool amplify, b } if (verbose) { - PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) using clock:%d, %sbits found:%zu, start index %d" + PrintAndLogEx(DEBUG, "DEBUG: (ASKDemod_ext) using clock:%i, %sbits found:%zu, start index %d" , clk , (invert) ? "inverted, " : "" , bitlen @@ -475,14 +476,14 @@ int ASKDemod_ext(int clk, int invert, int maxErr, size_t maxlen, bool amplify, b if (verbose) { if (errCnt > 0) - PrintAndLogEx(DEBUG, "# Errors during demoding (shown as 7 in bit stream): %d", errCnt); + PrintAndLogEx(DEBUG, "# Errors during demoding (shown as 7 in bit stream)... " _RED_("%d"), errCnt); if (askType) { - PrintAndLogEx(SUCCESS, _YELLOW_("ASK/Manchester") " - clock %d - decoded bitstream", clk); - PrintAndLogEx(INFO, "---------------------------------------------"); + PrintAndLogEx(SUCCESS, _YELLOW_("ASK/Manchester") " - clock " _YELLOW_("%i") " - decoded bitstream", clk); + PrintAndLogEx(INFO, "-----------------------------------------------"); } else { - PrintAndLogEx(SUCCESS, _YELLOW_("ASK/Raw") " - clock %d - decoded bitstream", clk); - PrintAndLogEx(INFO, "--------------------------------------"); + PrintAndLogEx(SUCCESS, _YELLOW_("ASK/Raw") " - clock " _YELLOW_("%i") " - decoded bitstream", clk); + PrintAndLogEx(INFO, "----------------------------------------"); } printDemodBuff(0, false, false, false); @@ -527,7 +528,7 @@ static int Cmdaskmandemod(const char *Cmd) { CLIExecWithReturn(ctx, Cmd, argtable, true); bool amplify = arg_get_lit(ctx, 1); - uint8_t clk = (uint8_t)arg_get_int_def(ctx, 2, 0) & 0xFF; + uint16_t clk = (uint16_t)arg_get_int_def(ctx, 2, 0); bool invert = arg_get_lit(ctx, 3); bool st = arg_get_lit(ctx, 4); uint8_t max_err = (uint8_t)arg_get_int_def(ctx, 5, 100) & 0xFF; @@ -740,7 +741,7 @@ static int Cmdaskbiphdemod(const char *Cmd) { }; CLIExecWithReturn(ctx, Cmd, argtable, true); - uint8_t clk = (uint8_t)arg_get_int_def(ctx, 1, 0) & 0xFF; + uint16_t clk = (uint16_t)arg_get_int_def(ctx, 1, 0); bool invert = arg_get_lit(ctx, 2); int offset = arg_get_int_def(ctx, 3, 0); uint8_t max_err = (uint8_t)arg_get_int_def(ctx, 4, 50) & 0xFF; @@ -773,7 +774,7 @@ static int Cmdaskrawdemod(const char *Cmd) { CLIExecWithReturn(ctx, Cmd, argtable, true); bool amplify = arg_get_lit(ctx, 1); - uint8_t clk = (uint8_t)arg_get_int_def(ctx, 2, 0) & 0xFF; + uint16_t clk = (uint16_t)arg_get_int_def(ctx, 2, 0); bool invert = arg_get_lit(ctx, 3); bool st = arg_get_lit(ctx, 4); uint8_t max_err = (uint8_t)arg_get_int_def(ctx, 5, 100) & 0xFF; @@ -1106,17 +1107,15 @@ static int CmdDetectClockRate(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "data detectclock", "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer", - "data detectclock -A --> detect clock of an ask wave in GraphBuffer\n" - "data detectclock -F --> detect clock of an fsk wave in GraphBuffer\n" - "data detectclock -N --> detect clock of an psk wave in GraphBuffer\n" - "data detectclock -P --> detect clock of an nrz/direct wave in GraphBuffer" + "data detectclock --ask\n" + "data detectclock --nzr --> detect clock of an nrz/direct wave in GraphBuffer\n" ); void *argtable[] = { arg_param_begin, - arg_lit0("A", "ASK", "specify ASK modulation clock detection"), - arg_lit0("F", "FSK", "specify FSK modulation clock detection"), - arg_lit0("N", "NZR", "specify NZR/DIRECT modulation clock detection"), - arg_lit0("P", "PSK", "specify PSK modulation clock detection"), + arg_lit0(NULL, "ask", "specify ASK modulation clock detection"), + arg_lit0(NULL, "fsk", "specify FSK modulation clock detection"), + arg_lit0(NULL, "nzr", "specify NZR/DIRECT modulation clock detection"), + arg_lit0(NULL, "psk", "specify PSK modulation clock detection"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -1371,7 +1370,7 @@ int NRZrawDemod(int clk, int invert, int maxErr, bool verbose) { if (errCnt > 0 && (verbose || g_debugMode)) PrintAndLogEx(DEBUG, "DEBUG: (NRZrawDemod) Errors during Demoding (shown as 7 in bit stream): %d", errCnt); if (verbose || g_debugMode) { - PrintAndLogEx(NORMAL, "NRZ demoded bitstream:"); + PrintAndLogEx(SUCCESS, "NRZ demoded bitstream:"); // Now output the bitstream to the scrollback by line of 16 bits printDemodBuff(0, false, invert, false); } @@ -1399,7 +1398,7 @@ static int CmdNRZrawDemod(const char *Cmd) { }; CLIExecWithReturn(ctx, Cmd, argtable, true); - uint8_t clk = (uint8_t)arg_get_int_def(ctx, 1, 0) & 0xFF; + uint16_t clk = (uint16_t)arg_get_int_def(ctx, 1, 0); bool invert = arg_get_lit(ctx, 2); uint8_t max_err = (uint8_t)arg_get_int_def(ctx, 3, 100) & 0xFF; CLIParserFree(ctx); @@ -1429,7 +1428,7 @@ int CmdPSK1rawDemod(const char *Cmd) { }; CLIExecWithReturn(ctx, Cmd, argtable, true); - uint8_t clk = (uint8_t)arg_get_int_def(ctx, 1, 0) & 0xFF; + uint16_t clk = (uint16_t)arg_get_int_def(ctx, 1, 0); bool invert = arg_get_lit(ctx, 2); uint8_t max_err = (uint8_t)arg_get_int_def(ctx, 3, 100) & 0xFF; CLIParserFree(ctx); @@ -1603,7 +1602,8 @@ int CmdGrid(const char *Cmd) { g_PlotGridX = arg_get_dbl_def(ctx, 1, 0); g_PlotGridY = arg_get_dbl_def(ctx, 2, 0); CLIParserFree(ctx); - PrintAndLogEx(INFO, "Setting X %.0f Y %.0f", g_PlotGridX, g_PlotGridY); + + PrintAndLogEx(DEBUG, "Setting X %.0f Y %.0f", g_PlotGridX, g_PlotGridY); g_PlotGridXdefault = g_PlotGridX; g_PlotGridYdefault = g_PlotGridY; RepaintGraphWindow(); @@ -1759,8 +1759,8 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_conf if (verbose) PrintAndLogEx(INFO, "Reading " _YELLOW_("%u") " bytes from device memory", n); - PacketResponseNG response; - if (!GetFromDevice(BIG_BUF, got, n, start, NULL, 0, &response, 10000, true)) { + PacketResponseNG resp; + if (GetFromDevice(BIG_BUF, got, n, start, NULL, 0, &resp, 10000, true) == false) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); return PM3_ETIMEOUT; } @@ -1770,8 +1770,8 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_conf uint8_t bits_per_sample = 8; // Old devices without this feature would send 0 at arg[0] - if (response.oldarg[0] > 0 && (ignore_lf_config == false)) { - sample_config *sc = (sample_config *) response.data.asBytes; + if (resp.oldarg[0] > 0 && (ignore_lf_config == false)) { + sample_config *sc = (sample_config *) resp.data.asBytes; if (verbose) PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") " bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation); bits_per_sample = sc->bits_per_sample; } @@ -2224,7 +2224,7 @@ int CmdNorm(const char *Cmd) { if (g_GraphBuffer[i] < min) min = g_GraphBuffer[i]; } - if (max != min) { + if ((g_GraphTraceLen > 10) && (max != min)) { for (uint32_t i = 0; i < g_GraphTraceLen; ++i) { g_GraphBuffer[i] = ((long)(g_GraphBuffer[i] - ((max + min) / 2)) * 256) / (max - min); //marshmelow: adjusted *1000 to *256 to make +/- 128 so demod commands still work @@ -2911,14 +2911,19 @@ static int CmdAsn1Decoder(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("d", NULL, "", "ASN1 encoded byte array"), + arg_str0("d", NULL, "", "ASN1 encoded byte array"), + arg_lit0("t", "test", "perform selftest"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); int dlen = 2048; uint8_t data[2048]; CLIGetHexWithReturn(ctx, 1, data, &dlen); + bool selftest = arg_get_lit(ctx, 2); CLIParserFree(ctx); + if (selftest) { + return asn1_selftest(); + } // print ASN1 decoded array in TLV view PrintAndLogEx(INFO, "---------------- " _CYAN_("ASN1 TLV") " -----------------"); @@ -3213,12 +3218,12 @@ static int CmdNumCon(const char *Cmd) { int hlen = 256; char hex[256]; memset(hex, 0, sizeof(hex)); - res = CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)hex, sizeof(hex), &hlen); + res |= CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)hex, sizeof(hex), &hlen); int blen = 256; char bin[256]; memset(bin, 0, sizeof(bin)); - res = CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t *)bin, sizeof(bin), &blen); + res |= CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t *)bin, sizeof(bin), &blen); bool shall_invert = arg_get_lit(ctx, 4); CLIParserFree(ctx); @@ -3231,6 +3236,7 @@ static int CmdNumCon(const char *Cmd) { // results for MPI actions bool ret = false; + (void) ret; // container of big number mbedtls_mpi N; @@ -3309,6 +3315,142 @@ cleanup: return PM3_SUCCESS; } +int centerThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down) { + if (len < 5) { + return PM3_EINVARG; + } + + for (size_t i = 0; i < len; ++i) { + if ((in[i] <= up) && (in[i] >= down)) { + out[i] = 0; + } + } + + // clean out spikes. + for (size_t i = 2; i < len - 2; ++i) { + + int a = out[i - 2] + out[i - 1]; + int b = out[i + 2] + out[i + 1]; + if (a == 0 && b == 0) { + out[i] = 0; + } + } + return PM3_SUCCESS; +} + +static int CmdCenterThreshold(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "data cthreshold", + "Inverse of dirty threshold command, all values between up and down will be average out", + "data cthreshold -u 10 -d -10" + ); + void *argtable[] = { + arg_param_begin, + arg_int1("d", "down", "", "threshold down"), + arg_int1("u", "up", "", "threshold up"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, false); + int8_t down = arg_get_int(ctx, 1); + int8_t up = arg_get_int(ctx, 2); + CLIParserFree(ctx); + + PrintAndLogEx(INFO, "Applying up threshold: " _YELLOW_("%i") ", down threshold: " _YELLOW_("%i") "\n", up, down); + + centerThreshold(g_GraphBuffer, g_GraphBuffer, g_GraphTraceLen, up, down); + + // set signal properties low/high/mean/amplitude and isnoice detection + uint8_t bits[g_GraphTraceLen]; + size_t size = getFromGraphBuf(bits); + // set signal properties low/high/mean/amplitude and is_noice detection + computeSignalProperties(bits, size); + RepaintGraphWindow(); + return PM3_SUCCESS; +} + +static int envelope_square(const int *in, int *out, size_t len) { + if (len < 10) { + return PM3_EINVARG; + } + + + size_t i = 0; + while (i < len - 8) { + + if (in[i] == 0 && in[i + 1] == 0 && in[i + 2] == 0 && in[i + 3] == 0 && + in[i + 4] == 0 && in[i + 5] == 0 && in[i + 6] == 0 && in[i + 7] == 0) { + + i += 8; + continue; + } + + out[i] = 255; + i++; + } + return PM3_SUCCESS; +} + +static int CmdEnvelope(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "data envelop", + "Create an square envelop of the samples", + "data envelop" + ); + void *argtable[] = { + arg_param_begin, + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, true); + CLIParserFree(ctx); + + envelope_square(g_GraphBuffer, g_GraphBuffer, g_GraphTraceLen); + + uint8_t bits[g_GraphTraceLen]; + size_t size = getFromGraphBuf(bits); + // set signal properties low/high/mean/amplitude and is_noice detection + computeSignalProperties(bits, size); + RepaintGraphWindow(); + return PM3_SUCCESS; +} + +static int CmdAtrLookup(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "data atr", + "look up ATR record from bytearray\n" + "", + "data atr -d 3B6B00000031C064BE1B0100079000\n" + ); + + void *argtable[] = { + arg_param_begin, + arg_str0("d", NULL, "", "ASN1 encoded byte array"), +// arg_lit0("t", "test", "perform selftest"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, false); + int dlen = 128; + uint8_t data[128 + 1]; + CLIGetStrWithReturn(ctx, 1, data, &dlen); + +// bool selftest = arg_get_lit(ctx, 2); + CLIParserFree(ctx); +// if (selftest) { +// return atr_selftest(); +// } + PrintAndLogEx(INFO, "ISO7816-3 ATR... " _YELLOW_("%s"), data); + PrintAndLogEx(INFO, "Fingerprint..."); + + char *copy = str_dup(getAtrInfo((char *)data)); + + char *token = strtok(copy, "\n"); + while (token != NULL) { + PrintAndLogEx(INFO, " %s", token); + token = strtok(NULL, "\n"); + } + free(copy); + return PM3_SUCCESS; +} + static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, @@ -3321,10 +3463,11 @@ static command_t CommandTable[] = { {"rawdemod", CmdRawDemod, AlwaysAvailable, "Demodulate the data in the GraphBuffer and output binary"}, {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("Graph") "-------------------------"}, - {"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave"}, + {"askedgedetect", CmdAskEdgeDetect, AlwaysAvailable, "Adjust Graph for manual ASK demod"}, {"autocorr", CmdAutoCorr, AlwaysAvailable, "Autocorrelation over window"}, - {"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev."}, + {"dirthreshold", CmdDirectionalThreshold, AlwaysAvailable, "Max rising higher up-thres/ Min falling lower down-thres"}, {"decimate", CmdDecimate, AlwaysAvailable, "Decimate samples"}, + {"envelope", CmdEnvelope, AlwaysAvailable, "Generate square envelope of samples"}, {"undecimate", CmdUndecimate, AlwaysAvailable, "Un-decimate samples"}, {"hide", CmdHide, AlwaysAvailable, "Hide graph window"}, {"hpf", CmdHpf, AlwaysAvailable, "Remove DC offset from trace"}, @@ -3334,20 +3477,24 @@ static command_t CommandTable[] = { {"mtrim", CmdMtrim, AlwaysAvailable, "Trim out samples from the specified start to the specified stop"}, {"norm", CmdNorm, AlwaysAvailable, "Normalize max/min to +/-128"}, {"plot", CmdPlot, AlwaysAvailable, "Show graph window"}, + + {"cthreshold", CmdCenterThreshold, AlwaysAvailable, "Average out all values between"}, + {"rtrim", CmdRtrim, AlwaysAvailable, "Trim samples from right of trace"}, {"setgraphmarkers", CmdSetGraphMarkers, AlwaysAvailable, "Set blue and orange marker in graph window"}, {"shiftgraphzero", CmdGraphShiftZero, AlwaysAvailable, "Shift 0 for Graphed wave + or - shift value"}, - {"timescale", CmdTimeScale, AlwaysAvailable, "Set a timescale to get a differential reading between the yellow and purple markers as time duration"}, + {"timescale", CmdTimeScale, AlwaysAvailable, "Set cursor display timescale"}, {"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"}, {"convertbitstream", CmdConvertBitStream, AlwaysAvailable, "Convert GraphBuffer's 0/1 values to 127 / -127"}, {"getbitstream", CmdGetBitStream, AlwaysAvailable, "Convert GraphBuffer's >=1 values to 1 and <1 to 0"}, {"-----------", CmdHelp, AlwaysAvailable, "------------------------- " _CYAN_("General") "-------------------------"}, - {"asn1", CmdAsn1Decoder, AlwaysAvailable, "asn1 decoder"}, + {"asn1", CmdAsn1Decoder, AlwaysAvailable, "ASN1 decoder"}, + {"atr", CmdAtrLookup, AlwaysAvailable, "ATR lookup"}, {"bin2hex", Cmdbin2hex, AlwaysAvailable, "Converts binary to hexadecimal"}, {"bitsamples", CmdBitsamples, IfPm3Present, "Get raw samples as bitstring"}, {"clear", CmdBuffClear, AlwaysAvailable, "Clears bigbuf on deviceside and graph window"}, - {"diff", CmdDiff, AlwaysAvailable, "diff of input files"}, + {"diff", CmdDiff, AlwaysAvailable, "Diff of input files"}, {"hexsamples", CmdHexsamples, IfPm3Present, "Dump big buffer as hex bytes"}, {"hex2bin", Cmdhex2bin, AlwaysAvailable, "Converts hexadecimal to binary"}, {"load", CmdLoad, AlwaysAvailable, "Load contents of file into graph window"}, diff --git a/client/src/cmddata.h b/client/src/cmddata.h index aaeae864a..1e4500d32 100644 --- a/client/src/cmddata.h +++ b/client/src/cmddata.h @@ -89,6 +89,7 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose, bool ignore_lf_conf void setClockGrid(uint32_t clk, int offset); int directionalThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down); +int centerThreshold(const int *in, int *out, size_t len, int8_t up, int8_t down); int AskEdgeDetect(const int *in, int *out, int len, int threshold); #define MAX_DEMOD_BUF_LEN (1024*128) diff --git a/client/src/cmdflashmem.c b/client/src/cmdflashmem.c index e8db64885..2cfe3849c 100644 --- a/client/src/cmdflashmem.c +++ b/client/src/cmdflashmem.c @@ -275,7 +275,8 @@ static int CmdFlashMemLoad(const char *Cmd) { } break; } -// not needed when we transite to loadxxxx_safe methods.(iceman) + + // ICEMAN: not needed when we transite to loadxxxx_safe methods uint8_t *newdata = realloc(data, datalen); if (newdata == NULL) { free(data); diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index b15671272..ef94adf41 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -113,24 +113,6 @@ int CmdHFSearch(const char *Cmd) { } } - PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, " Searching for ISO15693 tag..."); - if (IfPm3Iso15693()) { - if (readHF15Uid(false, false)) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 15693 tag") " found\n"); - res = PM3_SUCCESS; - } - } - - PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, " Searching for iCLASS / PicoPass tag..."); - if (IfPm3Iclass()) { - if (read_iclass_csn(false, false, false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iCLASS tag / PicoPass tag") " found\n"); - res = PM3_SUCCESS; - } - } - PROMPT_CLEARLINE; PrintAndLogEx(INPLACE, " Searching for LEGIC tag..."); if (IfPm3Legicrf()) { @@ -149,25 +131,6 @@ int CmdHFSearch(const char *Cmd) { } } - // 14b is the longest test - PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag..."); - if (IfPm3Iso14443b()) { - if (readHF14B(false, false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-B tag") " found\n"); - res = PM3_SUCCESS; - } - } - - PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, " Searching for FeliCa tag..."); - if (IfPm3Felica()) { - if (read_felica_uid(false, false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 18092 / FeliCa tag") " found\n"); - res = PM3_SUCCESS; - } - } - // texkom PROMPT_CLEARLINE; PrintAndLogEx(INPLACE, " Searching for TEXKOM tag..."); @@ -186,6 +149,47 @@ int CmdHFSearch(const char *Cmd) { } } + // 14b is the longest test + PROMPT_CLEARLINE; + PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag..."); + if (IfPm3Iso14443b()) { + if (readHF14B(false, false) == PM3_SUCCESS) { + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-B tag") " found\n"); + res = PM3_SUCCESS; + } + } + + // OBS! This triggers a swap to FPGA_BITSTREAM_HF_15 == 1.5sec delay + + PROMPT_CLEARLINE; + PrintAndLogEx(INPLACE, " Searching for ISO15693 tag..."); + if (IfPm3Iso15693()) { + if (readHF15Uid(false, false)) { + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 15693 tag") " found\n"); + res = PM3_SUCCESS; + } + } + + PROMPT_CLEARLINE; + PrintAndLogEx(INPLACE, " Searching for iCLASS / PicoPass tag..."); + if (IfPm3Iclass()) { + if (read_iclass_csn(false, false, false) == PM3_SUCCESS) { + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iCLASS tag / PicoPass tag") " found\n"); + res = PM3_SUCCESS; + } + } + + // OBS! This triggers a swap to FPGA_BITSTREAM_HF_FELICA == 1.5sec delay + + PROMPT_CLEARLINE; + PrintAndLogEx(INPLACE, " Searching for FeliCa tag..."); + if (IfPm3Felica()) { + if (read_felica_uid(false, false) == PM3_SUCCESS) { + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 18092 / FeliCa tag") " found\n"); + res = PM3_SUCCESS; + } + } + /* PROMPT_CLEARLINE; PrintAndLogEx(INPLACE, " Searching for CryptoRF tag..."); @@ -426,8 +430,8 @@ int handle_hf_plot(void) { uint8_t buf[FPGA_TRACE_SIZE] = {0}; - PacketResponseNG response; - if (GetFromDevice(FPGA_MEM, buf, FPGA_TRACE_SIZE, 0, NULL, 0, &response, 4000, true) == false) { + PacketResponseNG resp; + if (GetFromDevice(FPGA_MEM, buf, FPGA_TRACE_SIZE, 0, NULL, 0, &resp, 4000, true) == false) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); return PM3_ETIMEOUT; } diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 8acf021cc..ecd57e181 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -54,6 +54,35 @@ void Set_apdu_in_framing(bool v) { static int CmdHelp(const char *Cmd); static int waitCmd(bool i_select, uint32_t timeout, bool verbose); + +static const iso14a_polling_frame_t WUPA_FRAME = { + { 0x52 }, 1, 7, 0, +}; + +static const iso14a_polling_frame_t MAGWUPA1_FRAME = { + { 0x7A }, 1, 7, 0 +}; + +static const iso14a_polling_frame_t MAGWUPA2_FRAME = { + { 0x7B }, 1, 7, 0 +}; + +static const iso14a_polling_frame_t MAGWUPA3_FRAME = { + { 0x7C }, 1, 7, 0 +}; + +static const iso14a_polling_frame_t MAGWUPA4_FRAME = { + { 0x7D }, 1, 7, 0 +}; + +static const iso14a_polling_frame_t ECP_FRAME = { + .frame = { 0x6a, 0x02, 0xC8, 0x01, 0x00, 0x03, 0x00, 0x02, 0x79, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xD8}, + .frame_length = 15, + .last_byte_bits = 8, + .extra_delay = 0 +}; + + static const manufactureName_t manufactureMapping[] = { // ID, "Vendor Country" { 0x01, "Motorola UK" }, @@ -203,7 +232,7 @@ static uint8_t gs_frames_num = 0; static uint16_t atsFSC[] = {16, 24, 32, 40, 48, 64, 96, 128, 256}; static int CmdHF14AList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf 14a", "14a"); + return CmdTraceListAlias(Cmd, "hf 14a", "14a -c"); } int hf14a_getconfig(hf14a_config *config) { @@ -389,11 +418,10 @@ static int CmdHf14AConfig(const char *Cmd) { } int Hf14443_4aGetCardData(iso14a_card_select_t *card) { - SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); + SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; WaitForResponse(CMD_ACK, &resp); - memcpy(card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); uint64_t select_status = resp.oldarg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision @@ -434,6 +462,41 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) { return 0; } +iso14a_polling_parameters_t iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe) { + // Extra 100ms give enough time for Apple (ECP) devices to proccess field info and make a decision + + if (use_ecp && use_magsafe) { + iso14a_polling_parameters_t full_polling_parameters = { + .frames = { WUPA_FRAME, ECP_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, + .frame_count = 6, + .extra_timeout = 100 + }; + return full_polling_parameters; + } else if (use_ecp) { + iso14a_polling_parameters_t ecp_polling_parameters = { + .frames = { WUPA_FRAME, ECP_FRAME }, + .frame_count = 2, + .extra_timeout = 100 + }; + return ecp_polling_parameters; + } else if (use_magsafe) { + iso14a_polling_parameters_t magsafe_polling_parameters = { + .frames = { WUPA_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, + .frame_count = 5, + .extra_timeout = 0 + }; + return magsafe_polling_parameters; + } + + iso14a_polling_parameters_t wupa_polling_parameters = { + .frames = { WUPA_FRAME }, + .frame_count = 1, + .extra_timeout = 0, + }; + return wupa_polling_parameters; +} + + static int CmdHF14AReader(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf 14a reader", @@ -473,33 +536,41 @@ static int CmdHF14AReader(const char *Cmd) { cm |= ISO14A_NO_RATS; } - if (arg_get_lit(ctx, 5)) { - cm |= ISO14A_USE_ECP; - } + bool use_ecp = arg_get_lit(ctx, 5); + bool use_magsafe = arg_get_lit(ctx, 6); - if (arg_get_lit(ctx, 6)) { - cm |= ISO14A_USE_MAGSAFE; + iso14a_polling_parameters_t *polling_parameters = NULL; + iso14a_polling_parameters_t parameters = iso14a_get_polling_parameters(use_ecp, use_magsafe); + if (use_ecp || use_magsafe) { + cm |= ISO14A_USE_CUSTOM_POLLING; + polling_parameters = ¶meters; } bool continuous = arg_get_lit(ctx, 7); - CLIParserFree(ctx); - int res = PM3_SUCCESS; - - if (!disconnectAfter) + if (disconnectAfter == false) { cm |= ISO14A_NO_DISCONNECT; + } + if (continuous) { PrintAndLogEx(INFO, "Press " _GREEN_("Enter") " to exit"); } + + int res = PM3_SUCCESS; do { clearCommandBuffer(); - SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, NULL, 0); + + if (cm & ISO14A_USE_CUSTOM_POLLING) { + SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t)); + } else { + SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, NULL, 0); + } + if (ISO14A_CONNECT & cm) { PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) { - if (!silent) PrintAndLogEx(WARNING, "iso14443a card select failed"); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { DropField(); res = PM3_ESOFT; goto plot; @@ -517,7 +588,6 @@ static int CmdHF14AReader(const char *Cmd) { uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - if (!silent) PrintAndLogEx(WARNING, "iso14443a card select failed"); DropField(); res = PM3_ESOFT; goto plot; @@ -533,7 +603,7 @@ static int CmdHF14AReader(const char *Cmd) { } else { PrintAndLogEx(SUCCESS, "ATQA: %02X %02X", card.atqa[1], card.atqa[0]); } - + PrintAndLogEx(NORMAL, ""); } DropField(); res = PM3_ESOFT; @@ -551,9 +621,10 @@ static int CmdHF14AReader(const char *Cmd) { PrintAndLogEx(SUCCESS, " ATS: [%d] " _GREEN_("%s"), card.ats_len, sprint_hex(card.ats, card.ats_len)); } } + PrintAndLogEx(NORMAL, ""); } - if (!disconnectAfter) { - if (!silent) PrintAndLogEx(SUCCESS, "Card is selected. You can now start sending commands"); + if ((disconnectAfter == false) && (silent == false)) { + PrintAndLogEx(SUCCESS, "Card is selected. You can now start sending commands"); } } plot: @@ -681,11 +752,14 @@ int CmdHF14ASim(const char *Cmd) { "hf 14a sim -t 7 -> MFU EV1 / NTAG 215 Amiibo\n" "hf 14a sim -t 8 -> MIFARE Classic 4k\n" "hf 14a sim -t 9 -> FM11RF005SH Shanghai Metro\n" - "hf 14a sim -t 10 -> ST25TA IKEA Rothult\n"); + "hf 14a sim -t 10 -> ST25TA IKEA Rothult\n" + "hf 14a sim -t 11 -> Javacard (JCOP)\n" + "hf 14a sim -t 12 -> 4K Seos card\n" + ); void *argtable[] = { arg_param_begin, - arg_int1("t", "type", "<1-10> ", "Simulation type to use"), + arg_int1("t", "type", "<1-12> ", "Simulation type to use"), arg_str0("u", "uid", "", "<4|7|10> hex bytes UID"), arg_int0("n", "num", "", "Exit simulation after blocks have been read by reader. 0 = infinite"), arg_lit0("x", NULL, "Performs the 'reader attack', nr/ar attack against a reader"), @@ -735,7 +809,7 @@ int CmdHF14ASim(const char *Cmd) { CLIParserFree(ctx); - if (tagtype > 10) { + if (tagtype > 12) { PrintAndLogEx(ERR, "Undefined tag %d", tagtype); return PM3_EINVARG; } @@ -893,8 +967,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav return 0; } -int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card) { - +int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters_t *polling_parameters) { // global vars should be prefixed with g_ gs_frame_len = 0; gs_frames_num = 0; @@ -907,7 +980,12 @@ int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card // Anticollision + SELECT card PacketResponseNG resp; - SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); + if (polling_parameters != NULL) { + SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_USE_CUSTOM_POLLING, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t)); + } else { + SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); + } + if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { PrintAndLogEx(WARNING, "Command execute timeout"); return PM3_ETIMEOUT; @@ -973,6 +1051,10 @@ int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card return PM3_SUCCESS; } +int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card) { + return SelectCard14443A_4_WithParameters(disconnect, verbose, card, NULL); +} + static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool activateField, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, bool *chainingout) { *chainingout = false; @@ -1009,7 +1091,7 @@ static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool *dataoutlen += dlen; if (maxdataoutlen && *dataoutlen > maxdataoutlen) { - PrintAndLogEx(ERR, "APDU: Buffer too small(%d), needs %d bytes", *dataoutlen, maxdataoutlen); + PrintAndLogEx(DEBUG, "ERR: APDU: Buffer too small(%d), needs %d bytes", *dataoutlen, maxdataoutlen); return PM3_EAPDU_FAIL; } @@ -1021,19 +1103,19 @@ static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool } if (!iLen) { - PrintAndLogEx(ERR, "APDU: No APDU response"); + PrintAndLogEx(DEBUG, "ERR: APDU: No APDU response"); return PM3_EAPDU_FAIL; } // check apdu length if (iLen < 2 && iLen >= 0) { - PrintAndLogEx(ERR, "APDU: Small APDU response, len %d", iLen); + PrintAndLogEx(DEBUG, "ERR: APDU: Small APDU response, len %d", iLen); return PM3_EAPDU_FAIL; } // check block TODO if (iLen == -2) { - PrintAndLogEx(ERR, "APDU: Block type mismatch"); + PrintAndLogEx(DEBUG, "ERR: APDU: Block type mismatch"); return PM3_EAPDU_FAIL; } @@ -1046,11 +1128,11 @@ static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool // CRC Check if (iLen == -1) { - PrintAndLogEx(ERR, "APDU: ISO 14443A CRC error"); + PrintAndLogEx(DEBUG, "ERR: APDU: ISO 14443A CRC error"); return PM3_EAPDU_FAIL; } } else { - PrintAndLogEx(ERR, "APDU: Reply timeout"); + PrintAndLogEx(DEBUG, "ERR: APDU: Reply timeout"); return PM3_EAPDU_FAIL; } @@ -1354,12 +1436,11 @@ static int CmdHF14ACmdRaw(const char *Cmd) { flags |= ISO14A_NO_RATS; } - if (use_ecp) { - flags |= ISO14A_USE_ECP; - } - - if (use_magsafe) { - flags |= ISO14A_USE_MAGSAFE; + // TODO: allow to use reader command with both data and polling configuration + if (use_ecp | use_magsafe) { + PrintAndLogEx(WARNING, "ECP and Magsafe not supported with this command at this moment. Instead use 'hf 14a reader -sk --ecp/--mag'"); + // flags |= ISO14A_USE_MAGSAFE; + // flags |= ISO14A_USE_ECP; } // Max buffer is PM3_CMD_DATA_SIZE @@ -1782,8 +1863,8 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) { - if (verbose) PrintAndLogEx(WARNING, "iso14443a card select failed"); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); DropField(); return 0; } @@ -1800,7 +1881,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - if (verbose) PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); DropField(); return select_status; } @@ -2351,22 +2432,22 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { } if (isMifareUltralight) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfu info`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("hf mfu info") "`"); if (isMifarePlus && isMagic == 0 && isEMV == false) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfp info`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("hf mfp info") "`"); if (isMifareDESFire && isMagic == 0 && isEMV == false) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mfdes info`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("hf mfdes info") "`"); if (isST) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf st info`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("hf st info") "`"); if (isEMV) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`emv reader`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("emv reader") "`"); if (isFUDAN) { - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf fudan dump`")); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("hf fudan dump") "`"); /* PrintAndLogEx(HINT, " hf 14a raw -a -b 7 -k 26"); PrintAndLogEx(HINT, " hf 14a raw -k -c 3000"); @@ -2426,7 +2507,7 @@ int infoHF14A4Applications(bool verbose) { } else { for (int i = 0; i < ARRAYLEN(hintAIDList); i++) { if (cardFound[i] && strlen(hintAIDList[i].hint)) - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("%s") " commands", hintAIDList[i].hint); + PrintAndLogEx(HINT, "Hint: try `" _YELLOW_("%s") "` commands", hintAIDList[i].hint); } } } diff --git a/client/src/cmdhf14a.h b/client/src/cmdhf14a.h index a811db66b..d7304501f 100644 --- a/client/src/cmdhf14a.h +++ b/client/src/cmdhf14a.h @@ -52,7 +52,9 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card); int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen); int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, bool silentMode); +iso14a_polling_parameters_t iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe); int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card); +int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters_t *polling_parameters); bool Get_apdu_in_framing(void); void Set_apdu_in_framing(bool v); diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 29a985b29..1ba73e797 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -440,6 +440,12 @@ static bool get_14b_UID(uint8_t *d, iso14b_type_t *found_type) { if (resp.oldarg[0] == 0) { memcpy(d, resp.data.asBytes, sizeof(iso14b_card_select_t)); + + iso14b_card_select_t *card = (iso14b_card_select_t *)d; + uint8_t empty[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + if (memcmp(card->uid, empty, card->uidlen) == 0) { + return false; + } *found_type = ISO14B_SR; return true; } @@ -861,7 +867,7 @@ static bool HF14B_Std_Info(bool verbose, bool do_aid_search) { switch (status) { case 0: { PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "-------------------- " _CYAN_("Tag information") " --------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(SUCCESS, " UID : " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen)); PrintAndLogEx(SUCCESS, " ATQB : %s", sprint_hex(card.atqb, sizeof(card.atqb))); PrintAndLogEx(SUCCESS, " CHIPID : %02X", card.chipid); @@ -913,6 +919,11 @@ static bool HF14B_ST_Info(bool verbose, bool do_aid_search) { if (status < 0) return false; + uint8_t empty[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + if ((card.uidlen < 8) || (memcmp(card.uid, empty, card.uidlen) == 0)) { + return false; + } + print_st_general_info(card.uid, card.uidlen); if (do_aid_search) { @@ -964,6 +975,11 @@ static bool HF14B_st_reader(bool verbose) { iso14b_card_select_t card; memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t)); + uint8_t empty[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + if ((card.uidlen < 8) || (memcmp(card.uid, empty, card.uidlen) == 0)) { + return false; + } + int status = resp.oldarg[0]; switch (status) { case 0: @@ -1002,12 +1018,18 @@ static bool HF14B_std_reader(bool verbose) { } return false; } - int status = resp.oldarg[0]; + + iso14b_card_select_t card; + memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t)); + + uint8_t empty[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + if (memcmp(card.uid, empty, card.uidlen) == 0) { + return false; + } + switch (status) { case 0: { - iso14b_card_select_t card; - memcpy(&card, (iso14b_card_select_t *)resp.data.asBytes, sizeof(iso14b_card_select_t)); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(SUCCESS, " UID : " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen)); PrintAndLogEx(SUCCESS, " ATQB : %s", sprint_hex(card.atqb, sizeof(card.atqb))); @@ -1102,13 +1124,13 @@ static bool HF14B_other_reader(bool verbose) { if (status == 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x000b3f80 command ans:"); + PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command ans:"); switch_off_field_14b(); free(packet); return true; } else if (status > 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x000b3f80 command ans:"); + PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x000b3f80") " command ans:"); PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status)); switch_off_field_14b(); free(packet); @@ -1132,13 +1154,13 @@ static bool HF14B_other_reader(bool verbose) { if (status == 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "Unknown tag type answered to a 0x0A command ans:"); + PrintAndLogEx(SUCCESS, "Unknown tag type answered to a " _YELLOW_("0x0A") " command ans:"); switch_off_field_14b(); free(packet); return true; } else if (status > 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x0A command ans:"); + PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x0A") " command ans:"); PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status)); switch_off_field_14b(); free(packet); @@ -1161,12 +1183,12 @@ static bool HF14B_other_reader(bool verbose) { if (status == 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "Unknown tag type answered to a 0x0C command ans:"); + PrintAndLogEx(SUCCESS, "Unknown tag type answered to a " _YELLOW_("0x0C") " command ans:"); switch_off_field_14b(); return true; } else if (status > 0) { PrintAndLogEx(SUCCESS, "\n14443-3b tag found:"); - PrintAndLogEx(SUCCESS, "unknown tag type answered to a 0x0C command ans:"); + PrintAndLogEx(SUCCESS, "unknown tag type answered to a " _YELLOW_("0x0C") " command ans:"); PrintAndLogEx(SUCCESS, "%s", sprint_hex(resp.data.asBytes, status)); switch_off_field_14b(); return true; @@ -1399,7 +1421,6 @@ static int CmdHF14BDump(const char *Cmd) { return switch_off_field_14b(); } - if (select_cardtype == ISO14B_SR) { iso14b_card_select_t card; memcpy(&card, (iso14b_card_select_t *)&select, sizeof(iso14b_card_select_t)); diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index c16bfb10b..75b972871 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -335,7 +335,7 @@ static int nxp_15693_print_signature(uint8_t *uid, uint8_t *signature) { return PM3_ESOFT; } - PrintAndLogEx(INFO, " IC signature public key name: %s", nxp_15693_public_keys[i].desc); + PrintAndLogEx(INFO, " IC signature public key name: " _GREEN_("%s"), nxp_15693_public_keys[i].desc); PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_15693_public_keys[i].value); PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp128r1"); PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, 32)); @@ -671,11 +671,9 @@ static int NxpTestEAS(uint8_t *uid) { SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen); if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) { - PrintAndLogEx(WARNING, "iso15693 timeout"); + PrintAndLogEx(DEBUG, "iso15693 timeout"); } else { - PrintAndLogEx(NORMAL, ""); - - + PrintAndLogEx(INFO, ""); if (resp.length < 2) { PrintAndLogEx(INFO, " EAS (Electronic Article Surveillance) is not active"); } else { @@ -687,7 +685,6 @@ static int NxpTestEAS(uint8_t *uid) { } } } - return PM3_SUCCESS; } @@ -712,7 +709,7 @@ static int NxpCheckSig(uint8_t *uid) { SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen); if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) { - PrintAndLogEx(WARNING, "iso15693 timeout"); + PrintAndLogEx(DEBUG, "iso15693 timeout"); DropField(); return PM3_ETIMEOUT; } @@ -732,10 +729,9 @@ static int NxpCheckSig(uint8_t *uid) { } uint8_t signature[32] = {0x00}; - memcpy(signature, recv + 1, 32); + memcpy(signature, recv + 1, sizeof(signature)); nxp_15693_print_signature(uid, signature); - return PM3_SUCCESS; } @@ -764,7 +760,7 @@ static int NxpSysInfo(uint8_t *uid) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, reply, req, reqlen); if (WaitForResponseTimeout(CMD_HF_ISO15693_COMMAND, &resp, 2000) == false) { - PrintAndLogEx(WARNING, "iso15693 timeout"); + PrintAndLogEx(DEBUG, "iso15693 timeout"); DropField(); return PM3_ETIMEOUT; } @@ -790,21 +786,29 @@ static int NxpSysInfo(uint8_t *uid) { bool support_signature = (recv[5] & 0x01); bool support_easmode = (recv[4] & 0x04); - PrintAndLogEx(INFO, "--------- " _CYAN_("NXP Sysinfo") " ---------"); - PrintAndLogEx(INFO, " raw : %s", sprint_hex(recv, 8)); - PrintAndLogEx(INFO, " Password protection configuration:"); - PrintAndLogEx(INFO, " * Page L read%s password protected", ((recv[2] & 0x01) ? "" : " not")); - PrintAndLogEx(INFO, " * Page L write%s password protected", ((recv[2] & 0x02) ? "" : " not")); - PrintAndLogEx(INFO, " * Page H read%s password protected", ((recv[2] & 0x10) ? "" : " not")); - PrintAndLogEx(INFO, " * Page H write%s password protected", ((recv[2] & 0x20) ? "" : " not")); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "--- " _CYAN_("NXP Sysinfo")); + PrintAndLogEx(INFO, " raw... %s", sprint_hex(recv, 8)); + PrintAndLogEx(INFO, " " _CYAN_("Password protection configuration:")); + PrintAndLogEx(INFO, " * Page L read%s password protected", ((recv[2] & 0x01) ? "" : _GREEN_(" not"))); + PrintAndLogEx(INFO, " * Page L write%s password protected", ((recv[2] & 0x02) ? "" : _GREEN_(" not"))); + PrintAndLogEx(INFO, " * Page H read%s password protected", ((recv[2] & 0x10) ? "" : _GREEN_(" not"))); + PrintAndLogEx(INFO, " * Page H write%s password protected", ((recv[2] & 0x20) ? "" : _GREEN_(" not"))); - PrintAndLogEx(INFO, " Lock bits:"); - PrintAndLogEx(INFO, " * AFI%s locked", ((recv[3] & 0x01) ? "" : " not")); // AFI lock bit - PrintAndLogEx(INFO, " * EAS%s locked", ((recv[3] & 0x02) ? "" : " not")); // EAS lock bit - PrintAndLogEx(INFO, " * DSFID%s locked", ((recv[3] & 0x03) ? "" : " not")); // DSFID lock bit - PrintAndLogEx(INFO, " * Password protection configuration%s locked", ((recv[3] & 0x04) ? "" : " not")); // Password protection pointer address and access conditions lock bit + PrintAndLogEx(INFO, " " _CYAN_("Lock bits:")); + // AFI lock bit + PrintAndLogEx(INFO, " * AFI%s locked", ((recv[3] & 0x01) ? "" : _GREEN_(" not"))); - PrintAndLogEx(INFO, " Features:"); + // EAS lock bit + PrintAndLogEx(INFO, " * EAS%s locked", ((recv[3] & 0x02) ? "" : _GREEN_(" not"))); + + // DSFID lock bit + PrintAndLogEx(INFO, " * DSFID%s locked", ((recv[3] & 0x03) ? "" : _GREEN_(" not"))); + + // Password protection pointer address and access conditions lock bit + PrintAndLogEx(INFO, " * Password protection configuration%s locked", ((recv[3] & 0x04) ? "" : _GREEN_(" not"))); + + PrintAndLogEx(INFO, " " _CYAN_("Features:")); PrintAndLogEx(INFO, " * User memory password protection%s supported", ((recv[4] & 0x01) ? "" : " not")); PrintAndLogEx(INFO, " * Counter feature%s supported", ((recv[4] & 0x02) ? "" : " not")); PrintAndLogEx(INFO, " * EAS ID%s supported by EAS ALARM command", support_easmode ? "" : " not"); @@ -827,6 +831,7 @@ static int NxpSysInfo(uint8_t *uid) { NxpCheckSig(uid); } + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -925,7 +930,6 @@ static int CmdHF15Info(const char *Cmd) { memcpy(uid, data + 2, sizeof(uid)); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); - PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " TYPE: " _YELLOW_("%s"), getTagInfo_15(data + 2)); PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), iso15693_sprintUID(NULL, uid)); PrintAndLogEx(SUCCESS, " SYSINFO: %s", sprint_hex(data, resp.length - 2)); @@ -1129,6 +1133,7 @@ static int CmdHF15ELoad(const char *Cmd) { } free(data); PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, "uploaded " _YELLOW_("%zu") " bytes to emulator memory", offset); PrintAndLogEx(HINT, "You are ready to simulate. See " _YELLOW_("`hf 15 sim -h`")); PrintAndLogEx(INFO, "Done!"); @@ -1284,12 +1289,13 @@ static int CmdHF15Sim(const char *Cmd) { CLIParserFree(ctx); PrintAndLogEx(SUCCESS, "Starting simulating UID " _YELLOW_("%s"), iso15693_sprintUID(NULL, payload.uid)); - PrintAndLogEx(INFO, "press " _YELLOW_("`Pm3 button`") " to cancel"); + PrintAndLogEx(INFO, "Press " _YELLOW_("`pm3-button`") " to abort simulation"); PacketResponseNG resp; clearCommandBuffer(); SendCommandNG(CMD_HF_ISO15693_SIMULATE, (uint8_t *)&payload, sizeof(payload)); WaitForResponse(CMD_HF_ISO15693_SIMULATE, &resp); + PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } @@ -2820,10 +2826,45 @@ static int CmdHF15EASPassProtect(const char *Cmd) { return resp.status; } +static int CmdHF15View(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "hf 15 view", + "Print a ISO-15693 tag dump file (bin/eml/json)", + "hf 15 view -f hf-iclass-AA162D30F8FF12F1-dump.bin\n" + ); + void *argtable[] = { + arg_param_begin, + arg_str1("f", "file", "", "filename of dump (bin/eml/json)"), +// arg_lit0("z", "dense", "dense dump output style"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, false); + + int fnlen = 0; + char filename[FILE_PATH_SIZE]; + CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); +// bool dense_output = g_session.dense_output || arg_get_lit(ctx, 2); + CLIParserFree(ctx); + + // read dump file + uint8_t *dump = NULL; + size_t bytes_read = CARD_MEMORY_SIZE; + int res = pm3_load_dump(filename, (void **)&dump, &bytes_read, CARD_MEMORY_SIZE); + if (res != PM3_SUCCESS) { + return res; + } + + PrintAndLogEx(NORMAL, ""); + print_blocks_15693(dump, bytes_read, 4); + + free(dump); + return PM3_SUCCESS; +} + static command_t CommandTable[] = { - {"-----------", CmdHF15Help, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"}, {"help", CmdHF15Help, AlwaysAvailable, "This help"}, {"list", CmdHF15List, AlwaysAvailable, "List ISO-15693 history"}, + {"-----------", CmdHF15Help, AlwaysAvailable, "----------------------- " _CYAN_("general") " -----------------------"}, {"demod", CmdHF15Demod, AlwaysAvailable, "Demodulate ISO-15693 from tag"}, {"dump", CmdHF15Dump, IfPm3Iso15693, "Read all memory pages of an ISO-15693 tag, save to file"}, {"info", CmdHF15Info, IfPm3Iso15693, "Tag information"}, @@ -2834,10 +2875,14 @@ static command_t CommandTable[] = { {"reader", CmdHF15Reader, IfPm3Iso15693, "Act like an ISO-15693 reader"}, {"restore", CmdHF15Restore, IfPm3Iso15693, "Restore from file to all memory pages of an ISO-15693 tag"}, {"samples", CmdHF15Samples, IfPm3Iso15693, "Acquire samples as reader (enables carrier, sends inquiry)"}, + {"view", CmdHF15View, AlwaysAvailable, "Display content from tag dump file"}, + {"wrbl", CmdHF15Write, IfPm3Iso15693, "Write a block"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "--------------------- " _CYAN_("simulation") " ----------------------"}, + {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO-15693 tag"}, {"eload", CmdHF15ELoad, IfPm3Iso15693, "Load image file into emulator to be used by 'sim' command"}, {"esave", CmdHF15ESave, IfPm3Iso15693, "Save emulator memory into image file"}, {"eview", CmdHF15EView, IfPm3Iso15693, "View emulator memory"}, - {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO-15693 tag"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "------------------------ " _CYAN_("SLIX") " -------------------------"}, {"slixwritepwd", CmdHF15SlixWritePassword, IfPm3Iso15693, "Writes a password on a SLIX ISO-15693 tag"}, {"slixeasdisable", CmdHF15SlixEASDisable, IfPm3Iso15693, "Disable EAS mode on SLIX ISO-15693 tag"}, {"slixeasenable", CmdHF15SlixEASEnable, IfPm3Iso15693, "Enable EAS mode on SLIX ISO-15693 tag"}, @@ -2845,12 +2890,11 @@ static command_t CommandTable[] = { {"slixprivacyenable", CmdHF15SlixEnable, IfPm3Iso15693, "Enable privacy mode on SLIX ISO-15693 tag"}, {"passprotectafi", CmdHF15AFIPassProtect, IfPm3Iso15693, "Password protect AFI - Cannot be undone"}, {"passprotecteas", CmdHF15EASPassProtect, IfPm3Iso15693, "Password protect EAS - Cannot be undone"}, - {"wrbl", CmdHF15Write, IfPm3Iso15693, "Write a block"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("afi") " -----------------------"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "-------------------------- " _CYAN_("afi") " ------------------------"}, {"findafi", CmdHF15FindAfi, IfPm3Iso15693, "Brute force AFI of an ISO-15693 tag"}, {"writeafi", CmdHF15WriteAfi, IfPm3Iso15693, "Writes the AFI on an ISO-15693 tag"}, {"writedsfid", CmdHF15WriteDsfid, IfPm3Iso15693, "Writes the DSFID on an ISO-15693 tag"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("magic") " -----------------------"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "------------------------- " _CYAN_("magic") " -----------------------"}, {"csetuid", CmdHF15CSetUID, IfPm3Iso15693, "Set UID for magic card"}, {NULL, NULL, NULL, NULL} }; diff --git a/client/src/cmdhffido.c b/client/src/cmdhffido.c index a8021e4cf..d3ab66fc6 100644 --- a/client/src/cmdhffido.c +++ b/client/src/cmdhffido.c @@ -78,33 +78,36 @@ static int CmdHFFidoInfo(const char *Cmd) { uint8_t buf[APDU_RES_LEN] = {0}; size_t len = 0; uint16_t sw = 0; - int res = FIDOSelect(true, true, buf, sizeof(buf), &len, &sw); + int res = FIDOSelect(true, true, buf, sizeof(buf), &len, &sw); if (res) { DropField(); return res; } if (sw != ISO7816_OK) { - if (sw) - PrintAndLogEx(INFO, "Not a FIDO card! APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); - else - PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000."); - + if (sw) { + PrintAndLogEx(INFO, "Not a FIDO card. APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); + } else { + PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000"); + } DropField(); return PM3_SUCCESS; } - if (!strncmp((char *)buf, "U2F_V2", 7)) { - if (!strncmp((char *)buf, "FIDO_2_0", 8)) { - PrintAndLogEx(INFO, "FIDO2 authenticator detected. Version... " _YELLOW_("%.*s"), (int)len, buf); + if (strncmp((char *)buf, "U2F_V2", 7) == 0) { + if (strncmp((char *)buf, "FIDO_2_0", 8) == 0) { + PrintAndLogEx(INFO, "FIDO2 authenticator"); + PrintAndLogEx(INFO, "Version... " _YELLOW_("%.*s"), (int)len, buf); } else { - PrintAndLogEx(INFO, "FIDO authenticator detected (not standard U2F)."); - PrintAndLogEx(INFO, "Non U2F authenticator version:"); + PrintAndLogEx(INFO, "FIDO authenticator (not standard U2F)"); + PrintAndLogEx(INFO, "Non U2F authenticator"); + PrintAndLogEx(INFO, "version... "); print_buffer((const unsigned char *)buf, len, 1); } } else { - PrintAndLogEx(INFO, "FIDO U2F authenticator detected. Version... " _YELLOW_("%.*s"), (int)len, buf); + PrintAndLogEx(INFO, "FIDO U2F authenticator detected"); + PrintAndLogEx(INFO, "Version... " _YELLOW_("%.*s"), (int)len, buf); } res = FIDO2GetInfo(buf, sizeof(buf), &len, &sw); @@ -112,6 +115,7 @@ static int CmdHFFidoInfo(const char *Cmd) { if (res) { return res; } + if (sw != ISO7816_OK) { PrintAndLogEx(ERR, "FIDO2 version doesn't exist (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); return PM3_SUCCESS; @@ -441,7 +445,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) { controlByte = 0x07; uint8_t data[512] = {0}; - uint8_t hdata[250] = {0}; + uint8_t hdata[256] = {0}; bool public_key_loaded = false; uint8_t public_key[65] = {0}; int hdatalen = 0; diff --git a/client/src/cmdhffudan.c b/client/src/cmdhffudan.c index 38ef8eef5..53e580e1b 100644 --- a/client/src/cmdhffudan.c +++ b/client/src/cmdhffudan.c @@ -110,7 +110,7 @@ static int fudan_get_type(iso14a_card_select_t *card, bool verbose) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { - PrintAndLogEx(DEBUG, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ESOFT; } diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index a48bbb98e..86dda89cd 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -40,11 +40,12 @@ #include "crypto/asn1utils.h" // ASN1 decoder #include "preferences.h" - #define PICOPASS_BLOCK_SIZE 8 #define NUM_CSNS 9 +#define MAC_ITEM_SIZE 24 // csn(8) + epurse(8) + nr(4) + mac(4) = 24 bytes #define ICLASS_KEYS_MAX 8 #define ICLASS_AUTH_RETRY 10 +#define ICLASS_CFG_BLK_SR_BIT 0xA0 // indicates SIO present when set in block6[0] (legacy tags) #define ICLASS_DECRYPTION_BIN "iclass_decryptionkey.bin" static void print_picopass_info(const picopass_hdr_t *hdr); @@ -55,13 +56,13 @@ static void iclass_set_last_known_card(picopass_hdr_t *card) { memcpy(&iclass_last_known_card, card, sizeof(picopass_hdr_t)); } -static uint8_t empty[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -static uint8_t zeros[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t empty[PICOPASS_BLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +static uint8_t zeros[PICOPASS_BLOCK_SIZE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static int CmdHelp(const char *Cmd); static void printIclassSIO(uint8_t *iclass_dump); -static uint8_t iClass_Key_Table[ICLASS_KEYS_MAX][8] = { +static uint8_t iClass_Key_Table[ICLASS_KEYS_MAX][PICOPASS_BLOCK_SIZE] = { { 0xAE, 0xA6, 0x84, 0xA6, 0xDA, 0xB2, 0x32, 0x78 }, { 0xFD, 0xCB, 0x5A, 0x52, 0xEA, 0x8F, 0x30, 0x90 }, { 0xF0, 0xE1, 0xD2, 0xC3, 0xB4, 0xA5, 0x96, 0x87 }, @@ -130,7 +131,7 @@ static inline uint32_t leadingzeros(uint64_t a) { #endif } -static void iclass_upload_emul(uint8_t *d, uint16_t n, uint16_t *bytes_sent) { +static void iclass_upload_emul(uint8_t *d, uint16_t n, uint16_t offset, uint16_t *bytes_sent) { struct p { uint16_t offset; @@ -145,25 +146,32 @@ static void iclass_upload_emul(uint8_t *d, uint16_t n, uint16_t *bytes_sent) { *bytes_sent = 0; uint16_t bytes_remaining = n; + PrintAndLogEx(INFO, "Uploading to emulator memory"); + PrintAndLogEx(INFO, "." NOLF); + while (bytes_remaining > 0) { uint32_t bytes_in_packet = MIN(PM3_CMD_DATA_SIZE - 4, bytes_remaining); if (bytes_in_packet == bytes_remaining) { // Disable fast mode on last packet g_conn.block_after_ACK = false; } - clearCommandBuffer(); struct p *payload = calloc(4 + bytes_in_packet, sizeof(uint8_t)); - payload->offset = *bytes_sent; + payload->offset = offset + *bytes_sent; payload->len = bytes_in_packet; memcpy(payload->data, d + *bytes_sent, bytes_in_packet); + clearCommandBuffer(); SendCommandNG(CMD_HF_ICLASS_EML_MEMSET, (uint8_t *)payload, 4 + bytes_in_packet); free(payload); bytes_remaining -= bytes_in_packet; *bytes_sent += bytes_in_packet; + + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); } + PrintAndLogEx(NORMAL, ""); } static const char *card_types[] = { @@ -400,9 +408,10 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke // encrypted 0xFF PrintAndLogEx(INFO, "Setting 0xFF's... " NOLF); - for (uint8_t i = 0x16; i <= app1_limit; i++) { + for (uint16_t i = 0x16; i < (app1_limit + 1); i++) { memcpy(data + (i * 8), ffs, sizeof(ffs)); } + PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); // revert potential modified app1_limit @@ -417,7 +426,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke //Send to device PrintAndLogEx(INFO, "Uploading to device... "); uint16_t bytes_sent = 0; - iclass_upload_emul(data, tot_bytes, &bytes_sent); + iclass_upload_emul(data, tot_bytes, 0, &bytes_sent); free(data); PrintAndLogEx(NORMAL, ""); @@ -443,14 +452,14 @@ static void fuse_config(const picopass_hdr_t *hdr) { uint16_t otp = (hdr->conf.otp[1] << 8 | hdr->conf.otp[0]); - PrintAndLogEx(INFO, " Raw: " _YELLOW_("%s"), sprint_hex((uint8_t *)&hdr->conf, 8)); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "..................... app limit", hdr->conf.app_limit); - PrintAndLogEx(INFO, " " _YELLOW_("%04X") " ( %5u )...... OTP", otp, otp); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "............ block write lock", hdr->conf.block_writelock); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "......... chip", hdr->conf.chip_config); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "...... mem", hdr->conf.mem_config); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "... EAS", hdr->conf.eas); - PrintAndLogEx(INFO, " " _YELLOW_("%02X") " fuses", hdr->conf.fuses); + PrintAndLogEx(INFO, " Raw... " _YELLOW_("%s"), sprint_hex((uint8_t *)&hdr->conf, 8)); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") " ( %3u )............. app limit", hdr->conf.app_limit, hdr->conf.app_limit); + PrintAndLogEx(INFO, " " _YELLOW_("%04X") " ( %5u )...... OTP", otp, otp); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") "............ block write lock", hdr->conf.block_writelock); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") "......... chip", hdr->conf.chip_config); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") "...... mem", hdr->conf.mem_config); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") "... EAS", hdr->conf.eas); + PrintAndLogEx(INFO, " " _YELLOW_("%02X") " fuses", hdr->conf.fuses); uint8_t fuses = hdr->conf.fuses; @@ -594,51 +603,51 @@ static void mem_app_config(const picopass_hdr_t *hdr) { PrintAndLogEx(INFO, " * Kd, Debit key, AA1 Kc, Credit key, AA2 *"); uint8_t keyAccess = isset(mem, 0x01); if (keyAccess) { - PrintAndLogEx(INFO, " Read AA1....... debit"); - PrintAndLogEx(INFO, " Write AA1...... debit"); - PrintAndLogEx(INFO, " Read AA2....... credit"); - PrintAndLogEx(INFO, " Write AA2...... credit"); + PrintAndLogEx(INFO, " Read AA1..... debit"); + PrintAndLogEx(INFO, " Write AA1.... debit"); + PrintAndLogEx(INFO, " Read AA2..... credit"); + PrintAndLogEx(INFO, " Write AA2.... credit"); PrintAndLogEx(INFO, " Debit........ debit or credit"); PrintAndLogEx(INFO, " Credit....... credit"); } else { - PrintAndLogEx(INFO, " Read AA1....... debit or credit"); - PrintAndLogEx(INFO, " Write AA1...... credit"); - PrintAndLogEx(INFO, " Read AA2....... debit or credit"); - PrintAndLogEx(INFO, " Write AA2...... credit"); + PrintAndLogEx(INFO, " Read AA1..... debit or credit"); + PrintAndLogEx(INFO, " Write AA1.... credit"); + PrintAndLogEx(INFO, " Read AA2..... debit or credit"); + PrintAndLogEx(INFO, " Write AA2.... credit"); PrintAndLogEx(INFO, " Debit........ debit or credit"); PrintAndLogEx(INFO, " Credit....... credit"); } } void print_picopass_info(const picopass_hdr_t *hdr) { - PrintAndLogEx(INFO, "-------------------- " _CYAN_("card configuration") " --------------------"); + PrintAndLogEx(INFO, "-------------------- " _CYAN_("Card configuration") " --------------------"); fuse_config(hdr); mem_app_config(hdr); } void print_picopass_header(const picopass_hdr_t *hdr) { - PrintAndLogEx(INFO, "--------------------------- " _CYAN_("card") " ---------------------------"); - PrintAndLogEx(SUCCESS, " CSN: " _GREEN_("%s") " uid", sprint_hex(hdr->csn, sizeof(hdr->csn))); - PrintAndLogEx(SUCCESS, " Config: %s Card configuration", sprint_hex((uint8_t *)&hdr->conf, sizeof(hdr->conf))); - PrintAndLogEx(SUCCESS, "E-purse: %s Card challenge, CC", sprint_hex(hdr->epurse, sizeof(hdr->epurse))); + PrintAndLogEx(INFO, "--------------------------- " _CYAN_("Card") " ---------------------------"); + PrintAndLogEx(SUCCESS, " CSN... " _GREEN_("%s") " uid", sprint_hex(hdr->csn, sizeof(hdr->csn))); + PrintAndLogEx(SUCCESS, " Config... %s card configuration", sprint_hex((uint8_t *)&hdr->conf, sizeof(hdr->conf))); + PrintAndLogEx(SUCCESS, "E-purse... %s card challenge, CC", sprint_hex(hdr->epurse, sizeof(hdr->epurse))); if (memcmp(hdr->key_d, zeros, sizeof(zeros)) && memcmp(hdr->key_d, empty, sizeof(empty))) { - PrintAndLogEx(SUCCESS, " Kd: " _YELLOW_("%s") " debit key", sprint_hex(hdr->key_d, sizeof(hdr->key_d))); + PrintAndLogEx(SUCCESS, " Kd... " _YELLOW_("%s") " debit key", sprint_hex(hdr->key_d, sizeof(hdr->key_d))); } else { - PrintAndLogEx(SUCCESS, " Kd: %s debit key ( hidden )", sprint_hex(hdr->key_d, sizeof(hdr->key_d))); + PrintAndLogEx(SUCCESS, " Kd... %s debit key ( hidden )", sprint_hex(hdr->key_d, sizeof(hdr->key_d))); } if (memcmp(hdr->key_c, zeros, sizeof(zeros)) && memcmp(hdr->key_c, empty, sizeof(empty))) { - PrintAndLogEx(SUCCESS, " Kc: " _YELLOW_("%s") " credit key", sprint_hex(hdr->key_c, sizeof(hdr->key_c))); + PrintAndLogEx(SUCCESS, " Kc... " _YELLOW_("%s") " credit key", sprint_hex(hdr->key_c, sizeof(hdr->key_c))); } else { - PrintAndLogEx(SUCCESS, " Kc: %s credit key ( hidden )", sprint_hex(hdr->key_c, sizeof(hdr->key_c))); + PrintAndLogEx(SUCCESS, " Kc... %s credit key ( hidden )", sprint_hex(hdr->key_c, sizeof(hdr->key_c))); } - PrintAndLogEx(SUCCESS, " AIA: %s Application Issuer area", sprint_hex(hdr->app_issuer_area, sizeof(hdr->app_issuer_area))); + PrintAndLogEx(SUCCESS, " AIA... %s application issuer area", sprint_hex(hdr->app_issuer_area, sizeof(hdr->app_issuer_area))); } static int CmdHFiClassList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf iclass", "iclass"); + return CmdTraceListAlias(Cmd, "hf iclass", "iclass -c"); } static int CmdHFiClassSniff(const char *Cmd) { @@ -740,7 +749,7 @@ static int CmdHFiClassSim(const char *Cmd) { // remember to change the define NUM_CSNS to match. // pre-defined 9 CSN by iceman - uint8_t csns[8 * NUM_CSNS] = { + uint8_t csns[NUM_CSNS * PICOPASS_BLOCK_SIZE] = { 0x01, 0x0A, 0x0F, 0xFF, 0xF7, 0xFF, 0x12, 0xE0, 0x0C, 0x06, 0x0C, 0xFE, 0xF7, 0xFF, 0x12, 0xE0, 0x10, 0x97, 0x83, 0x7B, 0xF7, 0xFF, 0x12, 0xE0, @@ -772,7 +781,7 @@ static int CmdHFiClassSim(const char *Cmd) { PrintAndLogEx(INFO, "press " _YELLOW_("`enter`") " to cancel"); PacketResponseNG resp; clearCommandBuffer(); - SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 1, csns, 8 * NUM_CSNS); + SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 1, csns, NUM_CSNS * PICOPASS_BLOCK_SIZE); while (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) { tries++; @@ -792,7 +801,7 @@ static int CmdHFiClassSim(const char *Cmd) { if (num_mac == 0) break; - size_t datalen = NUM_CSNS * 24; + size_t datalen = NUM_CSNS * MAC_ITEM_SIZE; uint8_t *dump = calloc(datalen, sizeof(uint8_t)); if (!dump) { PrintAndLogEx(WARNING, "Failed to allocate memory"); @@ -804,11 +813,11 @@ static int CmdHFiClassSim(const char *Cmd) { uint8_t i = 0; for (i = 0 ; i < NUM_CSNS ; i++) { //copy CSN - memcpy(dump + i * 24, csns + i * 8, 8); + memcpy(dump + (i * MAC_ITEM_SIZE), csns + i * 8, 8); //copy epurse - memcpy(dump + i * 24 + 8, resp.data.asBytes + i * 16, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 8, resp.data.asBytes + i * 16, 8); // NR_MAC (eight bytes from the response) ( 8b csn + 8b epurse == 16) - memcpy(dump + i * 24 + 16, resp.data.asBytes + i * 16 + 8, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 16, resp.data.asBytes + i * 16 + 8, 8); } /** Now, save to dumpfile **/ saveFile("iclass_mac_attack", ".bin", dump, datalen); @@ -823,7 +832,7 @@ static int CmdHFiClassSim(const char *Cmd) { PrintAndLogEx(INFO, "press Enter to cancel"); PacketResponseNG resp; clearCommandBuffer(); - SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 1, csns, 8 * NUM_CSNS); + SendCommandMIX(CMD_HF_ICLASS_SIMULATE, sim_type, NUM_CSNS, 1, csns, NUM_CSNS * PICOPASS_BLOCK_SIZE); while (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) { tries++; @@ -843,25 +852,23 @@ static int CmdHFiClassSim(const char *Cmd) { if (num_mac == 0) break; - size_t datalen = NUM_CSNS * 24; + size_t datalen = NUM_CSNS * MAC_ITEM_SIZE; uint8_t *dump = calloc(datalen, sizeof(uint8_t)); if (!dump) { PrintAndLogEx(WARNING, "Failed to allocate memory"); return PM3_EMALLOC; } -#define MAC_ITEM_SIZE 24 - //KEYROLL 1 //Need zeroes for the CC-field memset(dump, 0, datalen); for (uint8_t i = 0; i < NUM_CSNS ; i++) { // copy CSN - memcpy(dump + i * MAC_ITEM_SIZE, csns + i * 8, 8); //CSN + memcpy(dump + (i * MAC_ITEM_SIZE), csns + i * 8, 8); //CSN // copy EPURSE - memcpy(dump + i * MAC_ITEM_SIZE + 8, resp.data.asBytes + i * 16, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 8, resp.data.asBytes + i * 16, 8); // copy NR_MAC (eight bytes from the response) ( 8b csn + 8b epurse == 16) - memcpy(dump + i * MAC_ITEM_SIZE + 16, resp.data.asBytes + i * 16 + 8, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 16, resp.data.asBytes + i * 16 + 8, 8); } saveFile("iclass_mac_attack_keyroll_A", ".bin", dump, datalen); @@ -870,11 +877,11 @@ static int CmdHFiClassSim(const char *Cmd) { for (uint8_t i = 0; i < NUM_CSNS; i++) { uint8_t resp_index = (i + NUM_CSNS) * 16; // Copy CSN - memcpy(dump + i * MAC_ITEM_SIZE, csns + i * 8, 8); + memcpy(dump + (i * MAC_ITEM_SIZE), csns + i * 8, 8); // copy EPURSE - memcpy(dump + i * MAC_ITEM_SIZE + 8, resp.data.asBytes + resp_index, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 8, resp.data.asBytes + resp_index, 8); // copy NR_MAC (eight bytes from the response) ( 8b csn + 8 epurse == 16) - memcpy(dump + i * MAC_ITEM_SIZE + 16, resp.data.asBytes + resp_index + 8, 8); + memcpy(dump + (i * MAC_ITEM_SIZE) + 16, resp.data.asBytes + resp_index + 8, 8); resp_index++; } saveFile("iclass_mac_attack_keyroll_B", ".bin", dump, datalen); @@ -1011,6 +1018,7 @@ static int CmdHFiClassELoad(const char *Cmd) { arg_param_begin, arg_str1("f", "file", "", "filename of dump (bin/eml/json)"), arg_lit0("m", "mem", "use RDV4 spiffs"), + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -1026,6 +1034,7 @@ static int CmdHFiClassELoad(const char *Cmd) { } bool use_spiffs = arg_get_lit(ctx, 2); + bool verbose = arg_get_lit(ctx, 3); CLIParserFree(ctx); // use RDV4 spiffs @@ -1074,14 +1083,20 @@ static int CmdHFiClassELoad(const char *Cmd) { dump = newdump; } - print_picopass_header((picopass_hdr_t *) dump); - print_picopass_info((picopass_hdr_t *) dump); + if (verbose) { + print_picopass_header((picopass_hdr_t *) dump); + print_picopass_info((picopass_hdr_t *) dump); + } + + PrintAndLogEx(NORMAL, ""); //Send to device uint16_t bytes_sent = 0; - iclass_upload_emul(dump, bytes_read, &bytes_sent); + iclass_upload_emul(dump, bytes_read, 0, &bytes_sent); free(dump); - PrintAndLogEx(SUCCESS, "sent %u bytes of data to device emulator memory", bytes_sent); + PrintAndLogEx(SUCCESS, "uploaded " _YELLOW_("%d") " bytes to emulator memory", bytes_sent); + PrintAndLogEx(HINT, "You are ready to simulate. See " _YELLOW_("`hf iclass sim -h`")); + PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } @@ -1207,7 +1222,55 @@ static int CmdHFiClassEView(const char *Cmd) { return PM3_SUCCESS; } +static int CmdHFiClassESetBlk(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "hf iclass esetblk", + "Sets an individual block in emulator memory.", + "hf iclass esetblk -b 7 -d 0000000000000000"); + + void *argtable[] = { + arg_param_begin, + arg_int1("b", "blk", "", "block number"), + arg_str0("d", "data", "", "bytes to write, 8 hex bytes"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, true); + + int blk = arg_get_int_def(ctx, 1, 0); + + if (blk > 255 || blk < 0) { + PrintAndLogEx(WARNING, "block number must be between 0 and 255. Got " _RED_("%i"), blk); + CLIParserFree(ctx); + return PM3_EINVARG; + } + + uint8_t data[PICOPASS_BLOCK_SIZE] = {0x00}; + int datalen = 0; + int res = CLIParamHexToBuf(arg_get_str(ctx, 2), data, sizeof(data), &datalen); + CLIParserFree(ctx); + + if (res) { + PrintAndLogEx(FAILED, "Error parsing bytes"); + return PM3_EINVARG; + } + + if (datalen != PICOPASS_BLOCK_SIZE) { + PrintAndLogEx(WARNING, "block data must include 8 HEX bytes. Got " _RED_("%i"), datalen); + return PM3_EINVARG; + } + + uint16_t bytes_sent = 0; + iclass_upload_emul(data, sizeof(data), blk * PICOPASS_BLOCK_SIZE, &bytes_sent); + + return PM3_SUCCESS; +} + static void iclass_decode_credentials(uint8_t *data) { + if (memcmp(data + (5 * PICOPASS_BLOCK_SIZE), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + // Not a Legacy or SR card, nothing to do here. + return; + } + BLOCK79ENCRYPTION encryption = (data[(6 * 8) + 7] & 0x03); bool has_values = (memcmp(data + (8 * 7), empty, 8) != 0) && (memcmp(data + (8 * 7), zeros, 8) != 0); if (has_values && encryption == None) { @@ -1232,7 +1295,7 @@ static void iclass_decode_credentials(uint8_t *data) { wiegand_message_t packed = initialize_message_object(top, mid, bot, 0); HIDTryUnpack(&packed); } else { - PrintAndLogEx(INFO, "No credential found"); + PrintAndLogEx(INFO, "No unencrypted legacy credential found"); } } @@ -1457,23 +1520,19 @@ static int CmdHFiClassDecrypt(const char *Cmd) { // decode block 9 has_values = (memcmp(decrypted + (8 * 9), empty, 8) != 0) && (memcmp(decrypted + (8 * 9), zeros, 8) != 0); - if (has_values) { - + if (has_values && use_sc) { uint8_t usr_blk_len = GetNumberBlocksForUserId(decrypted + (8 * 6)); if (usr_blk_len < 3) { - if (use_sc) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "Block 9 decoder"); - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "Block 9 decoder"); + uint8_t pinsize = GetPinSize(decrypted + (8 * 6)); + if (pinsize > 0) { - uint8_t pinsize = GetPinSize(decrypted + (8 * 6)); - if (pinsize > 0) { - - uint64_t pin = bytes_to_num(decrypted + (8 * 9), 5); - char tmp[17] = {0}; - snprintf(tmp, sizeof(tmp), "%."PRIu64, BCD2DEC(pin)); - PrintAndLogEx(INFO, "PIN........................ " _GREEN_("%.*s"), pinsize, tmp); - } + uint64_t pin = bytes_to_num(decrypted + (8 * 9), 5); + char tmp[17] = {0}; + snprintf(tmp, sizeof(tmp), "%."PRIu64, BCD2DEC(pin)); + PrintAndLogEx(INFO, "PIN........................ " _GREEN_("%.*s"), pinsize, tmp); } } } @@ -1746,7 +1805,6 @@ static int CmdHFiClassDump(const char *Cmd) { uint8_t tag_data[0x100 * 8]; memset(tag_data, 0xFF, sizeof(tag_data)); - iclass_card_select_t payload_rdr = { .flags = (FLAG_ICLASS_READER_INIT | FLAG_ICLASS_READER_CLEARTRACE) }; @@ -2144,6 +2202,129 @@ static int CmdHFiClass_WriteBlock(const char *Cmd) { return isok; } +static int CmdHFiClassCreditEpurse(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "hf iclass creditepurse", + "Credit the epurse on an iCLASS tag. The provided key must be the credit key.\n" + "The first two bytes of the epurse are the debit value (big endian) and may be any value except FFFF.\n" + "The remaining two bytes of the epurse are the credit value and must be smaller than the previous value.", + "hf iclass creditepurse -d FEFFFFFF -k 001122334455667B\n" + "hf iclass creditepurse -d FEFFFFFF --ki 0"); + + void *argtable[] = { + arg_param_begin, + arg_str0("k", "key", "", "Credit key as 8 hex bytes"), + arg_int0(NULL, "ki", "", "Key index to select key from memory 'hf iclass managekeys'"), + arg_str1("d", "data", "", "data to write as 8 hex bytes"), + arg_lit0(NULL, "elite", "elite computations applied to key"), + arg_lit0(NULL, "raw", "no computations applied to key"), + arg_lit0("v", "verbose", "verbose output"), + arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, false); + + int key_len = 0; + uint8_t key[8] = {0}; + + CLIGetHexWithReturn(ctx, 1, key, &key_len); + + int key_nr = arg_get_int_def(ctx, 2, -1); + + if (key_len > 0 && key_nr >= 0) { + PrintAndLogEx(ERR, "Please specify key or index, not both"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + + if (key_len > 0) { + if (key_len != 8) { + PrintAndLogEx(ERR, "Key is incorrect length"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + } else if (key_nr >= 0) { + if (key_nr < ICLASS_KEYS_MAX) { + memcpy(key, iClass_Key_Table[key_nr], 8); + PrintAndLogEx(SUCCESS, "Using key[%d] " _GREEN_("%s"), key_nr, sprint_hex(iClass_Key_Table[key_nr], 8)); + } else { + PrintAndLogEx(ERR, "Key number is invalid"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + } else { + PrintAndLogEx(ERR, "Key or key number must be provided"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + + int blockno = 2; + + int data_len = 0; + uint8_t data[4] = {0}; + CLIGetHexWithReturn(ctx, 3, data, &data_len); + + if (data_len != 4) { + PrintAndLogEx(ERR, "Data must be 4 hex bytes (8 hex symbols)"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + + bool elite = arg_get_lit(ctx, 4); + bool rawkey = arg_get_lit(ctx, 5); + bool verbose = arg_get_lit(ctx, 6); + bool shallow_mod = arg_get_lit(ctx, 7); + + CLIParserFree(ctx); + + if ((rawkey + elite) > 1) { + PrintAndLogEx(ERR, "Can not use a combo of 'elite', 'raw'"); + return PM3_EINVARG; + } + + iclass_credit_epurse_t payload = { + .req.use_raw = rawkey, + .req.use_elite = elite, + .req.use_credit_key = true, + .req.use_replay = false, + .req.blockno = blockno, + .req.send_reply = true, + .req.do_auth = true, + .req.shallow_mod = shallow_mod, + }; + memcpy(payload.req.key, key, 8); + memcpy(payload.epurse, data, sizeof(payload.epurse)); + + clearCommandBuffer(); + SendCommandNG(CMD_HF_ICLASS_CREDIT_EPURSE, (uint8_t *)&payload, sizeof(payload)); + PacketResponseNG resp; + + int isok; + if (WaitForResponseTimeout(CMD_HF_ICLASS_CREDIT_EPURSE, &resp, 2000) == 0) { + if (verbose) PrintAndLogEx(WARNING, "Command execute timeout"); + isok = PM3_ETIMEOUT; + } else if (resp.status != PM3_SUCCESS) { + if (verbose) PrintAndLogEx(ERR, "failed to communicate with card"); + isok = resp.status; + } else { + isok = (resp.data.asBytes[0] == 1) ? PM3_SUCCESS : PM3_ESOFT; + } + + switch (isok) { + case PM3_SUCCESS: + PrintAndLogEx(SUCCESS, "Credited epurse successfully"); + break; + case PM3_ETEAROFF: + if (verbose) + PrintAndLogEx(INFO, "Writing tear off triggered"); + break; + default: + PrintAndLogEx(FAILED, "Writing failed"); + break; + } + return isok; +} + static int CmdHFiClassRestore(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass restore", @@ -2469,7 +2650,7 @@ static int CmdHFiClass_ReadBlock(const char *Cmd) { return PM3_SUCCESS; // crypto helper available. - PrintAndLogEx(INFO, "----------------------------- " _CYAN_("cardhelper") " -----------------------------"); + PrintAndLogEx(INFO, "----------------------------- " _CYAN_("Cardhelper") " -----------------------------"); switch (blockno) { case 6: { @@ -2509,7 +2690,7 @@ static int CmdHFiClass_ReadBlock(const char *Cmd) { PrintAndLogEx(SUCCESS, " bin : %s", pbin); PrintAndLogEx(INFO, ""); - PrintAndLogEx(INFO, "------------------------------ " _CYAN_("wiegand") " -------------------------------"); + PrintAndLogEx(INFO, "------------------------------ " _CYAN_("Wiegand") " -------------------------------"); wiegand_message_t packed = initialize_message_object(top, mid, bot, 0); HIDTryUnpack(&packed); } else { @@ -2570,50 +2751,60 @@ static int CmdHFiClass_loclass(const char *Cmd) { } static void detect_credential(uint8_t *data, bool *legacy, bool *se, bool *sr) { - bool r1 = !memcmp(data + (5 * 8), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 8); + *legacy = false; + *sr = false; + *se = false; - uint8_t pattern_se[] = {0x05, 0x00}; - bool r2 = byte_strstr(data + (6 * 8), 6 * 8, pattern_se, sizeof(pattern_se)) != -1; + // Legacy AIA + if (!memcmp(data + (5 * PICOPASS_BLOCK_SIZE), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + *legacy = true; - uint8_t pattern_sr[] = {0x05, 0x00, 0x05, 0x00}; - bool r3 = byte_strstr(data + (11 * 8), 6 * 8, pattern_sr, sizeof(pattern_sr)) != -1; + // SR bit set in legacy config block + if ((data[6 * PICOPASS_BLOCK_SIZE] & ICLASS_CFG_BLK_SR_BIT) == ICLASS_CFG_BLK_SR_BIT) { + // If the card is blank (all FF's) then we'll reach here too, so check for an empty block 10 + // to avoid false positivies + if (memcmp(data + (10 * PICOPASS_BLOCK_SIZE), "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + *sr = true; + } + } - *legacy = (r1) && (data[6 * 8] != 0x30); - *se = (r2) && (data[6 * 8] == 0x30); - *sr = (r3) && (data[10 * 8] == 0x30); - r1 = NULL, r2 = NULL, r3 = NULL; + return; + } + + // SE AIA + if (!memcmp(data + (5 * PICOPASS_BLOCK_SIZE), "\xFF\xFF\xFF\x00\x06\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + *se = true; + return; + } } // print ASN1 decoded array in TLV view static void printIclassSIO(uint8_t *iclass_dump) { - bool isLegacy, isSE, isSR; detect_credential(iclass_dump, &isLegacy, &isSE, &isSR); - int dlen = 0; uint8_t *sio_start; if (isSE) { - - sio_start = iclass_dump + (6 * 8); - uint8_t pattern_se[] = {0x05, 0x00}; - dlen = byte_strstr(sio_start, 8 * 8, pattern_se, sizeof(pattern_se)); - if (dlen == -1) { - return; - } - dlen += sizeof(pattern_se); + // SE SIO starts at block 6 + sio_start = iclass_dump + (6 * PICOPASS_BLOCK_SIZE); } else if (isSR) { - - sio_start = iclass_dump + (10 * 8); - uint8_t pattern_sr[] = {0x05, 0x00, 0x05, 0x00}; - dlen = byte_strstr(sio_start, 8 * 8, pattern_sr, sizeof(pattern_sr)); - if (dlen == -1) { - return; - } - dlen += sizeof(pattern_sr); + // SR SIO starts at block 10 + sio_start = iclass_dump + (10 * PICOPASS_BLOCK_SIZE); } else { + // No SIO on Legacy credentials return; } + // Readers assume the SIO always fits within 7 blocks (they don't read any further blocks) + // Search backwards to find the last 0x05 0x00 seen at the end of the SIO + const uint8_t pattern_sio_end[] = {0x05, 0x00}; + int dlen = byte_strrstr(sio_start, 7 * PICOPASS_BLOCK_SIZE, pattern_sio_end, 2); + if (dlen == -1) { + return; + } + + dlen += sizeof(pattern_sio_end); + PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "---------------------------- " _CYAN_("SIO - RAW") " ----------------------------"); print_hex_noascii_break(sio_start, dlen, 32); @@ -2644,8 +2835,15 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e else maxmemcount = 31; - if (startblock == 0) - startblock = 6; + uint8_t pagemap = get_pagemap(hdr); + + if (startblock == 0) { + if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) { + startblock = 3; + } else { + startblock = 6; + } + } if ((endblock > maxmemcount) || (endblock == 0)) endblock = maxmemcount; @@ -2663,7 +2861,6 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e , filemaxblock ); */ - uint8_t pagemap = get_pagemap(hdr); bool isLegacy = false, isSE = false, isSR = false; if (filemaxblock >= 17) { @@ -2823,12 +3020,14 @@ static int CmdHFiClassView(const char *Cmd) { CLIParserInit(&ctx, "hf iclass view", "Print a iCLASS tag dump file (bin/eml/json)", "hf iclass view -f hf-iclass-AA162D30F8FF12F1-dump.bin\n" - "hf iclass view --first 1 -f hf-iclass-AA162D30F8FF12F1-dump.bin\n"); + "hf iclass view --first 1 -f hf-iclass-AA162D30F8FF12F1-dump.bin\n\n" + "If --first is not specified it will default to the first user block\n" + "which is block 6 for secured chips or block 3 for non-secured chips"); void *argtable[] = { arg_param_begin, arg_str1("f", "file", "", "filename of dump (bin/eml/json)"), - arg_int0(NULL, "first", "", "Begin printing from this block (default block 6)"), + arg_int0(NULL, "first", "", "Begin printing from this block (default first user block)"), arg_int0(NULL, "last", "", "End printing at this block (default 0, ALL)"), arg_lit0("v", "verbose", "verbose output"), arg_lit0("z", "dense", "dense dump output style"), @@ -4147,31 +4346,74 @@ static int CmdHFiClassConfigCard(const char *Cmd) { return PM3_SUCCESS; } +static int CmdHFiClassSAM(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "hf iclass sam", + "Manage via SAM\n", + "hf iclass sam\n" + ); + + void *argtable[] = { + arg_param_begin, + arg_str0("d", "data", "", "data"), + arg_lit0("v", "verbose", "verbose output"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, true); + int dlen = 0; + uint8_t data[128] = {0}; + CLIGetHexWithReturn(ctx, 1, data, &dlen); + + bool verbose = arg_get_lit(ctx, 2); + CLIParserFree(ctx); + + Iso7816CommandChannel channel = CC_CONTACT; + if (IfPm3Smartcard() == false) { + if (channel == CC_CONTACT) { + PrintAndLogEx(WARNING, "PM3 does not have SMARTCARD support, exiting"); + return PM3_EDEVNOTSUPP; + } + } + + int res = IsHIDSamPresent(verbose); + if (res != PM3_SUCCESS) { + return res; + } + + SetAPDULogging(verbose); + +// do things with sending apdus.. + + SetAPDULogging(false); + return PM3_SUCCESS; +} + static command_t CommandTable[] = { - {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("operations") " ---------------------"}, {"help", CmdHelp, AlwaysAvailable, "This help"}, + {"list", CmdHFiClassList, AlwaysAvailable, "List iclass history"}, + {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("general") " ---------------------"}, // {"clone", CmdHFiClassClone, IfPm3Iclass, "Create a HID credential to Picopass / iCLASS tag"}, {"dump", CmdHFiClassDump, IfPm3Iclass, "Dump Picopass / iCLASS tag to file"}, {"info", CmdHFiClassInfo, AlwaysAvailable, "Tag information"}, - {"list", CmdHFiClassList, AlwaysAvailable, "List iclass history"}, {"rdbl", CmdHFiClass_ReadBlock, IfPm3Iclass, "Read Picopass / iCLASS block"}, {"reader", CmdHFiClassReader, IfPm3Iclass, "Act like a Picopass / iCLASS reader"}, - {"restore", CmdHFiClassRestore, IfPm3Iclass, "Restore a dump file onto a Picopass / iCLASS tag"}, + {"restore", CmdHFiClassRestore, IfPm3Iclass, "Restore a dump file onto a Picopass / iCLASS tag"}, {"sniff", CmdHFiClassSniff, IfPm3Iclass, "Eavesdrop Picopass / iCLASS communication"}, + {"view", CmdHFiClassView, AlwaysAvailable, "Display content from tag dump file"}, {"wrbl", CmdHFiClass_WriteBlock, IfPm3Iclass, "Write Picopass / iCLASS block"}, - - {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("recovery") " ---------------------"}, + {"creditepurse", CmdHFiClassCreditEpurse, IfPm3Iclass, "Credit epurse value"}, + {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("recovery") " --------------------"}, // {"autopwn", CmdHFiClassAutopwn, IfPm3Iclass, "Automatic key recovery tool for iCLASS"}, {"chk", CmdHFiClassCheckKeys, IfPm3Iclass, "Check keys"}, {"loclass", CmdHFiClass_loclass, AlwaysAvailable, "Use loclass to perform bruteforce reader attack"}, {"lookup", CmdHFiClassLookUp, AlwaysAvailable, "Uses authentication trace to check for key in dictionary file"}, - {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("simulation") " ---------------------"}, + {"-----------", CmdHelp, IfPm3Iclass, "-------------------- " _CYAN_("simulation") " -------------------"}, {"sim", CmdHFiClassSim, IfPm3Iclass, "Simulate iCLASS tag"}, {"eload", CmdHFiClassELoad, IfPm3Iclass, "Load Picopass / iCLASS dump file into emulator memory"}, {"esave", CmdHFiClassESave, IfPm3Iclass, "Save emulator memory to file"}, + {"esetblk", CmdHFiClassESetBlk, IfPm3Iclass, "Set emulator memory block data"}, {"eview", CmdHFiClassEView, IfPm3Iclass, "View emulator memory"}, - - {"-----------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("utils") " ---------------------"}, + {"-----------", CmdHelp, AlwaysAvailable, "---------------------- " _CYAN_("utils") " ----------------------"}, {"configcard", CmdHFiClassConfigCard, AlwaysAvailable, "Reader configuration card"}, {"calcnewkey", CmdHFiClassCalcNewKey, AlwaysAvailable, "Calc diversified keys (blocks 3 & 4) to write new keys"}, {"encode", CmdHFiClassEncode, AlwaysAvailable, "Encode binary wiegand to block 7"}, @@ -4179,7 +4421,8 @@ static command_t CommandTable[] = { {"decrypt", CmdHFiClassDecrypt, AlwaysAvailable, "Decrypt given block data or tag dump file" }, {"managekeys", CmdHFiClassManageKeys, AlwaysAvailable, "Manage keys to use with iclass commands"}, {"permutekey", CmdHFiClassPermuteKey, AlwaysAvailable, "Permute function from 'heart of darkness' paper"}, - {"view", CmdHFiClassView, AlwaysAvailable, "Display content from tag dump file"}, + {"-----------", CmdHelp, IfPm3Smartcard, "----------------------- " _CYAN_("SAM") " -----------------------"}, + {"sam", CmdHFiClassSAM, IfPm3Smartcard, "SAM tests"}, {NULL, NULL, NULL, NULL} }; @@ -4240,7 +4483,7 @@ int info_iclass(bool shallow_mod) { picopass_ns_hdr_t *ns_hdr = &r->header.ns_hdr; PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--------------------- " _CYAN_("Tag Information") " ----------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ----------------------------------------"); if ((r->status & FLAG_ICLASS_CSN) == FLAG_ICLASS_CSN) { PrintAndLogEx(SUCCESS, " CSN: " _GREEN_("%s") " uid", sprint_hex(hdr->csn, sizeof(hdr->csn))); diff --git a/client/src/cmdhfjooki.c b/client/src/cmdhfjooki.c index 93ca6a00a..daf8530b0 100644 --- a/client/src/cmdhfjooki.c +++ b/client/src/cmdhfjooki.c @@ -200,7 +200,7 @@ static int jooki_create_ndef(uint8_t *b64ndef, uint8_t *ndefrecord) { static void jooki_printEx(uint8_t *b64, uint8_t *iv, uint8_t tid, uint8_t fid, uint8_t *uid, bool verbose) { int idx = jooki_lookup(tid, fid); - PrintAndLogEx(INFO, "Encoded URL.. %s ( %s )", sprint_hex(b64, 12), b64); + PrintAndLogEx(INFO, "Encoded URL.. %s ( " _YELLOW_("%s") " )", sprint_hex(b64, 12), b64); PrintAndLogEx(INFO, "Figurine..... %02x %02x - " _GREEN_("%s, %s") , tid , fid @@ -525,29 +525,36 @@ static int CmdHF14AJookiSim(const char *Cmd) { // upload to emulator memory PrintAndLogEx(INFO, "Uploading to emulator memory"); - PrintAndLogEx(INFO, "." NOLF); + // fast push mode g_conn.block_after_ACK = true; uint8_t blockwidth = 4, counter = 0, blockno = 0; + + // 12 is the size of the struct the fct mfEmlSetMem_xt uses to transfer to device + uint16_t max_avail_blocks = ((PM3_CMD_DATA_SIZE - 12) / blockwidth) * blockwidth; + while (datalen) { if (datalen == blockwidth) { // Disable fast mode on last packet g_conn.block_after_ACK = false; } + uint16_t chunk_size = MIN(max_avail_blocks, datalen); + uint16_t blocks_to_send = chunk_size / blockwidth; - if (mfEmlSetMem_xt(data + counter, blockno, 1, blockwidth) != PM3_SUCCESS) { + if (mfEmlSetMem_xt(data + counter, blockno, blocks_to_send, blockwidth) != PM3_SUCCESS) { PrintAndLogEx(FAILED, "Cant set emul block: %3d", blockno); free(data); return PM3_ESOFT; } + blockno += blocks_to_send; + counter += chunk_size; + datalen -= chunk_size; PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); - blockno++; - counter += blockwidth; - datalen -= blockwidth; } - PrintAndLogEx(NORMAL, "\n"); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, "uploaded " _YELLOW_("%d") " bytes to emulator memory", counter); struct { uint8_t tagtype; @@ -566,6 +573,8 @@ static int CmdHF14AJookiSim(const char *Cmd) { SendCommandNG(CMD_HF_ISO14443A_SIMULATE, (uint8_t *)&payload, sizeof(payload)); PacketResponseNG resp; + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, "Starting simulating"); PrintAndLogEx(INFO, "Press " _GREEN_("") " or pm3-button to abort simulation"); for (;;) { if (kbd_enter_pressed()) { @@ -574,15 +583,15 @@ static int CmdHF14AJookiSim(const char *Cmd) { break; } - if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0) + if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == false) continue; if (resp.status != PM3_SUCCESS) break; } free(data); - PrintAndLogEx(INFO, "Done"); PrintAndLogEx(HINT, "Try `" _YELLOW_("hf 14a list") "` to view trace log"); + PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index b842ddf54..488f8dcb2 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -58,34 +58,35 @@ static bool legic_xor(uint8_t *data, uint16_t cardsize) { } static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buffer) { - int i = 0, k = 0, segmentNum = 0, segment_len = 0, segment_flag = 0; - int crc = 0, wrp = 0, wrc = 0; - uint8_t stamp_len = 0; - char token_type[6] = {0, 0, 0, 0, 0, 0}; - int dcf = 0; - int bIsSegmented = 0; - int return_value = PM3_SUCCESS; if (!(card_size == LEGIC_PRIME_MIM22 || card_size == LEGIC_PRIME_MIM256 || card_size == LEGIC_PRIME_MIM1024)) { PrintAndLogEx(FAILED, "Bytebuffer is not any known legic card size! (MIM22, MIM256, MIM1024)"); - return_value = PM3_EFAILED; return PM3_EFAILED; } // copy input buffer into newly allocated buffer, because the existing code mutates the data inside. uint8_t *data = calloc(card_size, sizeof(uint8_t)); - if (!data) { + if (data == NULL) { PrintAndLogEx(WARNING, "Cannot allocate memory"); return PM3_EMALLOC; } memcpy(data, input_buffer, card_size); + int i = 0, k = 0, segmentNum = 0, segment_len = 0, segment_flag = 0; + int wrp = 0, wrc = 0, dcf = 0; + uint8_t stamp_len = 0; + char token_type[6] = {0, 0, 0, 0, 0, 0}; + int bIsSegmented = 0; + int return_value = PM3_SUCCESS; + // Output CDF System area (9 bytes) plus remaining header area (12 bytes) - crc = data[4]; + int crc = data[4]; uint32_t calc_crc = CRC8Legic(data, 4); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ----------------------------------------"); + PrintAndLogEx(NORMAL, ""); PrintAndLogEx(SUCCESS, " " _CYAN_("CDF: System Area")); - PrintAndLogEx(NORMAL, "------------------------------------------------------"); + PrintAndLogEx(INFO, "------------------------------------------------------"); PrintAndLogEx(SUCCESS, "MCD: " _GREEN_("%02X") " MSN: " _GREEN_("%s") " MCC: " _GREEN_("%02X") " ( %s )", data[0], sprint_hex(data + 1, 3), @@ -134,7 +135,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff stamp_len = 0xfc - data[6]; } - PrintAndLogEx(SUCCESS, "DCF: %d (%02x %02x), Token Type=" _YELLOW_("%s") " (OLE=%01u), OL=%02u, FL=%02u", + PrintAndLogEx(SUCCESS, "DCF: %d (%02x %02x) Token Type=" _YELLOW_("%s") " (OLE=%01u) OL=%02u FL=%02u", dcf, data[5], data[6], @@ -153,7 +154,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff strncpy(token_type, "IM", sizeof(token_type) - 1); } - PrintAndLogEx(SUCCESS, "DCF: %d (%02x %02x), Token Type = %s (OLE = %01u)", + PrintAndLogEx(SUCCESS, "DCF: %d (%02x %02x) Token Type = %s (OLE = %01u)", dcf, data[5], data[6], @@ -166,7 +167,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff if (dcf != 0xFFFF) { if (bIsSegmented) { - PrintAndLogEx(SUCCESS, "WRP = %02u, WRC = %01u, RD = %01u, SSC = %02X", + PrintAndLogEx(SUCCESS, "WRP = %02u WRC = %01u RD = %01u SSC = %02X", data[7] & 0x0f, (data[7] & 0x70) >> 4, (data[7] & 0x80) >> 7, @@ -185,7 +186,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff } } } - PrintAndLogEx(NORMAL, "------------------------------------------------------"); + PrintAndLogEx(INFO, "------------------------------------------------------"); uint8_t segCrcBytes[8] = {0, 0, 0, 0, 0, 0, 0, 0}; uint32_t segCalcCRC = 0; @@ -196,8 +197,9 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff goto out; } + PrintAndLogEx(INFO, ""); PrintAndLogEx(SUCCESS, _CYAN_("ADF: User Area")); - PrintAndLogEx(NORMAL, "------------------------------------------------------"); + PrintAndLogEx(INFO, "------------------------------------------------------"); if (bIsSegmented) { @@ -208,8 +210,8 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff for (segmentNum = 1; segmentNum < 128; segmentNum++) { // for decoding the segment header we need at least 4 bytes left in buffer if ((i + 4) > card_size) { - PrintAndLogEx(FAILED, "Cannot read segment header, because the input buffer is too small. " - "Please check that the data is correct and properly aligned. "); + PrintAndLogEx(FAILED, "Cannot read segment header, because the input buffer is too small."); + PrintAndLogEx(FAILED, "Please check that the data is correct and properly aligned"); return_value = PM3_EOUTOFBOUND; goto out; } @@ -236,20 +238,20 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff segCalcCRC = CRC8Legic(segCrcBytes, 8); segCRC = data[i + 4] ^ crc; - PrintAndLogEx(SUCCESS, "Segment | " _YELLOW_("%02u"), segmentNum); - PrintAndLogEx(SUCCESS, "raw header | 0x%02X 0x%02X 0x%02X 0x%02X", + PrintAndLogEx(SUCCESS, "Segment....... " _YELLOW_("%02u"), segmentNum); + PrintAndLogEx(SUCCESS, "Raw header.... 0x%02X 0x%02X 0x%02X 0x%02X", data[i] ^ crc, data[i + 1] ^ crc, data[i + 2] ^ crc, data[i + 3] ^ crc ); - PrintAndLogEx(SUCCESS, "Segment len | %u, Flag: 0x%X (valid:%01u, last:%01u)", + PrintAndLogEx(SUCCESS, "Segment len... %u Flag: 0x%X (valid:%01u last:%01u)", segment_len, segment_flag, (segment_flag & 0x4) >> 2, (segment_flag & 0x8) >> 3 ); - PrintAndLogEx(SUCCESS, " | WRP: %02u, WRC: %02u, RD: %01u, CRC: 0x%02X ( %s )", + PrintAndLogEx(SUCCESS, " WRP: %02u WRC: %02u RD: %01u CRC: 0x%02X ( %s )", wrp, wrc, ((data[i + 3] ^ crc) & 0x80) >> 7, @@ -268,28 +270,33 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff } if (hasWRC) { - PrintAndLogEx(SUCCESS, "\nWRC protected area: (I %d | K %d| WRC %d)", i, k, wrc); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(SUCCESS, _CYAN_("WRC protected area:") " (I %d | K %d| WRC %d)", i, k, wrc); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); for (k = i; k < (i + wrc); ++k) data[k] ^= crc; print_hex_break(data + i, wrc, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + PrintAndLogEx(INFO, ""); i += wrc; } if (hasWRP) { - PrintAndLogEx(SUCCESS, "Remaining write protected area: (I %d | K %d | WRC %d | WRP %d WRP_LEN %d)", i, k, wrc, wrp, wrp_len); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(SUCCESS, _CYAN_("Remaining write protected area:") " (I %d | K %d | WRC %d | WRP %d WRP_LEN %d)", i, k, wrc, wrp, wrp_len); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); for (k = i; k < (i + wrp_len); ++k) data[k] ^= crc; print_hex_break(data + i, wrp_len, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + PrintAndLogEx(INFO, ""); i += wrp_len; // does this one work? (Answer: Only if KGH/BGH is used with BCD encoded card number! So maybe this will show just garbage...) @@ -302,15 +309,16 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff } } if (remain_seg_payload_len > 0) { - PrintAndLogEx(SUCCESS, "Remaining segment payload: (I %d | K %d | Remain LEN %d)", i, k, remain_seg_payload_len); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(SUCCESS, _CYAN_("Remaining segment payload:") " (I %d | K %d | Remain LEN %d)", i, k, remain_seg_payload_len); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); for (k = i; k < (i + remain_seg_payload_len); ++k) data[k] ^= crc; print_hex_break(data + i, remain_seg_payload_len, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------\n"); i += remain_seg_payload_len; } // end with last segment @@ -331,7 +339,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff int wrp_len = (wrp - wrc); int remain_seg_payload_len = (card_size - 22 - wrp); - PrintAndLogEx(SUCCESS, "Unsegmented card - WRP: %02u, WRC: %02u, RD: %01u", + PrintAndLogEx(SUCCESS, "Unsegmented card - WRP: %02u WRC: %02u RD: %01u", wrp, wrc, (data[7] & 0x80) >> 7 @@ -346,20 +354,24 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff } if (hasWRC) { - PrintAndLogEx(SUCCESS, "WRC protected area: (I %d | WRC %d)", i, wrc); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(SUCCESS, _CYAN_("WRC protected area:") " (I %d | WRC %d)", i, wrc); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); print_hex_break(data + i, wrc, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + PrintAndLogEx(INFO, ""); i += wrc; } if (hasWRP) { - PrintAndLogEx(SUCCESS, "Remaining write protected area: (I %d | WRC %d | WRP %d | WRP_LEN %d)", i, wrc, wrp, wrp_len); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(SUCCESS, _CYAN_("Remaining write protected area:") " (I %d | WRC %d | WRP %d | WRP_LEN %d)", i, wrc, wrp, wrp_len); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); print_hex_break(data + i, wrp_len, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + PrintAndLogEx(INFO, ""); i += wrp_len; // Q: does this one work? @@ -374,11 +386,12 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff } if (remain_seg_payload_len > 0) { - PrintAndLogEx(SUCCESS, "Remaining segment payload: (I %d | Remain LEN %d)", i, remain_seg_payload_len); - PrintAndLogEx(NORMAL, "\nrow | data"); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------"); + PrintAndLogEx(SUCCESS, _CYAN_("Remaining segment payload:") " (I %d | Remain LEN %d)", i, remain_seg_payload_len); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "## | data | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); print_hex_break(data + i, remain_seg_payload_len, 16); - PrintAndLogEx(NORMAL, "-----+------------------------------------------------\n"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------\n"); } } @@ -400,9 +413,11 @@ static int CmdLegicInfo(const char *Cmd) { void *argtable[] = { arg_param_begin, + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); + bool verbose = arg_get_lit(ctx, 1); CLIParserFree(ctx); uint16_t datalen = 0; @@ -418,7 +433,7 @@ static int CmdLegicInfo(const char *Cmd) { // allocate receiver buffer uint8_t *data = calloc(card.cardsize, sizeof(uint8_t)); - if (!data) { + if (data == NULL) { PrintAndLogEx(WARNING, "Cannot allocate memory"); return PM3_EMALLOC; } @@ -430,8 +445,15 @@ static int CmdLegicInfo(const char *Cmd) { return status; } - decode_and_print_memory(card.cardsize, data); + if (verbose) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "## | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + print_hex_break(data, datalen, 16); + } + PrintAndLogEx(NORMAL, ""); + decode_and_print_memory(card.cardsize, data); free(data); return PM3_SUCCESS; } @@ -536,20 +558,21 @@ static int CmdLegicSim(const char *Cmd) { SendCommandNG(CMD_HF_LEGIC_SIMULATE, (uint8_t *)&payload, sizeof(payload)); PacketResponseNG resp; - PrintAndLogEx(INFO, "Press pm3-button to abort simulation"); - bool keypress = kbd_enter_pressed(); - while (keypress == false) { - keypress = kbd_enter_pressed(); + PrintAndLogEx(INFO, "Press " _GREEN_("") " or pm3-button to abort simulation"); + for (;;) { + if (kbd_enter_pressed()) { + SendCommandNG(CMD_BREAK_LOOP, NULL, 0); + PrintAndLogEx(DEBUG, "User aborted"); + break; + } if (WaitForResponseTimeout(CMD_HF_LEGIC_SIMULATE, &resp, 1500)) { break; } - } - if (keypress) - SendCommandNG(CMD_BREAK_LOOP, NULL, 0); PrintAndLogEx(INFO, "Done"); + PrintAndLogEx(HINT, "Try `" _YELLOW_("hf legic list") "` to view trace log"); return PM3_SUCCESS; } @@ -782,6 +805,9 @@ void legic_chk_iv(uint32_t *iv) { void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) { + PrintAndLogEx(INFO, "Uploading to emulator memory"); + PrintAndLogEx(INFO, "." NOLF); + // fast push mode g_conn.block_after_ACK = true; for (size_t i = offset; i < numofbytes; i += LEGIC_PACKET_SIZE) { @@ -800,7 +826,11 @@ void legic_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) { clearCommandBuffer(); SendCommandNG(CMD_HF_LEGIC_ESET, (uint8_t *)payload, sizeof(legic_packet_t) + len); free(payload); + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); } + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, "uploaded " _YELLOW_("%d") " bytes to emulator memory", numofbytes); } static int CmdLegicReader(const char *Cmd) { @@ -858,7 +888,7 @@ static int CmdLegicDump(const char *Cmd) { uint16_t dumplen = card.cardsize; legic_print_type(dumplen, 0); - PrintAndLogEx(SUCCESS, "Reading tag memory %d b...", dumplen); + PrintAndLogEx(SUCCESS, "Reading tag memory." NOLF); legic_packet_t *payload = calloc(1, sizeof(legic_packet_t)); payload->offset = 0; @@ -1077,10 +1107,11 @@ static int CmdLegicELoad(const char *Cmd) { legic_xor(dump, bytes_read); } - PrintAndLogEx(SUCCESS, "Uploading to emulator memory"); legic_seteml(dump, 0, bytes_read); free(dump); + + PrintAndLogEx(HINT, "You are ready to simulate. See " _YELLOW_("`hf legic sim -h`")); PrintAndLogEx(SUCCESS, "Done!"); return PM3_SUCCESS; } @@ -1174,6 +1205,7 @@ static int CmdLegicEView(const char *Cmd) { arg_lit0(NULL, "22", "LEGIC Prime MIM22"), arg_lit0(NULL, "256", "LEGIC Prime MIM256 (def)"), arg_lit0(NULL, "1024", "LEGIC Prime MIM1024"), + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1181,6 +1213,7 @@ static int CmdLegicEView(const char *Cmd) { bool m1 = arg_get_lit(ctx, 1); bool m2 = arg_get_lit(ctx, 2); bool m3 = arg_get_lit(ctx, 3); + bool verbose = arg_get_lit(ctx, 4); CLIParserFree(ctx); // validations @@ -1212,10 +1245,16 @@ static int CmdLegicEView(const char *Cmd) { return PM3_ETIMEOUT; } + if (verbose) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "## | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + print_hex_break(dump, bytes, 16); + } + PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "## | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ascii"); - PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); - print_hex_break(dump, bytes, 16); + decode_and_print_memory(bytes, dump); + free(dump); return PM3_SUCCESS; } @@ -1226,15 +1265,36 @@ static int CmdLegicEInfo(const char *Cmd) { CLIParserInit(&ctx, "hf legic einfo", "It decodes and displays emulator memory", "hf legic einfo\n" + "hf legic eview --22\n" ); void *argtable[] = { arg_param_begin, + arg_lit0(NULL, "22", "LEGIC Prime MIM22"), + arg_lit0(NULL, "256", "LEGIC Prime MIM256 (def)"), + arg_lit0(NULL, "1024", "LEGIC Prime MIM1024"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); + bool m1 = arg_get_lit(ctx, 1); + bool m2 = arg_get_lit(ctx, 2); + bool m3 = arg_get_lit(ctx, 3); CLIParserFree(ctx); + // validations + if (m1 + m2 + m3 > 1) { + PrintAndLogEx(WARNING, "Only specify one LEGIC Prime Type"); + return PM3_EINVARG; + } else if (m1 + m2 + m3 == 0) { + m2 = true; + } + size_t card_size = LEGIC_PRIME_MIM256; + if (m1) + card_size = LEGIC_PRIME_MIM22; + else if (m2) + card_size = LEGIC_PRIME_MIM256; + else if (m3) + card_size = LEGIC_PRIME_MIM1024; uint8_t *dump = calloc(card_size, sizeof(uint8_t)); if (dump == NULL) { @@ -1347,12 +1407,14 @@ static int CmdLegicView(const char *Cmd) { void *argtable[] = { arg_param_begin, arg_str1("f", "file", "", "Filename of dump"), + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); int fnlen = 0; char filename[FILE_PATH_SIZE]; CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); + bool verbose = arg_get_lit(ctx, 2); CLIParserFree(ctx); // read dump file @@ -1363,14 +1425,15 @@ static int CmdLegicView(const char *Cmd) { return res; } - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "## | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ascii"); - PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); - print_hex_break(dump, bytes_read, 16); + if (verbose) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "## | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ascii"); + PrintAndLogEx(INFO, "---+-------------------------------------------------+-----------------"); + print_hex_break(dump, bytes_read, 16); + } PrintAndLogEx(NORMAL, ""); decode_and_print_memory(bytes_read, dump); - free(dump); return PM3_SUCCESS; } diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index 5ddd3f1fa..bf67a2b0b 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -273,11 +273,13 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i MifareAuthState = masNone; break; case ISO14443A_CMD_RATS: - snprintf(exp, size, "RATS"); + snprintf(exp, size, "RATS - FSDI=%x, CID=%x", (cmd[1] & 0xF0) >> 4, (cmd[1] & 0x0F)); break; + /* Actually, PPSS is Dx case ISO14443A_CMD_PPS: snprintf(exp, size, "PPS"); break; + */ case ISO14443A_CMD_OPTS: snprintf(exp, size, "OPTIONAL TIMESLOT"); break; @@ -423,10 +425,14 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i snprintf(exp, size, "FAST WRITE (" _MAGENTA_("%d-%d") ")", cmd[1], cmd[2]); else snprintf(exp, size, "?"); - break; + default: - return PM3_ESOFT; + if ((cmd[0] & 0xF0) == 0xD0 && (cmdsize == 4 || cmdsize == 5)) { + snprintf(exp, size, "PPS - CID=%x", cmd[0] & 0x0F) ; + } else { + return PM3_ESOFT; + } } } else { if (gs_mfuc_state == 1) { @@ -1017,6 +1023,9 @@ void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { snprintf(exp, size, "CLEAR RECORD FILE"); } break; + case MFDES_NOTIFY_TRANSACTION_SUCCESS: + snprintf(exp, size, "NOTIFY TRANSACTION SUCCESS (ECP)"); + break; case MFDES_COMMIT_TRANSACTION: snprintf(exp, size, "COMMIT TRANSACTION"); break; @@ -1197,6 +1206,239 @@ void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { } } +// MIFARE Plus + +// returns the message to print for a given opcode. +const char *mfpGetAnnotationForCode(uint8_t code) { + struct mfp_code_msg { + uint8_t code; + const char *annotation; + } messages[] = { + { MFP_GETVERSION, "GET VERSION"}, + { MFP_ADDITIONALFRAME, "NEXT FRAME"}, + { MFP_AUTHENTICATENONFIRST, "FOLLOWING AUTH"}, + { MFP_AUTHENTICATECONTINUE, "SECOND AUTH STEP"}, + { MFP_RESETAUTH, "RESET AUTH"}, + { MFP_COMMITPERSO, "COMMIT PERSO"}, + { MFP_VCSUPPORTLASTISOL3, "CHECK VIRTUAL CARD"}, + { MFP_ISOSELECT, "SELECT VIRTUAL CARD"}, + { MFP_SETCONFIGSL1, "SET CONFIG SL1"}, + { MFP_MF_PERSONALIZEUIDUSAGE, "PERSONALIZE UID USAGE"}, + { MFP_READ_SIG, "READ SIGNATURE"}, + { MFDES_PREPARE_PC, "PREPARE PROXIMITY CHECK"}, + { MFDES_PROXIMITY_CHECK, "PROXIMITY CHECK"}, + { MFDES_VERIFY_PC, "VERIFY PROXIMITY CHECK"}, + { MFDES_COMMIT_READER_ID, "COMMIT READER ID"}, + { MFP_INCREMENTNOMAC, "INCREMENT"}, + { MFP_INCREMENTMAC, "INCREMENT"}, + { MFP_DECREMENTMAC, "DECREMENT"}, + { MFP_DECREMENTNOMAC, "DECREMENT"}, + { MFP_TRANSFERNOMAC, "TRANSFER"}, + { MFP_TRANSFERMAC, "TRANSFER"}, + { MFP_INCREMENTTRANSFERNOMAC, "INCREMENT, TRANSFER"}, + { MFP_INCREMENTTRANSFERMAC, "INCREMENT, TRANSFER"}, + { MFP_DECREMENTTRANSFERNOMAC, "DECREMENT, TRANSFER"}, + { MFP_DECREMENTTRANSFERMAC, "DECREMENT, TRANSFER"}, + { MFP_RESTORENOMAC, "RESTORE"}, + { MFP_RESTOREMAC, "RESTORE"}, + { 0, NULL} + } ; + + for (struct mfp_code_msg *p = messages ; p->annotation != NULL ; p++) { + if (p->code == code) { + return p->annotation ; + } + } + return NULL ; +} + +const char *mfpGetEncryptedForCode(uint8_t code) { + /* + encrypted |plain : bit 1 + 30 A0 0000 32 A2 0010 + 31 A1 0001 33 A3 0011 + 34 0100 36 0110 + 35 0101 37 0111 + */ + if ((code & 0x02) == 2) { + return "PLAIN" ; + } + return "ENCRYPTED" ; +} + +/* + response |command + NOMAC MAC UnMACed MACed + 30 31 34 30,A0 + 32 33 35 31,A1 + A0 A1 36 32,A2 + A2 A3 37 33,A3 + bit 0 is response: NOMAC if 0, MAC if 1 + bit 2 is command: UNMACed if 1, MACed if 0 +*/ +const char *mfpGetResponseMacedForCode(uint8_t code) { + if ((code & 0x01) == 0x00) { + return "NoMAC" ; + } + return "MAC" ; +} + +const char *mfpGetCommandMacedForCode(uint8_t code) { + if ((code & 0x04) == 0x04) { + return "UnMACed" ; + } + return "MACed" ; +} + +void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { + + // If we are in Mifare Classic Authenticated mode, all the work has already be done elsewhere + if ((MifareAuthState != masNone) && (MifareAuthState != masError)) { + return ; + } + + // it's basically a ISO14443a tag, so try annotation from there + if (applyIso14443a(exp, size, cmd, cmdsize, false) == PM3_SUCCESS) { + return ; + } + + // ok this part is copy paste from annotateMfDesfire, it seems to work for MIFARE Plus also + if (((cmd[0] & 0xC0) == 0x00) && (cmdsize > 2)) { + + // PCB [CID] [NAD] [INF] CRC CRC + int pos = 1; + if ((cmd[0] & 0x08) == 0x08) // cid byte following + pos++; + + if ((cmd[0] & 0x04) == 0x04) // nad byte following + pos++; + + for (uint8_t i = 0; i < 2; i++, pos++) { + bool found_annotation = true; + + uint8_t *data = cmd + pos + 1; + // if the byte prior to the command is 90 the command is wrapped, so data starts 3 bytes later + if (i > 0 && cmd[pos - 1] == 0x90) { + data += 3; + } + uint8_t data_size = 0; + if (cmdsize > (data - cmd)) { + data_size = cmdsize - (data - cmd); + } + uint8_t opcode = cmd[pos] ; + switch (opcode) { + case MFP_AUTHENTICATEFIRST: + case MFP_AUTHENTICATEFIRST_VARIANT: + if (data_size > 1) { + // key : uint16_t uKeyNum = 0x4000 + sectorNum * 2 + (keyB ? 1 : 0); + uint16_t uKeyNum = MemLeToUint2byte(data) ; + snprintf(exp, size, "FIRST AUTH (Keynr 0x%04X: %c sector %d)", uKeyNum, uKeyNum & 0x0001 ? 'B' : 'A', (uKeyNum - 0x4000) / 2); + } else { + snprintf(exp, size, "FIRST AUTH") ; + } + break; + + case MFP_WRITEPERSO: + if (data_size > 1) { + uint16_t uKeyNum = MemLeToUint2byte(data) ; + snprintf(exp, size, "WRITE PERSO (Keynr 0x%04X)", uKeyNum); + } else { + snprintf(exp, size, "WRITE PERSO"); + } + break; + + case MFP_READENCRYPTEDNOMAC_MACED: + case MFP_READENCRYPTEDMAC_MACED: + case MFP_READENCRYPTEDNOMAC_UNMACED: + case MFP_READENCRYPTEDMAC_UNMACED: + case MFP_READPLAINNOMAC_MACED: + case MFP_READPLAINMAC_MACED: + case MFP_READPLAINNOMAC_UNMACED: + case MFP_READPLAINMAC_UNMACED: { + const char *encrypted = mfpGetEncryptedForCode(opcode) ; + const char *responseMaced = mfpGetResponseMacedForCode(opcode) ; + const char *commandMaced = mfpGetCommandMacedForCode(opcode) ; + + if (data_size > 2) { + uint16_t uBlockNum = MemLeToUint2byte(data) ; + uint8_t uQty = data[2] ; + if (uQty > 1) { + snprintf(exp, size, "READ %s(%u-%i) %s_%s", encrypted, uBlockNum, uBlockNum + uQty - 1, responseMaced, commandMaced); + } else { + snprintf(exp, size, "READ %s(%u) %s_%s", encrypted, uBlockNum, responseMaced, commandMaced); + } + } else { + snprintf(exp, size, "READ %s %s_%s ?", encrypted, responseMaced, commandMaced); + } + break; + } + + case MFP_WRITEPLAINNOMAC : + case MFP_WRITEPLAINMAC : + case MFP_WRITEENCRYPTEDNOMAC: + case MFP_WRITEENCRYPTEDMAC : { + const char *encrypted = mfpGetEncryptedForCode(opcode) ; + const char *responseMaced = mfpGetResponseMacedForCode(opcode) ; + + if (data_size > 1) { + uint16_t uBlockNum = MemLeToUint2byte(data) ; + snprintf(exp, size, "WRITE %s(%u) %s", encrypted, uBlockNum, responseMaced); + } else { + snprintf(exp, size, "WRITE %s %s ?", encrypted, responseMaced); + } + break; + } + + case MFP_INCREMENTNOMAC : + case MFP_INCREMENTMAC : + case MFP_DECREMENTNOMAC : + case MFP_DECREMENTMAC : + case MFP_TRANSFERNOMAC : + case MFP_TRANSFERMAC : + case MFP_INCREMENTTRANSFERNOMAC: + case MFP_INCREMENTTRANSFERMAC : + case MFP_DECREMENTTRANSFERNOMAC: + case MFP_DECREMENTTRANSFERMAC : + case MFP_RESTORENOMAC : + case MFP_RESTOREMAC : { + const char *responseMaced = mfpGetResponseMacedForCode(opcode) ; + const char *annotation = mfpGetAnnotationForCode(opcode) ; + if (annotation == NULL) { + //should not happen outside of default case: it means an entry is mising in mfpGetAnnotationForCode() + annotation = "?? MISSING OPCODE" ; + } + + if (data_size > 1) { + uint16_t uBlockNum = MemLeToUint2byte(data) ; + snprintf(exp, size, "%s(%u) %s", annotation, uBlockNum, responseMaced); + } else { + snprintf(exp, size, "%s %s ?", annotation, responseMaced); + } + break; + } + + default: { + // Messages for commands that do not need args are treated here + const char *annotation = mfpGetAnnotationForCode(opcode) ; + if (annotation != NULL) { + snprintf(exp, size, "%s", annotation) ; + } else { + found_annotation = false; + } + break; + } + } + if (found_annotation) { + break; + } + } + } else { + // anything else + snprintf(exp, size, "?"); + } +} + + /** 06 00 = INITIATE 0E xx = SELECT ID (xx = Chip-ID) diff --git a/client/src/cmdhflist.h b/client/src/cmdhflist.h index 6499938eb..ab544a86f 100644 --- a/client/src/cmdhflist.h +++ b/client/src/cmdhflist.h @@ -56,6 +56,11 @@ void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateIso14443b(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response); void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); +const char *mfpGetAnnotationForCode(uint8_t code); +const char *mfpGetEncryptedForCode(uint8_t code); +const char *mfpGetResponseMacedForCode(uint8_t code); +const char *mfpGetCommandMacedForCode(uint8_t code); +void annotateMfPlus(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, const uint8_t *parity, uint8_t paritysize, bool isResponse); void annotateLTO(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); diff --git a/client/src/cmdhflto.c b/client/src/cmdhflto.c index b5a8d1206..d11f0c6d1 100644 --- a/client/src/cmdhflto.c +++ b/client/src/cmdhflto.c @@ -526,7 +526,7 @@ int infoLTO(bool verbose) { } static int CmdHfLTOList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf lto", "lto"); + return CmdTraceListAlias(Cmd, "hf lto", "lto -c"); } int rdblLTO(uint8_t st_blk, uint8_t end_blk, bool verbose) { diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index b48fd3d0a..7f8be4fbf 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -36,6 +36,7 @@ #include "crypto/libpcrypto.h" #include "wiegand_formats.h" #include "wiegand_formatutils.h" +#include "cmdhw.h" // set_fpga_mode static int CmdHelp(const char *Cmd); @@ -89,7 +90,7 @@ int mfc_ev1_print_signature(uint8_t *uid, uint8_t uidlen, uint8_t *signature, in return PM3_ESOFT; } - PrintAndLogEx(INFO, " IC signature public key name: %s", nxp_mfc_public_keys[i].desc); + PrintAndLogEx(INFO, " IC signature public key name: " _GREEN_("%s"), nxp_mfc_public_keys[i].desc); PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_mfc_public_keys[i].value); PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp128r1"); PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, 32)); @@ -101,8 +102,8 @@ static int GetHFMF14AUID(uint8_t *uid, int *uidlen) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(DEBUG, "iso14443a card select failed"); DropField(); return PM3_ERFTRANS; } @@ -153,26 +154,37 @@ static int initSectorTable(sector_t **src, size_t items) { static void decode_print_st(uint16_t blockno, uint8_t *data) { if (mfIsSectorTrailer(blockno)) { PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "----------------------- " _CYAN_("Sector trailer decoder") " -----------------------"); + PrintAndLogEx(INFO, "-------------------------- " _CYAN_("Sector trailer decoder") " --------------------------"); PrintAndLogEx(INFO, "key A........ " _GREEN_("%s"), sprint_hex_inrow(data, 6)); PrintAndLogEx(INFO, "acr.......... " _GREEN_("%s"), sprint_hex_inrow(data + 6, 3)); PrintAndLogEx(INFO, "user / gpb... " _GREEN_("%02x"), data[9]); PrintAndLogEx(INFO, "key B........ " _GREEN_("%s"), sprint_hex_inrow(data + 10, 6)); - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, " # | Access rights"); - PrintAndLogEx(INFO, "----+-----------------------------------------------------------------"); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, " # | access rights"); + PrintAndLogEx(INFO, "----+-----------------------------------------------------------------------"); if (mfValidateAccessConditions(&data[6]) == false) { PrintAndLogEx(WARNING, _RED_("Invalid Access Conditions")); } + int bln = mfFirstBlockOfSector(mfSectorNum(blockno)); int blinc = (mfNumBlocksPerSector(mfSectorNum(blockno)) > 4) ? 5 : 1; for (int i = 0; i < 4; i++) { PrintAndLogEx(INFO, "%3d%c| " _YELLOW_("%s"), bln, ((blinc > 1) && (i < 3) ? '+' : ' '), mfGetAccessConditionsDesc(i, &data[6])); bln += blinc; + + if (i == 3) { + uint8_t cond = mf_get_accesscondition(i, &data[6]); + if (cond == 0 || cond == 1 || cond == 2) { + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "OBS! Key B is readable, it SHALL NOT be able to authenticate on original MFC"); + } + } } - PrintAndLogEx(INFO, "----------------------------------------------------------------------"); + + + PrintAndLogEx(INFO, "----------------------------------------------------------------------------"); PrintAndLogEx(NORMAL, ""); } } @@ -365,12 +377,16 @@ static int mf_print_keys(uint16_t n, uint8_t *d) { } for (uint16_t i = 0; i < n; i++) { - if (mfIsSectorTrailer(i)) { - e_sector[mfSectorNum(i)].foundKey[0] = 1; - e_sector[mfSectorNum(i)].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE); - e_sector[mfSectorNum(i)].foundKey[1] = 1; - e_sector[mfSectorNum(i)].Key[1] = bytes_to_num(d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE); + if (mfIsSectorTrailer(i) == false) { + continue; } + // zero based index... + uint8_t lookup = mfSectorNum(i); + uint8_t sec = MIN(sectors - 1, lookup); + e_sector[sec].foundKey[0] = 1; + e_sector[sec].Key[0] = bytes_to_num(d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE); + e_sector[sec].foundKey[1] = 1; + e_sector[sec].Key[1] = bytes_to_num(d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE); } printKeyTable(sectors, e_sector); free(e_sector); @@ -550,13 +566,13 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_SUCCESS; } @@ -577,9 +593,6 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n size_t alen = 0, blen = 0; uint8_t *keyA, *keyB; if (loadFileBinaryKey(keyfn, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) { - if (keyA) { - free(keyA); - } free(fptr); return PM3_ESOFT; } @@ -1339,13 +1352,10 @@ static int CmdHF14AMfRestore(const char *Cmd) { size_t alen = 0, blen = 0; uint8_t *keyA, *keyB; if (loadFileBinaryKey(keyfilename, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) { - if (keyA) { - free(keyA); - } return PM3_ESOFT; } - PrintAndLogEx(INFO, "Using key file... `" _YELLOW_("%s") "`", keyfilename); + PrintAndLogEx(INFO, "Using key file `" _YELLOW_("%s") "`", keyfilename); // try reading card uid and create filename if (datafnlen == 0) { @@ -1376,10 +1386,9 @@ static int CmdHF14AMfRestore(const char *Cmd) { // default authentication key uint8_t default_key[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - PrintAndLogEx(INFO, "Restoring " _YELLOW_("%s")" to card", datafilename); - - PrintAndLogEx(INFO, " blk | "); - PrintAndLogEx(INFO, "-----+------------------------------------------------------------"); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, " blk | data | status"); + PrintAndLogEx(INFO, "-----+-------------------------------------------------+----------------"); // main loop for restoring. // a bit more complicated than needed @@ -1395,6 +1404,8 @@ static int CmdHF14AMfRestore(const char *Cmd) { // if sector trailer if (mfIsSectorTrailerBasedOnBlocks(s, b)) { + + // keep the current keys on the card if (use_keyfile_for_auth == false) { // replace KEY A memcpy(bldata, keyA + (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE); @@ -1433,10 +1444,13 @@ static int CmdHF14AMfRestore(const char *Cmd) { for (int8_t kt = MF_KEY_B; kt > -1; kt--) { if (use_keyfile_for_auth) { - if (kt == MF_KEY_A) + + if (kt == MF_KEY_A) { memcpy(wdata, keyA + (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE); - else + } else { memcpy(wdata, keyB + (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE); + } + } else { // use default key to authenticate for the write command memcpy(wdata, default_key, MIFARE_KEY_SIZE); @@ -1444,8 +1458,6 @@ static int CmdHF14AMfRestore(const char *Cmd) { uint16_t blockno = (mfFirstBlockOfSector(s) + b); - PrintAndLogEx(INFO, " %3d | %s", blockno, sprint_hex(bldata, sizeof(bldata))); - clearCommandBuffer(); SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, kt, 0, wdata, sizeof(wdata)); PacketResponseNG resp; @@ -1457,22 +1469,20 @@ static int CmdHF14AMfRestore(const char *Cmd) { int isOK = resp.oldarg[0] & 0xff; if (isOK == 1) { // if success, skip to next block + PrintAndLogEx(INFO, " %3d | %s| ( " _GREEN_("ok") " )", blockno, sprint_hex(bldata, sizeof(bldata))); break; - } else if (isOK == PM3_ETEAROFF) { + } + // write somehow failed. Lets determine why. + if (isOK == PM3_ETEAROFF) { PrintAndLogEx(INFO, "Tear off triggerd. Recommendation is not to use tear-off with restore command"); goto out; - } else { - if (b == 0) { - PrintAndLogEx(INFO, "Writing to manufacture block w key " _YELLOW_("%c") " ( " _RED_("fail") " )", - (kt == MF_KEY_A) ? 'A' : 'B' - ); - } else { - PrintAndLogEx(FAILED, "Write to block " _YELLOW_("%u") " w key " _YELLOW_("%c") " ( " _RED_("fail") " ) ", - blockno, - (kt == MF_KEY_A) ? 'A' : 'B' - ); - } } + + PrintAndLogEx(INFO, " %3d | %s| ( " _RED_("fail") " ) key " _YELLOW_("%c"), + blockno, + sprint_hex(bldata, sizeof(bldata)), + (kt == MF_KEY_A) ? 'A' : 'B' + ); } // end loop key types } // end loop B } // end loop S @@ -1481,7 +1491,7 @@ out: free(ref_dump); free(keyA); free(keyB); - PrintAndLogEx(INFO, "-----+------------------------------------------------------------"); + PrintAndLogEx(INFO, "-----+-------------------------------------------------+----------------"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; @@ -1828,7 +1838,7 @@ jumptoend: static int CmdHF14AMfNestedStatic(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mf staticnested", - "Execute Nested attack against MIFARE Classic card with static nonce for key recovery.\n" + "Execute static nested attack against MIFARE Classic card with static nonce for key recovery.\n" "Supply a known key from one block to recover all keys", "hf mf staticnested --mini --blk 0 -a -k FFFFFFFFFFFF\n" "hf mf staticnested --1k --blk 0 -a -k FFFFFFFFFFFF\n" @@ -2492,13 +2502,15 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + // iso14443a card select failed + PrintAndLogEx(FAILED, "No tag detected or other tag communication error"); + PrintAndLogEx(HINT, "Hint: Try some distance or position of the card"); return PM3_ECARDEXCHANGE; } @@ -2542,7 +2554,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { if (has_staticnonce == NONCE_NORMAL) { prng_type = detect_classic_prng(); if (prng_type < 0) { - PrintAndLogEx(FAILED, "\nNo tag detected or other tag communication error (%u)", prng_type); + PrintAndLogEx(FAILED, "\nNo tag detected or other tag communication error (%i)", prng_type); free(e_sector); free(fptr); return PM3_ESOFT; @@ -3103,8 +3115,9 @@ all_found: clearCommandBuffer(); SendCommandNG(CMD_HF_MIFARE_EML_MEMCLR, NULL, 0); - PrintAndLogEx(SUCCESS, "transferring keys to simulator memory (Cmd Error: 04 can occur)"); + PrintAndLogEx(INFO, "transferring keys to simulator memory " NOLF); + bool transfer_status = true; for (current_sector_i = 0; current_sector_i < sector_cnt; current_sector_i++) { mfEmlGetMem(block, current_sector_i, 1); if (e_sector[current_sector_i].foundKey[0]) @@ -3112,8 +3125,11 @@ all_found: if (e_sector[current_sector_i].foundKey[1]) num_to_bytes(e_sector[current_sector_i].Key[1], 6, block + 10); - mfEmlSetMem(block, mfFirstBlockOfSector(current_sector_i) + mfNumBlocksPerSector(current_sector_i) - 1, 1); + transfer_status |= mfEmlSetMem(block, mfFirstBlockOfSector(current_sector_i) + mfNumBlocksPerSector(current_sector_i) - 1, 1); } + PrintAndLogEx(NORMAL, "( %s )", (transfer_status) ? _GREEN_("ok") : _RED_("fail")); + + PrintAndLogEx(INFO, "dumping card content to emulator memory (Cmd Error: 04 can occur)"); // use ecfill trick FastDumpWithEcFill(sector_cnt); @@ -3127,8 +3143,8 @@ all_found: return PM3_EMALLOC; } - PrintAndLogEx(INFO, "downloading the card content from emulator memory"); - if (!GetFromDevice(BIG_BUF_EML, dump, bytes, 0, NULL, 0, NULL, 2500, false)) { + PrintAndLogEx(INFO, "downloading card content from emulator memory"); + if (GetFromDevice(BIG_BUF_EML, dump, bytes, 0, NULL, 0, NULL, 2500, false) == false) { PrintAndLogEx(ERR, "Fail, transfer from device time-out"); free(e_sector); free(dump); @@ -4255,6 +4271,7 @@ int CmdHF14AMfELoad(const char *Cmd) { arg_lit0(NULL, "ul", "MIFARE Ultralight family"), arg_lit0("m", "mem", "use RDV4 spiffs"), arg_int0("q", "qty", "", "manually set number of blocks (overrides)"), + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -4271,7 +4288,7 @@ int CmdHF14AMfELoad(const char *Cmd) { bool use_spiffs = arg_get_lit(ctx, 7); int numblks = arg_get_int_def(ctx, 8, -1); - + bool verbose = arg_get_lit(ctx, 9); CLIParserFree(ctx); // validations @@ -4303,13 +4320,17 @@ int CmdHF14AMfELoad(const char *Cmd) { return PM3_EINVARG; } - PrintAndLogEx(INFO, "%d blocks ( %u bytes ) to upload", block_cnt, block_cnt * block_width); + PrintAndLogEx(INFO, "Upload " _YELLOW_("%u") " blocks " _YELLOW_("%u") " bytes", block_cnt, block_cnt * block_width); if (numblks > 0) { block_cnt = MIN(numblks, block_cnt); - PrintAndLogEx(INFO, "overriding number of blocks, will use %d blocks ( %u bytes )", block_cnt, block_cnt * block_width); + PrintAndLogEx(INFO, "overriding number of blocks, will use " _YELLOW_("%u") " blocks " _YELLOW_("%u") " bytes", block_cnt, block_cnt * block_width); } + // ICEMAN: bug. if device has been using ICLASS commands, + // the device needs to load the HF fpga image. It takes 1.5 second. + set_fpga_mode(2); + // use RDV4 spiffs if (use_spiffs && IfPm3Flash() == false) { PrintAndLogEx(WARNING, "Device not compiled to support spiffs"); @@ -4363,8 +4384,10 @@ int CmdHF14AMfELoad(const char *Cmd) { return res; } - mfu_dump_t *mfu_dump = (mfu_dump_t *)data; - printMFUdumpEx(mfu_dump, mfu_dump->pages + 1, 0); + if (verbose) { + mfu_dump_t *mfu_dump = (mfu_dump_t *)data; + printMFUdumpEx(mfu_dump, mfu_dump->pages + 1, 0); + } // update expected blocks to match converted data. block_cnt = bytes_read / MFU_BLOCK_SIZE; @@ -4380,23 +4403,28 @@ int CmdHF14AMfELoad(const char *Cmd) { size_t offset = 0; int cnt = 0; + // 12 is the size of the struct the fct mfEmlSetMem_xt uses to transfer to device + uint16_t max_avail_blocks = ((PM3_CMD_DATA_SIZE - 12) / block_width) * block_width; + while (bytes_read && cnt < block_cnt) { if (bytes_read == block_width) { // Disable fast mode on last packet g_conn.block_after_ACK = false; } - if (mfEmlSetMem_xt(data + offset, cnt, 1, block_width) != PM3_SUCCESS) { + uint16_t chunk_size = MIN(max_avail_blocks, bytes_read); + uint16_t blocks_to_send = chunk_size / block_width; + + if (mfEmlSetMem_xt(data + offset, cnt, blocks_to_send, block_width) != PM3_SUCCESS) { PrintAndLogEx(FAILED, "Can't set emulator mem at block: %3d", cnt); free(data); return PM3_ESOFT; } + cnt += blocks_to_send; + offset += chunk_size; + bytes_read -= chunk_size; PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); - - cnt++; - offset += block_width; - bytes_read -= block_width; } free(data); PrintAndLogEx(NORMAL, ""); @@ -4415,8 +4443,8 @@ int CmdHF14AMfELoad(const char *Cmd) { PrintAndLogEx(WARNING, "Error, file content, Only loaded %d blocks, must be %d blocks into emulator memory", cnt, block_cnt); return PM3_SUCCESS; } + PrintAndLogEx(INFO, "Done!"); } - PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } @@ -5253,7 +5281,7 @@ static int CmdHF14AMfCSave(const char *Cmd) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } @@ -5265,7 +5293,7 @@ static int CmdHF14AMfCSave(const char *Cmd) { */ uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_SUCCESS; } @@ -5318,6 +5346,10 @@ static int CmdHF14AMfCSave(const char *Cmd) { if (mfEmlSetMem(dump + (i * MFBLOCK_SIZE), i, 5) != PM3_SUCCESS) { PrintAndLogEx(WARNING, "Can't set emul block: " _YELLOW_("%d"), i); } + if (i % 64 == 0) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "" NOLF) ; + } PrintAndLogEx(NORMAL, "." NOLF); fflush(stdout); } @@ -5403,7 +5435,7 @@ static int CmdHF14AMfCView(const char *Cmd) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } @@ -5416,7 +5448,7 @@ static int CmdHF14AMfCView(const char *Cmd) { uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_ERFTRANS; } @@ -6117,10 +6149,10 @@ int CmdHFMFNDEFRead(const char *Cmd) { } PrintAndLogEx(INFO, "reading data from tag"); - for (int i = 1; i <= madlen; i++) { + for (int i = 0; i < madlen; i++) { if (ndef_aid == mad[i]) { uint8_t vsector[MFBLOCK_SIZE * 4] = {0}; - if (mfReadSector(i, keyB ? MF_KEY_B : MF_KEY_A, ndefkey, vsector)) { + if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, ndefkey, vsector)) { PrintAndLogEx(ERR, "error, reading sector %d ", i + 1); return PM3_ESOFT; } @@ -6236,13 +6268,13 @@ int CmdHFMFNDEFFormat(const char *Cmd) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_SUCCESS; } @@ -6289,9 +6321,6 @@ int CmdHFMFNDEFFormat(const char *Cmd) { size_t alen = 0, blen = 0; uint8_t *tmpA, *tmpB; if (loadFileBinaryKey(keyFilename, "", (void **)&tmpA, (void **)&tmpB, &alen, &blen) != PM3_SUCCESS) { - if (tmpA) { - free(tmpA); - } goto skipfile; } @@ -6709,7 +6738,7 @@ static int CmdHFMFPersonalize(const char *Cmd) { } static int CmdHF14AMfList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf mf", "mf"); + return CmdTraceListAlias(Cmd, "hf mf", "mf -c"); } static int CmdHf14AGen3UID(const char *Cmd) { @@ -7043,8 +7072,14 @@ static int CmdHf14AMfSuperCard(const char *Cmd) { // --------------- CHANGE UID ---------------- uint8_t aCHANGE[] = {0x00, 0xa6, 0xa0, 0x00, 0x05, 0xff, 0xff, 0xff, 0xff, 0x00}; memcpy(aCHANGE + 5, uid, uidlen); - res = ExchangeAPDU14a(aCHANGE, sizeof(aCHANGE), activate_field, keep_field_on, response, sizeof(response), - &resplen); + res = ExchangeAPDU14a( + aCHANGE, sizeof(aCHANGE), + activate_field, + keep_field_on, + response, sizeof(response), + &resplen + ); + if (res != PM3_SUCCESS) { PrintAndLogEx(FAILED, "Super card UID change [ " _RED_("fail") " ]"); DropField(); @@ -7063,8 +7098,14 @@ static int CmdHf14AMfSuperCard(const char *Cmd) { // --------------- RESET CARD ---------------- uint8_t aRESET[] = {0x00, 0xa6, 0xc0, 0x00}; - res = ExchangeAPDU14a(aRESET, sizeof(aRESET), activate_field, keep_field_on, response, sizeof(response), - &resplen); + res = ExchangeAPDU14a( + aRESET, sizeof(aRESET), + activate_field, + keep_field_on, + response, sizeof(response), + &resplen + ); + if (res != PM3_SUCCESS) { PrintAndLogEx(FAILED, "Super card reset [ " _RED_("fail") " ]"); DropField(); @@ -7153,7 +7194,12 @@ static int CmdHf14AMfSuperCard(const char *Cmd) { uint64_t key64 = -1; if (mfkey32_moebius(&data, &key64)) { - PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ " _GREEN_("%012" PRIX64) " ]", sprint_hex_inrow(outA, 4), data.sector, (data.keytype == 0x60) ? 'A' : 'B', key64); + PrintAndLogEx(SUCCESS, "UID: %s Sector %02x key %c [ " _GREEN_("%012" PRIX64) " ]", + sprint_hex_inrow(outA, 4), + data.sector, + (data.keytype == 0x60) ? 'A' : 'B', + key64 + ); } else { PrintAndLogEx(FAILED, "failed to recover any key"); } @@ -7813,14 +7859,6 @@ static int CmdHF14AGen4View(const char *Cmd) { for (uint16_t i = 0; i < block_cnt; i++) { - // 4k READs can be long, so we split status each 64 blocks. - if (i % 64 == 0) { - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "" NOLF) ; - } - PrintAndLogEx(NORMAL, "." NOLF); - fflush(stdout); - uint8_t flags = 0 ; if (i == 0) flags |= MAGIC_INIT ; if (i + 1 == block_cnt) flags |= MAGIC_OFF ; @@ -7832,6 +7870,14 @@ static int CmdHF14AGen4View(const char *Cmd) { free(dump); return PM3_ESOFT; } + + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); + // 4k READs can be long, so we split status each 64 blocks. + if (i % 64 == 0) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "" NOLF) ; + } } PrintAndLogEx(NORMAL, ""); @@ -7884,6 +7930,10 @@ static int CmdHF14AGen4Save(const char *Cmd) { bool fill_emulator = arg_get_lit(ctx, 7); CLIParserFree(ctx); + // ICEMAN: bug. if device has been using ICLASS commands, + // the device needs to load the HF fpga image. It takes 1.5 second. + set_fpga_mode(2); + // validations if (pwd_len != 4 && pwd_len != 0) { PrintAndLogEx(FAILED, "Must specify 4 bytes, got " _YELLOW_("%u"), pwd_len); @@ -7916,15 +7966,13 @@ static int CmdHF14AGen4Save(const char *Cmd) { PrintAndLogEx(WARNING, "Please specify a MIFARE Type"); return PM3_EINVARG; } - PrintAndLogEx(SUCCESS, "Dumping magic gen4 GTU MIFARE Classic " _GREEN_("%s") " card memory", s); - PrintAndLogEx(INFO, "." NOLF); // Select card to get UID/UIDLEN information clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "iso14443a card select timeout"); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); return PM3_ETIMEOUT; } @@ -7936,7 +7984,7 @@ static int CmdHF14AGen4Save(const char *Cmd) { */ uint64_t select_status = resp.oldarg[0]; if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_SUCCESS; } @@ -7952,63 +8000,72 @@ static int CmdHF14AGen4Save(const char *Cmd) { return PM3_EMALLOC; } + PrintAndLogEx(SUCCESS, "Dumping magic gen4 GTU MIFARE Classic " _GREEN_("%s") " card memory", s); + PrintAndLogEx(INFO, "." NOLF); + for (uint16_t i = 0; i < block_cnt; i++) { - - // 4k READs can be long, so we split status each 64 blocks. - if (i % 64 == 0) { - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "" NOLF) ; - } - PrintAndLogEx(NORMAL, "." NOLF); - fflush(stdout); - uint8_t flags = 0 ; - if (i == 0) flags |= MAGIC_INIT ; - if (i + 1 == block_cnt) flags |= MAGIC_OFF ; + if (i == 0) { + flags |= MAGIC_INIT; + } + if (i + 1 == block_cnt) { + flags |= MAGIC_OFF; + } int res = mfG4GetBlock(pwd, i, dump + (i * MFBLOCK_SIZE), flags); if (res != PM3_SUCCESS) { + PrintAndLogEx(NORMAL, ""); PrintAndLogEx(WARNING, "Can't get magic card block: %u. error=%d", i, res); PrintAndLogEx(HINT, "Verify your card size, and try again or try another tag position"); free(dump); return PM3_ESOFT; } + + + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); + // 4k READs can be long, so we split status each 64 blocks. + if (i % 64 == 0 && i != 0) { + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "" NOLF) ; + } } PrintAndLogEx(NORMAL, ""); if (fill_emulator) { - PrintAndLogEx(INFO, "uploading to emulator memory" NOLF); + PrintAndLogEx(INFO, "uploading to emulator memory"); + PrintAndLogEx(INFO, "." NOLF); // fast push mode g_conn.block_after_ACK = true; size_t offset = 0; - int cnt = 0; + int cnt = 0; uint16_t bytes_left = bytes ; - while (bytes_left > 0 && cnt < block_cnt) { - // 4k writes can be long, so we split status each 64 blocks. - if (cnt % 64 == 0) { - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "" NOLF) ; - } - PrintAndLogEx(NORMAL, "." NOLF); - fflush(stdout); + // 12 is the size of the struct the fct mfEmlSetMem_xt uses to transfer to device + uint16_t max_avail_blocks = ((PM3_CMD_DATA_SIZE - 12) / MFBLOCK_SIZE) * MFBLOCK_SIZE; + while (bytes_left > 0 && cnt < block_cnt) { if (bytes_left == MFBLOCK_SIZE) { // Disable fast mode on last packet g_conn.block_after_ACK = false; } - if (mfEmlSetMem_xt(dump + offset, cnt, 1, MFBLOCK_SIZE) != PM3_SUCCESS) { + uint16_t chunk_size = MIN(max_avail_blocks, bytes_left); + uint16_t blocks_to_send = chunk_size / MFBLOCK_SIZE; + + if (mfEmlSetMem_xt(dump + offset, cnt, blocks_to_send, MFBLOCK_SIZE) != PM3_SUCCESS) { PrintAndLogEx(FAILED, "Can't set emulator mem at block: %3d", cnt); free(dump); return PM3_ESOFT; } - cnt++; - offset += MFBLOCK_SIZE; - bytes_left -= MFBLOCK_SIZE; + cnt += blocks_to_send; + offset += chunk_size; + bytes_left -= chunk_size; + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); } PrintAndLogEx(NORMAL, ""); @@ -8138,8 +8195,6 @@ static int CmdHF14AGen4_GDM_SetBlk(const char *Cmd) { void *argtable[] = { arg_param_begin, arg_int1(NULL, "blk", "", "block number"), - arg_lit0("a", NULL, "input key type is key A (def)"), - arg_lit0("b", NULL, "input key type is key B"), arg_str0("d", "data", "", "bytes to write, 16 hex bytes"), arg_str0("k", "key", "", "key, 6 hex bytes"), arg_lit0(NULL, "force", "override warnings"), @@ -8149,24 +8204,15 @@ static int CmdHF14AGen4_GDM_SetBlk(const char *Cmd) { int b = arg_get_int_def(ctx, 1, 1); - uint8_t keytype = MF_KEY_A; - if (arg_get_lit(ctx, 2) && arg_get_lit(ctx, 3)) { - CLIParserFree(ctx); - PrintAndLogEx(WARNING, "Input key type must be A or B"); - return PM3_EINVARG; - } else if (arg_get_lit(ctx, 3)) { - keytype = MF_KEY_B;; - } - uint8_t block[MFBLOCK_SIZE] = {0x00}; int blen = 0; - CLIGetHexWithReturn(ctx, 4, block, &blen); + CLIGetHexWithReturn(ctx, 2, block, &blen); int keylen = 0; uint8_t key[6] = {0}; - CLIGetHexWithReturn(ctx, 5, key, &keylen); + CLIGetHexWithReturn(ctx, 3, key, &keylen); - bool force = arg_get_lit(ctx, 6); + bool force = arg_get_lit(ctx, 4); CLIParserFree(ctx); if (blen != MFBLOCK_SIZE) { @@ -8190,18 +8236,16 @@ static int CmdHF14AGen4_GDM_SetBlk(const char *Cmd) { return PM3_EINVARG; } - PrintAndLogEx(INFO, "Writing block no %d, key %c - %s", blockno, (keytype == MF_KEY_B) ? 'B' : 'A', sprint_hex_inrow(key, sizeof(key))); + PrintAndLogEx(INFO, "Writing block no %d, key %s", blockno, sprint_hex_inrow(key, sizeof(key))); PrintAndLogEx(INFO, "data: %s", sprint_hex(block, sizeof(block))); struct p { uint8_t blockno; - uint8_t keytype; uint8_t key[6]; uint8_t data[MFBLOCK_SIZE]; // data to be written } PACKED payload; payload.blockno = blockno; - payload.keytype = keytype; memcpy(payload.key, key, sizeof(payload.key)); memcpy(payload.data, block, sizeof(payload.data)); @@ -8220,7 +8264,6 @@ static int CmdHF14AGen4_GDM_SetBlk(const char *Cmd) { return resp.status; } else { PrintAndLogEx(FAILED, "Write ( " _RED_("fail") " )"); - PrintAndLogEx(HINT, "Maybe access rights? Try specify keytype `" _YELLOW_("hf mf gdmsetblk -%c ...") "` instead", (keytype == MF_KEY_A) ? 'b' : 'a'); } return PM3_SUCCESS; } diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index b2cd1f7a5..03dcea842 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -1411,7 +1411,7 @@ static int CmdHF14aDesChk(const char *Cmd) { } static int CmdHF14ADesList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf mfdes", "des"); + return CmdTraceListAlias(Cmd, "hf mfdes", "des -c"); } static int DesfireAuthCheck(DesfireContext_t *dctx, DesfireISOSelectWay way, uint32_t appID, DesfireSecureChannel secureChannel, uint8_t *key) { diff --git a/client/src/cmdhfmfhard.c b/client/src/cmdhfmfhard.c index 090dcf531..713a658e9 100644 --- a/client/src/cmdhfmfhard.c +++ b/client/src/cmdhfmfhard.c @@ -30,6 +30,7 @@ #include #include #include // MingW +#include #include #include "commonutil.h" // ARRAYLEN @@ -51,8 +52,9 @@ #define IGNORE_BITFLIP_THRESHOLD 0.9901 #define STATE_FILES_DIRECTORY "hardnested_tables/" -#define STATE_FILE_TEMPLATE "bitflip_%d_%03" PRIx16 "_states.bin.bz2" #define STATE_FILE_TEMPLATE_RAW "bitflip_%d_%03" PRIx16 "_states.bin" +#define STATE_FILE_TEMPLATE_LZ4 "bitflip_%d_%03" PRIx16 "_states.bin.lz4" +#define STATE_FILE_TEMPLATE_BZ2 "bitflip_%d_%03" PRIx16 "_states.bin.bz2" #define DEBUG_KEY_ELIMINATION // #define DEBUG_REDUCTION @@ -135,7 +137,7 @@ static void print_progress_header(void) { void hardnested_print_progress(uint32_t nonces, const char *activity, float brute_force, uint64_t min_diff_print_time) { static uint64_t last_print_time = 0; - if (msclock() - last_print_time > min_diff_print_time) { + if (msclock() - last_print_time >= min_diff_print_time) { last_print_time = msclock(); uint64_t total_time = msclock() - start_time; float brute_force_time = brute_force / brute_force_per_second; @@ -256,34 +258,42 @@ static void init_bitflip_bitarrays(void) { #if defined (DEBUG_REDUCTION) uint8_t line = 0; #endif + uint64_t init_bitflip_bitarrays_starttime = msclock(); - bz_stream compressed_stream; - - char state_files_path[strlen(get_my_executable_directory()) + strlen(STATE_FILES_DIRECTORY) + strlen(STATE_FILE_TEMPLATE) + 1]; - char state_file_name[strlen(STATE_FILE_TEMPLATE) + 1]; - char state_file_raw_name[strlen(STATE_FILE_TEMPLATE_RAW) + 1]; - + char state_file_name[MAX(strlen(STATE_FILE_TEMPLATE_RAW), MAX(strlen(STATE_FILE_TEMPLATE_LZ4), strlen(STATE_FILE_TEMPLATE_BZ2))) + 1]; + char state_files_path[strlen(get_my_executable_directory()) + strlen(STATE_FILES_DIRECTORY) + sizeof(state_file_name)]; + uint16_t nraw = 0, nlz4 = 0, nbz2 = 0; for (odd_even_t odd_even = EVEN_STATE; odd_even <= ODD_STATE; odd_even++) { num_effective_bitflips[odd_even] = 0; for (uint16_t bitflip = 0x001; bitflip < 0x400; bitflip++) { bool open_uncompressed = false; + bool open_lz4compressed = false; + bool open_bz2compressed = false; bitflip_bitarrays[odd_even][bitflip] = NULL; count_bitflip_bitarrays[odd_even][bitflip] = 1 << 24; - snprintf(state_file_name, sizeof(state_file_name), STATE_FILE_TEMPLATE, odd_even, bitflip); + char *path; + snprintf(state_file_name, sizeof(state_file_name), STATE_FILE_TEMPLATE_RAW, odd_even, bitflip); strncpy(state_files_path, STATE_FILES_DIRECTORY, sizeof(state_files_path) - 1); strncat(state_files_path, state_file_name, sizeof(state_files_path) - (strlen(STATE_FILES_DIRECTORY) + 1)); - - char *path; - if (searchFile(&path, RESOURCES_SUBDIR, state_files_path, "", true) != PM3_SUCCESS) { - snprintf(state_file_raw_name, sizeof(state_file_raw_name), STATE_FILE_TEMPLATE_RAW, odd_even, bitflip); + if (searchFile(&path, RESOURCES_SUBDIR, state_files_path, "", true) == PM3_SUCCESS) { + open_uncompressed = true; + } else { + snprintf(state_file_name, sizeof(state_file_name), STATE_FILE_TEMPLATE_LZ4, odd_even, bitflip); strncpy(state_files_path, STATE_FILES_DIRECTORY, sizeof(state_files_path) - 1); - strncat(state_files_path, state_file_raw_name, sizeof(state_files_path) - (strlen(STATE_FILES_DIRECTORY) + 1)); + strncat(state_files_path, state_file_name, sizeof(state_files_path) - (strlen(STATE_FILES_DIRECTORY) + 1)); if (searchFile(&path, RESOURCES_SUBDIR, state_files_path, "", true) == PM3_SUCCESS) { - open_uncompressed = true; + open_lz4compressed = true; } else { - continue; + snprintf(state_file_name, sizeof(state_file_name), STATE_FILE_TEMPLATE_BZ2, odd_even, bitflip); + strncpy(state_files_path, STATE_FILES_DIRECTORY, sizeof(state_files_path) - 1); + strncat(state_files_path, state_file_name, sizeof(state_files_path) - (strlen(STATE_FILES_DIRECTORY) + 1)); + if (searchFile(&path, RESOURCES_SUBDIR, state_files_path, "", true) == PM3_SUCCESS) { + open_bz2compressed = true; + } else { + continue; + } } } @@ -291,26 +301,150 @@ static void init_bitflip_bitarrays(void) { free(path); if (statesfile == NULL) { continue; - } else if (!open_uncompressed) { - fseek(statesfile, 0, SEEK_END); - int fsize = ftell(statesfile); - if (fsize == -1) { + } + + fseek(statesfile, 0, SEEK_END); + int fsize = ftell(statesfile); + if (fsize == -1) { + PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); + fclose(statesfile); + exit(5); + } + uint32_t filesize = (uint32_t)fsize; + rewind(statesfile); + + if (open_uncompressed) { + + uint32_t count = 0; + size_t bytesread = fread(&count, 1, sizeof(count), statesfile); + if (bytesread != 4) { PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); fclose(statesfile); exit(5); } - uint32_t filesize = (uint32_t)fsize; - rewind(statesfile); + + if ((float)count / (1 << 24) < IGNORE_BITFLIP_THRESHOLD) { + uint32_t *bitset = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); + if (bitset == NULL) { + PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); + fclose(statesfile); + exit(4); + } + + bytesread = fread(bitset, 1, filesize - sizeof(count), statesfile); + if (bytesread != filesize - sizeof(count)) { + PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); + fclose(statesfile); + exit(5); + } + + effective_bitflip[odd_even][num_effective_bitflips[odd_even]++] = bitflip; + bitflip_bitarrays[odd_even][bitflip] = bitset; + count_bitflip_bitarrays[odd_even][bitflip] = count; +#if defined (DEBUG_REDUCTION) + PrintAndLogEx(INFO, "(%03" PRIx16 " %s:%5.1f%%) ", bitflip, odd_even ? "odd " : "even", (float)count / (1 << 24) * 100.0); + line++; + if (line == 8) { + PrintAndLogEx(NORMAL, ""); + line = 0; + } +#endif + } + fclose(statesfile); + nraw++; + continue; + + } else if (open_lz4compressed) { + + char *compressed_data = calloc(filesize, sizeof(uint8_t)); + if (compressed_data == NULL) { + PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); + fclose(statesfile); + exit(4); + } + size_t bytesread = fread(compressed_data, 1, filesize, statesfile); + if (bytesread != filesize) { + PrintAndLogEx(ERR, "File read error with %s (2). Aborting...\n", state_file_name); + free(compressed_data); + fclose(statesfile); + exit(5); + } + fclose(statesfile); + + char *uncompressed_data = calloc((sizeof(uint32_t) * (1 << 19)) + sizeof(uint32_t), sizeof(uint8_t)); + if (uncompressed_data == NULL) { + PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); + free(compressed_data); + exit(4); + } + + LZ4F_decompressionContext_t ctx; + LZ4F_errorCode_t result = LZ4F_createDecompressionContext(&ctx, LZ4F_VERSION); + if (LZ4F_isError(result)) { + PrintAndLogEx(ERR, "File read error with %s (3) Failed to create decompression context: %s. Aborting...\n", state_file_name, LZ4F_getErrorName(result)); + free(compressed_data); + free(uncompressed_data); + exit(5); + } + + size_t expected_output_size = (sizeof(uint32_t) * (1 << 19)) + sizeof(uint32_t); + size_t consumed_input_size = filesize; + size_t generated_output_size = expected_output_size; + result = LZ4F_decompress(ctx, uncompressed_data, &generated_output_size, compressed_data, &consumed_input_size, NULL); + + LZ4F_freeDecompressionContext(ctx); + free(compressed_data); + + if (LZ4F_isError(result)) { + PrintAndLogEx(ERR, "File read error with %s (3) %s. Aborting...\n", state_file_name, LZ4F_getErrorName(result)); + free(uncompressed_data); + exit(5); + } + if (generated_output_size != expected_output_size) { + PrintAndLogEx(ERR, "File read error with %s (3) got %lu instead of %lu bytes. Aborting...\n", state_file_name, generated_output_size, expected_output_size); + free(uncompressed_data); + exit(5); + } + + uint32_t count; + memcpy(&count, uncompressed_data, sizeof(uint32_t)); + + if ((float)count / (1 << 24) < IGNORE_BITFLIP_THRESHOLD) { + uint32_t *bitset = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); + if (bitset == NULL) { + PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); + free(uncompressed_data); + exit(4); + } + memcpy(bitset, uncompressed_data + sizeof(uint32_t), sizeof(uint32_t) * (1 << 19)); + effective_bitflip[odd_even][num_effective_bitflips[odd_even]++] = bitflip; + bitflip_bitarrays[odd_even][bitflip] = bitset; + count_bitflip_bitarrays[odd_even][bitflip] = count; +#if defined (DEBUG_REDUCTION) + PrintAndLogEx(INFO, "(%03" PRIx16 " %s:%5.1f%%) ", bitflip, odd_even ? "odd " : "even", (float)count / (1 << 24) * 100.0); + line++; + if (line == 8) { + PrintAndLogEx(NORMAL, ""); + line = 0; + } +#endif + } + free(uncompressed_data); + nlz4++; + continue; + } else if (open_bz2compressed) { + char input_buffer[filesize]; size_t bytesread = fread(input_buffer, 1, filesize, statesfile); if (bytesread != filesize) { PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); fclose(statesfile); - //BZ2_bzDecompressEnd(&compressed_stream); exit(5); } fclose(statesfile); + uint32_t count = 0; + bz_stream compressed_stream; init_bunzip2(&compressed_stream, input_buffer, filesize, (char *)&count, sizeof(count)); int res = BZ2_bzDecompress(&compressed_stream); if (res != BZ_OK) { @@ -346,57 +480,16 @@ static void init_bitflip_bitarrays(void) { #endif } BZ2_bzDecompressEnd(&compressed_stream); - } else { - fseek(statesfile, 0, SEEK_END); - int fsize = ftell(statesfile); - if (fsize == -1) { - PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); - fclose(statesfile); - exit(5); - } - uint32_t filesize = (uint32_t)fsize; - rewind(statesfile); - - uint32_t count = 0; - size_t bytesread = fread(&count, 1, sizeof(count), statesfile); - if (bytesread != 4) { - PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); - fclose(statesfile); - exit(5); - } - - if ((float)count / (1 << 24) < IGNORE_BITFLIP_THRESHOLD) { - uint32_t *bitset = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); - if (bitset == NULL) { - PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); - fclose(statesfile); - exit(4); - } - - bytesread = fread(bitset, 1, filesize-sizeof(count), statesfile); - if (bytesread != filesize-sizeof(count)) { - PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); - fclose(statesfile); - exit(5); - } - - effective_bitflip[odd_even][num_effective_bitflips[odd_even]++] = bitflip; - bitflip_bitarrays[odd_even][bitflip] = bitset; - count_bitflip_bitarrays[odd_even][bitflip] = count; -#if defined (DEBUG_REDUCTION) - PrintAndLogEx(INFO, "(%03" PRIx16 " %s:%5.1f%%) ", bitflip, odd_even ? "odd " : "even", (float)count / (1 << 24) * 100.0); - line++; - if (line == 8) { - PrintAndLogEx(NORMAL, ""); - line = 0; - } -#endif - } + nbz2++; } } effective_bitflip[odd_even][num_effective_bitflips[odd_even]] = 0x400; // EndOfList marker } - + { + char progress_text[80]; + snprintf(progress_text, sizeof(progress_text), "Loaded %u RAW / %u LZ4 / %u BZ2 in %"PRIu64" ms", nraw, nlz4, nbz2, msclock() - init_bitflip_bitarrays_starttime); + hardnested_print_progress(0, progress_text, (float)(1LL << 47), 0); + } uint16_t i = 0; uint16_t j = 0; num_all_effective_bitflips = 0; @@ -431,9 +524,11 @@ static void init_bitflip_bitarrays(void) { PrintAndLogEx(INFO, "%03x ", all_effective_bitflip[i]); } #endif - char progress_text[80]; - snprintf(progress_text, sizeof(progress_text), "Using %d precalculated bitflip state tables", num_all_effective_bitflips); - hardnested_print_progress(0, progress_text, (float)(1LL << 47), 0); + { + char progress_text[80]; + snprintf(progress_text, sizeof(progress_text), "Using %d precalculated bitflip state tables", num_all_effective_bitflips); + hardnested_print_progress(0, progress_text, (float)(1LL << 47), 0); + } } static void free_bitflip_bitarrays(void) { @@ -1468,7 +1563,20 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_ float brute_force_depth; FILE *fnonces = NULL; - PacketResponseNG resp; + + // init to ZERO + PacketResponseNG resp = { + .cmd = 0, + .length = 0, + .magic = 0, + .status = 0, + .crc = 0, + .ng = false, + }; + resp.oldarg[0] = 0; + resp.oldarg[1] = 0; + resp.oldarg[2] = 0; + memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); uint8_t write_buf[9]; char progress_text[80]; diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index 52f3da57e..c0078819b 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -283,7 +283,6 @@ static int CmdHFMFPInfo(const char *Cmd) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); - PrintAndLogEx(INFO, "-------------------------------------------------------------"); // Mifare Plus info SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); @@ -1811,7 +1810,7 @@ static int CmdHFMFPNDEFWrite(const char *Cmd) { } static int CmdHFMFPList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf mf", "mf"); + return CmdTraceListAlias(Cmd, "hf mfp", "mfp -c"); } static command_t CommandTable[] = { diff --git a/client/src/cmdhfmfp.h b/client/src/cmdhfmfp.h index 29723b204..e8be12e07 100644 --- a/client/src/cmdhfmfp.h +++ b/client/src/cmdhfmfp.h @@ -20,10 +20,6 @@ #include "common.h" - -#define AES_KEY_LEN 16 -#define MAX_AES_KEYS_LIST_LEN 1024 - typedef enum { MFP_UNKNOWN = 0, DESFIRE_MF3ICD40, diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 9f7f54c53..13b8c9cb4 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -30,9 +30,10 @@ #include "nfc/ndef.h" #include "cliparser.h" #include "cmdmain.h" -#include "amiibo.h" // amiiboo fcts +#include "amiibo.h" // amiiboo fcts #include "base64.h" -#include "fileutils.h" // saveFile +#include "fileutils.h" // saveFile +#include "cmdtrace.h" // trace list #define MAX_UL_BLOCKS 0x0F #define MAX_ULC_BLOCKS 0x2F @@ -190,7 +191,7 @@ int ul_read_uid(uint8_t *uid) { // 2: OK, no ATS // 3: proprietary Anticollision if (select_status == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); return PM3_ESOFT; } if (card.uidlen != 7) { @@ -224,14 +225,14 @@ static bool ul_select(iso14a_card_select_t *card) { PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { - PrintAndLogEx(WARNING, "timeout while waiting for reply."); + PrintAndLogEx(DEBUG, "iso14443a card select timeout"); DropField(); return false; } else { uint16_t len = (resp.oldarg[1] & 0xFFFF); if (len == 0) { - PrintAndLogEx(WARNING, "iso14443a card select failed"); + PrintAndLogEx(DEBUG, "iso14443a card select failed"); DropField(); return false; } @@ -1097,7 +1098,7 @@ static int ulev1_print_signature(TagTypeUL_t tagtype, uint8_t *uid, uint8_t *sig return PM3_ESOFT; } - PrintAndLogEx(INFO, " IC signature public key name: %s", nxp_mfu_public_keys[i].desc); + PrintAndLogEx(INFO, " IC signature public key name: " _GREEN_("%s"), nxp_mfu_public_keys[i].desc); PrintAndLogEx(INFO, "IC signature public key value: %s", nxp_mfu_public_keys[i].value); PrintAndLogEx(INFO, " Elliptic curve parameters: NID_secp128r1"); PrintAndLogEx(INFO, " TAG IC Signature: %s", sprint_hex_inrow(signature, signature_len)); @@ -1351,7 +1352,7 @@ static mfu_identify_t mfu_ident_table[] = { "Jooki", "0004040201000F03", 12, 32, "E11012000103A00C340329D101255504732E6A6F6F6B692E726F636B732F732F", ul_ev1_pwdgen_def, ul_ev1_packgen_def, - "hf jooki decode -r" + "hf mfu ndefread" }, { "Lego Dimensions", "0004040201000F03", @@ -1785,7 +1786,6 @@ static int CmdHF14AMfUInfo(const char *Cmd) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " --------------------------"); - PrintAndLogEx(INFO, "-------------------------------------------------------------"); ul_print_type(tagtype, 6); // Swap endianness @@ -3067,6 +3067,7 @@ static int CmdHF14AMfUeLoad(const char *Cmd) { arg_param_begin, arg_str1("f", "file", "", "Filename of dump"), arg_int0("q", "qty", "", "Number of blocks to load from eml file"), + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -3083,6 +3084,7 @@ static int CmdHF14AMfUeLoad(const char *Cmd) { free(nc); PrintAndLogEx(HINT, "Try " _YELLOW_("`hf mfu sim -t 7`") " to simulate an Amiibo."); + PrintAndLogEx(INFO, "Done!"); return res; } @@ -3104,7 +3106,7 @@ static int CmdHF14AMfUSim(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_int1("t", "type", "<1..10> ", "Simulation type to use"), + arg_int1("t", "type", "<1..12> ", "Simulation type to use"), arg_str0("u", "uid", "", "<4|7|10> hex bytes UID"), arg_int0("n", "num", "", "Exit simulation after blocks. 0 = infinite"), arg_lit0("v", "verbose", "Verbose output"), @@ -4670,6 +4672,10 @@ static int CmdHF14AMfuView(const char *Cmd) { return PM3_SUCCESS; } +static int CmdHF14AMfuList(const char *Cmd) { + return CmdTraceListAlias(Cmd, "hf 14a", "14a -c"); +} + /* static int CmdHF14AMfUCDecryptAmiibo(const char *Cmd){ @@ -4716,6 +4722,7 @@ static int CmdHF14AMfUCDecryptAmiibo(const char *Cmd){ //------------------------------------ static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, + {"list", CmdHF14AMfuList, AlwaysAvailable, "List MIFARE Ultralight / NTAG history"}, {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("recovery") " -------------------------"}, {"keygen", CmdHF14AMfUGenDiverseKeys, AlwaysAvailable, "Generate 3DES MIFARE diversified keys"}, {"pwdgen", CmdHF14AMfUPwdGen, AlwaysAvailable, "Generate pwd from known algos"}, diff --git a/client/src/cmdhftexkom.c b/client/src/cmdhftexkom.c index 2b54480ca..6cb77a54e 100644 --- a/client/src/cmdhftexkom.c +++ b/client/src/cmdhftexkom.c @@ -253,7 +253,7 @@ static bool TexcomTK13Decode(uint32_t *implengths, uint32_t implengthslen, char return false; if (verbose) - PrintAndLogEx(INFO, "raw bit string [%zu]: %s", strlen(bitstring), bitstring); + PrintAndLogEx(INFO, "raw bit string [%3zu]... %s", strlen(bitstring), bitstring); // add trailing impulse (some tags just ignore it) if (strlen(bitstring) % 2 != 0) { @@ -280,7 +280,7 @@ static bool TexcomTK13Decode(uint32_t *implengths, uint32_t implengthslen, char return false; if (verbose) - PrintAndLogEx(INFO, "bit string [%zu]: %s", strlen(cbitstring), cbitstring); + PrintAndLogEx(INFO, "bit string [%3zu].... %s", strlen(cbitstring), cbitstring); return ((strlen(cbitstring) == 64) && (strncmp(cbitstring, "1111111111111111", 16) == 0)); } @@ -324,8 +324,8 @@ static bool TexcomTK15Decode(uint32_t *implengths, uint32_t implengthslen, char return false; if (verbose) { - PrintAndLogEx(INFO, "raw bit string [%zu]: %s", strlen(bitstring), bitstring); - PrintAndLogEx(INFO, "bit string [%zu]: %s", strlen(cbitstring), cbitstring); + PrintAndLogEx(INFO, "raw bit string [%3zu]... %s", strlen(bitstring), bitstring); + PrintAndLogEx(INFO, "bit string [%3zu]....... %s", strlen(cbitstring), cbitstring); } return ((strlen(cbitstring) == 64) && (strncmp(cbitstring, "1111111111111111", 16) == 0)); @@ -420,7 +420,7 @@ static bool TexcomGeneralDecode(uint32_t *implengths, uint32_t implengthslen, ch } } if (verbose) - PrintAndLogEx(INFO, "General raw bit string [%zu]: %s", strlen(bitstring), bitstring); + PrintAndLogEx(INFO, "General raw bit string [%zu]... %s", strlen(bitstring), bitstring); return (!biterror && strlen(bitstring) > 0); } @@ -588,30 +588,38 @@ int read_texkom_uid(bool loop, bool verbose) { } bool crc = (TexcomTK13CRC(&card.tcode[3]) == card.tcode[7]); + bool printed = false; if (card.tcode[2] == 0x63) { - PrintAndLogEx(INFO, "TYPE..... TK13"); + PrintAndLogEx(INFO, "TYPE..... " _YELLOW_("TK13")); PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4)); if (verbose) { PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); } + printed = true; } else if (card.tcode[2] == 0xCA) { - PrintAndLogEx(INFO, "TYPE..... TK17"); + PrintAndLogEx(INFO, "TYPE..... " _YELLOW_("TK17")); PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4)); if (verbose) { PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); } + printed = true; } else if (card.tcode[2] == 0xFF && card.tcode[3] == 0xFF) { - PrintAndLogEx(INFO, "TYPE..... MMBIT"); + PrintAndLogEx(INFO, "TYPE..... " _YELLOW_("MMBIT")); PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[4], 3)); - crc = (MMBITCRC(&card.tcode[4]) == card.tcode[7] >> 4); if (verbose) { + crc = (MMBITCRC(&card.tcode[4]) == card.tcode[7] >> 4); PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); } + printed = true; } + if (verbose) { - PrintAndLogEx(INFO, "Raw... %s", sprint_hex(card.tcode, 8)); - PrintAndLogEx(INFO, "Raw Reversed... %s", sprint_hex(card.rtcode, 8)); + PrintAndLogEx(INFO, "Raw....... " _YELLOW_("%s"), sprint_hex(card.tcode, 8)); + PrintAndLogEx(INFO, "Raw rev... " _YELLOW_("%s"), sprint_hex(card.rtcode, 8)); + } + if (printed && loop) { + PrintAndLogEx(NORMAL, ""); } } @@ -753,82 +761,84 @@ static int CmdHFTexkomReader(const char *Cmd) { TexcomReverseCode(tcode, 8, rtcode); if (verbose) { - PrintAndLogEx(INFO, "Hex code: %s", sprint_hex(tcode, 8)); - PrintAndLogEx(INFO, "Hex code reversed: %s", sprint_hex(rtcode, 8)); + PrintAndLogEx(INFO, "Hex code............ %s", sprint_hex(tcode, 8)); + PrintAndLogEx(INFO, "Hex code rev........ %s", sprint_hex(rtcode, 8)); } if (tcode[0] == 0xff && tcode[1] == 0xff) { // decoding code if (verbose == false) { - PrintAndLogEx(INFO, "Texkom: %s", sprint_hex(tcode, 8)); - PrintAndLogEx(INFO, "Texkom duplicator: %s", sprint_hex(rtcode, 8)); + PrintAndLogEx(SUCCESS, "Texkom.............. %s", sprint_hex(tcode, 8)); + PrintAndLogEx(SUCCESS, "Texkom duplicator... %s", sprint_hex(rtcode, 8)); } if (codefound == TexkomModTK13) - PrintAndLogEx(INFO, "modulation: TK13"); + PrintAndLogEx(SUCCESS, "Modulation.......... " _YELLOW_("TK13")); else if (codefound == TexkomModTK15) - PrintAndLogEx(INFO, "modulation: TK15"); + PrintAndLogEx(SUCCESS, "Modulation.......... " _YELLOW_("TK15")); else if (codefound == TexkomModTK17) - PrintAndLogEx(INFO, "modulation: TK17"); + PrintAndLogEx(SUCCESS, "Modulation.......... " _YELLOW_("TK17")); else - PrintAndLogEx(INFO, "modulation: unknown"); + PrintAndLogEx(INFO, "Modulation.......... " _YELLOW_("unknown")); if (tcode[2] == 0x63) { // TK13 and TK15. differs only by timings. TK15 has impulse 0 and 1 lengths very close to each other. if (codefound == TexkomModTK13) - PrintAndLogEx(INFO, "type : TK13"); + PrintAndLogEx(SUCCESS, "Type................ " _YELLOW_("TK13")); else if (codefound == TexkomModTK15) - PrintAndLogEx(INFO, "type : TK15"); + PrintAndLogEx(SUCCESS, "Type................ " _YELLOW_("TK15")); else - PrintAndLogEx(WARNING, " mod type: WRONG"); - - PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4)); + PrintAndLogEx(WARNING, "Type................ " _RED_("fail")); + PrintAndLogEx(SUCCESS, "UID................. " _YELLOW_("%s"), sprint_hex(&tcode[3], 4)); + PrintAndLogEx(INFO, "CRC................ " NOLF); if (TexcomTK13CRC(&tcode[3]) == tcode[7]) - PrintAndLogEx(INFO, "crc : OK"); + PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); else - PrintAndLogEx(WARNING, "crc : WRONG"); + PrintAndLogEx(NORMAL, "( " _RED_("fail") " )"); } else if (tcode[2] == 0xFF && tcode[3] == 0xFF) { // MMBIT if (codefound != TexkomModTK13 && codefound != TexkomModTK15) { - PrintAndLogEx(WARNING, " mod type: WRONG"); + PrintAndLogEx(WARNING, "Mod type............ " _RED_("fail")); } - PrintAndLogEx(INFO, "type : MMBIT"); - PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[4], 3)); - + PrintAndLogEx(SUCCESS, "Type................ " _YELLOW_("MMBIT")); + PrintAndLogEx(SUCCESS, "UID................. " _YELLOW_("%s"), sprint_hex(&tcode[4], 3)); + PrintAndLogEx(INFO, "CRC................ " NOLF); if (MMBITCRC(&tcode[4]) == tcode[7] >> 4) - PrintAndLogEx(INFO, "crc : OK"); + PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); else - PrintAndLogEx(WARNING, "crc : WRONG"); + PrintAndLogEx(NORMAL, "( " _RED_("fail") " )"); + + } else if (tcode[2] == 0xCA) { // TK17 if (codefound != TexkomModTK17) { - PrintAndLogEx(WARNING, " mod type: WRONG"); + PrintAndLogEx(WARNING, "Mod type............ " _RED_("fail")); } - PrintAndLogEx(INFO, "type : TK17"); - PrintAndLogEx(INFO, "uid : %s", sprint_hex(&tcode[3], 4)); - + PrintAndLogEx(SUCCESS, "Type............... " _YELLOW_("TK17")); + PrintAndLogEx(SUCCESS, "UID................ " _YELLOW_("%s"), sprint_hex(&tcode[3], 4)); + PrintAndLogEx(INFO, "CRC................ " NOLF); if (TexcomTK17CRC(&tcode[3]) == tcode[7]) - PrintAndLogEx(INFO, "crc : OK"); + PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); else - PrintAndLogEx(WARNING, "crc : WRONG"); + PrintAndLogEx(NORMAL, "( " _RED_("fail") " )"); } else { - PrintAndLogEx(INFO, "type : unknown"); - PrintAndLogEx(INFO, "uid : %s (maybe)", sprint_hex(&tcode[3], 4)); + PrintAndLogEx(INFO, "Type............... unknown"); + PrintAndLogEx(INFO, "UID................ %s (maybe)", sprint_hex(&tcode[3], 4)); } } else { - PrintAndLogEx(ERR, "Code have no preamble FFFF: %s", sprint_hex(tcode, 8)); + PrintAndLogEx(ERR, "Code have no preamble FFFF... %s", sprint_hex(tcode, 8)); } } else { if (strlen(genbitstring) > 0) - PrintAndLogEx(INFO, "General decoding bitstring: %s", genbitstring); + PrintAndLogEx(INFO, "General decoding bitstring... %s", genbitstring); if (strlen(bitstring) > 0) - PrintAndLogEx(INFO, "last raw bit string [%zu]: %s", strlen(bitstring), bitstring); + PrintAndLogEx(INFO, "last raw bit string [%zu].... %s", strlen(bitstring), bitstring); if (strlen(cbitstring) > 0) - PrintAndLogEx(INFO, "last bit string [%zu]: %s", strlen(cbitstring), cbitstring); + PrintAndLogEx(INFO, "last bit string [%zu]........ %s", strlen(cbitstring), cbitstring); PrintAndLogEx(ERR, "Texkom card is not found"); } @@ -840,10 +850,10 @@ static int CmdHFTexkomSim(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf texkom sim", "Simulate a texkom tag", - "hf texkom sim \r\n" - "hf texkom sim --raw FFFF638C7DC45553 -> simulate TK13 tag with id 8C7DC455\r\n" - "hf texkom sim --tk17 --raw FFFFCA17F31EC512 -> simulate TK17 tag with id 17F31EC5\r\n" - "hf texkom sim --id 8C7DC455 -> simulate TK13 tag with id 8C7DC455\r\n" + "hf texkom sim \n" + "hf texkom sim --raw FFFF638C7DC45553 -> simulate TK13 tag with id 8C7DC455\n" + "hf texkom sim --tk17 --raw FFFFCA17F31EC512 -> simulate TK17 tag with id 17F31EC5\n" + "hf texkom sim --id 8C7DC455 -> simulate TK13 tag with id 8C7DC455\n" "hf texkom sim --id 8C7DC455 --tk17 -> simulate TK17 tag with id 17F31EC5"); void *argtable[] = { diff --git a/client/src/cmdhfthinfilm.c b/client/src/cmdhfthinfilm.c index 92c82f3f3..64b03a819 100644 --- a/client/src/cmdhfthinfilm.c +++ b/client/src/cmdhfthinfilm.c @@ -43,7 +43,7 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len, bool verbos if (verbose) { PrintAndLogEx(SUCCESS, " Data format : "_YELLOW_("%02X"), barcode[1]); if (barcode_len > 2) { - uint8_t b1, b2; + uint8_t b1 = 0, b2 = 0; compute_crc(CRC_14443_A, barcode, barcode_len - 2, &b1, &b2); bool isok = (barcode[barcode_len - 1] == b1 && barcode[barcode_len - 2] == b2); @@ -173,7 +173,7 @@ int CmdHfThinFilmSim(const char *Cmd) { CLIParserFree(ctx); if (addcrc && data_len <= 510) { - uint8_t b1, b2; + uint8_t b1 = 0, b2 = 0; compute_crc(CRC_14443_A, data, data_len, &b1, &b2); data[data_len++] = b2; data[data_len++] = b1; diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index 4483e3154..649882416 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -812,7 +812,7 @@ static int CmdHFTopazRaw(const char *Cmd) { } static int CmdHFTopazList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf topaz", "topaz"); + return CmdTraceListAlias(Cmd, "hf topaz", "topaz -c"); } static int CmdHFTopazSniff(const char *Cmd) { diff --git a/client/src/cmdhfvas.c b/client/src/cmdhfvas.c index 2bb5c8341..4e4a305e5 100644 --- a/client/src/cmdhfvas.c +++ b/client/src/cmdhfvas.c @@ -28,8 +28,8 @@ #include "util.h" #include "util_posix.h" #include "iso7816/iso7816core.h" -#include "stddef.h" -#include "stdbool.h" +#include +#include #include "mifare.h" #include #include @@ -41,15 +41,28 @@ #include "mbedtls/ecc_point_compression.h" #include "mbedtls/gcm.h" -uint8_t ecpData[] = { 0x6a, 0x01, 0x00, 0x00, 0x04 }; +static const iso14a_polling_frame_t WUPA_FRAME = { + .frame = { 0x52 }, + .frame_length = 1, + .last_byte_bits = 7, + .extra_delay = 0, +}; + +static const iso14a_polling_frame_t ECP_VAS_ONLY_FRAME = { + .frame = {0x6a, 0x01, 0x00, 0x00, 0x02, 0xe4, 0xd2}, + .frame_length = 7, + .last_byte_bits = 8, + .extra_delay = 0, +}; + uint8_t aid[] = { 0x4f, 0x53, 0x45, 0x2e, 0x56, 0x41, 0x53, 0x2e, 0x30, 0x31 }; uint8_t getVasUrlOnlyP2 = 0x00; uint8_t getVasFullReqP2 = 0x01; -static int ParseSelectVASResponse(uint8_t *response, size_t resLen, bool verbose) { +static int ParseSelectVASResponse(const uint8_t *response, size_t resLen, bool verbose) { struct tlvdb *tlvRoot = tlvdb_parse_multi(response, resLen); - struct tlvdb *versionTlv = tlvdb_find_full(tlvRoot, 0x9F21); + const struct tlvdb *versionTlv = tlvdb_find_full(tlvRoot, 0x9F21); if (versionTlv == NULL) { tlvdb_free(tlvRoot); return PM3_ECARDEXCHANGE; @@ -67,7 +80,7 @@ static int ParseSelectVASResponse(uint8_t *response, size_t resLen, bool verbose return PM3_ECARDEXCHANGE; } - struct tlvdb *capabilitiesTlv = tlvdb_find_full(tlvRoot, 0x9F23); + const struct tlvdb *capabilitiesTlv = tlvdb_find_full(tlvRoot, 0x9F23); if (capabilitiesTlv == NULL) { tlvdb_free(tlvRoot); return PM3_ECARDEXCHANGE; @@ -86,7 +99,7 @@ static int ParseSelectVASResponse(uint8_t *response, size_t resLen, bool verbose return PM3_SUCCESS; } -static int CreateGetVASDataCommand(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *out, int *outLen) { +static int CreateGetVASDataCommand(const uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *out, int *outLen) { if (pidHash == NULL && url == NULL) { PrintAndLogEx(FAILED, "Must provide a Pass Type ID or a URL"); return PM3_EINVARG; @@ -141,10 +154,10 @@ static int CreateGetVASDataCommand(uint8_t *pidHash, const char *url, size_t url return PM3_SUCCESS; } -static int ParseGetVASDataResponse(uint8_t *res, size_t resLen, uint8_t *cryptogram, size_t *cryptogramLen) { +static int ParseGetVASDataResponse(const uint8_t *res, size_t resLen, uint8_t *cryptogram, size_t *cryptogramLen) { struct tlvdb *tlvRoot = tlvdb_parse_multi(res, resLen); - struct tlvdb *cryptogramTlvdb = tlvdb_find_full(tlvRoot, 0x9F27); + const struct tlvdb *cryptogramTlvdb = tlvdb_find_full(tlvRoot, 0x9F27); if (cryptogramTlvdb == NULL) { tlvdb_free(tlvRoot); return PM3_ECARDEXCHANGE; @@ -158,10 +171,10 @@ static int ParseGetVASDataResponse(uint8_t *res, size_t resLen, uint8_t *cryptog return PM3_SUCCESS; } -static int LoadReaderPrivateKey(uint8_t *buf, size_t bufLen, mbedtls_ecp_keypair *privKey) { +static int LoadReaderPrivateKey(const uint8_t *buf, size_t bufLen, mbedtls_ecp_keypair *privKey) { struct tlvdb *derRoot = tlvdb_parse_multi(buf, bufLen); - struct tlvdb *privkeyTlvdb = tlvdb_find_full(derRoot, 0x04); + const struct tlvdb *privkeyTlvdb = tlvdb_find_full(derRoot, 0x04); if (privkeyTlvdb == NULL) { tlvdb_free(derRoot); return PM3_EINVARG; @@ -174,7 +187,7 @@ static int LoadReaderPrivateKey(uint8_t *buf, size_t bufLen, mbedtls_ecp_keypair return PM3_EINVARG; } - struct tlvdb *pubkeyCoordsTlvdb = tlvdb_find_full(derRoot, 0x03); + const struct tlvdb *pubkeyCoordsTlvdb = tlvdb_find_full(derRoot, 0x03); if (pubkeyCoordsTlvdb == NULL) { tlvdb_free(derRoot); PrintAndLogEx(FAILED, "Private key file should include public key component"); @@ -216,7 +229,7 @@ static int GetPrivateKeyHint(mbedtls_ecp_keypair *privKey, uint8_t *keyHint) { return PM3_SUCCESS; } -static int LoadMobileEphemeralKey(uint8_t *xcoordBuf, mbedtls_ecp_keypair *pubKey) { +static int LoadMobileEphemeralKey(const uint8_t *xcoordBuf, mbedtls_ecp_keypair *pubKey) { uint8_t compressedEcKey[33] = {0}; compressedEcKey[0] = 0x02; memcpy(compressedEcKey + 1, xcoordBuf, 32); @@ -236,7 +249,7 @@ static int LoadMobileEphemeralKey(uint8_t *xcoordBuf, mbedtls_ecp_keypair *pubKe static int internalVasDecrypt(uint8_t *cipherText, size_t cipherTextLen, uint8_t *sharedSecret, uint8_t *ansiSharedInfo, size_t ansiSharedInfoLen, - uint8_t *gcmAad, size_t gcmAadLen, uint8_t *out, size_t *outLen) { + const uint8_t *gcmAad, size_t gcmAadLen, uint8_t *out, size_t *outLen) { uint8_t key[32] = {0}; if (ansi_x963_sha256(sharedSecret, 32, ansiSharedInfo, ansiSharedInfoLen, sizeof(key), key)) { PrintAndLogEx(FAILED, "ANSI X9.63 key derivation failed"); @@ -336,12 +349,13 @@ static int DecryptVASCryptogram(uint8_t *pidHash, uint8_t *cryptogram, size_t cr static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *cryptogram, size_t *cryptogramLen, bool verbose) { clearCommandBuffer(); - uint16_t flags = ISO14A_RAW | ISO14A_CONNECT | ISO14A_NO_SELECT | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT; - SendCommandMIX(CMD_HF_ISO14443A_READER, flags, sizeof(ecpData), 0, ecpData, sizeof(ecpData)); + iso14a_polling_parameters_t polling_parameters = { + .frames = { WUPA_FRAME, ECP_VAS_ONLY_FRAME }, + .frame_count = 2, + .extra_timeout = 250 + }; - msleep(160); - - if (SelectCard14443A_4(false, false, NULL) != PM3_SUCCESS) { + if (SelectCard14443A_4_WithParameters(false, false, NULL, &polling_parameters) != PM3_SUCCESS) { PrintAndLogEx(FAILED, "No card in field"); return PM3_ECARDEXCHANGE; } @@ -349,7 +363,7 @@ static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t * uint16_t status = 0; size_t resLen = 0; uint8_t selectResponse[APDU_RES_LEN] = {0}; - Iso7816Select(CC_CONTACTLESS, true, true, aid, sizeof(aid), selectResponse, APDU_RES_LEN, &resLen, &status); + Iso7816Select(CC_CONTACTLESS, false, true, aid, sizeof(aid), selectResponse, APDU_RES_LEN, &resLen, &status); if (status != 0x9000) { PrintAndLogEx(FAILED, "Card doesn't support VAS"); diff --git a/client/src/cmdhfwaveshare.c b/client/src/cmdhfwaveshare.c index 8df62bcc1..8bb9eadc8 100644 --- a/client/src/cmdhfwaveshare.c +++ b/client/src/cmdhfwaveshare.c @@ -1064,7 +1064,14 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) { size_t bytes_read = 0; if (loadFile_safe(filename, ".bmp", (void **)&bmp, &bytes_read) != PM3_SUCCESS) { PrintAndLogEx(WARNING, "Could not find file " _YELLOW_("%s"), filename); - return PM3_EIO; + return PM3_EFILE; + } + if (bmp == NULL) { + return PM3_EMALLOC; + } + if (bytes_read < sizeof(bmp_header_t)) { + free(bmp); + return PM3_ESOFT; } int depth = picture_bit_depth(bmp, bytes_read, model_nr); diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index 57bba66aa..4b26bc00e 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -27,6 +27,7 @@ #include "comms.h" #include "usart_defs.h" #include "ui.h" +#include "fpga.h" #include "cmdhw.h" #include "cmddata.h" #include "commonutil.h" @@ -690,7 +691,7 @@ static int CmdSetDivisor(const char *Cmd) { CLIParserFree(ctx); if (arg < 19) { - PrintAndLogEx(ERR, "Divisor must be between" _YELLOW_("19") " and " _YELLOW_("255")); + PrintAndLogEx(ERR, "Divisor must be between " _YELLOW_("19") " and " _YELLOW_("255")); return PM3_EINVARG; } // 12 000 000 (12MHz) @@ -1083,6 +1084,23 @@ static int CmdBreak(const char *Cmd) { return PM3_SUCCESS; } +int set_fpga_mode(uint8_t mode) { + if (mode < 1 || mode > 4) { + return PM3_EINVARG; + } + uint8_t d[] = {mode}; + clearCommandBuffer(); + SendCommandNG(CMD_SET_FPGAMODE, d, sizeof(d)); + PacketResponseNG resp; + if (WaitForResponseTimeout(CMD_SET_FPGAMODE, &resp, 1000) == false) { + PrintAndLogEx(WARNING, "command execution timeout"); + return PM3_ETIMEOUT; + } + if (resp.status != PM3_SUCCESS) { + PrintAndLogEx(ERR, "failed to set FPGA mode"); + } + return resp.status; +} static command_t CommandTable[] = { {"-------------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Hardware") " -----------------------"}, @@ -1276,7 +1294,7 @@ void pm3_version(bool verbose, bool oneliner) { return; PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("Proxmark3 RFID instrument") " ]"); - PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("CLIENT") " ]"); + PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("Client") " ]"); FormatVersionInformation(temp, sizeof(temp), " ", &g_version_information); PrintAndLogEx(NORMAL, "%s", temp); PrintAndLogEx(NORMAL, " compiled with............. " PM3CLIENTCOMPILER __VERSION__); @@ -1315,7 +1333,7 @@ void pm3_version(bool verbose, bool oneliner) { #endif if (g_session.pm3_present) { - PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("PROXMARK3") " ]"); + PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("Proxmark3") " ]"); PacketResponseNG resp; clearCommandBuffer(); @@ -1375,7 +1393,7 @@ void pm3_version(bool verbose, bool oneliner) { } } PrintAndLogEx(NORMAL, payload->versionstr); - if (strstr(payload->versionstr, "2s30vq100") == NULL) { + if (strstr(payload->versionstr, FPGA_TYPE) == NULL) { PrintAndLogEx(NORMAL, " FPGA firmware... %s", _RED_("chip mismatch")); } diff --git a/client/src/cmdhw.h b/client/src/cmdhw.h index 4756a7cb0..a2b4f96e1 100644 --- a/client/src/cmdhw.h +++ b/client/src/cmdhw.h @@ -27,5 +27,5 @@ int CmdHW(const char *Cmd); int handle_tearoff(tearoff_params_t *params, bool verbose); void pm3_version(bool verbose, bool oneliner); void pm3_version_short(void); - +int set_fpga_mode(uint8_t mode); #endif diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index e6585d334..87095631b 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -352,18 +352,21 @@ int CmdLFCommandRead(const char *Cmd) { } } - PrintAndLogEx(DEBUG, "Cmd read - settings"); + PrintAndLogEx(DEBUG, _CYAN_("Cmd read - settings")); PrintAndLogEx(DEBUG, "-------------------"); - PrintAndLogEx(DEBUG, "delay: %u , zero %u , one %u , samples %u", payload.delay, payload.period_0, payload.period_1, payload.samples); - PrintAndLogEx(DEBUG, "Extra symbols"); + PrintAndLogEx(DEBUG, "delay... " _YELLOW_("%u")" zero... " _YELLOW_("%u") " one... " _YELLOW_("%u")" samples... %u", payload.delay, payload.period_0, payload.period_1, payload.samples); + PrintAndLogEx(DEBUG, ""); + PrintAndLogEx(DEBUG, _CYAN_("Extra symbols")); PrintAndLogEx(DEBUG, "-------------"); for (i = 0; i < LF_CMDREAD_MAX_EXTRA_SYMBOLS; i++) { if (payload.symbol_extra[i] == 0x00) continue; - PrintAndLogEx(DEBUG, " %c - %u", payload.symbol_extra[i], payload.period_extra[i]); + PrintAndLogEx(DEBUG, " %c ... " _YELLOW_("%u"), payload.symbol_extra[i], payload.period_extra[i]); } - PrintAndLogEx(DEBUG, "data: %s", payload.data); + PrintAndLogEx(DEBUG, ""); + PrintAndLogEx(DEBUG, "data... " _YELLOW_("%s"), payload.data); + PrintAndLogEx(DEBUG, ""); if (cm) { PrintAndLogEx(INFO, "Press " _GREEN_("") " to exit"); @@ -379,6 +382,17 @@ int CmdLFCommandRead(const char *Cmd) { SendCommandNG(CMD_LF_MOD_THEN_ACQ_RAW_ADC, (uint8_t *)&payload, PAYLOAD_HEADER_SIZE + cmd_len); PacketResponseNG resp; + // init to ZERO + resp.cmd = 0, + resp.length = 0, + resp.magic = 0, + resp.status = 0, + resp.crc = 0, + resp.ng = false, + resp.oldarg[0] = 0; + resp.oldarg[1] = 0; + resp.oldarg[2] = 0; + memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); i = 10; // 20sec wait loop @@ -1825,7 +1839,7 @@ static command_t CommandTable[] = { {"io", CmdLFIO, AlwaysAvailable, "{ ioProx RFIDs... }"}, {"jablotron", CmdLFJablotron, AlwaysAvailable, "{ Jablotron RFIDs... }"}, {"keri", CmdLFKeri, AlwaysAvailable, "{ KERI RFIDs... }"}, - {"motorola", CmdLFMotorola, AlwaysAvailable, "{ Motorola RFIDs... }"}, + {"motorola", CmdLFMotorola, AlwaysAvailable, "{ Motorola Flexpass RFIDs... }"}, {"nedap", CmdLFNedap, AlwaysAvailable, "{ Nedap RFIDs... }"}, {"nexwatch", CmdLFNEXWATCH, AlwaysAvailable, "{ NexWatch RFIDs... }"}, {"noralsy", CmdLFNoralsy, AlwaysAvailable, "{ Noralsy RFIDs... }"}, diff --git a/client/src/cmdlfcotag.c b/client/src/cmdlfcotag.c index 7c4bf1541..2306b0024 100644 --- a/client/src/cmdlfcotag.c +++ b/client/src/cmdlfcotag.c @@ -25,6 +25,7 @@ #include "ui.h" // PrintAndLog #include "ctype.h" // tolower #include "cliparser.h" +#include "commonutil.h" // reflect32 static int CmdHelp(const char *Cmd); @@ -37,6 +38,9 @@ int demodCOTAG(bool verbose) { size_t bitlen = COTAG_BITS; memcpy(bits, g_DemodBuffer, COTAG_BITS); + uint8_t inv_bits[COTAG_BITS] = {0}; + memcpy(inv_bits, g_DemodBuffer, COTAG_BITS); + uint8_t alignPos = 0; uint16_t err = manrawdecode(bits, &bitlen, 1, &alignPos); if (err > 50) { @@ -55,14 +59,38 @@ int demodCOTAG(bool verbose) { uint32_t raw3 = bytebits_to_byteLSBF(bits + 64, 32); uint32_t raw4 = bytebits_to_byteLSBF(bits + 96, 32); + /* fc 161: 1010 0001 -> LSB 1000 0101 cn 33593 1000 0011 0011 1001 -> LSB 1001 1100 1100 0001 cccc cccc cccc cccc ffffffff 0 1001 1100 1100 0001 1000 0101 0000 0000 100001010000000001111011100000011010000010000000000000000000000000000000000000000000000000000000100111001100000110000101000 1001 1100 1100 0001 10000101 + + COTAG FC/272 + 1 7 7 D E 2 0 0 8 0 0 0 3 9 2 0 D 0 4 0000000000000 + 0001 0111 0111 1101 1110 0010 0000 0000 1000 0000 0000 0000 0011 1001 0010 0000 1101 0000 0100 0000000000000000000000000000000000000000000000000000000 + 0001 0111 0111 1101 1110 001 0010 1001 0011 1000 0110 0100 + */ - PrintAndLogEx(SUCCESS, "COTAG Found: FC %u, CN: %u Raw: %08X%08X%08X%08X", fc, cn, raw1, raw2, raw3, raw4); + PrintAndLogEx(SUCCESS, "COTAG Found: FC " _GREEN_("%u")", CN: " _GREEN_("%u")" Raw: %08X%08X%08X%08X", fc, cn, raw1, raw2, raw3, raw4); + + bitlen = COTAG_BITS; + err = manrawdecode(inv_bits, &bitlen, 0, &alignPos); + if (err < 50) { + uint32_t cn_large = bytebits_to_byte(inv_bits + 1, 23); + cn_large = reflect32(cn_large) >> 9; + uint8_t a = bytebits_to_byte(inv_bits + 48, 4); + uint8_t b = bytebits_to_byte(inv_bits + 52, 4); + uint8_t c = bytebits_to_byte(inv_bits + 56, 4); + uint16_t fc_large = NIBBLE_LOW(c) << 8 | NIBBLE_LOW(b) << 4 | NIBBLE_LOW(a); + + raw1 = bytebits_to_byte(inv_bits, 32); + raw2 = bytebits_to_byte(inv_bits + 32, 32); + raw3 = bytebits_to_byte(inv_bits + 64, 32); + raw4 = bytebits_to_byte(inv_bits + 96, 32); + PrintAndLogEx(SUCCESS, " FC " _GREEN_("%u")", CN: " _GREEN_("%u")" Raw: %08X%08X%08X%08X", fc_large, cn_large, raw1, raw2, raw3, raw4); + } return PM3_SUCCESS; } @@ -75,11 +103,13 @@ static int CmdCOTAGDemod(const char *Cmd) { void *argtable[] = { arg_param_begin, + arg_lit0("v", "verbose", "verbose output"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); + bool verbose = arg_get_lit(ctx, 1); CLIParserFree(ctx); - return demodCOTAG(true); + return demodCOTAG(verbose); } // When reading a COTAG. @@ -152,7 +182,7 @@ static int CmdCOTAGReader(const char *Cmd) { case 0: case 2: { CmdPlot(""); - CmdGrid("384"); + CmdGrid("-x 384"); getSamples(0, false); break; } diff --git a/client/src/cmdlfcotag.h b/client/src/cmdlfcotag.h index 9577dabdb..11f0b28ce 100644 --- a/client/src/cmdlfcotag.h +++ b/client/src/cmdlfcotag.h @@ -20,6 +20,7 @@ #define CMDLFCOTAG_H__ #include "common.h" +#include #ifndef COTAG_BITS #define COTAG_BITS 264 diff --git a/client/src/cmdlfem4x05.c b/client/src/cmdlfem4x05.c index c21540f45..665518a40 100644 --- a/client/src/cmdlfem4x05.c +++ b/client/src/cmdlfem4x05.c @@ -2162,14 +2162,14 @@ static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, {"brute", CmdEM4x05Brute, IfPm3Lf, "Bruteforce password"}, {"chk", CmdEM4x05Chk, IfPm3Lf, "Check passwords from dictionary"}, - {"demod", CmdEM4x05Demod, AlwaysAvailable, "demodulate a EM4x05/EM4x69 tag from the GraphBuffer"}, - {"dump", CmdEM4x05Dump, IfPm3Lf, "dump EM4x05/EM4x69 tag"}, - {"info", CmdEM4x05Info, IfPm3Lf, "tag information EM4x05/EM4x69"}, - {"read", CmdEM4x05Read, IfPm3Lf, "read word data from EM4x05/EM4x69"}, + {"demod", CmdEM4x05Demod, AlwaysAvailable, "Demodulate a EM4x05/EM4x69 tag from the GraphBuffer"}, + {"dump", CmdEM4x05Dump, IfPm3Lf, "Dump EM4x05/EM4x69 tag"}, + {"info", CmdEM4x05Info, IfPm3Lf, "Tag information"}, + {"read", CmdEM4x05Read, IfPm3Lf, "Read word data from EM4x05/EM4x69"}, {"sniff", CmdEM4x05Sniff, AlwaysAvailable, "Attempt to recover em4x05 commands from sample buffer"}, - {"unlock", CmdEM4x05Unlock, IfPm3Lf, "execute tear off against EM4x05/EM4x69"}, - {"wipe", CmdEM4x05Wipe, IfPm3Lf, "wipe EM4x05/EM4x69 tag"}, - {"write", CmdEM4x05Write, IfPm3Lf, "write word data to EM4x05/EM4x69"}, + {"unlock", CmdEM4x05Unlock, IfPm3Lf, "Execute tear off against EM4x05/EM4x69"}, + {"wipe", CmdEM4x05Wipe, IfPm3Lf, "Wipe EM4x05/EM4x69 tag"}, + {"write", CmdEM4x05Write, IfPm3Lf, "Write word data to EM4x05/EM4x69"}, {NULL, NULL, NULL, NULL} }; diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index 07b1f91b0..a304a84fe 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -165,6 +165,8 @@ static int em4x50_load_file(const char *filename, uint8_t *data, size_t data_len static void em4x50_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) { + PrintAndLogEx(INFO, "uploading to emulator memory"); + PrintAndLogEx(INFO, "." NOLF); // fast push mode g_conn.block_after_ACK = true; for (size_t i = offset; i < numofbytes; i += PM3_CMD_DATA_SIZE) { @@ -176,7 +178,11 @@ static void em4x50_seteml(uint8_t *src, uint32_t offset, uint32_t numofbytes) { } clearCommandBuffer(); SendCommandOLD(CMD_LF_EM4X50_ESET, i, len, 0, src + i, len); + PrintAndLogEx(NORMAL, "." NOLF); + fflush(stdout); } + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, "uploaded " _YELLOW_("%d") " bytes to emulator memory", numofbytes); } int CmdEM4x50ELoad(const char *Cmd) { @@ -208,9 +214,8 @@ int CmdEM4x50ELoad(const char *Cmd) { } // upload to emulator memory - PrintAndLogEx(INFO, "Uploading to emulator memory contents of " _YELLOW_("%s"), filename); em4x50_seteml(data, 0, DUMP_FILESIZE); - + PrintAndLogEx(HINT, "You are ready to simulate. See " _YELLOW_("`lf em 4x50 sim -h`")); PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } @@ -1221,13 +1226,26 @@ int CmdEM4x50Sim(const char *Cmd) { } int status = PM3_EFAILED; - PrintAndLogEx(INFO, "Simulating data from emulator memory"); + PrintAndLogEx(INFO, "Starting simulating"); clearCommandBuffer(); SendCommandNG(CMD_LF_EM4X50_SIM, (uint8_t *)&password, sizeof(password)); - PacketResponseNG resp; PrintAndLogEx(INFO, "Press " _GREEN_("") " or pm3-button to abort simulation"); + + PacketResponseNG resp; + // init to ZERO + resp.cmd = 0, + resp.length = 0, + resp.magic = 0, + resp.status = 0, + resp.crc = 0, + resp.ng = false, + resp.oldarg[0] = 0; + resp.oldarg[1] = 0; + resp.oldarg[2] = 0; + memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + bool keypress; do { keypress = kbd_enter_pressed(); diff --git a/client/src/cmdlfem4x70.c b/client/src/cmdlfem4x70.c index d7bc3811a..c1e2aff03 100644 --- a/client/src/cmdlfem4x70.c +++ b/client/src/cmdlfem4x70.c @@ -35,8 +35,6 @@ static void print_info_result(const uint8_t *data) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); - PrintAndLogEx(INFO, "-----------------------------------------------"); - PrintAndLogEx(INFO, "Block | data | info"); PrintAndLogEx(INFO, "------+----------+-----------------------------"); diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c old mode 100755 new mode 100644 diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index 8cd28b842..1cbae7bd3 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -72,14 +72,14 @@ static int CmdLFHitagList(const char *Cmd) { } // Query for the actual size of the trace - PacketResponseNG response; - if (!GetFromDevice(BIG_BUF, got, PM3_CMD_DATA_SIZE, 0, NULL, 0, &response, 2500, false)) { + PacketResponseNG resp; + if (!GetFromDevice(BIG_BUF, got, PM3_CMD_DATA_SIZE, 0, NULL, 0, &resp, 2500, false)) { PrintAndLogEx(WARNING, "command execution time out"); free(got); return PM3_ETIMEOUT; } - uint16_t traceLen = response.arg[2]; + uint16_t traceLen = resp.arg[2]; if (traceLen > PM3_CMD_DATA_SIZE) { uint8_t *p = realloc(got, traceLen); if (p == NULL) { @@ -224,11 +224,11 @@ static int CmdLFHitagEload(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Specfiy dump filename"), - arg_lit0("1", NULL, "Card type Hitag1"), - arg_lit0("2", NULL, "Card type Hitag2"), - arg_lit0("s", NULL, "Card type HitagS"), - arg_lit0("m", NULL, "Card type HitagM"), + arg_str1("f", "file", "", "Specify dump filename"), + arg_lit0("1", "ht1", "Card type Hitag 1"), + arg_lit0("2", "ht2", "Card type Hitag 2"), + arg_lit0("s", "hts", "Card type Hitag S"), + arg_lit0("m", "htm", "Card type Hitag \xce\xbc"), // μ arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -243,9 +243,12 @@ static int CmdLFHitagEload(const char *Cmd) { bool use_htm = arg_get_lit(ctx, 5); CLIParserFree(ctx); - uint8_t n = (use_ht1 + use_ht2 + use_hts + use_htm); - if (n != 1) { - PrintAndLogEx(ERR, "error, only specify one Hitag type"); + if ((use_ht1 + use_ht2 + use_hts + use_htm) > 1) { + PrintAndLogEx(ERR, "error, specify only one Hitag type"); + return PM3_EINVARG; + } + if ((use_ht1 + use_ht2 + use_hts + use_htm) == 0) { + PrintAndLogEx(ERR, "error, specify one Hitag type"); return PM3_EINVARG; } @@ -288,16 +291,16 @@ static int CmdLFHitagEload(const char *Cmd) { static int CmdLFHitagSim(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf hitag sim", - "Simulate Hitag2 / HitagS transponder\n" + "Simulate Hitag transponder\n" "You need to `lf hitag eload` first", "lf hitag sim -2" ); void *argtable[] = { arg_param_begin, - arg_lit0("1", NULL, "simulate Hitag1"), - arg_lit0("2", NULL, "simulate Hitag2"), - arg_lit0("s", NULL, "simulate HitagS"), + arg_lit0("1", "ht1", "simulate Hitag 1"), + arg_lit0("2", "ht2", "simulate Hitag 2"), + arg_lit0("s", "hts", "simulate Hitag S"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -305,10 +308,15 @@ static int CmdLFHitagSim(const char *Cmd) { bool use_ht1 = arg_get_lit(ctx, 1); bool use_ht2 = arg_get_lit(ctx, 2); bool use_hts = arg_get_lit(ctx, 3); + bool use_htm = false; // not implemented yet CLIParserFree(ctx); - if ((use_ht1 + use_ht2 + use_hts) > 1) { - PrintAndLogEx(ERR, "error, Only specify one Hitag type"); + if ((use_ht1 + use_ht2 + use_hts + use_htm) > 1) { + PrintAndLogEx(ERR, "error, specify only one Hitag type"); + return PM3_EINVARG; + } + if ((use_ht1 + use_ht2 + use_hts + use_htm) == 0) { + PrintAndLogEx(ERR, "error, specify one Hitag type"); return PM3_EINVARG; } @@ -506,7 +514,6 @@ static int CmdLFHitagInfo(const char *Cmd) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); - PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%08X"), uid); PrintAndLogEx(SUCCESS, " TYPE: " _GREEN_("%s"), getHitagTypeStr(uid)); @@ -523,67 +530,85 @@ static int CmdLFHitagInfo(const char *Cmd) { return PM3_SUCCESS; } -// TODO: iceman -// Hitag2 reader, problem is that this command mixes up stuff. So 26 give uid. 21 etc will also give you a memory dump !? -// static int CmdLFHitagReader(const char *Cmd) { CLIParserContext *ctx; - CLIParserInit(&ctx, "lf hitag reader", - "Act like a Hitag Reader", - "Hitag S\n" - " lf hitag reader --01 --nrar 0102030411223344\n" - " lf hitag reader --02 -k 4F4E4D494B52\n" - "Hitag 2\n" - " lf hitag reader --21 -k 4D494B52\n" - " lf hitag reader --22 --nrar 0102030411223344\n" - " lf hitag reader --23 -k 4F4E4D494B52\n" - " lf hitag reader --26\n" + CLIParserInit(&ctx, "lf hitag read", + "Read Hitag memory\n" + "Crypto mode key format: ISK high + ISK low", + "Hitag S, plain mode\n" + " lf hitag read --hts\n" + "Hitag S, challenge mode\n" + " lf hitag read --hts --nrar 0102030411223344\n" + "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)\n" + " lf hitag read --hts --crypto\n" + "Hitag S, long key = crypto mode\n" + " lf hitag read --hts -k 4F4E4D494B52\n\n" + + "Hitag 2, password mode => use default key 4D494B52 (MIKR)\n" + " lf hitag read --ht2 --pwd\n" + "Hitag 2, providing a short key = password mode\n" + " lf hitag read --ht2 -k 4D494B52\n" + "Hitag 2, challenge mode\n" + " lf hitag read --ht2 --nrar 0102030411223344\n" + "Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)\n" + " lf hitag read --ht2 --crypto\n" + "Hitag 2, providing a long key = crypto mode\n" + " lf hitag read --ht2 -k 4F4E4D494B52\n" ); void *argtable[] = { arg_param_begin, - arg_lit0(NULL, "01", "HitagS, read all pages, challenge mode"), - arg_lit0(NULL, "02", "HitagS, read all pages, crypto mode. Set key=0 for no auth"), - arg_lit0(NULL, "21", "Hitag2, read all pages, password mode. def 4D494B52 (MIKR)"), - arg_lit0(NULL, "22", "Hitag2, read all pages, challenge mode"), - arg_lit0(NULL, "23", "Hitag2, read all pages, crypto mode. Key ISK high + ISK low. def 4F4E4D494B52 (ONMIKR)"), - arg_lit0(NULL, "25", "Hitag2, test recorded authentications (replay?)"), - arg_lit0(NULL, "26", "Hitag2, read UID"), + arg_lit0("s", "hts", "Hitag S"), + arg_lit0("2", "ht2", "Hitag 2"), + arg_lit0(NULL, "pwd", "password mode"), + arg_str0(NULL, "nrar", "", "nonce / answer writer, 8 hex bytes"), + arg_lit0(NULL, "crypto", "crypto mode"), arg_str0("k", "key", "", "key, 4 or 6 hex bytes"), - arg_str0(NULL, "nrar", "", "nonce / answer reader, 8 hex bytes"), +// currently pm3 fw reads all the memory anyway +// arg_int1("p", "page", "", "page address to write to"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); - // Hitag S - bool s01 = arg_get_lit(ctx, 1); - bool s02 = arg_get_lit(ctx, 2); + bool use_ht1 = false; // not yet implemented + bool use_hts = arg_get_lit(ctx, 1); + bool use_ht2 = arg_get_lit(ctx, 2); + bool use_htm = false; // not yet implemented - // Hitag 2 - bool h21 = arg_get_lit(ctx, 3); - bool h22 = arg_get_lit(ctx, 4); - bool h23 = arg_get_lit(ctx, 5); - bool h25 = arg_get_lit(ctx, 6); - bool h26 = arg_get_lit(ctx, 7); - - uint8_t key[6]; - int keylen = 0; - int res = CLIParamHexToBuf(arg_get_str(ctx, 8), key, sizeof(key), &keylen); + bool use_plain = false; + bool use_pwd = arg_get_lit(ctx, 3); + uint8_t nrar[8]; + int nalen = 0; + int res = CLIParamHexToBuf(arg_get_str(ctx, 4), nrar, sizeof(nrar), &nalen); if (res != 0) { CLIParserFree(ctx); return PM3_EINVARG; } + bool use_nrar = nalen > 0; + bool use_crypto = arg_get_lit(ctx, 5); - uint8_t nrar[8]; - int nalen = 0; - res = CLIParamHexToBuf(arg_get_str(ctx, 9), nrar, sizeof(nrar), &nalen); - CLIParserFree(ctx); + uint8_t key[6]; + int keylen = 0; + res = CLIParamHexToBuf(arg_get_str(ctx, 6), key, sizeof(key), &keylen); if (res != 0) { + CLIParserFree(ctx); + return PM3_EINVARG; + } +// uint32_t page = arg_get_u32_def(ctx, 6, 0); + + CLIParserFree(ctx); + + // sanity checks + if ((use_ht1 + use_ht2 + use_hts + use_htm) > 1) { + PrintAndLogEx(ERR, "error, specify only one Hitag type"); + return PM3_EINVARG; + } + if ((use_ht1 + use_ht2 + use_hts + use_htm) == 0) { + PrintAndLogEx(ERR, "error, specify one Hitag type"); return PM3_EINVARG; } - // sanity checks if (keylen != 0 && keylen != 4 && keylen != 6) { PrintAndLogEx(WARNING, "Wrong KEY len expected 0, 4 or 6, got %d", keylen); return PM3_EINVARG; @@ -594,48 +619,73 @@ static int CmdLFHitagReader(const char *Cmd) { return PM3_EINVARG; } - uint8_t foo = (s01 + s02 + h21 + h22 + h23 + h25 + h26); + // complete options + if (keylen == 4) { + use_pwd = true; + } + if (keylen == 6) { + use_crypto = true; + } + if ((keylen == 0) && use_pwd) { + memcpy(key, "MIKR", 4); + keylen = 4; + } + if ((keylen == 0) && use_crypto) { + memcpy(key, "ONMIKR", 6); + keylen = 6; + } + + // check coherence + uint8_t foo = (use_plain + use_pwd + use_nrar + use_crypto); if (foo > 1) { - PrintAndLogEx(WARNING, "Only specify one HITAG reader cmd"); + PrintAndLogEx(WARNING, "Specify only one authentication mode"); return PM3_EINVARG; } else if (foo == 0) { - PrintAndLogEx(WARNING, "Specify one HITAG reader cms"); + if (use_hts) { + use_plain = true; + } else { + PrintAndLogEx(WARNING, "Specify one authentication mode"); + return PM3_EINVARG; + } + } + + if (use_hts && use_pwd) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Password mode"); + return PM3_EINVARG; + } + + if (use_ht2 && use_plain) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Plain mode"); return PM3_EINVARG; } hitag_function htf; hitag_data htd; memset(&htd, 0, sizeof(htd)); - - - uint16_t cmd = CMD_LF_HITAG_READER; - if (s01) { + uint16_t cmd; + if (use_hts && use_nrar) { cmd = CMD_LF_HITAGS_READ; htf = RHTSF_CHALLENGE; memcpy(htd.auth.NrAr, nrar, sizeof(htd.auth.NrAr)); - } - if (s02) { + } else if (use_hts && use_crypto) { cmd = CMD_LF_HITAGS_READ; htf = RHTSF_KEY; memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); - } - if (h21) { + } else if (use_ht2 && use_pwd) { + cmd = CMD_LF_HITAG_READER; htf = RHT2F_PASSWORD; memcpy(htd.pwd.password, key, sizeof(htd.pwd.password)); - } - if (h22) { + } else if (use_ht2 && use_nrar) { + cmd = CMD_LF_HITAG_READER; htf = RHT2F_AUTHENTICATE; memcpy(htd.auth.NrAr, nrar, sizeof(htd.auth.NrAr)); - } - if (h23) { + } else if (use_ht2 && use_crypto) { htf = RHT2F_CRYPTO; + cmd = CMD_LF_HITAG_READER; memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); - } - if (h25) { - htf = RHT2F_TEST_AUTH_ATTEMPTS; - } - if (h26) { - htf = RHT2F_UID_ONLY; + } else { + PrintAndLogEx(WARNING, "Sorry, not yet implemented"); + return PM3_ENOTIMPL; } clearCommandBuffer(); @@ -653,21 +703,13 @@ static int CmdLFHitagReader(const char *Cmd) { uint32_t id = bytes_to_num(resp.data.asBytes, 4); uint8_t *data = resp.data.asBytes; PrintAndLogEx(SUCCESS, " UID: " _YELLOW_("%08x"), id); - - if (htf != RHT2F_UID_ONLY) { - - // block3, 1 byte - printHitag2Configuration(data[4 * 3]); - - // print data - print_hex_break(data, 48, 4); - - printHitag2PaxtonDowngrade(data); - } + printHitag2Configuration(data[4 * 3]); + print_hex_break(data, 48, 4); + printHitag2PaxtonDowngrade(data); return PM3_SUCCESS; } -static int CmdLFHitagCheckChallenges(const char *Cmd) { +static int CmdLFHitagSCheckChallenges(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf hitag cc", @@ -686,7 +728,6 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) { int fnlen = 0; char filename[FILE_PATH_SIZE] = {0}; CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); - CLIParserFree(ctx); clearCommandBuffer(); @@ -708,92 +749,170 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) { return PM3_SUCCESS; } +static int CmdLFHitag2CheckChallenges(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "lf hitag ta", + "Test recorded authentications (replay?)", + "lf hitag ta" + ); + CLIParserFree(ctx); + + clearCommandBuffer(); + SendCommandMIX(CMD_LF_HITAG_READER, RHT2F_TEST_AUTH_ATTEMPTS, 0, 0, NULL, 0); + PacketResponseNG resp; + if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } + if (resp.oldarg[0] == false) { + PrintAndLogEx(DEBUG, "DEBUG: Error - hitag failed"); + return PM3_ESOFT; + } + + // FIXME: doegox: not sure what this fct does and what it returns... + return PM3_SUCCESS; +} + + static int CmdLFHitagWriter(const char *Cmd) { CLIParserContext *ctx; - CLIParserInit(&ctx, "lf hitag writer", - "Act like a Hitag writer" - "In password mode the default key is 4D494B52 (MIKR)\n" - "In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", - "Hitag S\n" - " lf hitag writer --03 --nrar 0102030411223344 -p 3 -d 01020304\n" - " lf hitag writer --04 -k 4F4E4D494B52 -p 3 -d 01020304\n" - "Hitag 2\n" - " lf hitag writer --24 -k 4F4E4D494B52 -p 3 -d 01020304\n" - " lf hitag writer --27 -k 4D494B52 -p 3 -d 01020304\n" + CLIParserInit(&ctx, "lf hitag wrbl", + "Write a page in Hitag memory\n" + "Crypto mode key format: ISK high + ISK low", + "Hitag S, plain mode\n" + " lf hitag wrbl --hts -p 6 -d 01020304\n" + "Hitag S, challenge mode\n" + " lf hitag wrbl --hts --nrar 0102030411223344 -p 6 -d 01020304\n" + "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)\n" + " lf hitag wrbl --hts --crypto -p 6 -d 01020304\n" + "Hitag S, long key = crypto mode\n" + " lf hitag wrbl --hts -k 4F4E4D494B52 -p 6 -d 01020304\n\n" + + "Hitag 2, password mode => use default key 4D494B52 (MIKR)\n" + " lf hitag wrbl --ht2 --pwd -p 6 -d 01020304\n" + "Hitag 2, providing a short key = password mode\n" + " lf hitag wrbl --ht2 -k 4D494B52 -p 6 -d 01020304\n" + "Hitag 2, challenge mode\n" + " lf hitag wrbl --ht2 --nrar 0102030411223344 -p 6 -d 01020304\n" + "Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)\n" + " lf hitag wrbl --ht2 --crypto -p 6 -d 01020304\n" + "Hitag 2, providing a long key = crypto mode\n" + " lf hitag wrbl --ht2 -k 4F4E4D494B52 -p 6 -d 01020304\n" ); void *argtable[] = { arg_param_begin, - arg_lit0(NULL, "03", "HitagS, write page, challenge mode"), - arg_lit0(NULL, "04", "HitagS, write page, crypto mode. Set key=0 for no auth"), - arg_lit0(NULL, "24", "Hitag2, write page, crypto mode."), - arg_lit0(NULL, "27", "Hitag2, write page, password mode"), - arg_int1("p", "page", "", "page address to write to"), - arg_str0("d", "data", "", "data, 4 hex bytes"), - arg_str0("k", "key", "", "key, 4 or 6 hex bytes"), + arg_lit0("s", "hts", "Hitag S"), + arg_lit0("2", "ht2", "Hitag 2"), + arg_lit0(NULL, "pwd", "password mode"), arg_str0(NULL, "nrar", "", "nonce / answer writer, 8 hex bytes"), + arg_lit0(NULL, "crypto", "crypto mode"), + arg_str0("k", "key", "", "key, 4 or 6 hex bytes"), + arg_int1("p", "page", "", "page address to write to"), + arg_str1("d", "data", "", "data, 4 hex bytes"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); - // Hitag S - bool s03 = arg_get_lit(ctx, 1); - bool s04 = arg_get_lit(ctx, 2); + bool use_ht1 = false; // not yet implemented + bool use_hts = arg_get_lit(ctx, 1); + bool use_ht2 = arg_get_lit(ctx, 2); + bool use_htm = false; // not yet implemented - // Hitag 2 - bool h24 = arg_get_lit(ctx, 3); - bool h27 = arg_get_lit(ctx, 4); - - uint32_t page = arg_get_u32_def(ctx, 5, 0); - - uint8_t data[4]; - int dlen = 0; - int res = CLIParamHexToBuf(arg_get_str(ctx, 6), data, sizeof(data), &dlen); + bool use_plain = false; + bool use_pwd = arg_get_lit(ctx, 3); + uint8_t nrar[8]; + int nalen = 0; + int res = CLIParamHexToBuf(arg_get_str(ctx, 4), nrar, sizeof(nrar), &nalen); if (res != 0) { CLIParserFree(ctx); return PM3_EINVARG; } + bool use_nrar = nalen > 0; + bool use_crypto = arg_get_lit(ctx, 5); uint8_t key[6]; int keylen = 0; - res = CLIParamHexToBuf(arg_get_str(ctx, 7), key, sizeof(key), &keylen); + res = CLIParamHexToBuf(arg_get_str(ctx, 6), key, sizeof(key), &keylen); if (res != 0) { CLIParserFree(ctx); return PM3_EINVARG; } - uint8_t nrar[8]; - int nalen = 0; - res = CLIParamHexToBuf(arg_get_str(ctx, 8), nrar, sizeof(nrar), &nalen); + uint32_t page = arg_get_u32_def(ctx, 7, 0); + + uint8_t data[4]; + int dlen = 0; + res = CLIParamHexToBuf(arg_get_str(ctx, 8), data, sizeof(data), &dlen); + if (res != 0) { + CLIParserFree(ctx); + return PM3_EINVARG; + } CLIParserFree(ctx); - if (res != 0) { + // sanity checks + if ((use_ht1 + use_ht2 + use_hts + use_htm) > 1) { + PrintAndLogEx(ERR, "error, specify only one Hitag type"); + return PM3_EINVARG; + } + if ((use_ht1 + use_ht2 + use_hts + use_htm) == 0) { + PrintAndLogEx(ERR, "error, specify one Hitag type"); + return PM3_EINVARG; + } + + if (keylen != 0 && keylen != 4 && keylen != 6) { + PrintAndLogEx(WARNING, "Wrong KEY len expected 0, 4 or 6, got %d", keylen); return PM3_EINVARG; } - // sanity checks if (dlen != sizeof(data)) { PrintAndLogEx(WARNING, "Wrong DATA len expected 4, got %d", dlen); return PM3_EINVARG; } - if (keylen != 0 && keylen != 6 && keylen != 4) { - PrintAndLogEx(WARNING, "Wrong KEY len expected 0, 4 or 6, got %d", keylen); - return PM3_EINVARG; - } - if (nalen != 0 && nalen != 8) { PrintAndLogEx(WARNING, "Wrong NR/AR len expected 0 or 8, got %d", nalen); return PM3_EINVARG; } - uint8_t foo = (s03 + s04 + h24 + h27); + // complete options + if (keylen == 4) { + use_pwd = true; + } + if (keylen == 6) { + use_crypto = true; + } + if ((keylen == 0) && use_pwd) { + memcpy(key, "MIKR", 4); + keylen = 4; + } + if ((keylen == 0) && use_crypto) { + memcpy(key, "ONMIKR", 6); + keylen = 6; + } + + // check coherence + uint8_t foo = (use_plain + use_pwd + use_nrar + use_crypto); if (foo > 1) { - PrintAndLogEx(WARNING, "Only specify one HITAG write cmd"); + PrintAndLogEx(WARNING, "Specify only one authentication mode"); return PM3_EINVARG; } else if (foo == 0) { - PrintAndLogEx(WARNING, "Specify one HITAG write cmd"); + if (use_hts) { + use_plain = true; + } else { + PrintAndLogEx(WARNING, "Specify one authentication mode"); + return PM3_EINVARG; + } + } + + if (use_hts && use_pwd) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Password mode"); + return PM3_EINVARG; + } + + if (use_ht2 && use_plain) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Plain mode"); return PM3_EINVARG; } @@ -801,29 +920,33 @@ static int CmdLFHitagWriter(const char *Cmd) { hitag_data htd; memset(&htd, 0, sizeof(htd)); - if (s03) { + if (use_hts && use_nrar) { htf = WHTSF_CHALLENGE; memcpy(htd.auth.NrAr, nrar, sizeof(htd.auth.NrAr)); memcpy(htd.auth.data, data, sizeof(data)); - } - if (s04) { + PrintAndLogEx(INFO, "Authenticating to Hitag S in Challenge mode"); + } else if (use_hts && use_crypto) { htf = WHTSF_KEY; memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); memcpy(htd.crypto.data, data, sizeof(data)); - } - if (h24) { - htf = WHT2F_CRYPTO; - memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); - memcpy(htd.crypto.data, data, sizeof(data)); - } - if (h27) { + PrintAndLogEx(INFO, "Authenticating to Hitag S in Crypto mode"); + } else if (use_ht2 && use_pwd) { htf = WHT2F_PASSWORD; memcpy(htd.pwd.password, key, sizeof(htd.pwd.password)); memcpy(htd.crypto.data, data, sizeof(data)); + PrintAndLogEx(INFO, "Authenticating to Hitag 2 in Password mode"); + } else if (use_ht2 && use_crypto) { + htf = WHT2F_CRYPTO; + memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); + memcpy(htd.crypto.data, data, sizeof(data)); + PrintAndLogEx(INFO, "Authenticating to Hitag 2 in Crypto mode"); + } else { + PrintAndLogEx(WARNING, "Sorry, not yet implemented"); + return PM3_ENOTIMPL; } - + uint16_t cmd = CMD_LF_HITAGS_WRITE; clearCommandBuffer(); - SendCommandMIX(CMD_LF_HITAGS_WRITE, htf, 0, page, &htd, sizeof(htd)); + SendCommandMIX(cmd, htf, 0, page, &htd, sizeof(htd)); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 4000) == false) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); @@ -841,56 +964,132 @@ static int CmdLFHitag2Dump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf hitag dump", - "Read all card memory and save to file" - "In password mode the default key is 4D494B52 (MIKR)\n" - "In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", - "lf hitag dump -k 4F4E4D494B52\n" - "lf hitag dump -k 4D494B52\n" + "Read all Hitag 2 card memory and save to file\n" + "Crypto mode key format: ISK high + ISK low", + "Password mode => use default key 4D494B52 (MIKR)\n" + " lf hitag dump --pwd\n" + "Short key = password mode\n" + " lf hitag dump -k 4D494B52\n" + "Challenge mode\n" + " lf hitag dump --nrar 0102030411223344\n" + "Crypto mode => use default key 4F4E4D494B52 (ONMIKR)\n" + " lf hitag dump --crypto\n" + "Long key = crypto mode\n" + " lf hitag dump -k 4F4E4D494B52\n" ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "specify file name"), - arg_str0("k", "key", "", "key, 4 or 6 hex bytes"), + arg_lit0(NULL, "pwd", "password mode"), arg_str0(NULL, "nrar", "", "nonce / answer reader, 8 hex bytes"), + arg_lit0(NULL, "crypto", "crypto mode"), + arg_str0("k", "key", "", "key, 4 or 6 hex bytes"), + arg_str0("f", "file", "", "specify file name"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); - int fnlen = 0; - char filename[FILE_PATH_SIZE] = {0}; - CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); + bool use_ht1 = false; // not yet implemented + bool use_hts = false; // not yet implemented + bool use_ht2 = true; + bool use_htm = false; // not yet implemented + + bool use_plain = false; + bool use_pwd = arg_get_lit(ctx, 1); + uint8_t nrar[8]; + int nalen = 0; + int res = CLIParamHexToBuf(arg_get_str(ctx, 2), nrar, sizeof(nrar), &nalen); + if (res != 0) { + CLIParserFree(ctx); + return PM3_EINVARG; + } + bool use_nrar = nalen > 0; + bool use_crypto = arg_get_lit(ctx, 3); uint8_t key[6]; int keylen = 0; - int res = CLIParamHexToBuf(arg_get_str(ctx, 2), key, sizeof(key), &keylen); + res = CLIParamHexToBuf(arg_get_str(ctx, 4), key, sizeof(key), &keylen); if (res != 0) { CLIParserFree(ctx); return PM3_EINVARG; } - uint8_t nrar[8]; - int nalen = 0; - res = CLIParamHexToBuf(arg_get_str(ctx, 3), nrar, sizeof(nrar), &nalen); + int fnlen = 0; + char filename[FILE_PATH_SIZE] = {0}; + CLIParamStrToBuf(arg_get_str(ctx, 5), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); + CLIParserFree(ctx); - if (res != 0) { + + // sanity checks + if ((use_ht1 + use_ht2 + use_hts + use_htm) > 1) { + PrintAndLogEx(ERR, "error, specify only one Hitag type"); + return PM3_EINVARG; + } + if ((use_ht1 + use_ht2 + use_hts + use_htm) == 0) { + PrintAndLogEx(ERR, "error, specify one Hitag type"); + return PM3_EINVARG; + } + + if (keylen != 0 && keylen != 4 && keylen != 6) { + PrintAndLogEx(WARNING, "Wrong KEY len expected 0, 4 or 6, got %d", keylen); + return PM3_EINVARG; + } + + // complete options + if (keylen == 4) { + use_pwd = true; + } + if (keylen == 6) { + use_crypto = true; + } + if ((keylen == 0) && use_pwd) { + memcpy(key, "MIKR", 4); + keylen = 4; + } + if ((keylen == 0) && use_crypto) { + memcpy(key, "ONMIKR", 6); + keylen = 6; + } + + // check coherence + uint8_t foo = (use_plain + use_pwd + use_nrar + use_crypto); + if (foo > 1) { + PrintAndLogEx(WARNING, "Specify only one authentication mode"); + return PM3_EINVARG; + } else if (foo == 0) { + if (use_hts) { + use_plain = true; + } else { + PrintAndLogEx(WARNING, "Specify one authentication mode"); + return PM3_EINVARG; + } + } + + if (use_hts && use_pwd) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Password mode"); + return PM3_EINVARG; + } + + if (use_ht2 && use_plain) { // not sure for the other types... + PrintAndLogEx(WARNING, "Chosen Hitag type does not have Plain mode"); return PM3_EINVARG; } hitag_function htf; hitag_data htd; memset(&htd, 0, sizeof(htd)); - - if (keylen == 6) { - htf = RHT2F_CRYPTO; - memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); - PrintAndLogEx(INFO, "Authenticating in crypto mode"); - } else { + if (use_ht2 && use_pwd) { htf = RHT2F_PASSWORD; memcpy(htd.pwd.password, key, sizeof(htd.pwd.password)); - PrintAndLogEx(INFO, "Authenticating in password mode"); + PrintAndLogEx(INFO, "Authenticating to Hitag 2 in Password mode"); + } else if (use_ht2 && use_crypto) { + htf = RHT2F_CRYPTO; + memcpy(htd.crypto.key, key, sizeof(htd.crypto.key)); + PrintAndLogEx(INFO, "Authenticating to Hitag 2 in Crypto mode"); + } else { + PrintAndLogEx(WARNING, "Sorry, not yet implemented"); + return PM3_ENOTIMPL; } - uint16_t cmd = CMD_LF_HITAG_READER; clearCommandBuffer(); SendCommandMIX(cmd, htf, 0, 0, &htd, sizeof(htd)); @@ -909,7 +1108,8 @@ static int CmdLFHitag2Dump(const char *Cmd) { if (data == NULL) return PM3_ESOFT; - PrintAndLogEx(SUCCESS, "Dumping tag memory..."); + uint32_t id = bytes_to_num(resp.data.asBytes, 4); + PrintAndLogEx(SUCCESS, " UID: " _YELLOW_("%08x"), id); if (fnlen < 1) { char *fptr = filename; @@ -917,8 +1117,16 @@ static int CmdLFHitag2Dump(const char *Cmd) { FillFileNameByUID(fptr, data, "-dump", 4); } + // block3, 1 byte + printHitag2Configuration(data[4 * 3]); + + // print data print_hex_break(data, 48, 4); + printHitag2PaxtonDowngrade(data); + + PrintAndLogEx(SUCCESS, "Dumping tag memory..."); + pm3_save_dump(filename, data, 48, jsfHitag, 4); return PM3_SUCCESS; } @@ -982,16 +1190,20 @@ void annotateHitagS(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, } static command_t CommandTable[] = { + {"-----------", CmdHelp, IfPm3Hitag, "------------------------ " _CYAN_("General") " ------------------------"}, {"help", CmdHelp, AlwaysAvailable, "This help"}, - {"eload", CmdLFHitagEload, IfPm3Hitag, "Load Hitag dump file into emulator memory"}, {"list", CmdLFHitagList, AlwaysAvailable, "List Hitag trace history"}, - {"info", CmdLFHitagInfo, IfPm3Hitag, "Hitag2 tag information"}, - {"reader", CmdLFHitagReader, IfPm3Hitag, "Act like a Hitag reader"}, - {"sim", CmdLFHitagSim, IfPm3Hitag, "Simulate Hitag transponder"}, + {"-----------", CmdHelp, IfPm3Hitag, "----------------------- " _CYAN_("operations") " -----------------------"}, + {"info", CmdLFHitagInfo, IfPm3Hitag, "Hitag 2 tag information"}, + {"dump", CmdLFHitag2Dump, IfPm3Hitag, "Dump Hitag 2 tag"}, + {"read", CmdLFHitagReader, IfPm3Hitag, "Read Hitag memory"}, + {"wrbl", CmdLFHitagWriter, IfPm3Hitag, "Write a block (page) in Hitag memory"}, {"sniff", CmdLFHitagSniff, IfPm3Hitag, "Eavesdrop Hitag communication"}, - {"writer", CmdLFHitagWriter, IfPm3Hitag, "Act like a Hitag writer"}, - {"dump", CmdLFHitag2Dump, IfPm3Hitag, "Dump Hitag2 tag"}, - {"cc", CmdLFHitagCheckChallenges, IfPm3Hitag, "Test all challenges"}, + {"cc", CmdLFHitagSCheckChallenges, IfPm3Hitag, "Hitag S: test all provided challenges"}, + {"ta", CmdLFHitag2CheckChallenges, IfPm3Hitag, "Hitag 2: test all recorded authentications"}, + {"-----------", CmdHelp, IfPm3Hitag, "----------------------- " _CYAN_("simulation") " -----------------------"}, + {"eload", CmdLFHitagEload, IfPm3Hitag, "Load Hitag dump file into emulator memory"}, + {"sim", CmdLFHitagSim, IfPm3Hitag, "Simulate Hitag transponder"}, { NULL, NULL, 0, NULL } }; @@ -1007,7 +1219,7 @@ int CmdLFHitag(const char *Cmd) { } int readHitagUid(void) { - return (CmdLFHitagReader("--26") == PM3_SUCCESS); + return (CmdLFHitagReader("--ht2") == PM3_SUCCESS); } uint8_t hitag1_CRC_check(uint8_t *d, uint32_t nbit) { diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 1af21ec20..ba1d14205 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -663,7 +663,7 @@ static int CmdIndalaSim(const char *Cmd) { bool fmt4041x = arg_get_lit(ctx, 5); - int32_t cardnumber; + int32_t cardnumber = 0; uint8_t fc = 0; uint16_t cn = 0; bool got_cn = false, got_26 = false; diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index 90394be54..cd0c91864 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -128,7 +128,7 @@ int demodMotorola(bool verbose) { static int CmdMotorolaDemod(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf motorola demod", - "Try to find Motorola preamble, if found decode / descramble data", + "Try to find Motorola Flexpass preamble, if found decode / descramble data", "lf motorola demod" ); @@ -144,7 +144,7 @@ static int CmdMotorolaDemod(const char *Cmd) { static int CmdMotorolaReader(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf motorola reader", - "read a Motorola tag", + "read a Motorola Flexpass tag", "lf motorola reader -@ -> continuous reader mode" ); diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index ffb90513b..5033b5d54 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -4139,8 +4139,9 @@ static int CmdT55xxSniff(const char *Cmd) { blockAddr = 0; for (uint8_t i = 3; i < 6; i++) { blockAddr <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockAddr |= 1; + } } blockData = 0; have_data = true; @@ -4155,21 +4156,26 @@ static int CmdT55xxSniff(const char *Cmd) { usedPassword = 0; for (uint8_t i = 2; i <= 33; i++) { usedPassword <<= 1; - if (data[i] == '1') + if (data[i] == '1') { usedPassword |= 1; + } } + // Lock bit 34 blockData = 0; for (uint8_t i = 35; i <= 66; i++) { blockData <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockData |= 1; + } } + blockAddr = 0; for (uint8_t i = 67; i <= 69; i++) { blockAddr <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockAddr |= 1; + } } have_data = true; modeText = "Default pwd write"; @@ -4190,20 +4196,24 @@ static int CmdT55xxSniff(const char *Cmd) { blockData = 0; for (uint8_t i = 3; i <= 34; i++) { blockData <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockData |= 1; + } } + for (uint8_t i = 2; i <= 33; i++) { usedPassword <<= 1; if (data[i] == '1') { usedPassword |= 1; } } + blockAddr = 0; for (uint8_t i = 35; i <= 37; i++) { blockAddr <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockAddr |= 1; + } } have_data = true; modeText = "Default write/pwd read"; @@ -4227,21 +4237,27 @@ static int CmdT55xxSniff(const char *Cmd) { usedPassword = 0; for (uint8_t i = 5; i <= 36; i++) { usedPassword <<= 1; - if (data[i] == '1') + if (data[i] == '1') { usedPassword |= 1; + } } + blockData = 0; for (uint8_t i = 38; i <= 69; i++) { blockData <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockData |= 1; + } } + blockAddr = 0; for (uint8_t i = 70; i <= 72; i++) { blockAddr <<= 1; - if (data[i] == '1') + if (data[i] == '1') { blockAddr |= 1; + } } + have_data = true; modeText = "Leading 0 pwd write"; snprintf(pwdText, sizeof(pwdText), " %08X", usedPassword); @@ -4253,10 +4269,29 @@ static int CmdT55xxSniff(const char *Cmd) { // Print results if (have_data) { - if (blockAddr == 7) - PrintAndLogEx(SUCCESS, "%-22s | "_GREEN_("%10s")" | "_YELLOW_("%8s")" | "_YELLOW_("%d")" | "_GREEN_("%d")" | %3d | %3d | %s", modeText, pwdText, dataText, blockAddr, page, minWidth, maxWidth, data); - else - PrintAndLogEx(SUCCESS, "%-22s | "_GREEN_("%10s")" | "_GREEN_("%8s")" | "_GREEN_("%d")" | "_GREEN_("%d")" | %3d | %3d | %s", modeText, pwdText, dataText, blockAddr, page, minWidth, maxWidth, data); + if (blockAddr == 7) { + PrintAndLogEx(SUCCESS, "%-22s | "_GREEN_("%10s")" | "_YELLOW_("%8s")" | "_YELLOW_("%d")" | "_GREEN_("%d")" | %3d | %3d | %s" + , modeText + , pwdText + , dataText + , blockAddr + , page + , minWidth + , maxWidth + , data + ); + } else { + PrintAndLogEx(SUCCESS, "%-22s | "_GREEN_("%10s")" | "_GREEN_("%8s")" | "_GREEN_("%d")" | "_GREEN_("%d")" | %3d | %3d | %s" + , modeText + , pwdText + , dataText + , blockAddr + , page + , minWidth + , maxWidth + , data + ); + } } } diff --git a/client/src/cmdlft55xx.h b/client/src/cmdlft55xx.h index def6a5be6..6dbab378c 100644 --- a/client/src/cmdlft55xx.h +++ b/client/src/cmdlft55xx.h @@ -21,15 +21,15 @@ #include "common.h" -#define T55x7_CONFIGURATION_BLOCK 0x00 -#define T55x7_PWD_BLOCK 0x07 -#define T55x7_TRACE_BLOCK1 0x01 -#define T55x7_TRACE_BLOCK2 0x02 -#define T55x7_PAGE0 0x00 -#define T55x7_PAGE1 0x01 -#define T55x7_PWD 0x00000010 -#define REGULAR_READ_MODE_BLOCK 0xFF -#define T55x7_BLOCK_COUNT 12 +#define T55x7_CONFIGURATION_BLOCK 0x00 +#define T55x7_PWD_BLOCK 0x07 +#define T55x7_TRACE_BLOCK1 0x01 +#define T55x7_TRACE_BLOCK2 0x02 +#define T55x7_PAGE0 0x00 +#define T55x7_PAGE1 0x01 +#define T55x7_PWD 0x00000010 +#define REGULAR_READ_MODE_BLOCK 0xFF +#define T55x7_BLOCK_COUNT 12 // config blocks #define T55X7_DEFAULT_CONFIG_BLOCK 0x000880E8 // ASK, compat mode, data rate 32, manchester, STT, 7 data blocks @@ -70,6 +70,7 @@ #define T55X7_PAC_CONFIG_BLOCK 0x00080080 // NRZ, data rate 32, 4 data blocks #define T55X7_VERICHIP_CONFIG_BLOCK 0x000C0080 // NRZ, data rate 40, 4 data blocks + #define T55X7_bin 0b0010 // Q5 / Termic / T5555 diff --git a/client/src/cmdnfc.c b/client/src/cmdnfc.c index eadfa7161..431464076 100644 --- a/client/src/cmdnfc.c +++ b/client/src/cmdnfc.c @@ -109,7 +109,7 @@ static int CmdNfcDecode(const char *Cmd) { uint8_t *dump = NULL; size_t bytes_read = 4096; res = pm3_load_dump(filename, (void **)&dump, &bytes_read, 4096); - if (res != PM3_SUCCESS || dump == NULL) { + if (res != PM3_SUCCESS || dump == NULL || bytes_read > 4096) { return res; } diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 326a646b9..9182608ae 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -533,6 +533,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr crcStatus = !felica_CRC_check(frame + 2, data_len - 4); break; case PROTO_MIFARE: + case PROTO_MFPLUS: crcStatus = mifare_CRC_check(hdr->isResponse, frame, data_len); break; case ISO_14443A: @@ -603,7 +604,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr && protocol != FELICA && protocol != LTO && protocol != PROTO_CRYPTORF - && (hdr->isResponse || protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == SEOS) + && (hdr->isResponse || protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == PROTO_MFPLUS || protocol == SEOS) && (oddparity8(frame[j]) != ((parityBits >> (7 - (j & 0x0007))) & 0x01))) { snprintf(line[j / 18] + ((j % 18) * 4), 120, "%02x! ", frame[j]); @@ -654,11 +655,12 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr if (crcStatus == 0 || crcStatus == 1) { char *pos1 = line[(data_len - 2) / TRACE_MAX_HEX_BYTES]; - pos1 += (((data_len - 2) % TRACE_MAX_HEX_BYTES) * 4) - 1; + int delta = (data_len - 2) % TRACE_MAX_HEX_BYTES ? 1 : 0; + pos1 += (((data_len - 2) % TRACE_MAX_HEX_BYTES) * 4) - delta; - (*(pos1 + 6 + 1)) = '\0'; + (*(pos1 + 6 + delta)) = '\0'; - char *cb_str = str_dup(pos1 + 1); + char *cb_str = str_dup(pos1 + delta); if (g_session.supports_colors) { if (crcStatus == 0) { @@ -701,6 +703,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr // mark short bytes (less than 8 Bit + Parity) if (protocol == ISO_14443A || protocol == PROTO_MIFARE || + protocol == PROTO_MFPLUS || protocol == THINFILM) { // approximated with 128 * (9 * data_len); @@ -747,6 +750,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr annotateIso14443a(explanation, sizeof(explanation), frame, data_len, hdr->isResponse); break; case PROTO_MIFARE: + case PROTO_MFPLUS: annotateMifare(explanation, sizeof(explanation), frame, data_len, parityBytes, TRACELOG_PARITY_LEN(hdr), hdr->isResponse); break; case PROTO_HITAG1: @@ -766,7 +770,6 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr } if (hdr->isResponse == false) { - switch (protocol) { case LEGIC: annotateLegic(explanation, sizeof(explanation), frame, data_len); @@ -774,6 +777,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr case MFDES: annotateMfDesfire(explanation, sizeof(explanation), frame, data_len); break; + case PROTO_MFPLUS: + annotateMfPlus(explanation, sizeof(explanation), frame, data_len); + break; case ISO_14443B: annotateIso14443b(explanation, sizeof(explanation), frame, data_len); break; @@ -901,7 +907,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr } } - if (protocol == PROTO_MIFARE) { + if (protocol == PROTO_MIFARE || protocol == PROTO_MFPLUS) { uint8_t mfData[32] = {0}; size_t mfDataLen = 0; if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen, mfDicKeys, mfDicKeysCount)) { @@ -981,15 +987,15 @@ static int download_trace(void) { PrintAndLogEx(INFO, "downloading tracelog data from device"); // Query for the size of the trace, downloading PM3_CMD_DATA_SIZE - PacketResponseNG response; - if (!GetFromDevice(BIG_BUF, gs_trace, PM3_CMD_DATA_SIZE, 0, NULL, 0, &response, 4000, true)) { + PacketResponseNG resp; + if (!GetFromDevice(BIG_BUF, gs_trace, PM3_CMD_DATA_SIZE, 0, NULL, 0, &resp, 4000, true)) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); free(gs_trace); gs_trace = NULL; return PM3_ETIMEOUT; } - gs_traceLen = response.oldarg[2]; + gs_traceLen = resp.oldarg[2]; // if tracelog buffer was larger and we need to download more. if (gs_traceLen > PM3_CMD_DATA_SIZE) { @@ -1171,7 +1177,7 @@ int CmdTraceListAlias(const char *Cmd, const char *alias, const char *protocol) CLIParserFree(ctx); char args[128] = {0}; - snprintf(args, sizeof(args), "-c -t %s ", protocol); + snprintf(args, sizeof(args), "-t %s ", protocol); strncat(args, Cmd, sizeof(args) - strlen(args) - 1); return CmdTraceList(args); } @@ -1200,6 +1206,7 @@ int CmdTraceList(const char *Cmd) { "trace list -t seos -> interpret as " _YELLOW_("SEOS") "\n" "trace list -t thinfilm -> interpret as " _YELLOW_("Thinfilm") "\n" "trace list -t topaz -> interpret as " _YELLOW_("Topaz") "\n" + "trace list -t mfp -> interpret as " _YELLOW_("MIFARE Plus") "\n" "\n" "trace list -t mf -f mfc_default_keys.dic -> use default dictionary file\n" "trace list -t 14a --frame -> show frame delay times\n" @@ -1266,6 +1273,7 @@ int CmdTraceList(const char *Cmd) { else if (strcmp(type, "seos") == 0) protocol = SEOS; else if (strcmp(type, "thinfilm") == 0) protocol = THINFILM; else if (strcmp(type, "topaz") == 0) protocol = TOPAZ; + else if (strcmp(type, "mfp") == 0) protocol = PROTO_MFPLUS; else if (strcmp(type, "") == 0) protocol = -1; else { PrintAndLogEx(FAILED, "Unknown protocol \"%s\"", type); @@ -1304,7 +1312,7 @@ int CmdTraceList(const char *Cmd) { PrintAndLogEx(INFO, _YELLOW_("start") " = start of start frame " _YELLOW_("end") " = end of frame. " _YELLOW_("src") " = source of transfer"); } - if (protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == MFDES || protocol == TOPAZ || protocol == LTO) { + if (protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == MFDES || protocol == PROTO_MFPLUS || protocol == TOPAZ || protocol == LTO) { if (use_us) PrintAndLogEx(INFO, _YELLOW_("ISO14443A") " - all times are in microseconds"); else @@ -1354,7 +1362,7 @@ int CmdTraceList(const char *Cmd) { uint32_t dicKeysCount = 0; bool dictionaryLoad = false; - if (protocol == PROTO_MIFARE) { + if (protocol == PROTO_MIFARE || protocol == PROTO_MFPLUS) { if (diclen > 0) { uint8_t *keyBlock = NULL; int res = loadFileDICTIONARY_safe(dictionary, (void **) &keyBlock, 6, &dicKeysCount); @@ -1387,7 +1395,7 @@ int CmdTraceList(const char *Cmd) { PrintAndLogEx(NORMAL, "------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------"); // clean authentication data used with the mifare classic decrypt fct - if (protocol == ISO_14443A || protocol == PROTO_MIFARE) + if (protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == PROTO_MFPLUS) ClearAuthData(); uint32_t previous_EOT = 0; diff --git a/client/src/comms.c b/client/src/comms.c index 1c3d1f686..a7ed0fd06 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -97,7 +97,7 @@ void SendCommandOLD(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, v #endif if (!g_session.pm3_present) { - PrintAndLogEx(WARNING, "Sending bytes to Proxmark3 failed." _YELLOW_("offline")); + PrintAndLogEx(WARNING, "Sending bytes to Proxmark3 failed ( " _RED_("offline") " )"); return; } @@ -156,7 +156,7 @@ static void SendCommandNG_internal(uint16_t cmd, uint8_t *data, size_t len, bool memcpy(&txBufferNG.data, data, len); if ((g_conn.send_via_fpc_usart && g_conn.send_with_crc_on_fpc) || ((!g_conn.send_via_fpc_usart) && g_conn.send_with_crc_on_usb)) { - uint8_t first, second; + uint8_t first = 0, second = 0; compute_crc(CRC_14443_A, (uint8_t *)&txBufferNG, sizeof(PacketCommandNGPreamble) + len, &first, &second); tx_post->crc = (first << 8) + second; } else { @@ -670,10 +670,10 @@ int TestProxmark(pm3_device_t *dev) { bool is_bt_conn = (memcmp(g_conn.serial_port_name, "bt:", 3) == 0); PrintAndLogEx(INFO, "Communicating with PM3 over %s%s%s", - (g_conn.send_via_fpc_usart) ? _YELLOW_("FPC UART") : _YELLOW_("USB-CDC"), - (is_tcp_conn) ? " over " _YELLOW_("TCP") : "", - (is_bt_conn) ? " over " _YELLOW_("BT") : "" - ); + (g_conn.send_via_fpc_usart) ? _YELLOW_("FPC UART") : _YELLOW_("USB-CDC"), + (is_tcp_conn) ? " over " _YELLOW_("TCP") : "", + (is_bt_conn) ? " over " _YELLOW_("BT") : "" + ); if (g_conn.send_via_fpc_usart) { PrintAndLogEx(INFO, "PM3 UART serial baudrate: " _YELLOW_("%u") "\n", g_conn.uart_speed); @@ -742,9 +742,21 @@ static size_t communication_delay(void) { bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) { PacketResponseNG resp; + // init to ZERO + resp.cmd = 0, + resp.length = 0, + resp.magic = 0, + resp.status = 0, + resp.crc = 0, + resp.ng = false, + resp.oldarg[0] = 0; + resp.oldarg[1] = 0; + resp.oldarg[2] = 0; + memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); - if (response == NULL) + if (response == NULL) { response = &resp; + } // Add delay depending on the communication channel & speed if (ms_timeout != (size_t) - 1) @@ -808,11 +820,26 @@ bool WaitForResponse(uint32_t cmd, PacketResponseNG *response) { bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint32_t start_index, uint8_t *data, uint32_t datalen, PacketResponseNG *response, size_t ms_timeout, bool show_warning) { if (dest == NULL) return false; - if (bytes == 0) return true; PacketResponseNG resp; - if (response == NULL) + if (response == NULL) { response = &resp; + } + + // init to ZERO + resp.cmd = 0, + resp.length = 0, + resp.magic = 0, + resp.status = 0, + resp.crc = 0, + resp.ng = false, + resp.oldarg[0] = 0; + resp.oldarg[1] = 0; + resp.oldarg[2] = 0; + memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE); + + if (bytes == 0) return true; + // clear clearCommandBuffer(); diff --git a/client/src/crypto/asn1dump.c b/client/src/crypto/asn1dump.c index 5fcabe20a..025e200ca 100644 --- a/client/src/crypto/asn1dump.c +++ b/client/src/crypto/asn1dump.c @@ -342,7 +342,7 @@ static void asn1_tag_dump_object_id(const struct tlv *tlv, const struct asn1_tag if (jsondesc) { PrintAndLogEx(NORMAL, " - %s" NOLF, jsondesc); } else { - const char *ppstr; + const char *ppstr = NULL; mbedtls_oid_get_attr_short_name(&asn1_buf, &ppstr); if (ppstr && strnlen(ppstr, 1)) { PrintAndLogEx(NORMAL, " (%s)", ppstr); diff --git a/client/src/crypto/asn1utils.c b/client/src/crypto/asn1utils.c index 4618c5028..1fa839a7f 100644 --- a/client/src/crypto/asn1utils.c +++ b/client/src/crypto/asn1utils.c @@ -20,8 +20,9 @@ #include #include #include -#include // memcpy -#include "ui.h" // Print... +#include // memcpy +#include "ui.h" // Print... +#include "commonutil.h" // ARRAYLEN #include "emv/tlv.h" #include "asn1dump.h" #include "util.h" @@ -103,8 +104,152 @@ int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent) { PrintAndLogEx(ERR, "Can't parse data as TLV tree"); return PM3_ESOFT; } - return PM3_SUCCESS; } +typedef struct { + const char *hex; + const char *expected; + const char *desc; +} asn1_test; + +int asn1_selftest(void) { + + PrintAndLogEx(INFO, "to be implemented. Feel free to contribute!"); + + /* + + ICEMAN: + Problem to be solved, how to extract data back from our asn1 decoder to compare with the expected text found in the following test cases. + Thanks @Mistial for the suggestion and links. + + These test cases are from the project lapo-luchini's asn1js (ISC license which is like MIT license) + https://github.com/lapo-luchini/asn1js/blob/trunk/test.js + + + const asn1_test tests[] = { + // RSA Laboratories technical notes from https://luca.ntop.org/Teaching/Appunti/asn1.html + {"0304066E5DC0", "(18 bit)\n011011100101110111", "ntop, bit string: DER encoding"}, + {"0304066E5DE0", "(18 bit)\n011011100101110111", "ntop, bit string: padded with `100000`"}, + {"038104066E5DC0", "(18 bit)\n011011100101110111", "ntop, bit string: long form of length octets"}, + {"23090303006E5D030206C0", "(18 bit)\n011011100101110111", "ntop, bit string (constructed encoding): `0110111001011101` + `11`"}, + {"160D7465737431407273612E636F6D", "test1@rsa.com", "ntop, ia5string: DER encoding"}, + {"16810D7465737431407273612E636F6D", "test1@rsa.com", "ntop, ia5string: long form of length octets"}, + {"36131605746573743116014016077273612E636F6D", "test1@rsa.com", "ntop, ia5string: constructed encoding: `test1` + `@` + `rsa.com`"}, + {"020100", "0", "ntop, integer: 0"}, + {"02017F", "127", "ntop, integer: 127"}, + {"02020080", "128", "ntop, integer: 128"}, + {"02020100", "256", "ntop, integer: 256"}, + {"020180", "-128", "ntop, integer: -128"}, + {"0202FF7F", "-129", "ntop, integer: -129"}, + {"0500", "", "ntop, null: DER"}, + {"058100", "", "ntop, null: long form of length octets"}, + {"06062A864886F70D", "1.2.840.113549", "ntop, object identifier"}, + {"04080123456789ABCDEF", "(8 byte)\n0123456789ABCDEF", "ntop, octet string: DER encoding"}, + {"0481080123456789ABCDEF", "(8 byte)\n0123456789ABCDEF", "ntop, octet string: long form of length octets"}, + {"240C040401234567040489ABCDEF", "(8 byte)\n0123456789ABCDEF", "ntop, octet string (constructed encoding): 01…67 + 89…ef"}, + {"130B5465737420557365722031", "Test User 1", "ntop, printable string: DER encoding"}, + {"13810B5465737420557365722031", "Test User 1", "ntop, printable string: long form of length octets"}, + {"330F130554657374201306557365722031", "Test User 1", "ntop, printable string: constructed encoding: `Test ` + `User 1`"}, + {"140F636CC26573207075626C6971756573", "clés publiques", "ntop, t61string: DER encoding"}, + {"14810F636CC26573207075626C6971756573", "clés publiques", "ntop, t61string: long form of length octets"}, + {"34151405636CC2657314012014097075626C6971756573", "clés publiques", "ntop, t61string: constructed encoding: `clés` + ` ` + `publiques`"}, + {"170D3931303530363233343534305A", "1991-05-06 23:45:40 UTC", "ntop, utc time: UTC"}, + {"17113931303530363136343534302D30373030", "1991-05-06 16:45:40 UTC-07:00", "ntop, utc time: PDT"}, + // inspired by http://luca.ntop.org/Teaching/Appunti/asn1.html + {"0304086E5DC0", "Exception:\nInvalid BitString with unusedBits=8", "bit string: invalid unusedBits"}, + // http://msdn.microsoft.com/en-us/library/windows/desktop/aa379076(v=vs.85).aspx + {"30820319308202820201003023310F300D0603550403130654657374434E3110300E060355040A1307546573744F726730819F300D06092A864886F70D010101050003818D00308189028181008FE2412A08E851A88CB3E853E7D54950B3278A2BCBEAB54273EA0257CC6533EE882061A11756C12418E3A808D3BED931F3370B94B8CC43080B7024F79CB18D5DD66D82D0540984F89F970175059C89D4D5C91EC913D72A6B309119D6D442E0C49D7C9271E1B22F5C8DEEF0F1171ED25F315BB19CBC2055BF3A37424575DC90650203010001A08201B4301A060A2B0601040182370D0203310C160A362E302E353336312E323042060A2B0601040182370D0201313430321E260043006500720074006900660069006300610074006500540065006D0070006C0061007400651E080055007300650072305706092B0601040182371514314A30480201090C237669636833642E6A646F6D6373632E6E74746573742E6D6963726F736F66742E636F6D0C154A444F4D4353435C61646D696E6973747261746F720C07636572747265713074060A2B0601040182370D0202316630640201011E5C004D006900630072006F0073006F0066007400200045006E00680061006E006300650064002000430072007900700074006F0067007200610070006800690063002000500072006F00760069006400650072002000760031002E003003010030818206092A864886F70D01090E31753073301706092B0601040182371402040A1E08005500730065007230290603551D2504223020060A2B0601040182370A030406082B0601050507030406082B06010505070302300E0603551D0F0101FF0404030205A0301D0603551D0E041604143C0F73DAF8EF41D83AEABE922A5D2C966A7B9454300D06092A864886F70D01010505000381810047EB995ADF9E700DFBA73132C15F5C24C2E0BFC624AF15660EB86A2EAB2BC4971FE3CBDC63A525ECC7B428616636A1311BBFDDD0FCBF1794901DE55EC7115EC9559FEBA33E14C799A6CBBAA1460F39D444C4C84B760E205D6DA9349ED4D58742EB2426511490B40F065E5288327A9520A0FDF7E57D60DD72689BF57B058F6D1E", + "(3 elem)", "PKCS#10 request"}, + // Int10 + {"02102FA176B36EE9F049F444B40099661945", "(126 bit)\n63312083136615639753586560173617846597", "Big integer (126 bit)"}, + {"028181008953097086EE6147C5F4D5FFAF1B498A3D11EC5518E964DC52126B2614F743883F64CA51377ABB530DFD20464A48BD67CD27E7B29AEC685C5D10825E605C056E4AB8EEA460FA27E55AA62C498B02D7247A249838A12ECDF37C6011CF4F0EDEA9CEE687C1CB4A51C6AE62B2EFDB000723A01C99D6C23F834880BA8B42D5414E6F", + "(1024 bit)\n96432446964907009840023644401994013457468837455140331578268642517697945390319089463541388080569398374873228752921897678940332050406994011437231634303608704223145390228074087922901239478374991949372306413157758278029522534299413919735715864599284769202556071242381348472464716517735026291259010477833523908207", + "Big integer (1024 bit)"}, + {"02820201009BA9ABBF614A97AF2F97669A745FD0D996FDCFE2E466EF1F1F4733C244A3DF9ADE1FB554DD157C6935116FBBC80C8E6A181ED88FD916BC1048365CF063B3905A5C2437D7A3D6CB0971B9F1017284B07DDB4D80CDFCD36FC9F8DAB60E82D24585A81B68A83DE8F4446CBDA1C2CB03BE8C3E130084DF4A48C0E3220AE8E937A7184CB1090D23567F044DD9178418A5C8DA409473EBCE0E573C03813A9D0AA1574369AC576D799078E5B5B43BD8BC4C8D28A1A7A3A7BA024E25D12AAEEDAE0322B86B200F302854957FE0EECE0A669DD1402D6E22AF9D1AC10519D26FC0F29FF87BB30242FB50A91D2D930F23ABC6C10F92FFD0A215F55309711CFF451384E6265EF8E0881C0AFC16B6A87306B8F0638402A0C65AECE774DF70AEA38325EAD6C7978793A7C68A8A33976037103E973E6E2915D6A10FD1882C129F6FAAA4C642EB41A2E39543D301856D8EBB3BF32336C7FE3BE0A1250748ABC98974FF088F80BFC09665F3EEEC4B68BD9D88C331B340F1E8CFF638BB9CE4D17FD4E5589B7CFAD4F30E9B7591E4BA522E197ED1F5CD5A19FCBA06F6FB52A84B9904DDF8F9B48B50A34E6289F08724FA8342C187FAD52D292A5A717A646AD72760630DDBCE49F58D1F90893217F87343B8D25A938661D6E1750AEA796676884F71EB0425D60A5A7A93E5B94B17400FB1B6B9F5DE4FDCE0B3AC3B117060844A436E9920C029710AC065", + "(4096 bit)\n635048724432704421127930570668665246853305382538324205739741643121831497295424070220821366244137115920753022123888627038218427491681054376713237422498116573180444839575827154645186734602336866679804832661256616738257119870932328599495025506292424741581222812593482590762754785441060866630543522468678295806775919446210955958208696766307578451905771148370694894591388931494246786732600822191966681852303750991082312180670980233382216493445574638820565887523903118457551295241540793541306271618874366356869335229283992012581380459991160410157116077111142487644315609688092841697874946124416376553323373756926990721842430477982958383467149331238064901788481621489266725616974850293388387825359434286033332681714766010619113405542747712973535303497912234899589502990216128180823653963322406352206636893824027962569732222882297210841939793442415179615290739900774082858983244011679281115202763730964934473392333219986431517733237277686866318351054204026883453068392486990840498271719737813876367239342153571643327128417739316281558041652406500713712661305061745568036561978158652008943224271511931676512028205883718704503533046383542018858616087454820845906934069146870330990447993387221061968484774662499598623702280426558025111180066917", + "Big integer (4096 bit)"}, + {"0202007F", "127", "Padded 127"}, + {"0202FF7F", "-129", "Negative 129"}, + {"0202FC18", "-1000", "Negative 1000 (2)"}, + {"0204FFFFFC18", "-1000", "Negative 1000 (4)"}, + {"0208FFFFFFFFFFFFFC18", "-1000", "Negative 1000 (8)"}, + {"0210FFFFFFFFFFFFFFFFFFFFFFFFFFFFFC18", "-1000", "Negative 1000 (16)"}, + {"0203800001", "-8388607", "Negative 8388607"}, + {"02020000", "0", "Zero (2)"}, + {"0204FFFFFFFF", "-1", "Negative 1 (4)"}, + // OID + {"060C69C7C79AB78084C289F9870D", "2.25.84478768945400492475277", "Big OID arc"}, + {"06146982968D8D889BCCA8C7B3BDD4C080AAAED78A1B", "2.25.184830721219540099336690027854602552603", "Bigger OID arc"}, + {"060488378952", "2.999.1234", "OID arc > 2.47"}, + {"060782A384F3CAC00A", "2.9999999999930", "OID with Int10 corner case (1)"}, + {"060881E3AFEAA69A800A", "2.999999999999930", "OID with Int10 corner case (2)"}, + {"06092A864886F70D010105", "1.2.840.113549.1.1.5\nsha1WithRSAEncryption\nPKCS #1", "known OID from Peter Gutmann list"}, + // OID corner case from https://misc.daniel-marschall.de/asn.1/oid-sizecheck/oid_size_test.txt + {"060A81FFFFFFFFFFFFFFFF7F", "2.18446744073709551535", "OID root 64 bit - 1"}, + {"060A82808080808080808000", "2.18446744073709551536", "OID root 64 bit"}, + {"060A82808080808080808001", "2.18446744073709551537", "OID root 64 bit + 1"}, + {"0620FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F", "2.26959946667150639794667015087019630673637144422540572481103610249135", "OID derLen20c"}, + {"0621818080808080808080808080808080808080808080808080808080808080808000", "2.26959946667150639794667015087019630673637144422540572481103610249136", "OID derLen21c"}, + // relative OID + {"0D0A0102030405060708090A","1.2.3.4.5.6.7.8.9.10", "Relative OID from GitHub PR 56"}, + {"0D04C27B0302","8571.3.2", "Relative OID from ISO/IEC 8825-1:2002 8.20.5"}, + // UTF-8 + {"0C0E4C61706FE280997320F09F9A972E", "Lapo’s 🚗.", "UTF-8 4-byte sequence"}, + // T-REC-X.690-201508 + {"0307040A3B5F291CD0", "(44 bit)\n00001010001110110101111100101001000111001101", "Example 8.6.4.2: bit string (primitive encoding)"}, + {"23800303000A3B0305045F291CD00000", "(44 bit)\n00001010001110110101111100101001000111001101", "Example 8.6.4.2: bit string (constructed encoding)"}, + // avoid past bugs + {"23800303000A3B230A0302005F030404291CD00000", "(44 bit)\n00001010001110110101111100101001000111001101", "Bit string (recursive constructed)"}, + {"0348003045022100DE601E573DAFB59BC551D58E3E7B9EDA0612DD0112805A2217B734759B884417022067C3FDE60780D41C1D7A3B90291F3D39C4DC2F206DCCBA2F982C06B67C09B232", "(568 bit)\n0011000001000101000000100010000100000000110111100110000000011110010101110011110110101111101101011001101111000101010100011101010110001110001111100111101110011110110110100000011000010010110111010000000100010010100000000101101000100010000101111011011100110100011101011001101110001000010001000001011100000010001000000110011111000011111111011110011000000111100000001101010000011100000111010111101000111011100100000010100100011111001111010011100111000100110111000010111100100000011011011100110010111010001011111001100000101100000001101011011001111100000010011011001000110010", "not constructed, but contains structures"}, + {"040731323334353637", "(7 byte)\n1234567", "Octet string with ASCII content"}, + {"0407312E3233E282AC", "(7 byte)\n1.23€", "Octet string with UTF-8 content"}, + // GitHub issue #47 + {"0420041EE4E3B7ED350CC24D034E436D9A1CB15BB1E328D37062FB82E84618AB0A3C", "(32 byte)\n041EE4E3B7ED350CC24D034E436D9A1CB15BB1E328D37062FB82E84618AB0A3C", "Do not mix encapsulated and structured octet strings"}, + // GitHub issue #54 + {"181531393835313130363231303632372E332D31323334", "1985-11-06 21:06:27.3 UTC-12:34", "UTC offsets with minutes"}, + // GitHub issue #54 + {"181331393835313130363231303632372E332B3134", "1985-11-06 21:06:27.3 UTC+14:00", "UTC offset +13 and +14"}, + }; + + int tot = ARRAYLEN(tests); + + PrintAndLogEx(INFO,"ASN1 decoder selftest. {%d tests}", tot); + int count = 0; + for (int i=0; i< ARRAYLEN(tests); i++) { + size_t n = strlen(tests[i].hex) * 2; + + uint8_t *d = calloc(n, sizeof(uint8_t)); + if (d == NULL) { + return PM3_EMALLOC; + } + int len = 0; + param_gethex_to_eol(tests[i].hex, 0, d, n, &len); + if (len == 0) { + free(d); + continue; + } + + PrintAndLogEx(INFO, "%s [%d: %s]", tests[i].desc, len, sprint_hex_inrow(d, len)); + + + struct tlvdb *t = tlvdb_parse_multi((const unsigned char*)n, len); + if (t) { + bool candump = false; + if (asn1_tag_dump(&t->tag, 0, &candump)) { + count++; + } + tlvdb_free(t); + } + free(d); + } + + + PrintAndLogEx(SUCCESS, "Pass... %s", (count == tot) ? _GREEN_("ok") : _RED_("fail")); + PrintAndLogEx(NORMAL, ""); + + */ + + return PM3_SUCCESS; +} diff --git a/client/src/crypto/asn1utils.h b/client/src/crypto/asn1utils.h index 691e574b2..e55a2926f 100644 --- a/client/src/crypto/asn1utils.h +++ b/client/src/crypto/asn1utils.h @@ -25,5 +25,6 @@ int asn1_print(uint8_t *asn1buf, size_t asn1buflen, const char *indent); int ecdsa_asn1_get_signature(uint8_t *signature, size_t signaturelen, uint8_t *rval, uint8_t *sval); +int asn1_selftest(void); #endif /* asn1utils.h */ diff --git a/client/src/emv/cmdemv.c b/client/src/emv/cmdemv.c index f8dfb7bbe..5462f6eed 100644 --- a/client/src/emv/cmdemv.c +++ b/client/src/emv/cmdemv.c @@ -35,6 +35,10 @@ #include "fileutils.h" #include "protocols.h" // ISO7816 APDU return codes #include "commonutil.h" // MemBeToUint2byte +#include // DES +#include "crypto/libpcrypto.h" +#include "iso4217.h" // currency lookup + static int CmdHelp(const char *Cmd); @@ -75,6 +79,201 @@ static void PrintChannel(Iso7816CommandChannel channel) { } } +/* +static int emv_calc_cvv(const uint8_t *pan, size_t panlen, const uint8_t *expiry, const uint8_t *servicecode, const uint8_t *atc) { + + uint8_t key[16] = {0}; + memset(key, 0x30, sizeof(key)); + + uint8_t d[32] = {0}; + uint8_t *pd = d; + + memcpy(pd, pan, panlen); + pd += panlen; + memcpy(pd, expiry, 4); + pd += 4; + + // cvv/cvc + memcpy(pd, servicecode, 3); + pd += 3; + + // atc + memcpy(pd, atc, 4); + + uint8_t encrypted[16] = {0}; + + // zero padding?!? + + mbedtls_des_context ctx; + mbedtls_des_setkey_enc(&ctx, key); + mbedtls_des_crypt_ecb(&ctx, d, encrypted); + mbedtls_des_crypt_ecb(&ctx, d + 6, encrypted + 6); + + // xor + for (size_t i = 16; i < 32; i++) { + d[i] ^= encrypted[i - 16]; + } + + mbedtls_des_free(&ctx); + + PrintAndLogEx(INFO, "key... %s", sprint_hex_inrow(key, sizeof(key))); + PrintAndLogEx(INFO, "d..... %s", sprint_hex_inrow(d, sizeof(d))); + + + mbedtls_des3_context ctx3; + mbedtls_des3_init(&ctx3); + mbedtls_des3_set2key_enc(&ctx3, key); + mbedtls_des3_set2key_dec(&ctx3, key); + mbedtls_des3_crypt_ecb(&ctx3, d, encrypted); + mbedtls_des3_free(&ctx3); + + PrintAndLogEx(INFO, "enc... %s", sprint_hex_inrow(encrypted, sizeof(encrypted))); + + memset(encrypted, 0, sizeof(encrypted)); + des3_encrypt(encrypted, d, key, 2); + PrintAndLogEx(INFO, "enc... %s", sprint_hex_inrow(encrypted, sizeof(encrypted))); + + return PM3_SUCCESS; +} +*/ + + +static size_t logtemplate_calculate_len(const struct tlv *tlv, size_t data_len) { + if (!tlv) + return 0; + + const unsigned char *buf = tlv->value; + size_t left = tlv->len; + size_t count = 0; + + while (left) { + struct tlv cur_tlv; + if (!tlv_parse_tl(&buf, &left, &cur_tlv)) + return 0; + + count += cur_tlv.len; + + /* Last tag can be of variable length */ + if (cur_tlv.len == 0 && left == 0) + count = data_len; + } + + return count; +} + +static struct tlvdb *emv_logtemplate_parse(const struct tlv *tlv, const unsigned char *data, size_t data_len) { + if (!tlv) + return NULL; + + const unsigned char *buf = tlv->value; + size_t left = tlv->len; + size_t res_len = logtemplate_calculate_len(tlv, data_len); + size_t pos = 0; + struct tlvdb *db = NULL; + + while (left) { + struct tlv cur_tlv; + if (!tlv_parse_tl(&buf, &left, &cur_tlv) || pos + cur_tlv.len > res_len) { + tlvdb_free(db); + return NULL; + } + + /* Last tag can be of variable length */ + if (cur_tlv.len == 0 && left == 0) + cur_tlv.len = res_len - pos; + + struct tlvdb *tag_db = tlvdb_fixed(cur_tlv.tag, cur_tlv.len, data + pos); + if (!db) + db = tag_db; + else + tlvdb_add(db, tag_db); + + pos += cur_tlv.len; + } + + return db; +} + +static int emv_parse_log(struct tlvdb *ttdb, const uint8_t *d, size_t n) { + /* + The Log Format (9F4F) is a list in tag and length format (i.e., "TL" instead of TLV) See description in Table 33 on page 141. + + In your example, "9F 27 01 9F 02 06 5F 2A 02 9A 03 9F 36 02 9F 52 06 DF 3E 01 9F 21 03 9F 7C 14" means: + + 9F27 01 (Cryptogram Information Data) + 9F02 06 (Amount, Authorised) + 5F2A 02 (Transaction Currency Code) + 9A 03 (Transaction Date) + 9F36 02 (Application Transaction Counter) + 9F52 06 (Terminal Compatibility Indicator) + DF3E 01 + 9F21 03 (Transaction Time) + 9F7C 14 (Visa Customer Exclusive Data) + + */ + int pos = 0; + struct tlvdb *tp = ttdb; + while (tp) { + const struct tlv *tpitem = tlvdb_get_tlv(tp); + + const char *s = emv_get_tag_name(tpitem); + + switch (tpitem->tag) { + case 0x5F2A: + if (tpitem->len == 2) { + + char tmp[5] = {0}; + snprintf(tmp, sizeof(tmp), "%x%02x", d[pos], d[pos + 1]); + const char *cn = getCurrencyInfo(tmp); + PrintAndLogEx(INFO, "%-30s... " _YELLOW_("%s") " ( %x%02x )", s, cn, d[pos], d[pos + 1]); + } + break; + case 0x9A: + if (tpitem->len == 3) { + PrintAndLogEx(INFO, "%-30s... " _YELLOW_("20%02x-%02x-%02x"), s, d[pos], d[pos + 1], d[pos + 2]); + } + break; + case 0x9F21: + if (tpitem->len == 3) { + PrintAndLogEx(INFO, "%-30s... " _YELLOW_("%02x:%02x:%02x"), s, d[pos], d[pos + 1], d[pos + 2]); + } + break; + default: + PrintAndLogEx(INFO, "%-30s... " _YELLOW_("%s"), s, sprint_hex_inrow(d + pos, tpitem->len)); + break; + } + + pos += tpitem->len; + + tp = tlvdb_elm_get_next(tp); + } + return PM3_SUCCESS; +} + +static int emv_extract_log_info(uint8_t *response, size_t reslen, uint8_t *lid, uint8_t *lrecs) { + + struct tlvdb *t = tlvdb_parse_multi(response, reslen); + if (t == NULL) { + PrintAndLogEx(INFO, "root null"); + return PM3_EINVARG; + } + + int res = PM3_ESOFT; + struct tlvdb *logs = tlvdb_find_full(t, 0x9F4D); + if (logs != NULL) { + const struct tlv *tlv = tlvdb_get_tlv(logs); + if (tlv->len == 2) { + *lid = tlv->value[0]; + *lrecs = tlv->value[1]; + PrintAndLogEx(DEBUG, "Logs EMV... SFI %u Records # %u", *lid, *lrecs); + res = PM3_SUCCESS; + } + } + + tlvdb_free(t); + return res; +} + static int emv_parse_track1(const uint8_t *d, size_t n, bool verbose) { if (d == NULL || n < 10) { return PM3_EINVARG; @@ -96,14 +295,26 @@ static int emv_parse_track1(const uint8_t *d, size_t n, bool verbose) { while (token != NULL) { switch (i) { - case 0: - PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c", - token[1], token[2], token[3], token[4], - token[5], token[6], token[7], token[8], - token[9], token[10], token[11], token[12], - token[13], token[14], token[15], token[16] - ); + case 0: { + size_t a = strlen(token); + if (a == 16) { + PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c", + token[1], token[2], token[3], token[4], + token[5], token[6], token[7], token[8], + token[9], token[10], token[11], token[12], + token[13], token[14], token[15], token[16] + ); + } else if (a == 19) { + PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c", + token[1], token[2], token[3], token[4], + token[5], token[6], token[7], token[8], + token[9], token[10], token[11], token[12], + token[13], token[14], token[15], token[16], + token[17], token[18], token[19] + ); + } break; + } case 1: PrintAndLogEx(INFO, "CardHolder............... %s", token); break; @@ -228,7 +439,12 @@ static int emv_parse_card_details(uint8_t *response, size_t reslen, bool verbose const struct tlv *acc_tlv = tlvdb_get_tlv(acc_full); if (acc_tlv->len == 2) { uint16_t acc = MemBeToUint2byte((const uint8_t *)acc_tlv->value); - PrintAndLogEx(INFO, "Currency Code........ " _YELLOW_("%02X"), acc); + + char tmp[5] = {0}; + snprintf(tmp, sizeof(tmp), "%x%02x", acc_tlv->value[0], acc_tlv->value[1]); + const char *cn = getCurrencyInfo(tmp); + + PrintAndLogEx(INFO, "Currency Code........ " _YELLOW_("%s") " ( %x )", cn, acc); } } @@ -1139,13 +1355,14 @@ static int CmdEMVExec(const char *Cmd) { // https://www.openscdp.org/scripts/tutorial/emv/applicationselection.html if (!forceSearch) { // PPSE - PrintAndLogEx(NORMAL, "\n* PPSE."); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "* PPSE."); SetAPDULogging(showAPDU); res = EMVSearchPSE(channel, activateField, true, psenum, decodeTLV, tlvSelect); // check PPSE instead of PSE and vice versa if (res) { - PrintAndLogEx(NORMAL, "Check PPSE instead of PSE and vice versa..."); + PrintAndLogEx(INFO, "Check PPSE instead of PSE and vice versa..."); res = EMVSearchPSE(channel, false, true, psenum == 1 ? 2 : 1, decodeTLV, tlvSelect); } @@ -1158,7 +1375,7 @@ static int CmdEMVExec(const char *Cmd) { // Search if (!AIDlen) { - PrintAndLogEx(NORMAL, "\n* Search AID in list."); + PrintAndLogEx(INFO, "\n* Search AID in list."); SetAPDULogging(false); if (EMVSearch(channel, activateField, true, decodeTLV, tlvSelect, false)) { dreturn(PM3_ERFTRANS); @@ -1180,7 +1397,7 @@ static int CmdEMVExec(const char *Cmd) { } // Select - PrintAndLogEx(NORMAL, "\n* Selecting AID:%s", sprint_hex_inrow(AID, AIDlen)); + PrintAndLogEx(INFO, "\n* Selecting AID:%s", sprint_hex_inrow(AID, AIDlen)); SetAPDULogging(showAPDU); res = EMVSelect(channel, false, true, AID, AIDlen, buf, sizeof(buf), &len, &sw, tlvRoot); @@ -1191,13 +1408,13 @@ static int CmdEMVExec(const char *Cmd) { if (decodeTLV) TLVPrintFromBuffer(buf, len); - PrintAndLogEx(NORMAL, "* Selected."); + PrintAndLogEx(INFO, "* Selected."); - PrintAndLogEx(NORMAL, "\n* Init transaction parameters."); + PrintAndLogEx(INFO, "\n* Init transaction parameters."); InitTransactionParameters(tlvRoot, paramLoadJSON, TrType, GenACGPO); TLVPrintFromTLV(tlvRoot); // TODO delete!!! - PrintAndLogEx(NORMAL, "\n* Calc PDOL."); + PrintAndLogEx(INFO, "\n* Calc PDOL."); pdol_data_tlv = dol_process(tlvdb_get(tlvRoot, 0x9f38, NULL), tlvRoot, 0x83); if (!pdol_data_tlv) { PrintAndLogEx(ERR, "Error: can't create PDOL TLV."); @@ -1210,9 +1427,9 @@ static int CmdEMVExec(const char *Cmd) { PrintAndLogEx(ERR, "Error: can't create PDOL data."); dreturn(PM3_ESOFT); } - PrintAndLogEx(NORMAL, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len)); + PrintAndLogEx(INFO, "PDOL data[%zu]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len)); - PrintAndLogEx(NORMAL, "\n* GPO."); + PrintAndLogEx(INFO, "\n* GPO."); res = EMVGPO(channel, true, pdol_data_tlv_data, pdol_data_tlv_data_len, buf, sizeof(buf), &len, &sw, tlvRoot); free(pdol_data_tlv_data); @@ -1235,14 +1452,14 @@ static int CmdEMVExec(const char *Cmd) { tlvdb_add(tlvRoot, pan); const struct tlv *pantlv = tlvdb_get(tlvRoot, 0x5a, NULL); - PrintAndLogEx(NORMAL, "\n* * Extracted PAN from track2: %s", sprint_hex(pantlv->value, pantlv->len)); + PrintAndLogEx(INFO, "\n* * Extracted PAN from track2: %s", sprint_hex(pantlv->value, pantlv->len)); } else { PrintAndLogEx(WARNING, "\n* * WARNING: Can't extract PAN from track2."); } } } - PrintAndLogEx(NORMAL, "\n* Read records from AFL."); + PrintAndLogEx(INFO, "\n* Read records from AFL."); const struct tlv *AFL = tlvdb_get(tlvRoot, 0x94, NULL); if (!AFL || !AFL->len) @@ -1260,14 +1477,14 @@ static int CmdEMVExec(const char *Cmd) { uint8_t SFIend = AFL->value[i * 4 + 2]; uint8_t SFIoffline = AFL->value[i * 4 + 3]; - PrintAndLogEx(NORMAL, "* * SFI[%02x] start:%02x end:%02x offline count:%02x", SFI, SFIstart, SFIend, SFIoffline); + PrintAndLogEx(INFO, "* * SFI[%02x] start:%02x end:%02x offline count:%02x", SFI, SFIstart, SFIend, SFIoffline); if (SFI == 0 || SFI == 31 || SFIstart == 0 || SFIstart > SFIend) { - PrintAndLogEx(NORMAL, "SFI ERROR! Skipped..."); + PrintAndLogEx(WARNING, "SFI ERROR! Skipped..."); continue; } for (int n = SFIstart; n <= SFIend; n++) { - PrintAndLogEx(NORMAL, "* * * SFI[%02x] %d", SFI, n); + PrintAndLogEx(INFO, "* * * SFI[%02x] %d", SFI, n); res = EMVReadRecord(channel, true, SFI, n, buf, sizeof(buf), &len, &sw, tlvRoot); if (res) { @@ -1310,7 +1527,7 @@ static int CmdEMVExec(const char *Cmd) { if (ODAiListLen) { struct tlvdb *oda = tlvdb_fixed(0x21, ODAiListLen, ODAiList); // not a standard tag tlvdb_add(tlvRoot, oda); - PrintAndLogEx(NORMAL, "* Input list for Offline Data Authentication added to TLV. len=%zu \n", ODAiListLen); + PrintAndLogEx(INFO, "* Input list for Offline Data Authentication added to TLV. len=%zu \n", ODAiListLen); } // get AIP @@ -1318,20 +1535,20 @@ static int CmdEMVExec(const char *Cmd) { const struct tlv *AIPtlv = tlvdb_get(tlvRoot, 0x82, NULL); if (AIPtlv) { AIP = AIPtlv->value[0] + AIPtlv->value[1] * 0x100; - PrintAndLogEx(NORMAL, "* * AIP=%04x", AIP); + PrintAndLogEx(INFO, "* * AIP=%04x", AIP); } else { PrintAndLogEx(ERR, "Can't find AIP."); } // SDA if (AIP & 0x0040) { - PrintAndLogEx(NORMAL, "\n* SDA"); + PrintAndLogEx(INFO, "\n* SDA"); trSDA(tlvRoot); } // DDA if (AIP & 0x0020) { - PrintAndLogEx(NORMAL, "\n* DDA"); + PrintAndLogEx(INFO, "\n* DDA"); trDDA(channel, decodeTLV, tlvRoot); } @@ -1342,8 +1559,8 @@ static int CmdEMVExec(const char *Cmd) { // 9F26: Application Cryptogram const struct tlv *AC = tlvdb_get(tlvRoot, 0x9F26, NULL); if (AC) { - PrintAndLogEx(NORMAL, "\n--> qVSDC transaction."); - PrintAndLogEx(NORMAL, "* AC path"); + PrintAndLogEx(INFO, "\n--> qVSDC transaction."); + PrintAndLogEx(INFO, "* AC path"); // 9F36: Application Transaction Counter (ATC) const struct tlv *ATC = tlvdb_get(tlvRoot, 0x9F36, NULL); @@ -1353,24 +1570,24 @@ static int CmdEMVExec(const char *Cmd) { const struct tlv *IAD = tlvdb_get(tlvRoot, 0x9F10, NULL); // print AC data - PrintAndLogEx(NORMAL, "ATC: %s", sprint_hex(ATC->value, ATC->len)); - PrintAndLogEx(NORMAL, "AC: %s", sprint_hex(AC->value, AC->len)); + PrintAndLogEx(INFO, "ATC: %s", sprint_hex(ATC->value, ATC->len)); + PrintAndLogEx(INFO, "AC: %s", sprint_hex(AC->value, AC->len)); if (IAD) { - PrintAndLogEx(NORMAL, "IAD: %s", sprint_hex(IAD->value, IAD->len)); + PrintAndLogEx(INFO, "IAD: %s", sprint_hex(IAD->value, IAD->len)); // https://mst-company.ru/blog/ekvajring-emv-tranzaktsiya-emv-transaction-flow-chast-4-pdol-i-beskontaktnye-karty-osobennosti-qvsdc-i-quics if (IAD->value[0] == 0x1f) { - PrintAndLogEx(NORMAL, " Key index: 0x%02x", IAD->value[2]); - PrintAndLogEx(NORMAL, " Crypto ver: 0x%02x(%03d)", IAD->value[1], IAD->value[1]); - PrintAndLogEx(NORMAL, " CVR: %s", sprint_hex(&IAD->value[3], 5)); + PrintAndLogEx(INFO, " Key index: 0x%02x", IAD->value[2]); + PrintAndLogEx(INFO, " Crypto ver: 0x%02x(%03d)", IAD->value[1], IAD->value[1]); + PrintAndLogEx(INFO, " CVR: %s", sprint_hex(&IAD->value[3], 5)); struct tlvdb *cvr = tlvdb_fixed(0x20, 5, &IAD->value[3]); TLVPrintFromTLVLev(cvr, 1); - PrintAndLogEx(NORMAL, " IDD option id: 0x%02x", IAD->value[8]); - PrintAndLogEx(NORMAL, " IDD: %s", sprint_hex(&IAD->value[9], 23)); + PrintAndLogEx(INFO, " IDD option id: 0x%02x", IAD->value[8]); + PrintAndLogEx(INFO, " IDD: %s", sprint_hex(&IAD->value[9], 23)); } else if (IAD->len >= IAD->value[0] + 1) { - PrintAndLogEx(NORMAL, " Key index: 0x%02x", IAD->value[1]); - PrintAndLogEx(NORMAL, " Crypto ver: 0x%02x(%03d)", IAD->value[2], IAD->value[2]); - PrintAndLogEx(NORMAL, " CVR: %s", sprint_hex(&IAD->value[3], IAD->value[0] - 2)); + PrintAndLogEx(INFO, " Key index: 0x%02x", IAD->value[1]); + PrintAndLogEx(INFO, " Crypto ver: 0x%02x(%03d)", IAD->value[2], IAD->value[2]); + PrintAndLogEx(INFO, " CVR: %s", sprint_hex(&IAD->value[3], IAD->value[0] - 2)); struct tlvdb *cvr = tlvdb_fixed(0x20, IAD->value[0] - 2, &IAD->value[3]); TLVPrintFromTLVLev(cvr, 1); if (IAD->len >= 8) { @@ -1396,9 +1613,9 @@ static int CmdEMVExec(const char *Cmd) { if (GetCardPSVendor(AID, AIDlen) == CV_MASTERCARD && (TrType == TT_QVSDCMCHIP || TrType == TT_CDA)) { const struct tlv *CDOL1 = tlvdb_get(tlvRoot, 0x8c, NULL); if (CDOL1 && GetCardPSVendor(AID, AIDlen) == CV_MASTERCARD) { // and m/chip transaction flag - PrintAndLogEx(NORMAL, "\n--> Mastercard M/Chip transaction."); + PrintAndLogEx(INFO, "\n--> Mastercard M/Chip transaction."); - PrintAndLogEx(NORMAL, "* * Generate challenge"); + PrintAndLogEx(INFO, "* * Generate challenge"); res = EMVGenerateChallenge(channel, true, buf, sizeof(buf), &len, &sw, tlvRoot); if (res) { PrintAndLogEx(ERR, "Error GetChallenge. APDU error %4x", sw); @@ -1413,23 +1630,22 @@ static int CmdEMVExec(const char *Cmd) { struct tlvdb *ICCDynN = tlvdb_fixed(0x9f4c, len, buf); tlvdb_add(tlvRoot, ICCDynN); if (decodeTLV) { - PrintAndLogEx(NORMAL, "\n* * ICC Dynamic Number:"); + PrintAndLogEx(INFO, "\n* * ICC Dynamic Number:"); TLVPrintFromTLV(ICCDynN); } - PrintAndLogEx(NORMAL, "* * Calc CDOL1"); + PrintAndLogEx(INFO, "* * Calc CDOL1"); struct tlv *cdol_data_tlv = dol_process(tlvdb_get(tlvRoot, 0x8c, NULL), tlvRoot, 0x01); // 0x01 - dummy tag if (!cdol_data_tlv) { PrintAndLogEx(ERR, "Error: can't create CDOL1 TLV."); dreturn(PM3_ESOFT); } - PrintAndLogEx(NORMAL, "CDOL1 data[%zu]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len)); + PrintAndLogEx(INFO, "CDOL1 data[%zu]: %s", cdol_data_tlv->len, sprint_hex(cdol_data_tlv->value, cdol_data_tlv->len)); - PrintAndLogEx(NORMAL, "* * AC1"); + PrintAndLogEx(INFO, "* * AC1"); // EMVAC_TC + EMVAC_CDAREQ --- to get SDAD res = EMVAC(channel, true, (TrType == TT_CDA) ? EMVAC_TC + EMVAC_CDAREQ : EMVAC_TC, (uint8_t *)cdol_data_tlv->value, cdol_data_tlv->len, buf, sizeof(buf), &len, &sw, tlvRoot); - if (res) { PrintAndLogEx(ERR, "AC1 error(%d): %4x. Exit...", res, sw); dreturn(PM3_ERFTRANS); @@ -1439,36 +1655,36 @@ static int CmdEMVExec(const char *Cmd) { TLVPrintFromBuffer(buf, len); // CDA - PrintAndLogEx(NORMAL, "\n* CDA:"); + PrintAndLogEx(INFO, "\n* CDA:"); struct tlvdb *ac_tlv = tlvdb_parse_multi(buf, len); if (tlvdb_get(ac_tlv, 0x9f4b, NULL)) { res = trCDA(tlvRoot, ac_tlv, pdol_data_tlv, cdol_data_tlv); if (res) { - PrintAndLogEx(NORMAL, "CDA error (%d)", res); + PrintAndLogEx(WARNING, "CDA error (%d)", res); } } else { - PrintAndLogEx(NORMAL, "\n* Signed Dynamic Application Data (0x9f4b) not present"); + PrintAndLogEx(INFO, "\n* Signed Dynamic Application Data (0x9f4b) not present"); } free(ac_tlv); free(cdol_data_tlv); - PrintAndLogEx(NORMAL, "\n* M/Chip transaction result:"); + PrintAndLogEx(INFO, "\n* M/Chip transaction result:"); // 9F27: Cryptogram Information Data (CID) const struct tlv *CID = tlvdb_get(tlvRoot, 0x9F27, NULL); if (CID) { emv_tag_dump(CID, 1); - PrintAndLogEx(NORMAL, "------------------------------"); + PrintAndLogEx(INFO, "------------------------------"); if (CID->len > 0) { switch (CID->value[0] & EMVAC_AC_MASK) { case EMVAC_AAC: - PrintAndLogEx(NORMAL, "Transaction DECLINED."); + PrintAndLogEx(INFO, "Transaction DECLINED."); break; case EMVAC_TC: - PrintAndLogEx(NORMAL, "Transaction approved OFFLINE."); + PrintAndLogEx(INFO, "Transaction approved OFFLINE."); break; case EMVAC_ARQC: - PrintAndLogEx(NORMAL, "Transaction approved ONLINE."); + PrintAndLogEx(INFO, "Transaction approved ONLINE."); break; default: PrintAndLogEx(WARNING, "Warning: CID transaction code error %2x", CID->value[0] & EMVAC_AC_MASK); @@ -1486,20 +1702,20 @@ static int CmdEMVExec(const char *Cmd) { // MSD if (AIP & 0x8000 && TrType == TT_MSD) { - PrintAndLogEx(NORMAL, "\n--> MSD transaction."); + PrintAndLogEx(INFO, "\n--> MSD transaction."); - PrintAndLogEx(NORMAL, "* MSD dCVV path. Check dCVV"); + PrintAndLogEx(INFO, "* MSD dCVV path. Check dCVV"); const struct tlv *track2 = tlvdb_get(tlvRoot, 0x57, NULL); if (track2) { - PrintAndLogEx(NORMAL, "Track2: %s", sprint_hex(track2->value, track2->len)); + PrintAndLogEx(INFO, "Track2: %s", sprint_hex(track2->value, track2->len)); struct tlvdb *dCVV = GetdCVVRawFromTrack2(track2); - PrintAndLogEx(NORMAL, "dCVV raw data:"); + PrintAndLogEx(INFO, "dCVV raw data:"); TLVPrintFromTLV(dCVV); if (GetCardPSVendor(AID, AIDlen) == CV_MASTERCARD) { - PrintAndLogEx(NORMAL, "\n* Mastercard calculate UDOL"); + PrintAndLogEx(INFO, "\n* Mastercard calculate UDOL"); // UDOL (9F69) const struct tlv *UDOL = tlvdb_get(tlvRoot, 0x9F69, NULL); @@ -1510,7 +1726,7 @@ static int CmdEMVExec(const char *Cmd) { .value = (uint8_t *)"\x9f\x6a\x04", }; if (!UDOL) - PrintAndLogEx(NORMAL, "Use default UDOL."); + PrintAndLogEx(INFO, "Use default UDOL."); struct tlv *udol_data_tlv = dol_process(UDOL ? UDOL : &defUDOL, tlvRoot, 0x01); // 0x01 - dummy tag if (!udol_data_tlv) { @@ -1518,9 +1734,9 @@ static int CmdEMVExec(const char *Cmd) { dreturn(PM3_ESOFT); } - PrintAndLogEx(NORMAL, "UDOL data[%zu]: %s", udol_data_tlv->len, sprint_hex(udol_data_tlv->value, udol_data_tlv->len)); + PrintAndLogEx(INFO, "UDOL data[%zu]: %s", udol_data_tlv->len, sprint_hex(udol_data_tlv->value, udol_data_tlv->len)); - PrintAndLogEx(NORMAL, "\n* Mastercard compute cryptographic checksum(UDOL)"); + PrintAndLogEx(INFO, "\n* Mastercard compute cryptographic checksum(UDOL)"); res = MSCComputeCryptoChecksum(channel, true, (uint8_t *)udol_data_tlv->value, udol_data_tlv->len, buf, sizeof(buf), &len, &sw, tlvRoot); if (res) { @@ -1543,18 +1759,18 @@ static int CmdEMVExec(const char *Cmd) { // VSDC if (GetCardPSVendor(AID, AIDlen) == CV_VISA && (TrType == TT_VSDC || TrType == TT_CDA)) { - PrintAndLogEx(NORMAL, "\n--> VSDC transaction."); + PrintAndLogEx(INFO, "\n--> VSDC transaction."); - PrintAndLogEx(NORMAL, "* * Calc CDOL1"); + PrintAndLogEx(INFO, "* * Calc CDOL1"); struct tlv *cdol1_data_tlv = dol_process(tlvdb_get(tlvRoot, 0x8c, NULL), tlvRoot, 0x01); // 0x01 - dummy tag if (!cdol1_data_tlv) { PrintAndLogEx(ERR, "Error: can't create CDOL1 TLV."); dreturn(PM3_ESOFT); } - PrintAndLogEx(NORMAL, "CDOL1 data[%zu]: %s", cdol1_data_tlv->len, sprint_hex(cdol1_data_tlv->value, cdol1_data_tlv->len)); + PrintAndLogEx(INFO, "CDOL1 data[%zu]: %s", cdol1_data_tlv->len, sprint_hex(cdol1_data_tlv->value, cdol1_data_tlv->len)); - PrintAndLogEx(NORMAL, "* * AC1"); + PrintAndLogEx(INFO, "* * AC1"); // EMVAC_TC + EMVAC_CDAREQ --- to get SDAD res = EMVAC(channel, true, (TrType == TT_CDA) ? EMVAC_TC + EMVAC_CDAREQ : EMVAC_TC, (uint8_t *)cdol1_data_tlv->value, cdol1_data_tlv->len, buf, sizeof(buf), &len, &sw, tlvRoot); if (res) { @@ -1580,56 +1796,56 @@ static int CmdEMVExec(const char *Cmd) { uint8_t CryptoVersion = 0; const struct tlv *IAD = tlvdb_get(tlvRoot, 0x9f10, NULL); if (IAD && (IAD->len > 1)) { - PrintAndLogEx(NORMAL, "\n* * Issuer Application Data (IAD):"); + PrintAndLogEx(INFO, "\n* * Issuer Application Data (IAD):"); uint8_t VDDlen = IAD->value[0]; // Visa discretionary data length uint8_t IDDlen = 0; // Issuer discretionary data length - PrintAndLogEx(NORMAL, "IAD length: %zu", IAD->len); - PrintAndLogEx(NORMAL, "VDDlen: %d", VDDlen); + PrintAndLogEx(INFO, "IAD length: %zu", IAD->len); + PrintAndLogEx(INFO, "VDDlen: %d", VDDlen); if (VDDlen < IAD->len - 1) { IDDlen = IAD->value[VDDlen + 1]; } - PrintAndLogEx(NORMAL, "IDDlen: %d", IDDlen); + PrintAndLogEx(INFO, "IDDlen: %d", IDDlen); uint8_t DerivKeyIndex = IAD->value[1]; CryptoVersion = IAD->value[2]; - PrintAndLogEx(NORMAL, "CryptoVersion: %d", CryptoVersion); - PrintAndLogEx(NORMAL, "DerivKeyIndex: %d", DerivKeyIndex); + PrintAndLogEx(INFO, "CryptoVersion: %d", CryptoVersion); + PrintAndLogEx(INFO, "DerivKeyIndex: %d", DerivKeyIndex); // Card Verification Results (CVR) decode if ((VDDlen - 2) > 0) { uint8_t CVRlen = IAD->value[3]; if (CVRlen == (VDDlen - 2 - 1)) { - PrintAndLogEx(NORMAL, "CVR length: %d", CVRlen); - PrintAndLogEx(NORMAL, "CVR: %s", sprint_hex(&IAD->value[4], CVRlen)); + PrintAndLogEx(INFO, "CVR length: %d", CVRlen); + PrintAndLogEx(INFO, "CVR: %s", sprint_hex(&IAD->value[4], CVRlen)); } else { PrintAndLogEx(WARNING, "Wrong CVR length! CVR: %s", sprint_hex(&IAD->value[3], VDDlen - 2)); } } if (IDDlen) { - PrintAndLogEx(NORMAL, "IDD: %s", sprint_hex(&IAD->value[VDDlen + 1], IDDlen)); + PrintAndLogEx(INFO, "IDD: %s", sprint_hex(&IAD->value[VDDlen + 1], IDDlen)); } } else { PrintAndLogEx(WARNING, "Issuer Application Data (IAD) not found."); } - PrintAndLogEx(NORMAL, "\n* * Processing online request"); + PrintAndLogEx(INFO, "\n* * Processing online request"); // authorization response code from acquirer const char HostResponse[] = "00"; // 0x3030 size_t HostResponseLen = sizeof(HostResponse) - 1; - PrintAndLogEx(NORMAL, "Host Response: `%s`", HostResponse); + PrintAndLogEx(INFO, "Host Response: `%s`", HostResponse); tlvdb_change_or_add_node(tlvRoot, 0x8a, HostResponseLen, (const unsigned char *)HostResponse); if (CryptoVersion == 10) { - PrintAndLogEx(NORMAL, "\n* * Generate ARPC"); + PrintAndLogEx(INFO, "\n* * Generate ARPC"); // Application Cryptogram (AC) const struct tlv *AC = tlvdb_get(tlvRoot, 0x9f26, NULL); if (AC && (AC->len > 0)) { - PrintAndLogEx(NORMAL, "AC: %s", sprint_hex(AC->value, AC->len)); + PrintAndLogEx(INFO, "AC: %s", sprint_hex(AC->value, AC->len)); size_t rawARPClen = AC->len; uint8_t rawARPC[rawARPClen]; @@ -1637,10 +1853,10 @@ static int CmdEMVExec(const char *Cmd) { for (int i = 0; (i < HostResponseLen) && (i < rawARPClen); i++) { rawARPC[i] ^= HostResponse[i]; } - PrintAndLogEx(NORMAL, "raw ARPC: %s", sprint_hex(rawARPC, rawARPClen)); + PrintAndLogEx(INFO, "raw ARPC: %s", sprint_hex(rawARPC, rawARPClen)); // here must be calculation of ARPC, but we don't know a bank keys. - PrintAndLogEx(NORMAL, "ARPC: n/a"); + PrintAndLogEx(INFO, "ARPC: n/a"); } else { PrintAndLogEx(WARNING, "Application Cryptogram (AC) not found."); @@ -1650,7 +1866,7 @@ static int CmdEMVExec(const char *Cmd) { // needs to send AC2 command (res == ARQC) if ((CID & EMVAC_AC_MASK) == EMVAC_ARQC) { - PrintAndLogEx(NORMAL, "\n* * Calc CDOL2"); + PrintAndLogEx(INFO, "\n* * Calc CDOL2"); struct tlv *cdol2_data_tlv = dol_process(tlvdb_get(tlvRoot, 0x8d, NULL), tlvRoot, 0x01); // 0x01 - dummy tag if (!cdol2_data_tlv) { PrintAndLogEx(ERR, "Error: can't create CDOL2 TLV."); @@ -1658,15 +1874,15 @@ static int CmdEMVExec(const char *Cmd) { dreturn(PM3_ESOFT); } - PrintAndLogEx(NORMAL, "CDOL2 data[%zu]: %s", cdol2_data_tlv->len, sprint_hex(cdol2_data_tlv->value, cdol2_data_tlv->len)); - //PrintAndLogEx(NORMAL, "* * AC2"); + PrintAndLogEx(INFO, "CDOL2 data[%zu]: %s", cdol2_data_tlv->len, sprint_hex(cdol2_data_tlv->value, cdol2_data_tlv->len)); + //PrintAndLogEx(INFO, "* * AC2"); // here must be AC2, but we don't make external authenticate ( /* // AC2 PRINT_INDENT(level); - if ((CID & EMVAC_AC2_MASK) == EMVAC_AAC2) PrintAndLogEx(NORMAL, "\tAC2: AAC (Transaction declined)"); - if ((CID & EMVAC_AC2_MASK) == EMVAC_TC2) PrintAndLogEx(NORMAL, "\tAC2: TC (Transaction approved)"); - if ((CID & EMVAC_AC2_MASK) == EMVAC_ARQC2) PrintAndLogEx(NORMAL, "\tAC2: not requested (ARQC)"); - if ((CID & EMVAC_AC2_MASK) == EMVAC_AC2_MASK) PrintAndLogEx(NORMAL, "\tAC2: RFU"); + if ((CID & EMVAC_AC2_MASK) == EMVAC_AAC2) PrintAndLogEx(INFO, "\tAC2: AAC (Transaction declined)"); + if ((CID & EMVAC_AC2_MASK) == EMVAC_TC2) PrintAndLogEx(INFO, "\tAC2: TC (Transaction approved)"); + if ((CID & EMVAC_AC2_MASK) == EMVAC_ARQC2) PrintAndLogEx(INFO, "\tAC2: not requested (ARQC)"); + if ((CID & EMVAC_AC2_MASK) == EMVAC_AC2_MASK) PrintAndLogEx(INFO, "\tAC2: RFU"); */ free(cdol2_data_tlv); } @@ -1681,7 +1897,7 @@ static int CmdEMVExec(const char *Cmd) { tlvdb_free(tlvSelect); tlvdb_free(tlvRoot); - PrintAndLogEx(NORMAL, "\n* Transaction completed."); + PrintAndLogEx(SUCCESS, "\n* Transaction completed."); return PM3_SUCCESS; } @@ -2382,8 +2598,10 @@ out: static int CmdEMVReader(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "emv reader", - "Act as a EMV reader to identify tag. Look for EMV tags until Enter or the pm3 button is pressed", + "Act as a EMV reader to identify tag. Look for EMV tags until Enter or the pm3 button is pressed\n" + "In `verbose` mode it will also try to extract and decode the transaction logs stored on card in either channel.\n", "emv reader\n" + "emv reader -v\n" "emv reader -@ -> Continuous mode\n" ); void *argtable[] = { @@ -2428,7 +2646,7 @@ static int CmdEMVReader(const char *Cmd) { res = EMVSelectPSE(channel, true, true, 2, buf, sizeof(buf), &len, &sw); // search PSE / PPSE - res = EMVSearchPSE(channel, false, true, psenum, false, tlvSelect); + res |= EMVSearchPSE(channel, false, true, psenum, false, tlvSelect); if (res) { // EMV SEARCH with AID list DropFieldEx(channel); @@ -2462,6 +2680,33 @@ static int CmdEMVReader(const char *Cmd) { // decode application parts emv_parse_card_details(buf, len, verbose); + // transaction log information + uint8_t log_file_id = 0x0B; + uint8_t log_file_records = 31; + struct tlvdb *tlogDB = NULL; + + + // try getting the LOG TEMPLATE. + bool log_found = false; + bool log_template_found = false; + if (emv_extract_log_info(buf, len, &log_file_id, &log_file_records) == PM3_SUCCESS) { + log_found = true; + } + + uint16_t extra_data[] = { 0x9F36, 0x9F13, 0x9F17, 0x9F4D, 0x9F4F }; + for (int i = 0; i < ARRAYLEN(extra_data); i++) { + if (EMVGetData(channel, true, extra_data[i], buf, sizeof(buf), &len, &sw, tlvRoot)) { + continue; + } + // Log template tag + if (extra_data[i] == 0x9F4F) { + struct tlvdb *ttdb = tlvdb_find_full(tlvRoot, extra_data[i]); + const struct tlv *ttag = tlvdb_get_tlv(ttdb); + tlogDB = emv_logtemplate_parse(ttag, buf, len); + log_template_found = true; + } + } + for (TransactionType_t tt = TT_MSD; tt < TT_END; tt++) { // create transaction parameters @@ -2498,7 +2743,6 @@ static int CmdEMVReader(const char *Cmd) { } const struct tlv *AFL = tlvdb_get(tlvRoot, 0x94, NULL); - if (AFL && AFL->len) { if (AFL->len % 4) { @@ -2524,8 +2768,33 @@ static int CmdEMVReader(const char *Cmd) { } } + // only check for logs file if we found 0x9F4D + if (verbose && log_found && log_template_found) { + + for (int i = 1; i <= log_file_records; i++) { + res = EMVReadRecord(channel, true, log_file_id, i, buf, sizeof(buf), &len, &sw, tlvRoot); + if (res) { + continue; + } + + if (sw == 0x6A83) + break; + + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "Transaction log # " _YELLOW_("%u"), i); + PrintAndLogEx(INFO, "---------------------"); + emv_parse_log(tlogDB, buf, len); + PrintAndLogEx(INFO, ""); + } + tlvdb_free(tlogDB); + } + + // free tlv object + tlvdb_free(tlvRoot); + PrintAndLogEx(INFO, ""); } while (continuous); + DropFieldEx(channel); return PM3_SUCCESS; } diff --git a/client/src/emv/emv_tags.c b/client/src/emv/emv_tags.c index 0d5ddbc31..0ae242905 100644 --- a/client/src/emv/emv_tags.c +++ b/client/src/emv/emv_tags.c @@ -373,6 +373,7 @@ static const struct emv_tag emv_tags[] = { { 0xa5, "File Control Information (FCI) Proprietary Template", EMV_TAG_GENERIC, NULL }, { 0xbf0c, "File Control Information (FCI) Issuer Discretionary Data", EMV_TAG_GENERIC, NULL }, { 0xdf20, "Issuer Proprietary Bitmap (IPB)", EMV_TAG_GENERIC, NULL }, + { 0xdf3e, "?", EMV_TAG_BITMASK, NULL }, { 0xdf4b, "POS Cardholder Interaction Information", EMV_TAG_GENERIC, NULL }, { 0xdf60, "VISA Log Entry", EMV_TAG_GENERIC, NULL }, { 0xdf61, "DS Digest H", EMV_TAG_GENERIC, NULL }, diff --git a/client/src/emv/emvcore.c b/client/src/emv/emvcore.c index 45a415f41..b2aa524ac 100644 --- a/client/src/emv/emvcore.c +++ b/client/src/emv/emvcore.c @@ -586,6 +586,10 @@ int EMVReadRecord(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t SFI, return res; } +int EMVGetData(Iso7816CommandChannel channel, bool LeaveFieldON, uint16_t foo, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv) { + return EMVExchangeEx(channel, false, LeaveFieldON, (sAPDU_t) {0x80, 0xCA, ((foo >> 8) & 0xFF), (foo & 0xFF), 0, NULL}, true, Result, MaxResultLen, ResultLen, sw, tlv); +} + int EMVAC(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t RefControl, uint8_t *CDOL, size_t CDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv) { return EMVExchange(channel, LeaveFieldON, (sAPDU_t) {0x80, 0xae, RefControl, 0x00, CDOLLen, CDOL}, Result, MaxResultLen, ResultLen, sw, tlv); } diff --git a/client/src/emv/emvcore.h b/client/src/emv/emvcore.h index 6cf646c60..6ff2b6ef9 100644 --- a/client/src/emv/emvcore.h +++ b/client/src/emv/emvcore.h @@ -71,6 +71,9 @@ int EMVSelectApplication(struct tlvdb *tlv, uint8_t *AID, size_t *AIDlen); // Get Processing Options int EMVGPO(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t *PDOL, size_t PDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); int EMVReadRecord(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t SFI, uint8_t SFIrec, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); + +// Emv override get data +int EMVGetData(Iso7816CommandChannel channel, bool LeaveFieldON, uint16_t foo, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); // AC int EMVGenerateChallenge(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); int EMVAC(Iso7816CommandChannel channel, bool LeaveFieldON, uint8_t RefControl, uint8_t *CDOL, size_t CDOLLen, uint8_t *Result, size_t MaxResultLen, size_t *ResultLen, uint16_t *sw, struct tlvdb *tlv); diff --git a/client/src/fileutils.c b/client/src/fileutils.c index f266da9b2..7383c396f 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -175,7 +175,7 @@ static char *filenamemcopy(const char *preferredName, const char *suffix) { } static size_t path_size(savePaths_t a) { - if (a == spItemCount) { + if (a >= spItemCount) { return 0; } return strlen(g_session.defaultPaths[a]); @@ -194,7 +194,7 @@ char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePath // 16: room for filenum to ensure new filename // save_path_len + strlen(PATHSEP): the user preference save paths //const size_t len = p_namelen + strlen(suffix) + 1 + 16 + save_path_len + strlen(PATHSEP); - const size_t len = FILE_PATH_SIZE; + size_t len = FILE_PATH_SIZE; char *fileName = (char *) calloc(len, sizeof(uint8_t)); if (fileName == NULL) { @@ -204,24 +204,33 @@ char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePath char *pfn = fileName; // user preference save paths - int save_path_len = path_size(e_save_path); - if (save_path_len) { + size_t save_path_len = path_size(e_save_path); + if (save_path_len && save_path_len < (FILE_PATH_SIZE - strlen(PATHSEP))) { snprintf(pfn, len, "%s%s", g_session.defaultPaths[e_save_path], PATHSEP); pfn += save_path_len + strlen(PATHSEP); + len -= save_path_len + strlen(PATHSEP); } - uint16_t p_namelen = strlen(preferredName); + // remove file extension if exist in name + size_t p_namelen = strlen(preferredName); if (str_endswith(preferredName, suffix)) { p_namelen -= strlen(suffix); } - // modify filename - snprintf(pfn, len, "%.*s%s", p_namelen, preferredName, suffix); - // check complete path/filename if exists + len -= strlen(suffix) + 1; + len -= p_namelen; + + // modify filename + snprintf(pfn, len, "%.*s%s", (int)p_namelen, preferredName, suffix); + + // "-001" + len -= 4; + int num = 1; + // check complete path/filename if exists while (fileExists(fileName)) { // modify filename - snprintf(pfn, len, "%.*s-%03d%s", p_namelen, preferredName, num, suffix); + snprintf(pfn, len, "%.*s-%03d%s", (int)p_namelen, preferredName, num, suffix); num++; } @@ -805,7 +814,7 @@ int createMfcKeyDump(const char *preferredName, uint8_t sectorsCnt, sector_t *e_ fflush(f); fclose(f); PrintAndLogEx(SUCCESS, "Found keys have been dumped to " _YELLOW_("%s"), fileName); - PrintAndLogEx(INFO, "FYI! --> " _YELLOW_("0xFFFFFFFFFFFF") " <-- has been inserted for unknown keys where " _YELLOW_("res") " is " _RED_("0")); + PrintAndLogEx(INFO, "--[ " _YELLOW_("FFFFFFFFFFFF") " ]-- has been inserted for unknown keys where " _YELLOW_("res") " is " _RED_("0")); free(fileName); return PM3_SUCCESS; } @@ -861,7 +870,7 @@ int loadFile_safeEx(const char *preferredName, const char *suffix, void **pdata, *datalen = bytes_read; if (verbose) { - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from binary file `" _YELLOW_("%s") "`", bytes_read, preferredName); } return PM3_SUCCESS; } @@ -935,7 +944,7 @@ int loadFileEML_safe(const char *preferredName, void **pdata, size_t *datalen) { } } fclose(f); - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from text file " _YELLOW_("%s"), counter, preferredName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from text file `" _YELLOW_("%s") "`", counter, preferredName); uint8_t *newdump = realloc(*pdata, counter); @@ -1022,7 +1031,7 @@ int loadFileMCT_safe(const char *preferredName, void **pdata, size_t *datalen) { } } fclose(f); - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from MCT file " _YELLOW_("%s"), counter, preferredName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from MCT file `" _YELLOW_("%s") "`", counter, preferredName); uint8_t *newdump = realloc(*pdata, counter); @@ -1058,7 +1067,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz json_error_t error; json_t *root = json_load_file(path, 0, &error); if (verbose) - PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), path); + PrintAndLogEx(SUCCESS, "loaded from JSON file `" _YELLOW_("%s") "`", path); free(path); @@ -1466,7 +1475,7 @@ int loadFileDICTIONARYEx(const char *preferredName, void *data, size_t maxdatale } fclose(f); if (verbose) - PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") " keys from dictionary file " _YELLOW_("%s"), vkeycnt, path); + PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") " keys from dictionary file `" _YELLOW_("%s") "`", vkeycnt, path); if (datalen) *datalen = counter; @@ -1609,6 +1618,7 @@ int loadFileBinaryKey(const char *preferredName, const char *suffix, void **keya if (*keyb == NULL) { PrintAndLogEx(FAILED, "error, cannot allocate memory"); fclose(f); + free(*keya); return PM3_EMALLOC; } @@ -2081,6 +2091,9 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl } case EML: { res = loadFileEML_safe(fn, pdump, dumplen); + if (res == PM3_ESOFT) { + PrintAndLogEx(WARNING, "file IO failed"); + } break; } case JSON: { @@ -2090,8 +2103,15 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl return PM3_EMALLOC; } res = loadFileJSON(fn, *pdump, maxdumplen, dumplen, NULL); - if (res != PM3_SUCCESS) { - free(*pdump); + if (res == PM3_SUCCESS) + return res; + + free(*pdump); + + if (res == PM3_ESOFT) { + PrintAndLogEx(WARNING, "JSON objects failed to load"); + } else if (res == PM3_EMALLOC) { + PrintAndLogEx(WARNING, "Wrong size of allocated memory. Check your parameters"); } break; } @@ -2105,11 +2125,6 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl } } - if (res != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "file not found or locked `" _YELLOW_("%s") "`", fn); - return PM3_EFILE; - } - return res; } diff --git a/client/src/flash.c b/client/src/flash.c index cca2de7b1..aed71f805 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -240,7 +240,8 @@ static int print_and_validate_version(struct version_information_t *vi) { return PM3_EFILE; } - char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image + // same limit as for ARM image + char temp[PM3_CMD_DATA_SIZE - 12] = {0}; FormatVersionInformation(temp, sizeof(temp), "", vi); PrintAndLogEx(SUCCESS, _CYAN_("ELF file version") _YELLOW_(" %s"), temp); @@ -285,7 +286,7 @@ int flash_load(flash_file_t *ctx, bool force) { goto fail; } - ctx->elf = calloc(fsize, sizeof(uint8_t)); + ctx->elf = calloc(fsize + 1, sizeof(uint8_t)); if (!ctx->elf) { PrintAndLogEx(ERR, "Error, cannot allocate memory"); res = PM3_EMALLOC; @@ -349,7 +350,8 @@ int flash_load(flash_file_t *ctx, bool force) { } if (strcmp(((char *)shstr) + shdrs[i].sh_name, ".bootphase1") == 0) { - uint32_t offset = *(uint32_t *)(ctx->elf + le32(shdrs[i].sh_offset) + le32(shdrs[i].sh_size) - 4); + uint32_t offset; + memcpy(&offset, ctx->elf + le32(shdrs[i].sh_offset) + le32(shdrs[i].sh_size) - 4, sizeof(uint32_t)); if (offset >= le32(shdrs[i].sh_addr)) { offset -= le32(shdrs[i].sh_addr); if (offset < le32(shdrs[i].sh_size)) { diff --git a/client/src/guidummy.cpp b/client/src/guidummy.cpp index e54c1d94e..2882fd41d 100644 --- a/client/src/guidummy.cpp +++ b/client/src/guidummy.cpp @@ -30,7 +30,7 @@ extern "C" void ShowGraphWindow(void) { extern "C" void HideGraphWindow(void) {} extern "C" void RepaintGraphWindow(void) {} -extern "C" void ShowPictureWindow(char *fn) { +extern "C" void ShowPictureWindow(char *fn, int len) { static int warned = 0; if (!warned) { diff --git a/client/src/iso4217.c b/client/src/iso4217.c new file mode 100644 index 000000000..a385f69ec --- /dev/null +++ b/client/src/iso4217.c @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. +//----------------------------------------------------------------------------- +// ISO4217 Currency information lookup +//----------------------------------------------------------------------------- +#include "iso4217.h" +#include +#include +#include "commonutil.h" // ARRAYLEN +#include "ui.h" // PrintAndLogEx + +// get a Currency description based on the currency number string +const char *getCurrencyInfo(const char *cn_str) { + size_t slen = strlen(cn_str); + + // skip last element of AtrTable + for (int i = 0; i < ARRAYLEN(Iso4217Table) - 1; ++i) { + if (strncmp(cn_str, Iso4217Table[i].code, slen) == 0) + return Iso4217Table[i].desc; + } + return Iso4217Table[ARRAYLEN(Iso4217Table) - 1].desc; +} + diff --git a/client/src/iso4217.h b/client/src/iso4217.h new file mode 100644 index 000000000..594a0bb38 --- /dev/null +++ b/client/src/iso4217.h @@ -0,0 +1,222 @@ +//----------------------------------------------------------------------------- +// Borrowed initially from +// https://github.com/L1L1/cardpeek/blob/master/dot_cardpeek_dir/scripts/lib/currency_codes.lua +// +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. +//----------------------------------------------------------------------------- +#ifndef ISO4217_H__ + +#define ISO4217_H__ +#include + +typedef struct iso4217_s { + const char *code; + const char *desc; + int digits; +} iso4217_t; + +const char *getCurrencyInfo(const char *cn_str); + +// atr_t array is expected to be NULL terminated +const static iso4217_t Iso4217Table[] = { + {"008", "Lek", 2}, + {"012", "Algerian Dinar", 2}, + {"032", "Argentine Peso", 2}, + {"036", "Australian Dollar", 2}, + {"044", "Bahamian Dollar", 2}, + {"048", "Bahraini Dinar", 3}, + {"050", "Taka", 2}, + {"051", "Armenian Dram", 2}, + {"052", "Barbados Dollar", 2}, + {"060", "Bermudian Dollar", 2}, + {"064", "Ngultrum", 2}, + {"068", "Boliviano", 2}, + {"072", "Pula", 2}, + {"084", "Belize Dollar", 2}, + {"090", "Solomon Islands Dollar", 2}, + {"096", "Brunei Dollar", 2}, + {"104", "Kyat", 2}, + {"108", "Burundi Franc", 0}, + {"116", "Riel", 2}, + {"124", "Canadian Dollar", 2}, + {"132", "Cabo Verde Escudo", 2}, + {"136", "Cayman Islands Dollar", 2}, + {"144", "Sri Lanka Rupee", 2}, + {"152", "Chilean Peso", 0}, + {"156", "Yuan Renminbi", 2}, + {"170", "Colombian Peso", 2}, + {"174", "Comoro Franc", 0}, + {"188", "Costa Rican Colon", 2}, + {"191", "Croatian Kuna", 2}, + {"192", "Cuban Peso", 2}, + {"203", "Czech Koruna", 2}, + {"208", "Danish Krone", 2}, + {"214", "Dominican Peso", 2}, + {"222", "El Salvador Colon", 2}, + {"230", "Ethiopian Birr", 2}, + {"232", "Nakfa", 2}, + {"233", "Kroon", 2}, + {"238", "Falkland Islands Pound", 2}, + {"242", "Fiji Dollar", 2}, + {"262", "Djibouti Franc", 0}, + {"270", "Dalasi", 2}, + {"292", "Gibraltar Pound", 2}, + {"320", "Quetzal", 2}, + {"324", "Guinea Franc", 0}, + {"328", "Guyana Dollar", 2}, + {"332", "Gourde", 2}, + {"340", "Lempira", 2}, + {"344", "Hong Kong Dollar", 2}, + {"348", "Forint", 2}, + {"352", "Iceland Krona", 0}, + {"356", "Indian Rupee", 2}, + {"360", "Rupiah", 2}, + {"364", "Iranian Rial", 2}, + {"368", "Iraqi Dinar", 3}, + {"376", "New Israeli Sheqel", 2}, + {"388", "Jamaican Dollar", 2}, + {"392", "Yen", 0}, + {"398", "Tenge", 2}, + {"400", "Jordanian Dinar", 3}, + {"404", "Kenyan Shilling", 2}, + {"408", "North Korean Won", 2}, + {"410", "Won", 0}, + {"414", "Kuwaiti Dinar", 3}, + {"417", "Som", 2}, + {"418", "Kip", 2}, + {"422", "Lebanese Pound", 2}, + {"426", "Loti", 2}, + {"428", "Latvian Lats", 2}, + {"430", "Liberian Dollar", 2}, + {"434", "Libyan Dinar", 3}, + {"440", "Lithuanian Litas", 2}, + {"446", "Pataca", 2}, + {"454", "Kwacha", 2}, + {"458", "Malaysian Ringgit", 2}, + {"462", "Rufiyaa", 2}, + {"478", "Ouguiya", 2}, + {"480", "Mauritius Rupee", 2}, + {"484", "Mexican Peso", 2}, + {"496", "Tugrik", 2}, + {"498", "Moldovan Leu", 2}, + {"504", "Moroccan Dirham", 2}, + {"512", "Rial Omani", 3}, + {"516", "Namibia Dollar", 2}, + {"524", "Nepalese Rupee", 2}, + {"532", "Netherlands Antillean Guilder", 2}, + {"533", "Aruban Florin", 2}, + {"548", "Vatu", 0}, + {"554", "New Zealand Dollar", 2}, + {"558", "Cordoba Oro", 2}, + {"566", "Naira", 2}, + {"578", "Norwegian Krone", 2}, + {"586", "Pakistan Rupee", 2}, + {"590", "Balboa", 2}, + {"598", "Kina", 2}, + {"600", "Guarani", 0}, + {"604", "Nuevo Sol", 2}, + {"608", "Philippine Peso", 2}, + {"624", "Guinea-Bissau Peso", -1}, + {"634", "Qatari Rial", 2}, + {"643", "Russian Ruble", 2}, + {"646", "Rwanda Franc", 0}, + {"654", "Saint Helena Pound", 2}, + {"678", "Dobra", 2}, + {"682", "Saudi Riyal", 2}, + {"690", "Seychelles Rupee", 2}, + {"694", "Leone", 2}, + {"702", "Singapore Dollar", 2}, + {"704", "Dong", 0}, + {"706", "Somali Shilling", 2}, + {"710", "Rand", 2}, + {"728", "South Sudanese Pound", 2}, + {"748", "Lilangeni", 2}, + {"752", "Swedish Krona", 2}, + {"756", "Swiss Franc", 2}, + {"760", "Syrian Pound", 2}, + {"764", "Baht", 2}, + {"776", "Pa\'anga", 2}, + {"780", "Trinidad and Tobago Dollar", 2}, + {"784", "UAE Dirham", 2}, + {"788", "Tunisian Dinar", 3}, + {"800", "Uganda Shilling", 0}, + {"807", "Denar", 2}, + {"818", "Egyptian Pound", 2}, + {"826", "Pound Sterling", 2}, + {"834", "Tanzanian Shilling", 2}, + {"840", "US Dollar", 2}, + {"858", "Peso Uruguayo", 2}, + {"860", "Uzbekistan Sum", 2}, + {"882", "Tala", 2}, + {"886", "Yemeni Rial", 2}, + {"894", "Zambian Kwacha", 2}, + {"901", "New Taiwan Dollar", 2}, + {"931", "Peso Convertible", 2}, + {"932", "Zimbabwe Dollar", 2}, + {"934", "Turkmenistan New Manat", 2}, + {"936", "Ghana Cedi", 2}, + {"937", "Bolivar", 2}, + {"938", "Sudanese Pound", 2}, + {"940", "Uruguay Peso en Unidades Indexadas (URUIURUI)", 0}, + {"941", "Serbian Dinar", 2}, + {"943", "Mozambique Metical", 2}, + {"944", "Azerbaijanian Manat", 2}, + {"946", "New Romanian Leu", 2}, + {"947", "WIR Euro", 2}, + {"948", "WIR Franc", 2}, + {"949", "Turkish Lira", 2}, + {"950", "CFA Franc BEAC", 0}, + {"951", "East Caribbean Dollar", 2}, + {"952", "CFA Franc BCEAO", 0}, + {"953", "CFP Franc", 0}, + {"955", "Bond Markets Unit European Composite Unit (EURCO)", 0}, + {"956", "Bond Markets Unit European Monetary Unit (E.M.U.-6)", 0}, + {"957", "Bond Markets Unit European Unit of Account 9 (E.U.A.-9)", 0}, + {"958", "Bond Markets Unit European Unit of Account 17 (E.U.A.-17)", 0}, + {"959", "Gold", 0}, + {"960", "SDR (Special Drawing Right)", 0}, + {"961", "Silver", 0}, + {"962", "Platinum", 0}, + {"963", "Codes specifically reserved for testing purposes", -1}, + {"964", "Palladium", -1}, + {"965", "ADB Unit of Account", -1}, + {"967", "Zambian Kwacha", 2}, + {"968", "Surinam Dollar", 2}, + {"969", "Malagasy Ariary", 1}, + {"969", "Malagasy Ariary", 2}, + {"970", "Unidad de Valor Real", 2}, + {"971", "Afghani", 2}, + {"972", "Somoni", 2}, + {"973", "Kwanza", 2}, + {"974", "Belarussian Ruble", 0}, + {"975", "Bulgarian Lev", 2}, + {"976", "Congolese Franc", 2}, + {"977", "Convertible Mark", 2}, + {"978", "Euro", 2}, + {"979", "Mexican Unidad de Inversion (UDI)", 2}, + {"980", "Hryvnia", 2}, + {"981", "Lari", 2}, + {"984", "Mvdol", 2}, + {"985", "Zloty", 2}, + {"986", "Brazilian Real", 2}, + {"990", "Unidad de Fomento", 4}, + {"994", "Sucre", -1}, + {"997", "US Dollar (Next day)", 2}, + {"998", "US Dollar (Same day)", 2}, + {"999", "No currency is involved", -1}, + {"NULL", "N/A", -1} +}; + +#endif diff --git a/client/src/mifare/mifare4.c b/client/src/mifare/mifare4.c index 7a3ec9f77..420c93a9e 100644 --- a/client/src/mifare/mifare4.c +++ b/client/src/mifare/mifare4.c @@ -83,6 +83,7 @@ bool mfValidateAccessConditions(const uint8_t *data) { return ((nd1 == (d1 ^ 0xF)) && (nd2 == (d2 ^ 0xF)) && (nd3 == (d3 ^ 0xF))); } + bool mfReadOnlyAccessConditions(uint8_t blockn, const uint8_t *data) { uint8_t d1 = NIBBLE_HIGH(data[1]) >> blockn; @@ -98,7 +99,6 @@ bool mfReadOnlyAccessConditions(uint8_t blockn, const uint8_t *data) { return false; } - const char *mfGetAccessConditionsDesc(uint8_t blockn, const uint8_t *data) { uint8_t d1 = NIBBLE_HIGH(data[1]) >> blockn; uint8_t d2 = NIBBLE_LOW(data[2]) >> blockn; @@ -118,9 +118,17 @@ const char *mfGetAccessConditionsDesc(uint8_t blockn, const uint8_t *data) { } }; - static char StaticNone[] = "none"; - return StaticNone; + static char none[] = "none"; + return none; } + +uint8_t mf_get_accesscondition(uint8_t blockn, const uint8_t *data) { + uint8_t d1 = NIBBLE_HIGH(data[1]) >> blockn; + uint8_t d2 = NIBBLE_LOW(data[2]) >> blockn; + uint8_t d3 = NIBBLE_HIGH(data[2]) >> blockn; + return (d1 & 0x01) << 2 | (d2 & 0x01) << 1 | (d3 & 0x01); +} + /* static int CalculateEncIVCommand(mf4Session_t *mf4session, uint8_t *iv, bool verbose) { memcpy(&iv[0], &mf4session->TI, 4); diff --git a/client/src/mifare/mifare4.h b/client/src/mifare/mifare4.h index fee12ef6e..6687930e6 100644 --- a/client/src/mifare/mifare4.h +++ b/client/src/mifare/mifare4.h @@ -73,6 +73,7 @@ int MFPGetVersion(bool activateField, bool leaveSignalON, uint8_t *dataout, int bool mfValidateAccessConditions(const uint8_t *data); bool mfReadOnlyAccessConditions(uint8_t blockn, const uint8_t *data); const char *mfGetAccessConditionsDesc(uint8_t blockn, const uint8_t *data); +uint8_t mf_get_accesscondition(uint8_t blockn, const uint8_t *data); uint8_t mfNumBlocksPerSector(uint8_t sectorNo); uint8_t mfFirstBlockOfSector(uint8_t sectorNo); diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index 6c9d8caa2..76c392490 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -195,15 +195,22 @@ int mfCheckKeys(uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keyc SendCommandNG(CMD_HF_MIFARE_CHKKEYS, data, (5 + 6 * keycnt)); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_HF_MIFARE_CHKKEYS, &resp, 2500)) return PM3_ETIMEOUT; - if (resp.status != PM3_SUCCESS) return resp.status; + if (!WaitForResponseTimeout(CMD_HF_MIFARE_CHKKEYS, &resp, 2500)) { + return PM3_ETIMEOUT; + } + if (resp.status != PM3_SUCCESS) { + return resp.status; + } struct kr { uint8_t key[6]; bool found; } PACKED; struct kr *keyresult = (struct kr *)&resp.data.asBytes; - if (!keyresult->found) return PM3_ESOFT; + if (!keyresult->found) { + return PM3_ESOFT; + } + *key = bytes_to_num(keyresult->key, sizeof(keyresult->key)); return PM3_SUCCESS; } @@ -585,7 +592,6 @@ out: return PM3_ESOFT; } - int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *resultKey) { uint32_t uid; @@ -781,7 +787,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl p_keyblock = mem; } - uint8_t fn[26] = "static_nested_000.bin"; + uint8_t fn[32] = "static_nested_000.bin"; uint64_t start_time = msclock(); for (uint32_t i = 0; i < keycnt; i += max_keys_chunk) { @@ -867,13 +873,13 @@ out: int mfReadSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *data) { clearCommandBuffer(); - SendCommandMIX(CMD_HF_MIFARE_READSC, sectorNo, keyType, 0, (uint8_t *)key, 6); + SendCommandMIX(CMD_HF_MIFARE_READSC, sectorNo, keyType, 0, (uint8_t *)key, MIFARE_KEY_SIZE); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - uint8_t isOK = resp.oldarg[0] & 0xff; + uint8_t isOK = resp.oldarg[0] & 0xFF; if (isOK) { - memcpy(data, resp.data.asBytes, mfNumBlocksPerSector(sectorNo) * 16); + memcpy(data, resp.data.asBytes, mfNumBlocksPerSector(sectorNo) * MFBLOCK_SIZE); return PM3_SUCCESS; } else { return PM3_EUNDEF; @@ -896,7 +902,7 @@ int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *d SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t)); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500)) { - memcpy(data, resp.data.asBytes, 16); + memcpy(data, resp.data.asBytes, MFBLOCK_SIZE); if (resp.status != PM3_SUCCESS) { PrintAndLogEx(DEBUG, "failed reading block"); @@ -912,7 +918,7 @@ int mfReadBlock(uint8_t blockNo, uint8_t keyType, const uint8_t *key, uint8_t *d // EMULATOR int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) { - size_t size = blocksCount * 16; + size_t size = blocksCount * MFBLOCK_SIZE; if (size > PM3_CMD_DATA_SIZE) { return PM3_ESOFT; } @@ -941,7 +947,7 @@ int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) { } int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) { - return mfEmlSetMem_xt(data, blockNum, blocksCount, 16); + return mfEmlSetMem_xt(data, blockNum, blocksCount, MFBLOCK_SIZE); } int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth) { @@ -955,7 +961,7 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt size_t size = ((size_t) blocksCount) * blockBtWidth; if (size > (PM3_CMD_DATA_SIZE - sizeof(struct p))) { - return PM3_ESOFT; + return PM3_EINVARG; } size_t paylen = sizeof(struct p) + size; @@ -976,7 +982,7 @@ int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidt int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t *sak, uint8_t *old_uid, uint8_t *verifed_uid, uint8_t wipecard) { uint8_t params = MAGIC_SINGLE; - uint8_t block0[16]; + uint8_t block0[MFBLOCK_SIZE]; memset(block0, 0x00, sizeof(block0)); int res = mfCGetBlock(0, block0, params); @@ -1039,11 +1045,11 @@ int mfCSetUID(uint8_t *uid, uint8_t uidlen, const uint8_t *atqa, const uint8_t * } int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak) { - uint8_t block0[16] = {0x00, 0x56, 0x78, 0xBB, 0x95, 0x08, 0x04, 0x00, 0x02, 0xB2, 0x1E, 0x24, 0x23, 0x27, 0x1E, 0x1D}; - // uint8_t block0[16] = {0x04, 0x03, 0x02, 0x01, 0x04, 0x08, 0x04, 0x00, 0x64, 0xB9, 0x95, 0x11, 0x4D, 0x20, 0x42, 0x09}; - uint8_t blockD[16] = {0x00}; + uint8_t block0[MFBLOCK_SIZE] = {0x00, 0x56, 0x78, 0xBB, 0x95, 0x08, 0x04, 0x00, 0x02, 0xB2, 0x1E, 0x24, 0x23, 0x27, 0x1E, 0x1D}; + // uint8_t block0[MFBLOCK_SIZE] = {0x04, 0x03, 0x02, 0x01, 0x04, 0x08, 0x04, 0x00, 0x64, 0xB9, 0x95, 0x11, 0x4D, 0x20, 0x42, 0x09}; + uint8_t blockD[MFBLOCK_SIZE] = {0x00}; // default transport ACL - uint8_t blockK[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + uint8_t blockK[MFBLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t params = MAGIC_SINGLE; if (uid != NULL) { @@ -1089,16 +1095,18 @@ int mfCWipe(uint8_t *uid, const uint8_t *atqa, const uint8_t *sak) { } int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params) { - clearCommandBuffer(); - SendCommandMIX(CMD_HF_MIFARE_CSETBL, params, blockNo, 0, data, 16); + SendCommandMIX(CMD_HF_MIFARE_CSETBL, params, blockNo, 0, data, MFBLOCK_SIZE); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 3500)) { uint8_t isOK = resp.oldarg[0] & 0xff; - if (uid != NULL) + if (uid != NULL) { memcpy(uid, resp.data.asBytes, 4); - if (!isOK) + } + + if (!isOK) { return PM3_EUNDEF; + } } else { PrintAndLogEx(WARNING, "command execute timeout"); return PM3_ETIMEOUT; @@ -1112,9 +1120,10 @@ int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params) { PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { uint8_t isOK = resp.oldarg[0] & 0xff; - if (!isOK) + if (!isOK) { return PM3_EUNDEF; - memcpy(data, resp.data.asBytes, 16); + } + memcpy(data, resp.data.asBytes, MFBLOCK_SIZE); } else { PrintAndLogEx(WARNING, "command execute timeout"); return PM3_ETIMEOUT; @@ -1139,11 +1148,11 @@ int mfGen3UID(uint8_t *uid, uint8_t uidlen, uint8_t *oldUid) { int mfGen3Block(uint8_t *block, int blockLen, uint8_t *newBlock) { clearCommandBuffer(); - SendCommandMIX(CMD_HF_MIFARE_GEN3BLK, blockLen, 0, 0, block, 16); + SendCommandMIX(CMD_HF_MIFARE_GEN3BLK, blockLen, 0, 0, block, MFBLOCK_SIZE); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_HF_MIFARE_GEN3BLK, &resp, 3500)) { if (resp.status == PM3_SUCCESS && newBlock) { - memcpy(newBlock, resp.data.asBytes, 16); + memcpy(newBlock, resp.data.asBytes, MFBLOCK_SIZE); } return resp.status; } else { @@ -1181,7 +1190,7 @@ int mfG4GetBlock(uint8_t *pwd, uint8_t blockno, uint8_t *data, uint8_t workFlags if (resp.status != PM3_SUCCESS) { return PM3_EUNDEF; } - memcpy(data, resp.data.asBytes, 16); + memcpy(data, resp.data.asBytes, MFBLOCK_SIZE); } else { PrintAndLogEx(WARNING, "command execute timeout"); return PM3_ETIMEOUT; @@ -1193,7 +1202,7 @@ int mfG4SetBlock(uint8_t *pwd, uint8_t blockno, uint8_t *data, uint8_t workFlags struct p { uint8_t blockno; uint8_t pwd[4]; - uint8_t data[16]; + uint8_t data[MFBLOCK_SIZE]; uint8_t workFlags; } PACKED payload; payload.blockno = blockno; @@ -1262,7 +1271,7 @@ int detect_classic_prng(void) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, flags, sizeof(cmd), 0, cmd, sizeof(cmd)); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) { + if (WaitForResponseTimeout(CMD_ACK, &resp, 2000) == false) { PrintAndLogEx(WARNING, "PRNG UID: Reply timeout."); return PM3_ETIMEOUT; } @@ -1272,7 +1281,7 @@ int detect_classic_prng(void) { PrintAndLogEx(ERR, "error: selecting tag failed, can't detect prng\n"); return PM3_ERFTRANS; } - if (!WaitForResponseTimeout(CMD_ACK, &respA, 2500)) { + if (WaitForResponseTimeout(CMD_ACK, &respA, 2500) == false) { PrintAndLogEx(WARNING, "PRNG data: Reply timeout."); return PM3_ETIMEOUT; } diff --git a/client/src/nfc/ndef.c b/client/src/nfc/ndef.c index 44ef70ee6..e0bc83c14 100644 --- a/client/src/nfc/ndef.c +++ b/client/src/nfc/ndef.c @@ -121,7 +121,7 @@ static int ndefDecodePayload(NDEFHeader_t *ndef, bool verbose); static uint16_t ndefTLVGetLength(const uint8_t *data, size_t *indx) { uint16_t len = 0; if (data[0] == 0xFF) { - len = (data[1] << 8) + data[2]; + len = MemBeToUint2byte(data + 1); *indx += 3; } else { len = data[0]; @@ -274,7 +274,7 @@ static int ndef_print_signature(uint8_t *data, uint8_t data_len, uint8_t *signat return PM3_ESOFT; } - PrintAndLogEx(INFO, " IC signature public key name: %s", ndef_public_keys[i].desc); + PrintAndLogEx(INFO, " IC signature public key name: " _GREEN_("%s"), ndef_public_keys[i].desc); PrintAndLogEx(INFO, "IC signature public key value: %s", ndef_public_keys[i].value); PrintAndLogEx(INFO, " Elliptic curve parameters: %s", get_curve_name(ndef_public_keys[i].grp_id)); PrintAndLogEx(INFO, " NDEF Signature: %s", sprint_hex_inrow(signature, 32)); diff --git a/client/src/pm3line.c b/client/src/pm3line.c index 1bf4476e0..5c09c6135 100644 --- a/client/src/pm3line.c +++ b/client/src/pm3line.c @@ -27,7 +27,7 @@ #elif defined(HAVE_LINENOISE) #include "linenoise.h" #endif -#include "pm3line_vocabulory.h" +#include "pm3line_vocabulary.h" #include "pm3_cmd.h" #include "ui.h" // g_session #include "util.h" // str_ndup @@ -45,12 +45,12 @@ static char *rl_command_generator(const char *text, int state) { len = strlen(text); } - while ((command = vocabulory[index].name)) { + while ((command = vocabulary[index].name)) { // When no pm3 device present // and the command is not available offline, // we skip it. - if ((g_session.pm3_present == false) && (vocabulory[index].offline == false)) { + if ((g_session.pm3_present == false) && (vocabulary[index].offline == false)) { index++; continue; } @@ -82,12 +82,12 @@ static void ln_command_completion(const char *text, linenoiseCompletions *lc) { size_t prev_match_len = 0; size_t len = strlen(text); const char *command; - while ((command = vocabulory[index].name)) { + while ((command = vocabulary[index].name)) { // When no pm3 device present // and the command is not available offline, // we skip it. - if ((g_session.pm3_present == false) && (vocabulory[index].offline == false)) { + if ((g_session.pm3_present == false) && (vocabulary[index].offline == false)) { index++; continue; } diff --git a/client/src/pm3line_vocabulary.h b/client/src/pm3line_vocabulary.h new file mode 100644 index 000000000..5cbe8b495 --- /dev/null +++ b/client/src/pm3line_vocabulary.h @@ -0,0 +1,816 @@ +//----------------------------------------------------------------------------- +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. +//----------------------------------------------------------------------------- +// readline auto complete utilities +//----------------------------------------------------------------------------- + +#ifndef PM3LINE_VOCABULARY_H__ +#define PM3LINE_VOCABULARY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct vocabulary_s { + bool offline; + const char *name; +} vocabulary_t; + +const static vocabulary_t vocabulary[] = { + { 1, "help" }, + { 0, "auto" }, + { 1, "clear" }, + { 1, "hints" }, + { 1, "msleep" }, + { 1, "rem" }, + { 1, "quit" }, + { 1, "exit" }, + { 1, "prefs help" }, + { 1, "prefs show" }, + { 1, "prefs get barmode" }, + { 1, "prefs get clientdebug" }, + { 1, "prefs get clientdelay" }, + { 1, "prefs get color" }, + { 1, "prefs get savepaths" }, + { 1, "prefs get emoji" }, + { 1, "prefs get hints" }, + { 1, "prefs get output" }, + { 1, "prefs get plotsliders" }, + { 1, "prefs set help" }, + { 1, "prefs set barmode" }, + { 1, "prefs set clientdebug" }, + { 1, "prefs set clientdelay" }, + { 1, "prefs set color" }, + { 1, "prefs set emoji" }, + { 1, "prefs set hints" }, + { 1, "prefs set savepaths" }, + { 1, "prefs set output" }, + { 1, "prefs set plotsliders" }, + { 1, "analyse help" }, + { 1, "analyse lcr" }, + { 1, "analyse crc" }, + { 1, "analyse chksum" }, + { 1, "analyse dates" }, + { 1, "analyse lfsr" }, + { 1, "analyse a" }, + { 1, "analyse nuid" }, + { 1, "analyse demodbuff" }, + { 1, "analyse freq" }, + { 1, "analyse foo" }, + { 1, "analyse units" }, + { 1, "data help" }, + { 1, "data biphaserawdecode" }, + { 1, "data detectclock" }, + { 1, "data fsktonrz" }, + { 1, "data manrawdecode" }, + { 1, "data modulation" }, + { 1, "data rawdemod" }, + { 1, "data askedgedetect" }, + { 1, "data autocorr" }, + { 1, "data dirthreshold" }, + { 1, "data decimate" }, + { 1, "data envelope" }, + { 1, "data undecimate" }, + { 1, "data hide" }, + { 1, "data hpf" }, + { 1, "data iir" }, + { 1, "data grid" }, + { 1, "data ltrim" }, + { 1, "data mtrim" }, + { 1, "data norm" }, + { 1, "data plot" }, + { 1, "data cthreshold" }, + { 1, "data rtrim" }, + { 1, "data setgraphmarkers" }, + { 1, "data shiftgraphzero" }, + { 1, "data timescale" }, + { 1, "data zerocrossings" }, + { 1, "data convertbitstream" }, + { 1, "data getbitstream" }, + { 1, "data asn1" }, + { 1, "data atr" }, + { 1, "data bin2hex" }, + { 0, "data bitsamples" }, + { 1, "data clear" }, + { 1, "data diff" }, + { 0, "data hexsamples" }, + { 1, "data hex2bin" }, + { 1, "data load" }, + { 1, "data num" }, + { 1, "data print" }, + { 0, "data samples" }, + { 1, "data save" }, + { 1, "data setdebugmode" }, + { 0, "data tune" }, + { 1, "emv help" }, + { 1, "emv list" }, + { 1, "emv test" }, + { 0, "emv challenge" }, + { 0, "emv exec" }, + { 0, "emv genac" }, + { 0, "emv gpo" }, + { 0, "emv intauth" }, + { 0, "emv pse" }, + { 0, "emv reader" }, + { 0, "emv readrec" }, + { 0, "emv roca" }, + { 0, "emv scan" }, + { 0, "emv search" }, + { 0, "emv select" }, + { 1, "hf help" }, + { 1, "hf list" }, + { 0, "hf plot" }, + { 0, "hf tune" }, + { 1, "hf search" }, + { 0, "hf sniff" }, + { 1, "hf 14a help" }, + { 1, "hf 14a list" }, + { 0, "hf 14a antifuzz" }, + { 0, "hf 14a config" }, + { 0, "hf 14a cuids" }, + { 0, "hf 14a info" }, + { 0, "hf 14a sim" }, + { 0, "hf 14a sniff" }, + { 0, "hf 14a raw" }, + { 0, "hf 14a reader" }, + { 0, "hf 14a apdu" }, + { 0, "hf 14a apdufind" }, + { 0, "hf 14a chaining" }, + { 0, "hf 14a ndefformat" }, + { 0, "hf 14a ndefread" }, + { 0, "hf 14a ndefwrite" }, + { 1, "hf 14b help" }, + { 0, "hf 14b apdu" }, + { 0, "hf 14b dump" }, + { 0, "hf 14b info" }, + { 1, "hf 14b list" }, + { 0, "hf 14b ndefread" }, + { 0, "hf 14b raw" }, + { 0, "hf 14b reader" }, + { 0, "hf 14b sim" }, + { 0, "hf 14b sniff" }, + { 0, "hf 14b rdbl" }, + { 0, "hf 14b sriwrite" }, + { 1, "hf 14b view" }, + { 1, "hf 15 help" }, + { 1, "hf 15 list" }, + { 1, "hf 15 demod" }, + { 0, "hf 15 dump" }, + { 0, "hf 15 info" }, + { 0, "hf 15 sniff" }, + { 0, "hf 15 raw" }, + { 0, "hf 15 rdbl" }, + { 0, "hf 15 rdmulti" }, + { 0, "hf 15 reader" }, + { 0, "hf 15 restore" }, + { 0, "hf 15 samples" }, + { 1, "hf 15 view" }, + { 0, "hf 15 wrbl" }, + { 0, "hf 15 sim" }, + { 0, "hf 15 eload" }, + { 0, "hf 15 esave" }, + { 0, "hf 15 eview" }, + { 0, "hf 15 slixwritepwd" }, + { 0, "hf 15 slixeasdisable" }, + { 0, "hf 15 slixeasenable" }, + { 0, "hf 15 slixprivacydisable" }, + { 0, "hf 15 slixprivacyenable" }, + { 0, "hf 15 passprotectafi" }, + { 0, "hf 15 passprotecteas" }, + { 0, "hf 15 findafi" }, + { 0, "hf 15 writeafi" }, + { 0, "hf 15 writedsfid" }, + { 0, "hf 15 csetuid" }, + { 1, "hf cipurse help" }, + { 0, "hf cipurse info" }, + { 0, "hf cipurse select" }, + { 0, "hf cipurse auth" }, + { 0, "hf cipurse read" }, + { 0, "hf cipurse write" }, + { 0, "hf cipurse aread" }, + { 0, "hf cipurse awrite" }, + { 0, "hf cipurse formatall" }, + { 0, "hf cipurse create" }, + { 0, "hf cipurse delete" }, + { 0, "hf cipurse updkey" }, + { 0, "hf cipurse updakey" }, + { 0, "hf cipurse default" }, + { 1, "hf cipurse test" }, + { 1, "hf epa help" }, + { 0, "hf epa cnonces" }, + { 0, "hf epa replay" }, + { 0, "hf epa sim" }, + { 1, "hf emrtd help" }, + { 0, "hf emrtd dump" }, + { 1, "hf emrtd info" }, + { 1, "hf emrtd list" }, + { 1, "hf felica help" }, + { 1, "hf felica list" }, + { 0, "hf felica reader" }, + { 0, "hf felica info" }, + { 0, "hf felica sniff" }, + { 0, "hf felica raw" }, + { 0, "hf felica rdbl" }, + { 0, "hf felica wrbl" }, + { 0, "hf felica rqservice" }, + { 0, "hf felica rqresponse" }, + { 0, "hf felica scsvcode" }, + { 0, "hf felica rqsyscode" }, + { 0, "hf felica auth1" }, + { 0, "hf felica auth2" }, + { 0, "hf felica rqspecver" }, + { 0, "hf felica resetmode" }, + { 0, "hf felica litesim" }, + { 0, "hf felica litedump" }, + { 1, "hf fido help" }, + { 1, "hf fido list" }, + { 0, "hf fido info" }, + { 0, "hf fido reg" }, + { 0, "hf fido auth" }, + { 0, "hf fido make" }, + { 0, "hf fido assert" }, + { 1, "hf fudan help" }, + { 0, "hf fudan reader" }, + { 0, "hf fudan dump" }, + { 0, "hf fudan rdbl" }, + { 1, "hf fudan view" }, + { 0, "hf fudan wrbl" }, + { 1, "hf gallagher help" }, + { 0, "hf gallagher reader" }, + { 0, "hf gallagher clone" }, + { 0, "hf gallagher delete" }, + { 1, "hf gallagher diversifykey" }, + { 1, "hf gallagher decode" }, + { 1, "hf ksx6924 help" }, + { 0, "hf ksx6924 select" }, + { 0, "hf ksx6924 info" }, + { 0, "hf ksx6924 balance" }, + { 0, "hf ksx6924 init" }, + { 0, "hf ksx6924 prec" }, + { 1, "hf jooki help" }, + { 0, "hf jooki clone" }, + { 1, "hf jooki decode" }, + { 1, "hf jooki encode" }, + { 0, "hf jooki sim" }, + { 1, "hf iclass help" }, + { 1, "hf iclass list" }, + { 0, "hf iclass dump" }, + { 1, "hf iclass info" }, + { 0, "hf iclass rdbl" }, + { 0, "hf iclass reader" }, + { 0, "hf iclass restore" }, + { 0, "hf iclass sniff" }, + { 1, "hf iclass view" }, + { 0, "hf iclass wrbl" }, + { 0, "hf iclass creditepurse" }, + { 0, "hf iclass chk" }, + { 1, "hf iclass loclass" }, + { 1, "hf iclass lookup" }, + { 0, "hf iclass sim" }, + { 0, "hf iclass eload" }, + { 0, "hf iclass esave" }, + { 0, "hf iclass esetblk" }, + { 0, "hf iclass eview" }, + { 1, "hf iclass configcard" }, + { 1, "hf iclass calcnewkey" }, + { 1, "hf iclass encode" }, + { 1, "hf iclass encrypt" }, + { 1, "hf iclass decrypt" }, + { 1, "hf iclass managekeys" }, + { 1, "hf iclass permutekey" }, + { 0, "hf iclass sam" }, + { 1, "hf legic help" }, + { 0, "hf legic dump" }, + { 0, "hf legic info" }, + { 1, "hf legic list" }, + { 0, "hf legic rdbl" }, + { 0, "hf legic reader" }, + { 0, "hf legic restore" }, + { 0, "hf legic wipe" }, + { 0, "hf legic wrbl" }, + { 0, "hf legic sim" }, + { 0, "hf legic eload" }, + { 0, "hf legic esave" }, + { 0, "hf legic eview" }, + { 0, "hf legic einfo" }, + { 1, "hf legic crc" }, + { 1, "hf legic view" }, + { 1, "hf lto help" }, + { 0, "hf lto dump" }, + { 0, "hf lto info" }, + { 1, "hf lto list" }, + { 0, "hf lto rdbl" }, + { 0, "hf lto reader" }, + { 0, "hf lto restore" }, + { 0, "hf lto wrbl" }, + { 1, "hf mf help" }, + { 1, "hf mf list" }, + { 0, "hf mf darkside" }, + { 0, "hf mf nested" }, + { 1, "hf mf hardnested" }, + { 0, "hf mf staticnested" }, + { 0, "hf mf autopwn" }, + { 0, "hf mf nack" }, + { 0, "hf mf chk" }, + { 0, "hf mf fchk" }, + { 1, "hf mf decrypt" }, + { 0, "hf mf supercard" }, + { 0, "hf mf auth4" }, + { 1, "hf mf acl" }, + { 0, "hf mf dump" }, + { 1, "hf mf mad" }, + { 0, "hf mf personalize" }, + { 0, "hf mf rdbl" }, + { 0, "hf mf rdsc" }, + { 0, "hf mf restore" }, + { 0, "hf mf setmod" }, + { 1, "hf mf value" }, + { 1, "hf mf view" }, + { 0, "hf mf wipe" }, + { 0, "hf mf wrbl" }, + { 0, "hf mf sim" }, + { 0, "hf mf ecfill" }, + { 0, "hf mf eclr" }, + { 0, "hf mf egetblk" }, + { 0, "hf mf egetsc" }, + { 0, "hf mf ekeyprn" }, + { 0, "hf mf eload" }, + { 0, "hf mf esave" }, + { 0, "hf mf esetblk" }, + { 0, "hf mf eview" }, + { 0, "hf mf cgetblk" }, + { 0, "hf mf cgetsc" }, + { 0, "hf mf cload" }, + { 0, "hf mf csave" }, + { 0, "hf mf csetblk" }, + { 0, "hf mf csetuid" }, + { 0, "hf mf cview" }, + { 0, "hf mf cwipe" }, + { 0, "hf mf gen3uid" }, + { 0, "hf mf gen3blk" }, + { 0, "hf mf gen3freeze" }, + { 0, "hf mf ggetblk" }, + { 0, "hf mf gload" }, + { 0, "hf mf gsave" }, + { 0, "hf mf gsetblk" }, + { 0, "hf mf gview" }, + { 0, "hf mf gdmcfg" }, + { 0, "hf mf gdmsetcfg" }, + { 0, "hf mf gdmsetblk" }, + { 0, "hf mf ndefformat" }, + { 0, "hf mf ndefread" }, + { 0, "hf mf ndefwrite" }, + { 1, "hf mfp help" }, + { 1, "hf mfp list" }, + { 0, "hf mfp auth" }, + { 0, "hf mfp chk" }, + { 0, "hf mfp dump" }, + { 0, "hf mfp info" }, + { 0, "hf mfp mad" }, + { 0, "hf mfp rdbl" }, + { 0, "hf mfp rdsc" }, + { 0, "hf mfp wrbl" }, + { 0, "hf mfp commitp" }, + { 0, "hf mfp initp" }, + { 0, "hf mfp wrp" }, + { 0, "hf mfp ndefformat" }, + { 0, "hf mfp ndefread" }, + { 0, "hf mfp ndefwrite" }, + { 1, "hf mfu help" }, + { 1, "hf mfu list" }, + { 1, "hf mfu keygen" }, + { 1, "hf mfu pwdgen" }, + { 0, "hf mfu otptear" }, + { 0, "hf mfu cauth" }, + { 0, "hf mfu dump" }, + { 0, "hf mfu info" }, + { 0, "hf mfu ndefread" }, + { 0, "hf mfu rdbl" }, + { 0, "hf mfu restore" }, + { 1, "hf mfu view" }, + { 0, "hf mfu wrbl" }, + { 0, "hf mfu tamper" }, + { 0, "hf mfu eload" }, + { 0, "hf mfu esave" }, + { 0, "hf mfu eview" }, + { 0, "hf mfu sim" }, + { 0, "hf mfu setpwd" }, + { 0, "hf mfu setuid" }, + { 1, "hf mfdes help" }, + { 0, "hf mfdes info" }, + { 0, "hf mfdes getuid" }, + { 0, "hf mfdes default" }, + { 0, "hf mfdes auth" }, + { 0, "hf mfdes chk" }, + { 0, "hf mfdes detect" }, + { 0, "hf mfdes freemem" }, + { 0, "hf mfdes setconfig" }, + { 0, "hf mfdes formatpicc" }, + { 1, "hf mfdes list" }, + { 0, "hf mfdes mad" }, + { 0, "hf mfdes lsapp" }, + { 0, "hf mfdes getaids" }, + { 0, "hf mfdes getappnames" }, + { 0, "hf mfdes bruteaid" }, + { 0, "hf mfdes createapp" }, + { 0, "hf mfdes deleteapp" }, + { 0, "hf mfdes selectapp" }, + { 0, "hf mfdes changekey" }, + { 0, "hf mfdes chkeysettings" }, + { 0, "hf mfdes getkeysettings" }, + { 0, "hf mfdes getkeyversions" }, + { 0, "hf mfdes getfileids" }, + { 0, "hf mfdes getfileisoids" }, + { 0, "hf mfdes lsfiles" }, + { 0, "hf mfdes dump" }, + { 0, "hf mfdes createfile" }, + { 0, "hf mfdes createvaluefile" }, + { 0, "hf mfdes createrecordfile" }, + { 0, "hf mfdes createmacfile" }, + { 0, "hf mfdes deletefile" }, + { 0, "hf mfdes getfilesettings" }, + { 0, "hf mfdes chfilesettings" }, + { 0, "hf mfdes read" }, + { 0, "hf mfdes write" }, + { 0, "hf mfdes value" }, + { 0, "hf mfdes clearrecfile" }, + { 1, "hf mfdes test" }, + { 1, "hf ntag424 help" }, + { 0, "hf ntag424 info" }, + { 0, "hf ntag424 sdm" }, + { 1, "hf ntag424 view" }, + { 1, "hf seos help" }, + { 0, "hf seos info" }, + { 1, "hf seos list" }, + { 1, "hf st25ta help" }, + { 0, "hf st25ta info" }, + { 1, "hf st25ta list" }, + { 1, "hf st25ta ndefread" }, + { 0, "hf st25ta protect" }, + { 0, "hf st25ta pwd" }, + { 0, "hf st25ta sim" }, + { 1, "hf tesla help" }, + { 0, "hf tesla info" }, + { 1, "hf tesla list" }, + { 1, "hf texkom help" }, + { 0, "hf texkom reader" }, + { 0, "hf texkom sim" }, + { 1, "hf thinfilm help" }, + { 0, "hf thinfilm info" }, + { 1, "hf thinfilm list" }, + { 0, "hf thinfilm sim" }, + { 1, "hf topaz help" }, + { 1, "hf topaz list" }, + { 0, "hf topaz dump" }, + { 0, "hf topaz info" }, + { 0, "hf topaz raw" }, + { 0, "hf topaz rdbl" }, + { 0, "hf topaz reader" }, + { 0, "hf topaz sim" }, + { 0, "hf topaz sniff" }, + { 1, "hf topaz view" }, + { 0, "hf topaz wrbl" }, + { 1, "hf vas help" }, + { 0, "hf vas reader" }, + { 1, "hf vas decrypt" }, + { 1, "hf waveshare help" }, + { 0, "hf waveshare loadbmp" }, + { 1, "hf xerox help" }, + { 0, "hf xerox info" }, + { 0, "hf xerox reader" }, + { 0, "hf xerox dump" }, + { 1, "hw help" }, + { 0, "hw break" }, + { 1, "hw connect" }, + { 0, "hw dbg" }, + { 0, "hw detectreader" }, + { 0, "hw fpgaoff" }, + { 0, "hw lcd" }, + { 0, "hw lcdreset" }, + { 0, "hw ping" }, + { 0, "hw readmem" }, + { 0, "hw reset" }, + { 0, "hw setlfdivisor" }, + { 0, "hw setmux" }, + { 0, "hw standalone" }, + { 0, "hw status" }, + { 0, "hw tearoff" }, + { 0, "hw tia" }, + { 1, "hw timeout" }, + { 0, "hw tune" }, + { 1, "hw version" }, + { 1, "lf help" }, + { 0, "lf config" }, + { 0, "lf cmdread" }, + { 0, "lf read" }, + { 1, "lf search" }, + { 0, "lf sim" }, + { 0, "lf simask" }, + { 0, "lf simfsk" }, + { 0, "lf simpsk" }, + { 0, "lf simbidir" }, + { 0, "lf sniff" }, + { 0, "lf tune" }, + { 1, "lf awid help" }, + { 1, "lf awid demod" }, + { 0, "lf awid reader" }, + { 0, "lf awid clone" }, + { 0, "lf awid sim" }, + { 0, "lf awid brute" }, + { 0, "lf awid watch" }, + { 1, "lf cotag help" }, + { 1, "lf cotag demod" }, + { 0, "lf cotag reader" }, + { 1, "lf destron help" }, + { 1, "lf destron demod" }, + { 0, "lf destron reader" }, + { 0, "lf destron clone" }, + { 0, "lf destron sim" }, + { 1, "lf em help" }, + { 1, "lf em 410x help" }, + { 1, "lf em 410x demod" }, + { 0, "lf em 410x reader" }, + { 0, "lf em 410x sim" }, + { 0, "lf em 410x brute" }, + { 0, "lf em 410x watch" }, + { 0, "lf em 410x spoof" }, + { 0, "lf em 410x clone" }, + { 1, "lf em 4x05 help" }, + { 0, "lf em 4x05 brute" }, + { 0, "lf em 4x05 chk" }, + { 1, "lf em 4x05 demod" }, + { 0, "lf em 4x05 dump" }, + { 0, "lf em 4x05 info" }, + { 0, "lf em 4x05 read" }, + { 1, "lf em 4x05 sniff" }, + { 0, "lf em 4x05 unlock" }, + { 0, "lf em 4x05 wipe" }, + { 0, "lf em 4x05 write" }, + { 1, "lf em 4x50 help" }, + { 0, "lf em 4x50 brute" }, + { 0, "lf em 4x50 chk" }, + { 0, "lf em 4x50 dump" }, + { 0, "lf em 4x50 info" }, + { 0, "lf em 4x50 login" }, + { 0, "lf em 4x50 rdbl" }, + { 0, "lf em 4x50 reader" }, + { 0, "lf em 4x50 restore" }, + { 0, "lf em 4x50 wrbl" }, + { 0, "lf em 4x50 wrpwd" }, + { 0, "lf em 4x50 wipe" }, + { 0, "lf em 4x50 eload" }, + { 0, "lf em 4x50 esave" }, + { 0, "lf em 4x50 eview" }, + { 0, "lf em 4x50 sim" }, + { 1, "lf em 4x70 help" }, + { 0, "lf em 4x70 brute" }, + { 0, "lf em 4x70 info" }, + { 0, "lf em 4x70 write" }, + { 0, "lf em 4x70 unlock" }, + { 0, "lf em 4x70 auth" }, + { 0, "lf em 4x70 writepin" }, + { 0, "lf em 4x70 writekey" }, + { 1, "lf fdxb help" }, + { 1, "lf fdxb demod" }, + { 0, "lf fdxb reader" }, + { 0, "lf fdxb clone" }, + { 0, "lf fdxb sim" }, + { 1, "lf gallagher help" }, + { 1, "lf gallagher demod" }, + { 0, "lf gallagher reader" }, + { 0, "lf gallagher clone" }, + { 0, "lf gallagher sim" }, + { 1, "lf gproxii help" }, + { 1, "lf gproxii demod" }, + { 0, "lf gproxii reader" }, + { 0, "lf gproxii clone" }, + { 0, "lf gproxii sim" }, + { 1, "lf hid help" }, + { 1, "lf hid demod" }, + { 0, "lf hid reader" }, + { 0, "lf hid clone" }, + { 0, "lf hid sim" }, + { 0, "lf hid brute" }, + { 0, "lf hid watch" }, + { 1, "lf hitag help" }, + { 1, "lf hitag list" }, + { 0, "lf hitag info" }, + { 0, "lf hitag dump" }, + { 0, "lf hitag read" }, + { 0, "lf hitag wrbl" }, + { 0, "lf hitag sniff" }, + { 0, "lf hitag cc" }, + { 0, "lf hitag ta" }, + { 0, "lf hitag eload" }, + { 0, "lf hitag sim" }, + { 1, "lf idteck help" }, + { 1, "lf idteck demod" }, + { 0, "lf idteck reader" }, + { 0, "lf idteck clone" }, + { 0, "lf idteck sim" }, + { 1, "lf indala help" }, + { 0, "lf indala brute" }, + { 1, "lf indala demod" }, + { 1, "lf indala altdemod" }, + { 0, "lf indala reader" }, + { 0, "lf indala clone" }, + { 0, "lf indala sim" }, + { 1, "lf io help" }, + { 1, "lf io demod" }, + { 0, "lf io reader" }, + { 0, "lf io clone" }, + { 0, "lf io sim" }, + { 0, "lf io watch" }, + { 1, "lf jablotron help" }, + { 1, "lf jablotron demod" }, + { 0, "lf jablotron reader" }, + { 0, "lf jablotron clone" }, + { 0, "lf jablotron sim" }, + { 1, "lf keri help" }, + { 1, "lf keri demod" }, + { 0, "lf keri reader" }, + { 0, "lf keri clone" }, + { 0, "lf keri sim" }, + { 1, "lf motorola help" }, + { 1, "lf motorola demod" }, + { 0, "lf motorola reader" }, + { 0, "lf motorola clone" }, + { 0, "lf motorola sim" }, + { 1, "lf nedap help" }, + { 1, "lf nedap demod" }, + { 0, "lf nedap reader" }, + { 0, "lf nedap clone" }, + { 0, "lf nedap sim" }, + { 1, "lf nexwatch help" }, + { 1, "lf nexwatch demod" }, + { 0, "lf nexwatch reader" }, + { 0, "lf nexwatch clone" }, + { 0, "lf nexwatch sim" }, + { 1, "lf noralsy help" }, + { 1, "lf noralsy demod" }, + { 0, "lf noralsy reader" }, + { 0, "lf noralsy clone" }, + { 0, "lf noralsy sim" }, + { 1, "lf pac help" }, + { 1, "lf pac demod" }, + { 0, "lf pac reader" }, + { 0, "lf pac clone" }, + { 0, "lf pac sim" }, + { 1, "lf paradox help" }, + { 1, "lf paradox demod" }, + { 0, "lf paradox reader" }, + { 0, "lf paradox clone" }, + { 0, "lf paradox sim" }, + { 1, "lf pcf7931 help" }, + { 0, "lf pcf7931 reader" }, + { 0, "lf pcf7931 write" }, + { 1, "lf pcf7931 config" }, + { 1, "lf presco help" }, + { 1, "lf presco demod" }, + { 0, "lf presco reader" }, + { 0, "lf presco clone" }, + { 0, "lf presco sim" }, + { 1, "lf pyramid help" }, + { 1, "lf pyramid demod" }, + { 0, "lf pyramid reader" }, + { 0, "lf pyramid clone" }, + { 0, "lf pyramid sim" }, + { 1, "lf securakey help" }, + { 1, "lf securakey demod" }, + { 0, "lf securakey reader" }, + { 0, "lf securakey clone" }, + { 0, "lf securakey sim" }, + { 1, "lf ti help" }, + { 1, "lf ti demod" }, + { 0, "lf ti reader" }, + { 0, "lf ti write" }, + { 1, "lf t55xx help" }, + { 0, "lf t55xx clonehelp" }, + { 1, "lf t55xx config" }, + { 0, "lf t55xx dangerraw" }, + { 1, "lf t55xx detect" }, + { 0, "lf t55xx deviceconfig" }, + { 0, "lf t55xx dump" }, + { 1, "lf t55xx info" }, + { 0, "lf t55xx p1detect" }, + { 0, "lf t55xx read" }, + { 0, "lf t55xx resetread" }, + { 0, "lf t55xx restore" }, + { 1, "lf t55xx trace" }, + { 0, "lf t55xx wakeup" }, + { 0, "lf t55xx write" }, + { 0, "lf t55xx bruteforce" }, + { 0, "lf t55xx chk" }, + { 0, "lf t55xx protect" }, + { 0, "lf t55xx recoverpw" }, + { 1, "lf t55xx sniff" }, + { 0, "lf t55xx special" }, + { 0, "lf t55xx wipe" }, + { 1, "lf viking help" }, + { 1, "lf viking demod" }, + { 0, "lf viking reader" }, + { 0, "lf viking clone" }, + { 0, "lf viking sim" }, + { 1, "lf visa2000 help" }, + { 1, "lf visa2000 demod" }, + { 0, "lf visa2000 reader" }, + { 0, "lf visa2000 clone" }, + { 0, "lf visa2000 sim" }, + { 1, "mem help" }, + { 0, "mem baudrate" }, + { 0, "mem dump" }, + { 0, "mem info" }, + { 0, "mem load" }, + { 0, "mem wipe" }, + { 1, "mem spiffs help" }, + { 0, "mem spiffs copy" }, + { 0, "mem spiffs check" }, + { 0, "mem spiffs dump" }, + { 0, "mem spiffs info" }, + { 0, "mem spiffs mount" }, + { 0, "mem spiffs remove" }, + { 0, "mem spiffs rename" }, + { 0, "mem spiffs test" }, + { 0, "mem spiffs tree" }, + { 0, "mem spiffs unmount" }, + { 0, "mem spiffs upload" }, + { 0, "mem spiffs view" }, + { 0, "mem spiffs wipe" }, + { 1, "nfc help" }, + { 1, "nfc decode" }, + { 0, "nfc type1 read" }, + { 1, "nfc type1 help" }, + { 0, "nfc type2 read" }, + { 1, "nfc type2 help" }, + { 0, "nfc type4a format" }, + { 0, "nfc type4a read" }, + { 0, "nfc type4a write" }, + { 0, "nfc type4a st25taread" }, + { 1, "nfc type4a help" }, + { 0, "nfc type4b read" }, + { 1, "nfc type4b help" }, + { 0, "nfc mf cformat" }, + { 0, "nfc mf cread" }, + { 0, "nfc mf cwrite" }, + { 0, "nfc mf pread" }, + { 1, "nfc mf help" }, + { 0, "nfc barcode read" }, + { 0, "nfc barcode sim" }, + { 1, "nfc barcode help" }, + { 1, "piv help" }, + { 0, "piv select" }, + { 0, "piv getdata" }, + { 0, "piv authsign" }, + { 0, "piv scan" }, + { 1, "piv list" }, + { 1, "smart help" }, + { 1, "smart list" }, + { 0, "smart info" }, + { 0, "smart reader" }, + { 0, "smart raw" }, + { 1, "smart upgrade" }, + { 0, "smart setclock" }, + { 0, "smart brute" }, + { 1, "script help" }, + { 1, "script list" }, + { 1, "script run" }, + { 1, "trace help" }, + { 1, "trace extract" }, + { 1, "trace list" }, + { 1, "trace load" }, + { 1, "trace save" }, + { 1, "usart help" }, + { 0, "usart btpin" }, + { 0, "usart btfactory" }, + { 0, "usart tx" }, + { 0, "usart rx" }, + { 0, "usart txrx" }, + { 0, "usart txhex" }, + { 0, "usart rxhex" }, + { 0, "usart config" }, + { 1, "wiegand help" }, + { 1, "wiegand list" }, + { 1, "wiegand encode" }, + { 1, "wiegand decode" }, + {0, NULL} +}; + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/client/src/pm3line_vocabulory.h b/client/src/pm3line_vocabulory.h deleted file mode 100644 index 38e64a791..000000000 --- a/client/src/pm3line_vocabulory.h +++ /dev/null @@ -1,808 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// See LICENSE.txt for the text of the license. -//----------------------------------------------------------------------------- -// readline auto complete utilities -//----------------------------------------------------------------------------- - -#ifndef PM3LINE_VOCABULORY_H__ -#define PM3LINE_VOCABULORY_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -typedef struct vocabulory_s { - bool offline; - const char *name; -} vocabulory_t; - -const static vocabulory_t vocabulory[] = { - { 1, "help" }, - { 0, "auto" }, - { 1, "clear" }, - { 1, "hints" }, - { 1, "msleep" }, - { 1, "rem" }, - { 1, "quit" }, - { 1, "exit" }, - { 1, "prefs help" }, - { 1, "prefs show" }, - { 1, "prefs get barmode" }, - { 1, "prefs get clientdebug" }, - { 1, "prefs get clientdelay" }, - { 1, "prefs get color" }, - { 1, "prefs get savepaths" }, - { 1, "prefs get emoji" }, - { 1, "prefs get hints" }, - { 1, "prefs get output" }, - { 1, "prefs get plotsliders" }, - { 1, "prefs set help" }, - { 1, "prefs set barmode" }, - { 1, "prefs set clientdebug" }, - { 1, "prefs set clientdelay" }, - { 1, "prefs set color" }, - { 1, "prefs set emoji" }, - { 1, "prefs set hints" }, - { 1, "prefs set savepaths" }, - { 1, "prefs set output" }, - { 1, "prefs set plotsliders" }, - { 1, "analyse help" }, - { 1, "analyse lcr" }, - { 1, "analyse crc" }, - { 1, "analyse chksum" }, - { 1, "analyse dates" }, - { 1, "analyse lfsr" }, - { 1, "analyse a" }, - { 1, "analyse nuid" }, - { 1, "analyse demodbuff" }, - { 1, "analyse freq" }, - { 1, "analyse foo" }, - { 1, "analyse units" }, - { 1, "data help" }, - { 1, "data biphaserawdecode" }, - { 1, "data detectclock" }, - { 1, "data fsktonrz" }, - { 1, "data manrawdecode" }, - { 1, "data modulation" }, - { 1, "data rawdemod" }, - { 1, "data askedgedetect" }, - { 1, "data autocorr" }, - { 1, "data dirthreshold" }, - { 1, "data decimate" }, - { 1, "data undecimate" }, - { 1, "data hide" }, - { 1, "data hpf" }, - { 1, "data iir" }, - { 1, "data grid" }, - { 1, "data ltrim" }, - { 1, "data mtrim" }, - { 1, "data norm" }, - { 1, "data plot" }, - { 1, "data rtrim" }, - { 1, "data setgraphmarkers" }, - { 1, "data shiftgraphzero" }, - { 1, "data timescale" }, - { 1, "data zerocrossings" }, - { 1, "data convertbitstream" }, - { 1, "data getbitstream" }, - { 1, "data asn1" }, - { 1, "data bin2hex" }, - { 0, "data bitsamples" }, - { 1, "data clear" }, - { 1, "data diff" }, - { 0, "data hexsamples" }, - { 1, "data hex2bin" }, - { 1, "data load" }, - { 1, "data num" }, - { 1, "data print" }, - { 0, "data samples" }, - { 1, "data save" }, - { 1, "data setdebugmode" }, - { 0, "data tune" }, - { 1, "emv help" }, - { 1, "emv list" }, - { 1, "emv test" }, - { 0, "emv challenge" }, - { 0, "emv exec" }, - { 0, "emv genac" }, - { 0, "emv gpo" }, - { 0, "emv intauth" }, - { 0, "emv pse" }, - { 0, "emv reader" }, - { 0, "emv readrec" }, - { 0, "emv roca" }, - { 0, "emv scan" }, - { 0, "emv search" }, - { 0, "emv select" }, - { 1, "hf help" }, - { 1, "hf list" }, - { 0, "hf plot" }, - { 0, "hf tune" }, - { 1, "hf search" }, - { 0, "hf sniff" }, - { 1, "hf 14a help" }, - { 1, "hf 14a list" }, - { 0, "hf 14a antifuzz" }, - { 0, "hf 14a config" }, - { 0, "hf 14a cuids" }, - { 0, "hf 14a info" }, - { 0, "hf 14a sim" }, - { 0, "hf 14a sniff" }, - { 0, "hf 14a raw" }, - { 0, "hf 14a reader" }, - { 0, "hf 14a apdu" }, - { 0, "hf 14a apdufind" }, - { 0, "hf 14a chaining" }, - { 0, "hf 14a ndefformat" }, - { 0, "hf 14a ndefread" }, - { 0, "hf 14a ndefwrite" }, - { 1, "hf 14b help" }, - { 0, "hf 14b apdu" }, - { 0, "hf 14b dump" }, - { 0, "hf 14b info" }, - { 1, "hf 14b list" }, - { 0, "hf 14b ndefread" }, - { 0, "hf 14b raw" }, - { 0, "hf 14b reader" }, - { 0, "hf 14b sim" }, - { 0, "hf 14b sniff" }, - { 0, "hf 14b rdbl" }, - { 0, "hf 14b sriwrite" }, - { 1, "hf 14b view" }, - { 1, "hf 15 help" }, - { 1, "hf 15 list" }, - { 1, "hf 15 demod" }, - { 0, "hf 15 dump" }, - { 0, "hf 15 info" }, - { 0, "hf 15 sniff" }, - { 0, "hf 15 raw" }, - { 0, "hf 15 rdbl" }, - { 0, "hf 15 rdmulti" }, - { 0, "hf 15 reader" }, - { 0, "hf 15 restore" }, - { 0, "hf 15 samples" }, - { 0, "hf 15 eload" }, - { 0, "hf 15 esave" }, - { 0, "hf 15 eview" }, - { 0, "hf 15 sim" }, - { 0, "hf 15 slixwritepwd" }, - { 0, "hf 15 slixeasdisable" }, - { 0, "hf 15 slixeasenable" }, - { 0, "hf 15 slixprivacydisable" }, - { 0, "hf 15 slixprivacyenable" }, - { 0, "hf 15 passprotectafi" }, - { 0, "hf 15 passprotecteas" }, - { 0, "hf 15 wrbl" }, - { 0, "hf 15 findafi" }, - { 0, "hf 15 writeafi" }, - { 0, "hf 15 writedsfid" }, - { 0, "hf 15 csetuid" }, - { 1, "hf cipurse help" }, - { 0, "hf cipurse info" }, - { 0, "hf cipurse select" }, - { 0, "hf cipurse auth" }, - { 0, "hf cipurse read" }, - { 0, "hf cipurse write" }, - { 0, "hf cipurse aread" }, - { 0, "hf cipurse awrite" }, - { 0, "hf cipurse formatall" }, - { 0, "hf cipurse create" }, - { 0, "hf cipurse delete" }, - { 0, "hf cipurse updkey" }, - { 0, "hf cipurse updakey" }, - { 0, "hf cipurse default" }, - { 1, "hf cipurse test" }, - { 1, "hf epa help" }, - { 0, "hf epa cnonces" }, - { 0, "hf epa replay" }, - { 0, "hf epa sim" }, - { 1, "hf emrtd help" }, - { 0, "hf emrtd dump" }, - { 1, "hf emrtd info" }, - { 1, "hf emrtd list" }, - { 1, "hf felica help" }, - { 1, "hf felica list" }, - { 0, "hf felica reader" }, - { 0, "hf felica info" }, - { 0, "hf felica sniff" }, - { 0, "hf felica raw" }, - { 0, "hf felica rdbl" }, - { 0, "hf felica wrbl" }, - { 0, "hf felica rqservice" }, - { 0, "hf felica rqresponse" }, - { 0, "hf felica scsvcode" }, - { 0, "hf felica rqsyscode" }, - { 0, "hf felica auth1" }, - { 0, "hf felica auth2" }, - { 0, "hf felica rqspecver" }, - { 0, "hf felica resetmode" }, - { 0, "hf felica litesim" }, - { 0, "hf felica litedump" }, - { 1, "hf fido help" }, - { 1, "hf fido list" }, - { 0, "hf fido info" }, - { 0, "hf fido reg" }, - { 0, "hf fido auth" }, - { 0, "hf fido make" }, - { 0, "hf fido assert" }, - { 1, "hf fudan help" }, - { 0, "hf fudan reader" }, - { 0, "hf fudan dump" }, - { 0, "hf fudan rdbl" }, - { 1, "hf fudan view" }, - { 0, "hf fudan wrbl" }, - { 1, "hf gallagher help" }, - { 0, "hf gallagher reader" }, - { 0, "hf gallagher clone" }, - { 0, "hf gallagher delete" }, - { 1, "hf gallagher diversifykey" }, - { 1, "hf gallagher decode" }, - { 1, "hf ksx6924 help" }, - { 0, "hf ksx6924 select" }, - { 0, "hf ksx6924 info" }, - { 0, "hf ksx6924 balance" }, - { 0, "hf ksx6924 init" }, - { 0, "hf ksx6924 prec" }, - { 1, "hf jooki help" }, - { 0, "hf jooki clone" }, - { 1, "hf jooki decode" }, - { 1, "hf jooki encode" }, - { 0, "hf jooki sim" }, - { 1, "hf iclass help" }, - { 0, "hf iclass dump" }, - { 1, "hf iclass info" }, - { 1, "hf iclass list" }, - { 0, "hf iclass rdbl" }, - { 0, "hf iclass reader" }, - { 0, "hf iclass restore" }, - { 0, "hf iclass sniff" }, - { 0, "hf iclass wrbl" }, - { 0, "hf iclass chk" }, - { 1, "hf iclass loclass" }, - { 1, "hf iclass lookup" }, - { 0, "hf iclass sim" }, - { 0, "hf iclass eload" }, - { 0, "hf iclass esave" }, - { 0, "hf iclass eview" }, - { 1, "hf iclass configcard" }, - { 1, "hf iclass calcnewkey" }, - { 1, "hf iclass encode" }, - { 1, "hf iclass encrypt" }, - { 1, "hf iclass decrypt" }, - { 1, "hf iclass managekeys" }, - { 1, "hf iclass permutekey" }, - { 1, "hf iclass view" }, - { 1, "hf legic help" }, - { 0, "hf legic dump" }, - { 0, "hf legic info" }, - { 1, "hf legic list" }, - { 0, "hf legic rdbl" }, - { 0, "hf legic reader" }, - { 0, "hf legic restore" }, - { 0, "hf legic wipe" }, - { 0, "hf legic wrbl" }, - { 0, "hf legic sim" }, - { 0, "hf legic eload" }, - { 0, "hf legic esave" }, - { 0, "hf legic eview" }, - { 0, "hf legic einfo" }, - { 1, "hf legic crc" }, - { 1, "hf legic view" }, - { 1, "hf lto help" }, - { 0, "hf lto dump" }, - { 0, "hf lto info" }, - { 1, "hf lto list" }, - { 0, "hf lto rdbl" }, - { 0, "hf lto reader" }, - { 0, "hf lto restore" }, - { 0, "hf lto wrbl" }, - { 1, "hf mf help" }, - { 1, "hf mf list" }, - { 0, "hf mf darkside" }, - { 0, "hf mf nested" }, - { 1, "hf mf hardnested" }, - { 0, "hf mf staticnested" }, - { 0, "hf mf autopwn" }, - { 0, "hf mf nack" }, - { 0, "hf mf chk" }, - { 0, "hf mf fchk" }, - { 1, "hf mf decrypt" }, - { 0, "hf mf supercard" }, - { 0, "hf mf auth4" }, - { 1, "hf mf acl" }, - { 0, "hf mf dump" }, - { 1, "hf mf mad" }, - { 0, "hf mf personalize" }, - { 0, "hf mf rdbl" }, - { 0, "hf mf rdsc" }, - { 0, "hf mf restore" }, - { 0, "hf mf setmod" }, - { 1, "hf mf value" }, - { 1, "hf mf view" }, - { 0, "hf mf wipe" }, - { 0, "hf mf wrbl" }, - { 0, "hf mf sim" }, - { 0, "hf mf ecfill" }, - { 0, "hf mf eclr" }, - { 0, "hf mf egetblk" }, - { 0, "hf mf egetsc" }, - { 0, "hf mf ekeyprn" }, - { 0, "hf mf eload" }, - { 0, "hf mf esave" }, - { 0, "hf mf esetblk" }, - { 0, "hf mf eview" }, - { 0, "hf mf cgetblk" }, - { 0, "hf mf cgetsc" }, - { 0, "hf mf cload" }, - { 0, "hf mf csave" }, - { 0, "hf mf csetblk" }, - { 0, "hf mf csetuid" }, - { 0, "hf mf cview" }, - { 0, "hf mf cwipe" }, - { 0, "hf mf gen3uid" }, - { 0, "hf mf gen3blk" }, - { 0, "hf mf gen3freeze" }, - { 0, "hf mf ggetblk" }, - { 0, "hf mf gload" }, - { 0, "hf mf gsave" }, - { 0, "hf mf gsetblk" }, - { 0, "hf mf gview" }, - { 0, "hf mf gdmcfg" }, - { 0, "hf mf gdmsetcfg" }, - { 0, "hf mf gdmsetblk" }, - { 0, "hf mf ndefformat" }, - { 0, "hf mf ndefread" }, - { 0, "hf mf ndefwrite" }, - { 1, "hf mfp help" }, - { 1, "hf mfp list" }, - { 0, "hf mfp auth" }, - { 0, "hf mfp chk" }, - { 0, "hf mfp dump" }, - { 0, "hf mfp info" }, - { 0, "hf mfp mad" }, - { 0, "hf mfp rdbl" }, - { 0, "hf mfp rdsc" }, - { 0, "hf mfp wrbl" }, - { 0, "hf mfp commitp" }, - { 0, "hf mfp initp" }, - { 0, "hf mfp wrp" }, - { 0, "hf mfp ndefformat" }, - { 0, "hf mfp ndefread" }, - { 0, "hf mfp ndefwrite" }, - { 1, "hf mfu help" }, - { 1, "hf mfu keygen" }, - { 1, "hf mfu pwdgen" }, - { 0, "hf mfu otptear" }, - { 0, "hf mfu cauth" }, - { 0, "hf mfu dump" }, - { 0, "hf mfu info" }, - { 0, "hf mfu ndefread" }, - { 0, "hf mfu rdbl" }, - { 0, "hf mfu restore" }, - { 1, "hf mfu view" }, - { 0, "hf mfu wrbl" }, - { 0, "hf mfu tamper" }, - { 0, "hf mfu eload" }, - { 0, "hf mfu esave" }, - { 0, "hf mfu eview" }, - { 0, "hf mfu sim" }, - { 0, "hf mfu setpwd" }, - { 0, "hf mfu setuid" }, - { 1, "hf mfdes help" }, - { 0, "hf mfdes info" }, - { 0, "hf mfdes getuid" }, - { 0, "hf mfdes default" }, - { 0, "hf mfdes auth" }, - { 0, "hf mfdes chk" }, - { 0, "hf mfdes detect" }, - { 0, "hf mfdes freemem" }, - { 0, "hf mfdes setconfig" }, - { 0, "hf mfdes formatpicc" }, - { 1, "hf mfdes list" }, - { 0, "hf mfdes mad" }, - { 0, "hf mfdes lsapp" }, - { 0, "hf mfdes getaids" }, - { 0, "hf mfdes getappnames" }, - { 0, "hf mfdes bruteaid" }, - { 0, "hf mfdes createapp" }, - { 0, "hf mfdes deleteapp" }, - { 0, "hf mfdes selectapp" }, - { 0, "hf mfdes changekey" }, - { 0, "hf mfdes chkeysettings" }, - { 0, "hf mfdes getkeysettings" }, - { 0, "hf mfdes getkeyversions" }, - { 0, "hf mfdes getfileids" }, - { 0, "hf mfdes getfileisoids" }, - { 0, "hf mfdes lsfiles" }, - { 0, "hf mfdes dump" }, - { 0, "hf mfdes createfile" }, - { 0, "hf mfdes createvaluefile" }, - { 0, "hf mfdes createrecordfile" }, - { 0, "hf mfdes createmacfile" }, - { 0, "hf mfdes deletefile" }, - { 0, "hf mfdes getfilesettings" }, - { 0, "hf mfdes chfilesettings" }, - { 0, "hf mfdes read" }, - { 0, "hf mfdes write" }, - { 0, "hf mfdes value" }, - { 0, "hf mfdes clearrecfile" }, - { 1, "hf mfdes test" }, - { 1, "hf ntag424 help" }, - { 0, "hf ntag424 info" }, - { 0, "hf ntag424 sdm" }, - { 1, "hf ntag424 view" }, - { 1, "hf seos help" }, - { 0, "hf seos info" }, - { 1, "hf seos list" }, - { 1, "hf st25ta help" }, - { 0, "hf st25ta info" }, - { 1, "hf st25ta list" }, - { 1, "hf st25ta ndefread" }, - { 0, "hf st25ta protect" }, - { 0, "hf st25ta pwd" }, - { 0, "hf st25ta sim" }, - { 1, "hf tesla help" }, - { 0, "hf tesla info" }, - { 1, "hf tesla list" }, - { 1, "hf texkom help" }, - { 0, "hf texkom reader" }, - { 0, "hf texkom sim" }, - { 1, "hf thinfilm help" }, - { 0, "hf thinfilm info" }, - { 1, "hf thinfilm list" }, - { 0, "hf thinfilm sim" }, - { 1, "hf topaz help" }, - { 1, "hf topaz list" }, - { 0, "hf topaz dump" }, - { 0, "hf topaz info" }, - { 0, "hf topaz raw" }, - { 0, "hf topaz rdbl" }, - { 0, "hf topaz reader" }, - { 0, "hf topaz sim" }, - { 0, "hf topaz sniff" }, - { 1, "hf topaz view" }, - { 0, "hf topaz wrbl" }, - { 1, "hf vas help" }, - { 0, "hf vas reader" }, - { 1, "hf vas decrypt" }, - { 1, "hf waveshare help" }, - { 0, "hf waveshare loadbmp" }, - { 1, "hf xerox help" }, - { 0, "hf xerox info" }, - { 0, "hf xerox reader" }, - { 0, "hf xerox dump" }, - { 1, "hw help" }, - { 0, "hw break" }, - { 1, "hw connect" }, - { 0, "hw dbg" }, - { 0, "hw detectreader" }, - { 0, "hw fpgaoff" }, - { 0, "hw lcd" }, - { 0, "hw lcdreset" }, - { 0, "hw ping" }, - { 0, "hw readmem" }, - { 0, "hw reset" }, - { 0, "hw setlfdivisor" }, - { 0, "hw setmux" }, - { 0, "hw standalone" }, - { 0, "hw status" }, - { 0, "hw tearoff" }, - { 0, "hw tia" }, - { 1, "hw timeout" }, - { 0, "hw tune" }, - { 1, "hw version" }, - { 1, "lf help" }, - { 0, "lf config" }, - { 0, "lf cmdread" }, - { 0, "lf read" }, - { 1, "lf search" }, - { 0, "lf sim" }, - { 0, "lf simask" }, - { 0, "lf simfsk" }, - { 0, "lf simpsk" }, - { 0, "lf simbidir" }, - { 0, "lf sniff" }, - { 0, "lf tune" }, - { 1, "lf awid help" }, - { 1, "lf awid demod" }, - { 0, "lf awid reader" }, - { 0, "lf awid clone" }, - { 0, "lf awid sim" }, - { 0, "lf awid brute" }, - { 0, "lf awid watch" }, - { 1, "lf cotag help" }, - { 1, "lf cotag demod" }, - { 0, "lf cotag reader" }, - { 1, "lf destron help" }, - { 1, "lf destron demod" }, - { 0, "lf destron reader" }, - { 0, "lf destron clone" }, - { 0, "lf destron sim" }, - { 1, "lf em help" }, - { 1, "lf em 410x help" }, - { 1, "lf em 410x demod" }, - { 0, "lf em 410x reader" }, - { 0, "lf em 410x sim" }, - { 0, "lf em 410x brute" }, - { 0, "lf em 410x watch" }, - { 0, "lf em 410x spoof" }, - { 0, "lf em 410x clone" }, - { 1, "lf em 4x05 help" }, - { 0, "lf em 4x05 brute" }, - { 0, "lf em 4x05 chk" }, - { 1, "lf em 4x05 demod" }, - { 0, "lf em 4x05 dump" }, - { 0, "lf em 4x05 info" }, - { 0, "lf em 4x05 read" }, - { 1, "lf em 4x05 sniff" }, - { 0, "lf em 4x05 unlock" }, - { 0, "lf em 4x05 wipe" }, - { 0, "lf em 4x05 write" }, - { 1, "lf em 4x50 help" }, - { 0, "lf em 4x50 brute" }, - { 0, "lf em 4x50 chk" }, - { 0, "lf em 4x50 dump" }, - { 0, "lf em 4x50 info" }, - { 0, "lf em 4x50 login" }, - { 0, "lf em 4x50 rdbl" }, - { 0, "lf em 4x50 reader" }, - { 0, "lf em 4x50 restore" }, - { 0, "lf em 4x50 wrbl" }, - { 0, "lf em 4x50 wrpwd" }, - { 0, "lf em 4x50 wipe" }, - { 0, "lf em 4x50 eload" }, - { 0, "lf em 4x50 esave" }, - { 0, "lf em 4x50 eview" }, - { 0, "lf em 4x50 sim" }, - { 1, "lf em 4x70 help" }, - { 0, "lf em 4x70 brute" }, - { 0, "lf em 4x70 info" }, - { 0, "lf em 4x70 write" }, - { 0, "lf em 4x70 unlock" }, - { 0, "lf em 4x70 auth" }, - { 0, "lf em 4x70 writepin" }, - { 0, "lf em 4x70 writekey" }, - { 1, "lf fdxb help" }, - { 1, "lf fdxb demod" }, - { 0, "lf fdxb reader" }, - { 0, "lf fdxb clone" }, - { 0, "lf fdxb sim" }, - { 1, "lf gallagher help" }, - { 1, "lf gallagher demod" }, - { 0, "lf gallagher reader" }, - { 0, "lf gallagher clone" }, - { 0, "lf gallagher sim" }, - { 1, "lf gproxii help" }, - { 1, "lf gproxii demod" }, - { 0, "lf gproxii reader" }, - { 0, "lf gproxii clone" }, - { 0, "lf gproxii sim" }, - { 1, "lf hid help" }, - { 1, "lf hid demod" }, - { 0, "lf hid reader" }, - { 0, "lf hid clone" }, - { 0, "lf hid sim" }, - { 0, "lf hid brute" }, - { 0, "lf hid watch" }, - { 1, "lf hitag help" }, - { 0, "lf hitag eload" }, - { 1, "lf hitag list" }, - { 0, "lf hitag info" }, - { 0, "lf hitag reader" }, - { 0, "lf hitag sim" }, - { 0, "lf hitag sniff" }, - { 0, "lf hitag writer" }, - { 0, "lf hitag dump" }, - { 0, "lf hitag cc" }, - { 1, "lf idteck help" }, - { 1, "lf idteck demod" }, - { 0, "lf idteck reader" }, - { 0, "lf idteck clone" }, - { 0, "lf idteck sim" }, - { 1, "lf indala help" }, - { 0, "lf indala brute" }, - { 1, "lf indala demod" }, - { 1, "lf indala altdemod" }, - { 0, "lf indala reader" }, - { 0, "lf indala clone" }, - { 0, "lf indala sim" }, - { 1, "lf io help" }, - { 1, "lf io demod" }, - { 0, "lf io reader" }, - { 0, "lf io clone" }, - { 0, "lf io sim" }, - { 0, "lf io watch" }, - { 1, "lf jablotron help" }, - { 1, "lf jablotron demod" }, - { 0, "lf jablotron reader" }, - { 0, "lf jablotron clone" }, - { 0, "lf jablotron sim" }, - { 1, "lf keri help" }, - { 1, "lf keri demod" }, - { 0, "lf keri reader" }, - { 0, "lf keri clone" }, - { 0, "lf keri sim" }, - { 1, "lf motorola help" }, - { 1, "lf motorola demod" }, - { 0, "lf motorola reader" }, - { 0, "lf motorola clone" }, - { 0, "lf motorola sim" }, - { 1, "lf nedap help" }, - { 1, "lf nedap demod" }, - { 0, "lf nedap reader" }, - { 0, "lf nedap clone" }, - { 0, "lf nedap sim" }, - { 1, "lf nexwatch help" }, - { 1, "lf nexwatch demod" }, - { 0, "lf nexwatch reader" }, - { 0, "lf nexwatch clone" }, - { 0, "lf nexwatch sim" }, - { 1, "lf noralsy help" }, - { 1, "lf noralsy demod" }, - { 0, "lf noralsy reader" }, - { 0, "lf noralsy clone" }, - { 0, "lf noralsy sim" }, - { 1, "lf pac help" }, - { 1, "lf pac demod" }, - { 0, "lf pac reader" }, - { 0, "lf pac clone" }, - { 0, "lf pac sim" }, - { 1, "lf paradox help" }, - { 1, "lf paradox demod" }, - { 0, "lf paradox reader" }, - { 0, "lf paradox clone" }, - { 0, "lf paradox sim" }, - { 1, "lf pcf7931 help" }, - { 0, "lf pcf7931 reader" }, - { 0, "lf pcf7931 write" }, - { 1, "lf pcf7931 config" }, - { 1, "lf presco help" }, - { 1, "lf presco demod" }, - { 0, "lf presco reader" }, - { 0, "lf presco clone" }, - { 0, "lf presco sim" }, - { 1, "lf pyramid help" }, - { 1, "lf pyramid demod" }, - { 0, "lf pyramid reader" }, - { 0, "lf pyramid clone" }, - { 0, "lf pyramid sim" }, - { 1, "lf securakey help" }, - { 1, "lf securakey demod" }, - { 0, "lf securakey reader" }, - { 0, "lf securakey clone" }, - { 0, "lf securakey sim" }, - { 1, "lf ti help" }, - { 1, "lf ti demod" }, - { 0, "lf ti reader" }, - { 0, "lf ti write" }, - { 1, "lf t55xx help" }, - { 0, "lf t55xx clonehelp" }, - { 1, "lf t55xx config" }, - { 0, "lf t55xx dangerraw" }, - { 1, "lf t55xx detect" }, - { 0, "lf t55xx deviceconfig" }, - { 0, "lf t55xx dump" }, - { 1, "lf t55xx info" }, - { 0, "lf t55xx p1detect" }, - { 0, "lf t55xx read" }, - { 0, "lf t55xx resetread" }, - { 0, "lf t55xx restore" }, - { 1, "lf t55xx trace" }, - { 0, "lf t55xx wakeup" }, - { 0, "lf t55xx write" }, - { 0, "lf t55xx bruteforce" }, - { 0, "lf t55xx chk" }, - { 0, "lf t55xx protect" }, - { 0, "lf t55xx recoverpw" }, - { 1, "lf t55xx sniff" }, - { 0, "lf t55xx special" }, - { 0, "lf t55xx wipe" }, - { 1, "lf viking help" }, - { 1, "lf viking demod" }, - { 0, "lf viking reader" }, - { 0, "lf viking clone" }, - { 0, "lf viking sim" }, - { 1, "lf visa2000 help" }, - { 1, "lf visa2000 demod" }, - { 0, "lf visa2000 reader" }, - { 0, "lf visa2000 clone" }, - { 0, "lf visa2000 sim" }, - { 1, "mem help" }, - { 0, "mem baudrate" }, - { 0, "mem dump" }, - { 0, "mem info" }, - { 0, "mem load" }, - { 0, "mem wipe" }, - { 1, "mem spiffs help" }, - { 0, "mem spiffs copy" }, - { 0, "mem spiffs check" }, - { 0, "mem spiffs dump" }, - { 0, "mem spiffs info" }, - { 0, "mem spiffs mount" }, - { 0, "mem spiffs remove" }, - { 0, "mem spiffs rename" }, - { 0, "mem spiffs test" }, - { 0, "mem spiffs tree" }, - { 0, "mem spiffs unmount" }, - { 0, "mem spiffs upload" }, - { 0, "mem spiffs view" }, - { 0, "mem spiffs wipe" }, - { 1, "nfc help" }, - { 1, "nfc decode" }, - { 0, "nfc type1 read" }, - { 1, "nfc type1 help" }, - { 0, "nfc type2 read" }, - { 1, "nfc type2 help" }, - { 0, "nfc type4a format" }, - { 0, "nfc type4a read" }, - { 0, "nfc type4a write" }, - { 0, "nfc type4a st25taread" }, - { 1, "nfc type4a help" }, - { 0, "nfc type4b read" }, - { 1, "nfc type4b help" }, - { 0, "nfc mf cformat" }, - { 0, "nfc mf cread" }, - { 0, "nfc mf cwrite" }, - { 0, "nfc mf pread" }, - { 1, "nfc mf help" }, - { 0, "nfc barcode read" }, - { 0, "nfc barcode sim" }, - { 1, "nfc barcode help" }, - { 1, "piv help" }, - { 0, "piv select" }, - { 0, "piv getdata" }, - { 0, "piv authsign" }, - { 0, "piv scan" }, - { 1, "piv list" }, - { 1, "smart help" }, - { 1, "smart list" }, - { 0, "smart info" }, - { 0, "smart relay" }, - { 0, "smart reader" }, - { 0, "smart raw" }, - { 1, "smart upgrade" }, - { 0, "smart setclock" }, - { 0, "smart brute" }, - { 1, "script help" }, - { 1, "script list" }, - { 1, "script run" }, - { 1, "trace help" }, - { 1, "trace extract" }, - { 1, "trace list" }, - { 1, "trace load" }, - { 1, "trace save" }, - { 1, "usart help" }, - { 0, "usart btpin" }, - { 0, "usart btfactory" }, - { 0, "usart tx" }, - { 0, "usart rx" }, - { 0, "usart txrx" }, - { 0, "usart txhex" }, - { 0, "usart rxhex" }, - { 0, "usart config" }, - { 1, "wiegand help" }, - { 1, "wiegand list" }, - { 1, "wiegand encode" }, - { 1, "wiegand decode" }, - {0, NULL} -}; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/client/src/proxendian.h b/client/src/proxendian.h index 17003e75e..d258d2ce8 100644 --- a/client/src/proxendian.h +++ b/client/src/proxendian.h @@ -53,11 +53,15 @@ #else static inline uint16_t le16(uint16_t v) { - return (v >> 8) | (v << 8); + return (uint16_t)( + (v >> 8) | (v << 8) + ); } static inline uint32_t le32(uint32_t v) { - return (le16(v) << 16) | (le16(v >> 16)); + return (uint32_t)( + (le16(v) << 16) | (le16(v >> 16)) + ); } #endif // HOST_LITTLE_ENDIAN diff --git a/client/src/proxguiqt.cpp b/client/src/proxguiqt.cpp index ff88bce1e..1c9a05d11 100644 --- a/client/src/proxguiqt.cpp +++ b/client/src/proxguiqt.cpp @@ -794,7 +794,7 @@ void Plot::paintEvent(QPaintEvent *event) { snprintf(scalestr, sizeof(scalestr), "[%2.2f %s] ", ((int32_t)(CursorBPos - CursorAPos)) / g_CursorScaleFactor, g_CursorScaleFactorUnit); } } - snprintf(str, sizeof(str), "@%u..%u dt=%i %szoom=%2.2f CursorAPos=%u CursorBPos=%u GridX=%lf GridY=%lf (%s) GridXoffset=%lf", + snprintf(str, sizeof(str), "@%u..%u dt=%i %szoom=%2.3f CursorAPos=%u CursorBPos=%u GridX=%lf GridY=%lf (%s) GridXoffset=%lf", g_GraphStart, g_GraphStop, CursorBPos - CursorAPos, @@ -838,17 +838,25 @@ void Plot::closeEvent(QCloseEvent *event) { gs_useOverlays = false; } +// every 4 steps the zoom doubles (or halves) +#define ZOOM_STEP (1.189207) +// limit zoom to 32 times in either direction +#define ZOOM_LIMIT (32) + void Plot::Zoom(double factor, uint32_t refX) { + double g_GraphPixelsPerPointNew = g_GraphPixelsPerPoint * factor; + if (factor >= 1) { // Zoom in - if (g_GraphPixelsPerPoint <= 25 * factor) { - g_GraphPixelsPerPoint *= factor; + if (g_GraphPixelsPerPointNew <= ZOOM_LIMIT) { + g_GraphPixelsPerPoint = g_GraphPixelsPerPointNew; if (refX > g_GraphStart) { g_GraphStart += (refX - g_GraphStart) - ((refX - g_GraphStart) / factor); } } } else { // Zoom out - if (g_GraphPixelsPerPoint >= 0.01 / factor) { - g_GraphPixelsPerPoint *= factor; + if (g_GraphPixelsPerPointNew >= (1.0 / ZOOM_LIMIT)) { + g_GraphPixelsPerPoint = g_GraphPixelsPerPointNew; + // shift graph towards refX when zooming out if (refX > g_GraphStart) { if (g_GraphStart >= ((refX - g_GraphStart) / factor) - (refX - g_GraphStart)) { g_GraphStart -= ((refX - g_GraphStart) / factor) - (refX - g_GraphStart); @@ -885,7 +893,6 @@ void Plot::Move(int offset) { void Plot::Trim(void) { uint32_t lref, rref; - const double zoom_offset = 1.148698354997035; // 2**(1/5) if ((CursorAPos == 0) || (CursorBPos == 0)) { // if we don't have both cursors set lref = g_GraphStart; rref = g_GraphStop; @@ -902,12 +909,12 @@ void Plot::Trim(void) { } else { lref = CursorAPos < CursorBPos ? CursorAPos : CursorBPos; rref = CursorAPos < CursorBPos ? CursorBPos : CursorAPos; - // g_GraphPixelsPerPoint mush remain a power of zoom_offset + // g_GraphPixelsPerPoint must remain a power of ZOOM_STEP double GPPPtarget = g_GraphPixelsPerPoint * (g_GraphStop - g_GraphStart) / (rref - lref); while (g_GraphPixelsPerPoint < GPPPtarget) { - g_GraphPixelsPerPoint *= zoom_offset; + g_GraphPixelsPerPoint *= ZOOM_STEP; } - g_GraphPixelsPerPoint /= zoom_offset; + g_GraphPixelsPerPoint /= ZOOM_STEP; CursorAPos -= lref; CursorBPos -= lref; } @@ -925,34 +932,26 @@ void Plot::wheelEvent(QWheelEvent *event) { const float move_offset = 0.05; // -120+shift => zoom in (5 times = *2) // 120+shift => zoom out (5 times = /2) - const double zoom_offset = 1.148698354997035; // 2**(1/5) - if (event->modifiers() & Qt::ShiftModifier) { -// event->position doesn't exist in QT5.12.8, both exist in 5.14.2 and event->x doesn't exist in 5.15.0 #if QT_VERSION >= 0x050d00 - uint32_t x = event->position().x(); + // event->position doesn't exist in QT5.12.8, both exist in 5.14.2 and event->x doesn't exist in 5.15.0 + uint32_t x = event->position().x(); + // event->angleDelta doesn't exist in QT4, both exist in 5.12.8 and 5.14.2 and event->delta doesn't exist in 5.15.0 + float delta = -event->angleDelta().y(); #else - uint32_t x = event->x(); + uint32_t x = event->x(); + float delta = -event->delta(); #endif + if (event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier)) { x -= WIDTH_AXES; x = (int)(x / g_GraphPixelsPerPoint); x += g_GraphStart; -// event->angleDelta doesn't exist in QT4, both exist in 5.12.8 and 5.14.2 and event->delta doesn't exist in 5.15.0 -#if QT_VERSION >= 0x050d00 - float delta = event->angleDelta().y(); -#else - float delta = event->delta(); -#endif if (delta < 0) { - Zoom(zoom_offset, x); + Zoom(ZOOM_STEP, x); } else { - Zoom(1.0 / zoom_offset, x); + Zoom(1.0 / ZOOM_STEP, x); } } else { -#if QT_VERSION >= 0x050d00 - Move(PageWidth * (-(float)event->angleDelta().y() / (120 / move_offset))); -#else - Move(PageWidth * (-(float)event->delta() / (120 / move_offset))); -#endif + Move(PageWidth * delta * move_offset / 120); } this->update(); } @@ -972,7 +971,6 @@ void Plot::mouseMoveEvent(QMouseEvent *event) { void Plot::keyPressEvent(QKeyEvent *event) { uint32_t offset; // Left/right movement offset (in sample size) - const double zoom_offset = 1.148698354997035; // 2**(1/5) if (event->modifiers() & Qt::ShiftModifier) { if (g_PlotGridX) @@ -983,22 +981,22 @@ void Plot::keyPressEvent(QKeyEvent *event) { if (event->modifiers() & Qt::ControlModifier) offset = 1; else - offset = (int)(20 / g_GraphPixelsPerPoint); + offset = int(ZOOM_LIMIT / g_GraphPixelsPerPoint); } switch (event->key()) { case Qt::Key_Down: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ControlModifier) { - Zoom(zoom_offset, CursorBPos); + Zoom(ZOOM_STEP, CursorBPos); } else { - Zoom(2, CursorBPos); + Zoom(ZOOM_STEP * 2, CursorBPos); } } else { if (event->modifiers() & Qt::ControlModifier) { - Zoom(zoom_offset, CursorAPos); + Zoom(ZOOM_STEP, CursorAPos); } else { - Zoom(2, CursorAPos); + Zoom(ZOOM_STEP * 2, CursorAPos); } } break; @@ -1006,15 +1004,15 @@ void Plot::keyPressEvent(QKeyEvent *event) { case Qt::Key_Up: if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ControlModifier) { - Zoom(1.0 / zoom_offset, CursorBPos); + Zoom(1.0 / ZOOM_STEP, CursorBPos); } else { - Zoom(0.5, CursorBPos); + Zoom(1.0 / (ZOOM_STEP * 2), CursorBPos); } } else { if (event->modifiers() & Qt::ControlModifier) { - Zoom(1.0 / zoom_offset, CursorAPos); + Zoom(1.0 / ZOOM_STEP, CursorAPos); } else { - Zoom(0.5, CursorAPos); + Zoom(1.0 / (ZOOM_STEP * 2), CursorAPos); } } break; diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 162bc7776..a91f74179 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -282,19 +282,22 @@ check_script: // read script file if (fgets(script_cmd_buf, sizeof(script_cmd_buf), current_cmdscriptfile()) == NULL) { - if (!pop_cmdscriptfile()) + if (pop_cmdscriptfile() == false) { break; - + } goto check_script; - } else { - prompt_ctx = PROXPROMPT_CTX_SCRIPTFILE; - // remove linebreaks - strcleanrn(script_cmd_buf, sizeof(script_cmd_buf)); - - cmd = str_dup(script_cmd_buf); - if (cmd != NULL) - printprompt = true; } + + prompt_ctx = PROXPROMPT_CTX_SCRIPTFILE; + + // remove linebreaks + strcleanrn(script_cmd_buf, sizeof(script_cmd_buf)); + + cmd = str_dup(script_cmd_buf); + if (cmd != NULL) { + printprompt = true; + } + } else { // If there is a script command if (execCommand) { @@ -429,8 +432,9 @@ check_script: msleep(100); // Make sure command is sent before killing client } - while (current_cmdscriptfile()) + while (current_cmdscriptfile()) { pop_cmdscriptfile(); + } pm3line_flush_history(); @@ -577,6 +581,7 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " --unlock-bootloader Enable flashing of bootloader area *DANGEROUS* (need --flash)"); PrintAndLogEx(NORMAL, " --force Enable flashing even if firmware seems to not match client version"); PrintAndLogEx(NORMAL, " --image image to flash. Can be specified several times."); + PrintAndLogEx(NORMAL, " --ncpu override number of CPU cores"); PrintAndLogEx(NORMAL, "\nExamples:"); PrintAndLogEx(NORMAL, "\n to run Proxmark3 client:\n"); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -- runs the pm3 client", exec_name); @@ -601,7 +606,7 @@ static void show_help(bool showFullHelp, char *exec_name) { } } -static int flash_pm3(char *serial_port_name, uint8_t num_files, char *filenames[FLASH_MAX_FILES], bool can_write_bl, bool force) { +static int flash_pm3(char *serial_port_name, uint8_t num_files, const char *filenames[FLASH_MAX_FILES], bool can_write_bl, bool force) { int ret = PM3_EUNDEF; flash_file_t files[FLASH_MAX_FILES]; @@ -751,7 +756,7 @@ int main(int argc, char *argv[]) { bool flash_force = false; bool debug_mode_forced = false; int flash_num_files = 0; - char *flash_filenames[FLASH_MAX_FILES]; + const char *flash_filenames[FLASH_MAX_FILES]; // color management: // 1. default = no color @@ -992,6 +997,23 @@ int main(int argc, char *argv[]) { continue; } + if (strcmp(argv[i], "--ncpu") == 0) { + if (i + 1 == argc) { + PrintAndLogEx(ERR, _RED_("ERROR:") " missing CPU number specification after --ncpu\n"); + show_help(false, exec_name); + return 1; + } + long int ncpus = strtol(argv[i + 1], NULL, 10); + const int detected_cpus = detect_num_CPUs(); + if (ncpus < 0 || ncpus >= detected_cpus) { + PrintAndLogEx(ERR, _RED_("ERROR:") " invalid number of CPU cores: --ncpu " _YELLOW_("%s") " (available: %d)\n", argv[i + 1], detected_cpus); + return 1; + } + g_numCPUs = ncpus; + i++; + continue; + } + // We got an unknown parameter PrintAndLogEx(ERR, _RED_("ERROR:") " invalid parameter: " _YELLOW_("%s") "\n", argv[i]); show_help(false, exec_name); diff --git a/client/src/proxmark3.h b/client/src/proxmark3.h index a9f80ae91..71072422a 100644 --- a/client/src/proxmark3.h +++ b/client/src/proxmark3.h @@ -36,7 +36,7 @@ #define PROXPROMPT_DEV_OFFLINE _RL_BOLD_RED_("offline") #define PROXHISTORY "history.txt" -#define PROXLOG "log_%Y%m%d.txt" +#define PROXLOG "log_%Y%m%d%H%M%S.txt" #define MAX_NESTED_CMDSCRIPT 10 #define MAX_NESTED_LUASCRIPT 10 diff --git a/client/src/scripting.c b/client/src/scripting.c index c96d593df..613562978 100644 --- a/client/src/scripting.c +++ b/client/src/scripting.c @@ -1269,8 +1269,9 @@ static int l_searchfile(lua_State *L) { size_t size; // data const char *filename = luaL_checklstring(L, 1, &size); - if (size == 0) + if (size == 0) { return returnToLuaWithError(L, "Must specify filename"); + } const char *suffix = luaL_checklstring(L, 2, &size); char *path; diff --git a/client/src/util.c b/client/src/util.c index 51408a524..e531b51ea 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -40,6 +40,8 @@ uint8_t g_debugMode = 0; uint8_t g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG; // global client tell if a pending prompt is present bool g_pendingPrompt = false; +// global CPU core count override +int g_numCPUs = 0; #ifdef _WIN32 #include @@ -1077,8 +1079,16 @@ uint64_t HornerScheme(uint64_t num, uint64_t divider, uint64_t factor) { return result; } -// determine number of logical CPU cores (use for multithreaded functions) int num_CPUs(void) { + if (g_numCPUs > 0) { + return g_numCPUs; + } + + return detect_num_CPUs(); +} + +// determine number of logical CPU cores (use for multithreaded functions) +int detect_num_CPUs(void) { #if defined(_WIN32) #include SYSTEM_INFO sysinfo; @@ -1256,6 +1266,8 @@ inline uint64_t leadingzeros64(uint64_t a) { } +// byte_strstr searches for the first occurrence of pattern in src +// returns the byte offset the pattern is found at, or -1 if not found int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen) { size_t max = srclen - plen + 1; @@ -1279,6 +1291,28 @@ int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_ return -1; } +// byte_strrstr is like byte_strstr except searches in reverse +// ie it returns the last occurrence of the pattern in src instead of the first +// returns the byte offset the pattern is found at, or -1 if not found +int byte_strrstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen) { + for (int i = srclen - plen; i >= 0; i--) { + // compare only first byte + if (src[i] != pattern[0]) + continue; + + // try to match rest of the pattern + for (int j = plen - 1; j >= 1; j--) { + + if (src[i + j] != pattern[j]) + break; + + if (j == 1) + return i; + } + } + return -1; +} + void sb_append_char(smartbuf *sb, unsigned char c) { if (sb->idx >= sb->size) { sb->size *= 2; diff --git a/client/src/util.h b/client/src/util.h index 4dab9ae06..cfaf97167 100644 --- a/client/src/util.h +++ b/client/src/util.h @@ -32,6 +32,7 @@ extern uint8_t g_debugMode; extern uint8_t g_printAndLog; extern bool g_pendingPrompt; +extern int g_numCPUs; #define PRINTANDLOG_PRINT 1 #define PRINTANDLOG_LOG 2 @@ -130,7 +131,8 @@ void wiegand_add_parity_swapped(uint8_t *target, uint8_t *source, uint8_t length uint32_t PackBits(uint8_t start, uint8_t len, const uint8_t *bits); uint64_t HornerScheme(uint64_t num, uint64_t divider, uint64_t factor); -int num_CPUs(void); // number of logical CPUs +int num_CPUs(void); +int detect_num_CPUs(void); // number of logical CPUs void str_lower(char *s); // converts string to lower case void str_upper(char *s); // converts string to UPPER case @@ -153,6 +155,7 @@ uint32_t leadingzeros32(uint32_t a); uint64_t leadingzeros64(uint64_t a); int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen); +int byte_strrstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen); struct smartbuf { char *ptr; diff --git a/client/src/wiegand_formatutils.c b/client/src/wiegand_formatutils.c index e55f999bd..75aa6ae2f 100644 --- a/client/src/wiegand_formatutils.c +++ b/client/src/wiegand_formatutils.c @@ -148,7 +148,7 @@ static uint8_t get_length_from_header(wiegand_message_t *data) { len = 32; } else { - printf("hid preamble detected\n"); + PrintAndLogEx(DEBUG, "hid preamble detected"); len = 32; if ((data->Mid ^ 0x20) == 0) { hfmt = data->Bot; len = 0; } diff --git a/common/cardhelper.c b/common/cardhelper.c index c8c8b6bd8..7523c9a72 100644 --- a/common/cardhelper.c +++ b/common/cardhelper.c @@ -35,26 +35,68 @@ // look for CardHelper bool IsCardHelperPresent(bool verbose) { - if (IfPm3Smartcard()) { - int resp_len = 0; - uint8_t version[] = {0x96, 0x69, 0x00, 0x00, 0x00}; - uint8_t resp[30] = {0}; - ExchangeAPDUSC(verbose, version, sizeof(version), true, true, resp, sizeof(resp), &resp_len); + if (IfPm3Smartcard() == false) { + return false; + } - if (resp_len < 8) { - return false; - } + int resp_len = 0; + uint8_t version[] = {0x96, 0x69, 0x00, 0x00, 0x00}; + uint8_t resp[30] = {0}; + ExchangeAPDUSC(verbose, version, sizeof(version), true, true, resp, sizeof(resp), &resp_len); - if (strstr("CryptoHelper", (char *)resp) == 0) { - if (verbose) { - PrintAndLogEx(INFO, "Found smart card helper"); - } - return true; + if (resp_len < 8) { + return false; + } + + if (strstr("CryptoHelper", (char *)resp) == 0) { + if (verbose) { + PrintAndLogEx(INFO, "Found smart card helper"); } + return true; } return false; } +bool IsHIDSamPresent(bool verbose) { + + if (IfPm3Smartcard() == false) { + return false; + } + + // detect SAM + smart_card_atr_t card; + smart_select(verbose, &card); + if (!card.atr_len) { + PrintAndLogEx(ERR, "Can't get ATR from a smart card"); + return false; + } + + // SAM identification + uint8_t sam_atr[] = {0x3B, 0x95, 0x96, 0x80, 0xB1, 0xFE, 0x55, 0x1F, 0xC7, 0x47, 0x72, 0x61, 0x63, 0x65, 0x13}; + if (memcmp(card.atr, sam_atr, card.atr_len) < 0) { + + uint8_t sam_atr2[] = {0x3b, 0x90, 0x96, 0x91, 0x81, 0xb1, 0xfe, 0x55, 0x1f, 0xc7, 0xd4}; + if (memcmp(card.atr, sam_atr2, card.atr_len) < 0) { + if (verbose) { + PrintAndLogEx(SUCCESS, "Not detecting a SAM"); + } + return false; + } + } + + // Suspect some SAMs has version name in their ATR + uint8_t T0 = card.atr[1]; + uint8_t K = T0 & 0x0F; + if (K > 4 && verbose) { + if (byte_strstr(card.atr, card.atr_len, (const uint8_t *)"Grace", 5) > -1) { + PrintAndLogEx(SUCCESS, "SAM (Grace) detected"); + } else if (byte_strstr(card.atr, card.atr_len, (const uint8_t *)"Hopper", 6) > -1) { + PrintAndLogEx(SUCCESS, "SAM (Hopper) detected"); + } + } + return true; +} + static bool executeCrypto(uint8_t ins, uint8_t *src, uint8_t *dest) { uint8_t cmd[] = {0x96, ins, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; memcpy(cmd + 5, src, 8); diff --git a/common/cardhelper.h b/common/cardhelper.h index 9574397a1..b88ff1e16 100644 --- a/common/cardhelper.h +++ b/common/cardhelper.h @@ -22,6 +22,7 @@ #include #include "common.h" +bool IsHIDSamPresent(bool verbose); bool IsCardHelperPresent(bool verbose); bool Encrypt(uint8_t *src, uint8_t *dest); bool Decrypt(uint8_t *src, uint8_t *dest); diff --git a/common/commonutil.c b/common/commonutil.c index 4af16b3c0..58e694d76 100644 --- a/common/commonutil.c +++ b/common/commonutil.c @@ -23,8 +23,8 @@ * verifies the magic properties, then stores a formatted string, prefixed by * prefix in dst. */ -void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info) { - struct version_information_t *v = (struct version_information_t *)version_info; +void FormatVersionInformation(char *dst, int len, const char *prefix, const void *version_info) { + const struct version_information_t *v = (const struct version_information_t *)version_info; dst[0] = 0; strncat(dst, prefix, len - 1); if (v->magic != VERSION_INFORMATION_MAGIC) { @@ -53,8 +53,8 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers strncat(dst, v->armsrc, len - strlen(dst) - 1); } -void format_version_information_short(char *dst, int len, void *version_info) { - struct version_information_t *v = (struct version_information_t *)version_info; +void format_version_information_short(char *dst, int len, const void *version_info) { + const struct version_information_t *v = (const struct version_information_t *)version_info; dst[0] = 0; if (v->magic != VERSION_INFORMATION_MAGIC) { strncat(dst, "Missing/Invalid version information", len - strlen(dst) - 1); @@ -151,7 +151,7 @@ void num_to_bytes(uint64_t n, size_t len, uint8_t *dest) { } } -uint64_t bytes_to_num(uint8_t *src, size_t len) { +uint64_t bytes_to_num(const uint8_t *src, size_t len) { uint64_t num = 0; while (len--) { num = (num << 8) | (*src); @@ -161,63 +161,255 @@ uint64_t bytes_to_num(uint8_t *src, size_t len) { } uint16_t MemLeToUint2byte(const uint8_t *data) { - return (data[1] << 8) + data[0]; + return (uint16_t)( + (((uint16_t)(data[1])) << (8 * 1)) + + (((uint16_t)(data[0])) << (8 * 0)) + ); } uint32_t MemLeToUint3byte(const uint8_t *data) { - return (data[2] << 16) + (data[1] << 8) + data[0]; + return (uint32_t)( + (((uint32_t)(data[2])) << (8 * 2)) + + (((uint32_t)(data[1])) << (8 * 1)) + + (((uint32_t)(data[0])) << (8 * 0)) + ); } uint32_t MemLeToUint4byte(const uint8_t *data) { - return (data[3] << 24) + (data[2] << 16) + (data[1] << 8) + data[0]; + return (uint32_t)( + (((uint32_t)(data[3])) << (8 * 3)) + + (((uint32_t)(data[2])) << (8 * 2)) + + (((uint32_t)(data[1])) << (8 * 1)) + + (((uint32_t)(data[0])) << (8 * 0)) + ); +} + +uint64_t MemLeToUint5byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[4])) << (8 * 4)) + + (((uint64_t)(data[3])) << (8 * 3)) + + (((uint64_t)(data[2])) << (8 * 2)) + + (((uint64_t)(data[1])) << (8 * 1)) + + (((uint64_t)(data[0])) << (8 * 0)) + ); +} + +uint64_t MemLeToUint6byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[5])) << (8 * 5)) + + (((uint64_t)(data[4])) << (8 * 4)) + + (((uint64_t)(data[3])) << (8 * 3)) + + (((uint64_t)(data[2])) << (8 * 2)) + + (((uint64_t)(data[1])) << (8 * 1)) + + (((uint64_t)(data[0])) << (8 * 0)) + ); +} + +uint64_t MemLeToUint7byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[6])) << (8 * 6)) + + (((uint64_t)(data[5])) << (8 * 5)) + + (((uint64_t)(data[4])) << (8 * 4)) + + (((uint64_t)(data[3])) << (8 * 3)) + + (((uint64_t)(data[2])) << (8 * 2)) + + (((uint64_t)(data[1])) << (8 * 1)) + + (((uint64_t)(data[0])) << (8 * 0)) + ); +} + +uint64_t MemLeToUint8byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[7])) << (8 * 7)) + + (((uint64_t)(data[6])) << (8 * 6)) + + (((uint64_t)(data[5])) << (8 * 5)) + + (((uint64_t)(data[4])) << (8 * 4)) + + (((uint64_t)(data[3])) << (8 * 3)) + + (((uint64_t)(data[2])) << (8 * 2)) + + (((uint64_t)(data[1])) << (8 * 1)) + + (((uint64_t)(data[0])) << (8 * 0)) + ); } uint16_t MemBeToUint2byte(const uint8_t *data) { - return (data[0] << 8) + data[1]; + return (uint16_t)( + (((uint16_t)(data[0])) << (8 * 1)) + + (((uint16_t)(data[1])) << (8 * 0)) + ); } uint32_t MemBeToUint3byte(const uint8_t *data) { - return (data[0] << 16) + (data[1] << 8) + data[2]; + return (uint32_t)( + (((uint32_t)(data[0])) << (8 * 2)) + + (((uint32_t)(data[1])) << (8 * 1)) + + (((uint32_t)(data[2])) << (8 * 0)) + ); } uint32_t MemBeToUint4byte(const uint8_t *data) { - return (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]; + return (uint32_t)( + (((uint32_t)(data[0])) << (8 * 3)) + + (((uint32_t)(data[1])) << (8 * 2)) + + (((uint32_t)(data[2])) << (8 * 1)) + + (((uint32_t)(data[3])) << (8 * 0)) + ); +} + +uint64_t MemBeToUint5byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[0])) << (8 * 4)) + + (((uint64_t)(data[1])) << (8 * 3)) + + (((uint64_t)(data[2])) << (8 * 2)) + + (((uint64_t)(data[3])) << (8 * 1)) + + (((uint64_t)(data[4])) << (8 * 0)) + ); +} + +uint64_t MemBeToUint6byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[0])) << (8 * 5)) + + (((uint64_t)(data[1])) << (8 * 4)) + + (((uint64_t)(data[2])) << (8 * 3)) + + (((uint64_t)(data[3])) << (8 * 2)) + + (((uint64_t)(data[4])) << (8 * 1)) + + (((uint64_t)(data[5])) << (8 * 0)) + ); +} + +uint64_t MemBeToUint7byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[0])) << (8 * 6)) + + (((uint64_t)(data[1])) << (8 * 5)) + + (((uint64_t)(data[2])) << (8 * 4)) + + (((uint64_t)(data[3])) << (8 * 3)) + + (((uint64_t)(data[4])) << (8 * 2)) + + (((uint64_t)(data[5])) << (8 * 1)) + + (((uint64_t)(data[6])) << (8 * 0)) + ); +} + +uint64_t MemBeToUint8byte(const uint8_t *data) { + return (uint64_t)( + (((uint64_t)(data[0])) << (8 * 7)) + + (((uint64_t)(data[1])) << (8 * 6)) + + (((uint64_t)(data[2])) << (8 * 5)) + + (((uint64_t)(data[3])) << (8 * 4)) + + (((uint64_t)(data[4])) << (8 * 3)) + + (((uint64_t)(data[5])) << (8 * 2)) + + (((uint64_t)(data[6])) << (8 * 1)) + + (((uint64_t)(data[7])) << (8 * 0)) + ); } void Uint2byteToMemLe(uint8_t *data, uint16_t value) { - data[1] = (value >> 8) & 0xff; - data[0] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); } void Uint3byteToMemLe(uint8_t *data, uint32_t value) { - data[2] = (value >> 16) & 0xff; - data[1] = (value >> 8) & 0xff; - data[0] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); } void Uint4byteToMemLe(uint8_t *data, uint32_t value) { - data[3] = (value >> 24) & 0xff; - data[2] = (value >> 16) & 0xff; - data[1] = (value >> 8) & 0xff; - data[0] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); +} + +void Uint5byteToMemLe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 4)) & 0xffu); +} + +void Uint6byteToMemLe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 5)) & 0xffu); +} + +void Uint7byteToMemLe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 5)) & 0xffu); + data[6] = (uint8_t)((value >> (8 * 6)) & 0xffu); +} + +void Uint8byteToMemLe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 0)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 5)) & 0xffu); + data[6] = (uint8_t)((value >> (8 * 6)) & 0xffu); + data[7] = (uint8_t)((value >> (8 * 7)) & 0xffu); } void Uint2byteToMemBe(uint8_t *data, uint16_t value) { - data[0] = (value >> 8) & 0xff; - data[1] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 0)) & 0xffu); } void Uint3byteToMemBe(uint8_t *data, uint32_t value) { - data[0] = (value >> 16) & 0xff; - data[1] = (value >> 8) & 0xff; - data[2] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 0)) & 0xffu); } void Uint4byteToMemBe(uint8_t *data, uint32_t value) { - data[0] = (value >> 24) & 0xff; - data[1] = (value >> 16) & 0xff; - data[2] = (value >> 8) & 0xff; - data[3] = value & 0xff; + data[0] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 0)) & 0xffu); +} + +void Uint5byteToMemBe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 0)) & 0xffu); +} + +void Uint6byteToMemBe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 5)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 0)) & 0xffu); +} + +void Uint7byteToMemBe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 6)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 5)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[6] = (uint8_t)((value >> (8 * 0)) & 0xffu); +} + +void Uint8byteToMemBe(uint8_t *data, uint64_t value) { + data[0] = (uint8_t)((value >> (8 * 7)) & 0xffu); + data[1] = (uint8_t)((value >> (8 * 6)) & 0xffu); + data[2] = (uint8_t)((value >> (8 * 5)) & 0xffu); + data[3] = (uint8_t)((value >> (8 * 4)) & 0xffu); + data[4] = (uint8_t)((value >> (8 * 3)) & 0xffu); + data[5] = (uint8_t)((value >> (8 * 2)) & 0xffu); + data[6] = (uint8_t)((value >> (8 * 1)) & 0xffu); + data[7] = (uint8_t)((value >> (8 * 0)) & 0xffu); } // RotateLeft - Ultralight, Desfire diff --git a/common/commonutil.h b/common/commonutil.h index 7beb95355..aef8240a6 100644 --- a/common/commonutil.h +++ b/common/commonutil.h @@ -50,8 +50,8 @@ #endif extern struct version_information_t g_version_information; -void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_info); -void format_version_information_short(char *dst, int len, void *version_info); +void FormatVersionInformation(char *dst, int len, const char *prefix, const void *version_info); +void format_version_information_short(char *dst, int len, const void *version_info); uint32_t reflect(uint32_t v, int b); // used in crc.c ... uint8_t reflect8(uint8_t b); // dedicated 8bit reversal @@ -59,21 +59,40 @@ uint16_t reflect16(uint16_t b); // dedicated 16bit reversal uint32_t reflect32(uint32_t b); // dedicated 32bit reversal void num_to_bytes(uint64_t n, size_t len, uint8_t *dest); -uint64_t bytes_to_num(uint8_t *src, size_t len); +uint64_t bytes_to_num(const uint8_t *src, size_t len); // LE and BE to/from memory uint16_t MemLeToUint2byte(const uint8_t *data); uint32_t MemLeToUint3byte(const uint8_t *data); uint32_t MemLeToUint4byte(const uint8_t *data); +uint64_t MemLeToUint5byte(const uint8_t *data); +uint64_t MemLeToUint6byte(const uint8_t *data); +uint64_t MemLeToUint7byte(const uint8_t *data); +uint64_t MemLeToUint8byte(const uint8_t *data); + uint16_t MemBeToUint2byte(const uint8_t *data); uint32_t MemBeToUint3byte(const uint8_t *data); uint32_t MemBeToUint4byte(const uint8_t *data); +uint64_t MemBeToUint5byte(const uint8_t *data); +uint64_t MemBeToUint6byte(const uint8_t *data); +uint64_t MemBeToUint7byte(const uint8_t *data); +uint64_t MemBeToUint8byte(const uint8_t *data); + void Uint2byteToMemLe(uint8_t *data, uint16_t value); void Uint3byteToMemLe(uint8_t *data, uint32_t value); void Uint4byteToMemLe(uint8_t *data, uint32_t value); +void Uint5byteToMemLe(uint8_t *data, uint64_t value); +void Uint6byteToMemLe(uint8_t *data, uint64_t value); +void Uint7byteToMemLe(uint8_t *data, uint64_t value); +void Uint8byteToMemLe(uint8_t *data, uint64_t value); + void Uint2byteToMemBe(uint8_t *data, uint16_t value); void Uint3byteToMemBe(uint8_t *data, uint32_t value); void Uint4byteToMemBe(uint8_t *data, uint32_t value); +void Uint5byteToMemBe(uint8_t *data, uint64_t value); +void Uint6byteToMemBe(uint8_t *data, uint64_t value); +void Uint7byteToMemBe(uint8_t *data, uint64_t value); +void Uint8byteToMemBe(uint8_t *data, uint64_t value); // rotate left byte array void rol(uint8_t *data, const size_t len); diff --git a/common/crapto1/readme b/common/crapto1/readme index d57fa3e08..3a979efad 100644 --- a/common/crapto1/readme +++ b/common/crapto1/readme @@ -3,10 +3,10 @@ CRAPTO1 Provides a set of library functions which aid the verification of crypto1 weaknesses. - In short a partial implementation of: + In short a partial implementation of: Dismantling MIFARE Classic URL: http://www.sos.cs.ru.nl/applications/rfid/2008-esorics.pdf - Flavio D. Garcia, Gerhard de Koning Gans, Ruben Muijrers, + Flavio D. Garcia, Gerhard de Koning Gans, Ruben Muijrers, Peter van Rossum, Roel Verdult, Ronny Wichers Schreur, Bart Jacobs Institute for Computing and Information Sciences, Radboud University Nijmegen, The Netherlands diff --git a/common/default_version_pm3.c b/common/default_version_pm3.c index 46eac57c9..d93a7ef15 100644 --- a/common/default_version_pm3.c +++ b/common/default_version_pm3.c @@ -26,5 +26,7 @@ const struct version_information_t SECTVERSINFO g_version_information = { 1, /* version 1 */ 0, /* version information not present */ 2, /* cleanliness couldn't be determined */ - /* Remaining fields: zero */ + "Iceman/master/unknown", + "1970-01-01 00:00:00", + "no sha256" }; diff --git a/common/generator.c b/common/generator.c index 7cf5498e1..20f8a0b5f 100644 --- a/common/generator.c +++ b/common/generator.c @@ -173,7 +173,7 @@ uint32_t ul_ev1_pwdgenD(const uint8_t *uid) { // AIR purifier Xiaomi uint32_t ul_ev1_pwdgenE(const uint8_t *uid) { - uint8_t hash[20]; + uint8_t hash[20] = {0}; mbedtls_sha1(uid, 7, hash); uint32_t pwd = 0; pwd |= (hash[ hash[0] % 20 ]) << 24 ; @@ -185,7 +185,7 @@ uint32_t ul_ev1_pwdgenE(const uint8_t *uid) { // NDEF tools format password generator uint32_t ul_ev1_pwdgenF(const uint8_t *uid) { - uint8_t hash[16]; + uint8_t hash[16] = {0};; mbedtls_md5(uid, 7, hash); uint32_t pwd = 0; pwd |= hash[0] << 24; @@ -549,7 +549,7 @@ int mfdes_kdf_input_gallagher(uint8_t *uid, uint8_t uidLen, uint8_t keyNo, uint3 int mfc_generate4b_nuid(uint8_t *uid, uint8_t *nuid) { uint16_t crc; - uint8_t b1, b2; + uint8_t b1 = 0, b2 = 0; compute_crc(CRC_14443_A, uid, 3, &b1, &b2); nuid[0] = (b2 & 0xE0) | 0xF; diff --git a/common/lfdemod.c b/common/lfdemod.c index 73b580a6b..9ed6f4e28 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -436,10 +436,10 @@ static size_t findModStart(const uint8_t *src, size_t size, uint8_t expWaveSize) } static int getClosestClock(int testclk) { - const uint16_t clocks[] = {8, 16, 32, 40, 50, 64, 100, 128, 256, 384}; - const uint8_t limit[] = {1, 2, 4, 4, 5, 8, 8, 8, 8, 8}; + const uint16_t clocks[] = {8, 16, 32, 40, 50, 64, 100, 128, 256, 272, 384}; + const uint8_t limit[] = {1, 2, 4, 4, 5, 8, 8, 8, 8, 24, 24}; - for (uint8_t i = 0; i < 10; i++) { + for (uint8_t i = 0; i < ARRAYLEN(clocks); i++) { if (testclk >= clocks[i] - limit[i] && testclk <= clocks[i] + limit[i]) return clocks[i]; } @@ -613,7 +613,7 @@ bool DetectCleanAskWave(const uint8_t *dest, size_t size, uint8_t high, uint8_t // based on count of low to low int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clock) { size_t i = 100; - size_t minClk = 512; + size_t minClk = 768; uint16_t shortestWaveIdx = 0; // get to first full low to prime loop and skip incomplete first pulse @@ -622,11 +622,11 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo if (i == size) return -1; - if (size < 512) + if (size < 768) return -2; // clock, numoftimes, first idx - uint16_t tmpclk[10][3] = { + uint16_t tmpclk[11][3] = { {8, 0, 0}, {16, 0, 0}, {32, 0, 0}, @@ -636,11 +636,12 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo {100, 0, 0}, {128, 0, 0}, {256, 0, 0}, + {272, 0, 0}, {384, 0, 0}, }; // loop through all samples (well, we don't want to go out-of-bounds) - while (i < (size - 512)) { + while (i < (size - 768)) { // measure from low to low size_t startwave = i; @@ -655,7 +656,7 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo int foo = getClosestClock(minClk); if (foo > 0) { - for (uint8_t j = 0; j < 10; j++) { + for (uint8_t j = 0; j < 11; j++) { if (tmpclk[j][0] == foo) { tmpclk[j][1]++; @@ -669,8 +670,17 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo } // find the clock with most hits and it the first index it was encountered. + int possible_clks = 0; + for (uint8_t j = 0; j < 11; j++) { + if (tmpclk[j][1] > 0) { + possible_clks++; + } + } + + uint16_t second_shortest = 0; + int second = 0; int max = 0; - for (uint8_t j = 0; j < 10; j++) { + for (int j = 10; j > -1; j--) { if (g_debugMode == 2) { prnt("DEBUG, ASK, clocks %u | hits %u | idx %u" , tmpclk[j][0] @@ -678,13 +688,23 @@ int DetectStrongAskClock(uint8_t *dest, size_t size, int high, int low, int *clo , tmpclk[j][2] ); } + if (max < tmpclk[j][1]) { + second = *clock; + second_shortest = shortestWaveIdx; + *clock = tmpclk[j][0]; shortestWaveIdx = tmpclk[j][2]; max = tmpclk[j][1]; } } + // ASK clock 8 is very rare and usually gives us false positives + if (possible_clks > 1 && *clock == 8) { + *clock = second; + shortestWaveIdx = second_shortest; + } + if (*clock == 0) return -1; @@ -712,9 +732,9 @@ int DetectASKClock(uint8_t *dest, size_t size, int *clock, int maxErr) { } size_t i = 1; - uint8_t num_clks = 9; + uint8_t num_clks = 10; // first 255 value pos0 is placeholder for user inputed clock. - uint16_t clk[] = {255, 8, 16, 32, 40, 50, 64, 100, 128, 255}; + uint16_t clk[] = {255, 8, 16, 32, 40, 50, 64, 100, 128, 255, 272}; // sometimes there is a strange end wave - filter out this size -= 60; @@ -755,8 +775,8 @@ int DetectASKClock(uint8_t *dest, size_t size, int *clock, int maxErr) { uint8_t clkCnt, tol; size_t j = 0; - uint16_t bestErr[] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}; - uint8_t bestStart[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + uint16_t bestErr[] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}; + uint8_t bestStart[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; size_t errCnt, arrLoc, loopEnd; if (found_clk) { @@ -895,11 +915,11 @@ int DetectStrongNRZClk(const uint8_t *dest, size_t size, int peak, int low, bool // detect nrz clock by reading #peaks vs no peaks(or errors) int DetectNRZClock(uint8_t *dest, size_t size, int clock, size_t *clockStartIdx) { size_t i = 0; - uint8_t clk[] = {8, 16, 32, 40, 50, 64, 100, 128, 255}; + uint16_t clk[] = {8, 16, 32, 40, 50, 64, 100, 128, 255, 272, 384}; size_t loopCnt = 4096; //don't need to loop through entire array... //if we already have a valid clock quit - for (; i < 8; ++i) + for (; i < ARRAYLEN(clk); ++i) if (clk[i] == clock) return clock; if (size < 20) return 0; @@ -926,7 +946,7 @@ int DetectNRZClock(uint8_t *dest, size_t size, int clock, size_t *clockStartIdx) uint8_t tol = 0; uint16_t smplCnt = 0; int16_t peakcnt = 0; - int16_t peaksdet[] = {0, 0, 0, 0, 0, 0, 0, 0}; + int16_t peaksdet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; uint16_t minPeak = 255; bool firstpeak = true; //test for large clipped waves - ignore first peak @@ -949,10 +969,10 @@ int DetectNRZClock(uint8_t *dest, size_t size, int clock, size_t *clockStartIdx) bool errBitHigh = 0, bitHigh = 0, lastPeakHigh = 0; uint8_t ignoreCnt = 0, ignoreWindow = 4; int lastBit = 0; - size_t bestStart[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + size_t bestStart[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; peakcnt = 0; //test each valid clock from smallest to greatest to see which lines up - for (clkCnt = 0; clkCnt < 8; ++clkCnt) { + for (clkCnt = 0; clkCnt < ARRAYLEN(bestStart); ++clkCnt) { //ignore clocks smaller than smallest peak if (clk[clkCnt] < minPeak - (clk[clkCnt] / 4)) continue; //try lining up the peaks by moving starting point (try first 256) @@ -1005,7 +1025,7 @@ int DetectNRZClock(uint8_t *dest, size_t size, int clock, size_t *clockStartIdx) } uint8_t best = 0; - for (int m = 7; m > 0; m--) { + for (int m = ARRAYLEN(peaksdet) - 1; m >= 0; m--) { if ((peaksdet[m] >= (peaksdet[best] - 1)) && (peaksdet[m] <= peaksdet[best] + 1) && lowestTransition) { if (clk[m] > (lowestTransition - (clk[m] / 8)) && clk[m] < (lowestTransition + (clk[m] / 8))) { best = m; @@ -1098,10 +1118,12 @@ uint16_t countFC(const uint8_t *bits, size_t size, bool fskAdj) { fcH = fcLens[best2]; fcL = fcLens[best1]; } + /* if ((size - 180) / fcH / 3 > fcCnts[best1] + fcCnts[best2]) { if (g_debugMode == 2) prnt("DEBUG countfc: fc is too large: %zu > %u. Not psk or fsk", (size - 180) / fcH / 3, fcCnts[best1] + fcCnts[best2]); return 0; //lots of waves not psk or fsk } + */ // TODO: take top 3 answers and compare to known Field clocks to get top 2 uint16_t fcs = (((uint16_t)fcH) << 8) | fcL; @@ -1112,8 +1134,8 @@ uint16_t countFC(const uint8_t *bits, size_t size, bool fskAdj) { // detect psk clock by reading each phase shift // a phase shift is determined by measuring the sample length of each wave int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShift, uint8_t *curPhase, uint8_t *fc) { - uint8_t clk[] = {255, 16, 32, 40, 50, 64, 100, 128, 255}; //255 is not a valid clock - uint16_t loopCnt = 4096; //don't need to loop through entire array... + uint16_t clk[] = {255, 16, 32, 40, 50, 64, 100, 128, 256, 272, 384}; // 255 is not a valid clock + uint16_t loopCnt = 4096; // don't need to loop through entire array... if (size < 160 + 20) return 0; // size must be larger than 20 here, and 160 later on. @@ -1134,8 +1156,8 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif uint8_t clkCnt; uint16_t waveLenCnt, fullWaveLen = 0; - uint16_t bestErr[] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}; - uint16_t peaksdet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + uint16_t bestErr[] = {1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000}; + uint16_t peaksdet[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //find start of modulating data in trace size_t i = findModStart(dest, size, *fc); @@ -1157,7 +1179,7 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif } //test each valid clock from greatest to smallest to see which lines up - for (clkCnt = 7; clkCnt >= 1 ; clkCnt--) { + for (clkCnt = 9; clkCnt >= 1 ; clkCnt--) { uint8_t tol = *fc / 2; size_t lastClkBit = firstFullWave; //set end of wave as clock align size_t waveStart = 0; @@ -1197,8 +1219,8 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif } //all tested with errors //return the highest clk with the most peaks found - uint8_t best = 7; - for (i = 7; i >= 1; i--) { + uint8_t best = 9; + for (i = 9; i >= 1; i--) { if (peaksdet[i] > peaksdet[best]) best = i; diff --git a/common_arm/Makefile.hal b/common_arm/Makefile.hal index 9679382ce..f9d7d2fe4 100644 --- a/common_arm/Makefile.hal +++ b/common_arm/Makefile.hal @@ -48,7 +48,9 @@ Known definitions: endef define HELP_DEFINITIONS + Options to define platform, platform extras and/or standalone mode: + (1) Run make with your PLATFORM, PLATFORM_EXTRAS and/or STANDALONE choices as follows: make PLATFORM=PM3GENERIC STANDALONE=$(HELP_EXAMPLE_STANDALONE) @@ -65,6 +67,7 @@ STANDALONE= For Proxmarks with only 256k, you can define PLATFORM_SIZE=256 + to be warned if the image is too big for your device and you can specify which parts to skip in order to reduce the size: SKIP_LF=1 @@ -80,6 +83,7 @@ SKIP_NFCBARCODE=1 SKIP_HFSNIFF=1 SKIP_HFPLOT=1 SKIP_ZX8211=1 + endef define KNOWN_DEFINITIONS diff --git a/common_arm/flashmem.c b/common_arm/flashmem.c index 94dcf1fd3..f4dde74a0 100644 --- a/common_arm/flashmem.c +++ b/common_arm/flashmem.c @@ -402,7 +402,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" Mifare.................. "_YELLOW_("%d")" / "_GREEN_("%d")" keys", num, DEFAULT_MF_KEYS_MAX); + Dbprintf(" Mifare.................. "_YELLOW_("%u")" / "_GREEN_("%u")" keys", num, DEFAULT_MF_KEYS_MAX); } Flash_CheckBusy(BUSY_TIMEOUT); @@ -410,7 +410,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" T55x7................... "_YELLOW_("%d")" / "_GREEN_("%d")" keys", num, DEFAULT_T55XX_KEYS_MAX); + Dbprintf(" T55x7................... "_YELLOW_("%u")" / "_GREEN_("%u")" keys", num, DEFAULT_T55XX_KEYS_MAX); } Flash_CheckBusy(BUSY_TIMEOUT); @@ -418,7 +418,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" iClass.................. "_YELLOW_("%d")" / "_GREEN_("%d")" keys", num, DEFAULT_ICLASS_KEYS_MAX); + Dbprintf(" iClass.................. "_YELLOW_("%u")" / "_GREEN_("%u")" keys", num, DEFAULT_ICLASS_KEYS_MAX); } FlashStop(); diff --git a/common_fpga/fpga.h b/common_fpga/fpga.h index b7e017d68..35143ec6f 100644 --- a/common_fpga/fpga.h +++ b/common_fpga/fpga.h @@ -23,9 +23,11 @@ #define FPGA_BITSTREAM_FIXED_HEADER_SIZE sizeof(bitparse_fixed_header) #define FPGA_INTERLEAVE_SIZE 288 #if defined XC3 -#define FPGA_CONFIG_SIZE 72864L // our current fpga_[lh]f.bit files are 72742 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE +#define FPGA_TYPE "3s100evq100" +#define FPGA_CONFIG_SIZE 72864L // FPGA .bit file rounded up to next multiple of FPGA_INTERLEAVE_SIZE #else -#define FPGA_CONFIG_SIZE 42336L // our current fpga_[lh]f.bit files are 42175 bytes. Rounded up to next multiple of FPGA_INTERLEAVE_SIZE +#define FPGA_TYPE "2s30vq100" +#define FPGA_CONFIG_SIZE 42336L // FPGA .bit file rounded up to next multiple of FPGA_INTERLEAVE_SIZE #endif #define FPGA_RING_BUFFER_BYTES (1024 * 30) #define FPGA_TRACE_SIZE 3072 diff --git a/doc/T5577_Guide.md b/doc/T5577_Guide.md index 6c4eceaf5..ded308676 100644 --- a/doc/T5577_Guide.md +++ b/doc/T5577_Guide.md @@ -142,7 +142,7 @@ developers have done a great job and gave us commands. What we need to know is that with the T5577, data is read/written one complete block at a time. Each block holds 32 bits of data (hence the binary output shown) -Since we know that the card has data and configuration blocks, lets say +Since we know that the card has data and configuration blocks, lets stay away from those while we learn how to read and write. I suggest you follow along and perform each command and check the results as we go. diff --git a/doc/cheatsheet.md b/doc/cheatsheet.md index 22e47b3f1..a859f4392 100644 --- a/doc/cheatsheet.md +++ b/doc/cheatsheet.md @@ -514,24 +514,22 @@ Read Hitag information pm3 --> lf hitag info ``` -Act as Hitag reader +Read Hitag memory +Crypto mode key format: ISK high + ISK low ``` Options --- - --01 HitagS, read all pages, challenge mode - --02 HitagS, read all pages, crypto mode. Set key=0 for no auth - - --21 Hitag2, read all pages, password mode. def 4D494B52 (MIKR) - --22 Hitag2, read all pages, challenge mode - --23 Hitag2, read all pages, crypto mode. Key ISK high + ISK low. def 4F4E4D494B52 (ONMIKR) - --25 Hitag2, test recorded authentications (replay?) - --26 Hitag2, read UID --k, --key key, 4 or 6 hex bytes - --nrar nonce / answer reader, 8 hex bytes + -h, --help This help + -s, --hts Hitag S + -2, --ht2 Hitag 2 + --pwd password mode + --nrar nonce / answer writer, 8 hex bytes + --crypto crypto mode + -k, --key key, 4 or 6 hex bytes -pm3 --> lf hitag --26 -pm3 --> lf hitag --21 -k 4D494B52 -pm3 --> lf hitag reader --23 -k 4F4E4D494B52 +pm3 --> lf hitag read --ht2 +pm3 --> lf hitag read --ht2 -k 4D494B52 +pm3 --> lf hitag read --ht2 -k 4F4E4D494B52 ``` Sniff Hitag traffic @@ -545,26 +543,27 @@ Simulate Hitag2 pm3 --> lf hitag sim -2 ``` -Write to Hitag block +Write a page in Hitag memory +Crypto mode key format: ISK high + ISK low ``` Options --- - --03 HitagS, write page, challenge mode - --04 HitagS, write page, crypto mode. Set key=0 for no auth + -h, --help This help + -s, --hts Hitag S + -2, --ht2 Hitag 2 + --pwd password mode + --nrar nonce / answer writer, 8 hex bytes + --crypto crypto mode + -k, --key key, 4 or 6 hex bytes + -p, --page page address to write to + -d, --data data, 4 hex bytes - --24 Hitag2, write page, crypto mode. - --27 Hitag2, write page, password mode --p, --page page address to write to --d, --data data, 4 hex bytes --k, --key key, 4 or 6 hex bytes - --nrar nonce / answer writer, 8 hex bytes - -pm3 --> lf hitag writer --24 -k 499602D2 -p 1 -d 00000000 +pm3 --> lf hitag wrbl --ht2 -k 499602D2 -p 1 -d 00000000 ``` Simulate Hitag2 sequence ``` -pm3 --> lf hitag reader --21 -k 56713368 +pm3 --> lf hitag read --ht2 -k 56713368 pm3 --> lf hitag sim -2 ``` diff --git a/doc/clocks.md b/doc/clocks.md index 161d680fb..9e0384d23 100644 --- a/doc/clocks.md +++ b/doc/clocks.md @@ -7,6 +7,7 @@ The device side firmware uses a range of different clocks. Here is an attempt t # Table of Contents - [Notes on device side clocks](#notes-on-device-side-clocks) - [Table of Contents](#table-of-contents) + - [Units](#units) - [Slow clock](#slow-clock) - [Main Oscillator / MAINCK](#main-oscillator--mainck) - [PLL clock](#pll-clock) @@ -15,9 +16,48 @@ The device side firmware uses a range of different clocks. Here is an attempt t - [1 kHz RTC: TickCount functions](#1-khz-rtc-tickcount-functions) - [Occasional PWM timer](#occasional-pwm-timer) - [Occasional TC0+TC1 / CountUS functions](#occasional-tc0tc1--countus-functions) - - [Occasional TC0+TC1+TC2 SSP_CLK from FPGA / CountSspClk functions](#occasional-tc0tc1tc2-ssp_clk-from-fpga--countsspclk-functions) + - [Occasional TC0+TC1+TC2 SSP\_CLK from FPGA / CountSspClk functions](#occasional-tc0tc1tc2-ssp_clk-from-fpga--countsspclk-functions) - [Occasional TC0+TC1 / Ticks functions](#occasional-tc0tc1--ticks-functions) + +## Units +^[Top](#top) + +Good calculator +https://www.unitjuggler.com/convert-frequency-from-MHz-to-ns(p).html?val=3.39 + +Basic units of time measurment or how long in time is a Hertz? + +``` +1 hertz = 1 second = 1000 milli seconds +10 Hertz = 1 / 10 = 0,1 = 100 milli seconds +100 Hertz = 1 / 100 = 0,01 = 10 milli seconds +1 kHz = 1 / 1000 = 0,001 = 1 milli seconds +10 kHz = 1 / 10 000 = 0,000 1 = 100 micro seconds +100 kHz = 1 / 100 000 = 0,000 01 = 10 micro seconds +1 MHZ = 1 / 1 000 000 = 0,000 001 = 1 micro seconds +``` + +- kHz, Kilo Hertz, 1000 Hertz +- MHz, Mega Hertz, 1000 000 Hertz + + +Basic units of time you will run into in the RFID world. + +``` +13.56 MHz = 1 / 13 560 000 = 73,74 nano seconds = 0,07374 micro seconds +125 kHz = 1/ 125 000 = 8 micro seconds +``` + +Given these units the following clocks used by Proxmark3 will make more sense. + +Like the SSP Clock running at 3.39 MHz. +3.39 MHz = 1 / 3 390 000 = 294,98 nano seconds = 0,2949 micro seconds + +1 tick at 3.39 MHz is 294.98 nano seconds. + + + ## Slow clock ^[Top](#top) diff --git a/doc/colors_notes.md b/doc/colors_notes.md index dac993585..b25a7d7c9 100644 --- a/doc/colors_notes.md +++ b/doc/colors_notes.md @@ -43,7 +43,6 @@ The following definition has be crystallized out from these experiments. Its no ``` PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); - PrintAndLogEx(INFO, "-------------------------------------------------------------"); ``` For more examples, see also all **-h** helptext now in the LUA scripts. For the command help texts using _YELLOW_ for the example makes it very easy to see what is the command vs the description. diff --git a/doc/commands.json b/doc/commands.json index d4cbf628a..55da69cd3 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -140,15 +140,17 @@ "command": "analyse units", "description": "experiments of unit conversions found in HF. ETU (1/13.56mhz), US or SSP_CLK (1/3.39MHz)", "notes": [ - "analyse uints --etu 10analyse uints --us 100" + "analyse uints --etu 10", + "analyse uints --us 100" ], "offline": true, "options": [ "-h, --help This help", "--etu number in ETU", - "--us number in micro seconds (us)" + "--us number in micro seconds (us)", + "-t, --selftest self tests" ], - "usage": "analyse units [-h] [--etu ] [--us ]" + "usage": "analyse units [-ht] [--etu ] [--us ]" }, "auto": { "command": "auto", @@ -197,11 +199,25 @@ "data asn1 -d 303381050186922305a5020500a6088101010403030008a7188516eeee4facacf4fbde5e5c49d95e55bfbca74267b02407a9020500" ], "offline": true, + "options": [ + "-h, --help This help", + "-d ASN1 encoded byte array", + "-t, --test perform selftest" + ], + "usage": "data asn1 [-ht] [-d ]" + }, + "data atr": { + "command": "data atr", + "description": "look up ATR record from bytearray", + "notes": [ + "data atr -d 3B6B00000031C064BE1B0100079000" + ], + "offline": true, "options": [ "-h, --help This help", "-d ASN1 encoded byte array" ], - "usage": "data asn1 [-h] -d " + "usage": "data atr [-h] [-d ]" }, "data autocorr": { "command": "data autocorr", @@ -283,6 +299,20 @@ ], "usage": "data convertbitstream [-h]" }, + "data cthreshold": { + "command": "data cthreshold", + "description": "Inverse of dirty threshold command, all values between up and down will be average out", + "notes": [ + "data cthreshold -u 10 -d -10" + ], + "offline": true, + "options": [ + "-h, --help This help", + "-d, --down threshold down", + "-u, --up threshold up" + ], + "usage": "data cthreshold [-h] -d -u " + }, "data decimate": { "command": "data decimate", "description": "Performs decimation, by reducing samples N times in the grapbuf. Good for PSK", @@ -301,20 +331,18 @@ "command": "data detectclock", "description": "Detect ASK, FSK, NRZ, PSK clock rate of wave in GraphBuffer", "notes": [ - "data detectclock -A -> detect clock of an ask wave in GraphBuffer", - "data detectclock -F -> detect clock of an fsk wave in GraphBuffer", - "data detectclock -N -> detect clock of an psk wave in GraphBuffer", - "data detectclock -P -> detect clock of an nrz/direct wave in GraphBuffer" + "data detectclock --ask", + "data detectclock --nzr -> detect clock of an nrz/direct wave in GraphBuffer" ], "offline": true, "options": [ "-h, --help This help", - "-A, --ASK specify ASK modulation clock detection", - "-F, --FSK specify FSK modulation clock detection", - "-N, --NZR specify NZR/DIRECT modulation clock detection", - "-P, --PSK specify PSK modulation clock detection" + "--ask specify ASK modulation clock detection", + "--fsk specify FSK modulation clock detection", + "--nzr specify NZR/DIRECT modulation clock detection", + "--psk specify PSK modulation clock detection" ], - "usage": "data detectclock [-hAFNP]" + "usage": "data detectclock [-h] [--ask] [--fsk] [--nzr] [--psk]" }, "data diff": { "command": "data diff", @@ -352,6 +380,18 @@ ], "usage": "data dirthreshold [-h] -d -u " }, + "data envelope": { + "command": "data envelope", + "description": "Create an square envelop of the samples", + "notes": [ + "data envelop" + ], + "offline": true, + "options": [ + "-h, --help This help" + ], + "usage": "data envelop [-h]" + }, "data fsktonrz": { "command": "data fsktonrz", "description": "Convert fsk2 to nrz wave for alternate fsk demodulating (for weak fsk) Omitted values are autodetect instead", @@ -901,18 +941,20 @@ }, "emv reader": { "command": "emv reader", - "description": "Act as a EMV reader to identify tag. Look for EMV tags until Enter or the pm3 button is pressed", + "description": "Act as a EMV reader to identify tag. Look for EMV tags until Enter or the pm3 button is pressed In `verbose` mode it will also try to extract and decode the transaction logs stored on card in either channel.", "notes": [ "emv reader", + "emv reader -v", "emv reader -@ -> Continuous mode" ], "offline": false, "options": [ "-h, --help This help", "-w, --wired Send data via contact (iso7816) interface. (def: Contactless interface)", + "-v, --verbose verbose", "-@ continuous reader mode" ], - "usage": "emv reader [-hw@]" + "usage": "emv reader [-hwv@]" }, "emv readrec": { "command": "emv readrec", @@ -1143,7 +1185,7 @@ }, "hf 14a list": { "command": "hf 14a list", - "description": "Alias of `trace list -t 14a` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t 14a -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf 14a list --frame -> show frame delay times", "hf 14a list -1 -> use trace buffer" @@ -1270,19 +1312,21 @@ "hf 14a sim -t 7 -> MFU EV1 / NTAG 215 Amiibo", "hf 14a sim -t 8 -> MIFARE Classic 4k", "hf 14a sim -t 9 -> FM11RF005SH Shanghai Metro", - "hf 14a sim -t 10 -> ST25TA IKEA Rothult" + "hf 14a sim -t 10 -> ST25TA IKEA Rothult", + "hf 14a sim -t 11 -> Javacard (JCOP)", + "hf 14a sim -t 12 -> 4K Seos card" ], "offline": false, "options": [ "-h, --help This help", - "-t, --type <1-10> Simulation type to use", + "-t, --type <1-12> Simulation type to use", "-u, --uid <4|7|10> hex bytes UID", "-n, --num Exit simulation after blocks have been read by reader. 0 = infinite", "-x Performs the 'reader attack', nr/ar attack against a reader", "--sk Fill simulator keys from found keys", "-v, --verbose verbose output" ], - "usage": "hf 14a sim [-hxv] -t <1-10> [-u ] [-n ] [--sk]" + "usage": "hf 14a sim [-hxv] -t <1-12> [-u ] [-n ] [--sk]" }, "hf 14a sniff": { "command": "hf 14a sniff", @@ -1866,6 +1910,19 @@ ], "usage": "hf 15 sniff [-h]" }, + "hf 15 view": { + "command": "hf 15 view", + "description": "Print a ISO-15693 tag dump file (bin/eml/json)", + "notes": [ + "hf 15 view -f hf-iclass-AA162D30F8FF12F1-dump.bin" + ], + "offline": true, + "options": [ + "-h, --help This help", + "-f, --file filename of dump (bin/eml/json)" + ], + "usage": "hf 15 view [-h] -f " + }, "hf 15 wrbl": { "command": "hf 15 wrbl", "description": "Write block on ISO-15693 tag", @@ -2653,8 +2710,8 @@ "hf fido auth --kh 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f -> execute command with 2 parameters, filled 0x00 and key handle", "hf fido auth", "--kh 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f", - "--cp 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f", - "--ap 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f -> execute command with parameters" + "--cpx 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f", + "--apx 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f -> execute command with parameters" ], "offline": false, "options": [ @@ -2972,6 +3029,26 @@ ], "usage": "hf iclass configcard [-hglp] [--ci ] [--ki ]" }, + "hf iclass creditepurse": { + "command": "hf iclass creditepurse", + "description": "Credit the epurse on an iCLASS tag. The provided key must be the credit key. The first two bytes of the epurse are the debit value (big endian) and may be any value except FFFF. The remaining two bytes of the epurse are the credit value and must be smaller than the previous value.", + "notes": [ + "hf iclass creditepurse -d FEFFFFFF -k 001122334455667B", + "hf iclass creditepurse -d FEFFFFFF --ki 0" + ], + "offline": false, + "options": [ + "-h, --help This help", + "-k, --key Credit key as 8 hex bytes", + "--ki Key index to select key from memory 'hf iclass managekeys'", + "-d, --data data to write as 8 hex bytes", + "--elite elite computations applied to key", + "--raw no computations applied to key", + "-v, --verbose verbose output", + "--shallow use shallow (ASK) reader modulation instead of OOK" + ], + "usage": "hf iclass creditepurse [-hv] [-k ] [--ki ] -d [--elite] [--raw] [--shallow]" + }, "hf iclass decrypt": { "command": "hf iclass decrypt", "description": "3DES decrypt data This is a naive implementation, it tries to decrypt every block after block 6. Correct behaviour would be to decrypt only the application areas where the key is valid, which is defined by the configuration block. OBS! In order to use this function, the file `iclass_decryptionkey.bin` must reside in the resources directory. The file should be 16 bytes binary data or... make sure your cardhelper is placed in the sim module", @@ -3030,9 +3107,10 @@ "options": [ "-h, --help This help", "-f, --file filename of dump (bin/eml/json)", - "-m, --mem use RDV4 spiffs" + "-m, --mem use RDV4 spiffs", + "-v, --verbose verbose output" ], - "usage": "hf iclass eload [-hm] -f " + "usage": "hf iclass eload [-hmv] -f " }, "hf iclass encode": { "command": "hf iclass encode", @@ -3091,6 +3169,20 @@ ], "usage": "hf iclass esave [-h] [-f ] [-s <256|2048>]" }, + "hf iclass esetblk": { + "command": "hf iclass esetblk", + "description": "Sets an individual block in emulator memory.", + "notes": [ + "hf iclass esetblk -b 7 -d 0000000000000000" + ], + "offline": false, + "options": [ + "-h, --help This help", + "-b, --blk block number", + "-d, --data bytes to write, 8 hex bytes" + ], + "usage": "hf iclass esetblk [-h] -b [-d ]" + }, "hf iclass eview": { "command": "hf iclass eview", "description": "Display emulator memory. Number of bytes to download defaults to 256. Other value is 2048.", @@ -3123,7 +3215,7 @@ }, "hf iclass list": { "command": "hf iclass list", - "description": "Alias of `trace list -t iclass` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t iclass -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf iclass list --frame -> show frame delay times", "hf iclass list -1 -> use trace buffer" @@ -3274,6 +3366,20 @@ ], "usage": "hf iclass restore [-hv] -f [-k ] [--ki ] --first --last [--credit] [--elite] [--raw] [--shallow]" }, + "hf iclass sam": { + "command": "hf iclass sam", + "description": "Manage via SAM", + "notes": [ + "hf iclass sam" + ], + "offline": false, + "options": [ + "-h, --help This help", + "-d, --data data", + "-v, --verbose verbose output" + ], + "usage": "hf iclass sam [-hv] [-d ]" + }, "hf iclass sim": { "command": "hf iclass sim", "description": "Simulate a iCLASS legacy/standard tag", @@ -3311,13 +3417,16 @@ "description": "Print a iCLASS tag dump file (bin/eml/json)", "notes": [ "hf iclass view -f hf-iclass-AA162D30F8FF12F1-dump.bin", - "hf iclass view --first 1 -f hf-iclass-AA162D30F8FF12F1-dump.bin" + "hf iclass view --first 1 -f hf-iclass-AA162D30F8FF12F1-dump.bin", + "", + "If --first is not specified it will default to the first user block", + "which is block 6 for secured chips or block 3 for non-secured chips" ], "offline": true, "options": [ "-h, --help This help", "-f, --file filename of dump (bin/eml/json)", - "--first Begin printing from this block (default block 6)", + "--first Begin printing from this block (default first user block)", "--last End printing at this block (default 0, ALL)", "-v, --verbose verbose output", "-z, --dense dense dump output style" @@ -3532,13 +3641,17 @@ "command": "hf legic einfo", "description": "It decodes and displays emulator memory", "notes": [ - "hf legic einfo" + "hf legic einfo", + "hf legic eview --22" ], "offline": false, "options": [ - "-h, --help This help" + "-h, --help This help", + "--22 LEGIC Prime MIM22", + "--256 LEGIC Prime MIM256 (def)", + "--1024 LEGIC Prime MIM1024" ], - "usage": "hf legic einfo [-h]" + "usage": "hf legic einfo [-h] [--22] [--256] [--1024]" }, "hf legic eload": { "command": "hf legic eload", @@ -3586,9 +3699,10 @@ "-h, --help This help", "--22 LEGIC Prime MIM22", "--256 LEGIC Prime MIM256 (def)", - "--1024 LEGIC Prime MIM1024" + "--1024 LEGIC Prime MIM1024", + "-v, --verbose verbose output" ], - "usage": "hf legic eview [-h] [--22] [--256] [--1024]" + "usage": "hf legic eview [-hv] [--22] [--256] [--1024]" }, "hf legic info": { "command": "hf legic info", @@ -3598,9 +3712,10 @@ ], "offline": false, "options": [ - "-h, --help This help" + "-h, --help This help", + "-v, --verbose verbose output" ], - "usage": "hf legic info [-h]" + "usage": "hf legic info [-hv]" }, "hf legic list": { "command": "hf legic list", @@ -3692,9 +3807,10 @@ "offline": true, "options": [ "-h, --help This help", - "-f, --file Filename of dump" + "-f, --file Filename of dump", + "-v, --verbose verbose output" ], - "usage": "hf legic view [-h] -f " + "usage": "hf legic view [-hv] -f " }, "hf legic wipe": { "command": "hf legic wipe", @@ -3772,7 +3888,7 @@ }, "hf lto list": { "command": "hf lto list", - "description": "Alias of `trace list -t lto` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t lto -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf lto list --frame -> show frame delay times", "hf lto list -1 -> use trace buffer" @@ -4218,9 +4334,10 @@ "--4k MIFARE Classic 4k / S70", "--ul MIFARE Ultralight family", "-m, --mem use RDV4 spiffs", - "-q, --qty manually set number of blocks (overrides)" + "-q, --qty manually set number of blocks (overrides)", + "-v, --verbose verbose output" ], - "usage": "hf mf eload [-hm] -f [--mini] [--1k] [--2k] [--4k] [--ul] [-q ]" + "usage": "hf mf eload [-hmv] -f [--mini] [--1k] [--2k] [--4k] [--ul] [-q ]" }, "hf mf esave": { "command": "hf mf esave", @@ -4325,13 +4442,11 @@ "options": [ "-h, --help This help", "--blk block number", - "-a input key type is key A (def)", - "-b input key type is key B", "-d, --data bytes to write, 16 hex bytes", "-k, --key key, 6 hex bytes", "--force override warnings" ], - "usage": "hf mf gdmsetblk [-hab] --blk [-d ] [-k ] [--force]" + "usage": "hf mf gdmsetblk [-h] --blk [-d ] [-k ] [--force]" }, "hf mf gdmsetcfg": { "command": "hf mf gdmsetcfg", @@ -4528,7 +4643,7 @@ }, "hf mf list": { "command": "hf mf list", - "description": "Alias of `trace list -t mf` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t mf -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf mf list --frame -> show frame delay times", "hf mf list -1 -> use trace buffer" @@ -4804,7 +4919,7 @@ }, "hf mf staticnested": { "command": "hf mf staticnested", - "description": "Execute Nested attack against MIFARE Classic card with static nonce for key recovery. Supply a known key from one block to recover all keys", + "description": "Execute static nested attack against MIFARE Classic card with static nonce for key recovery. Supply a known key from one block to recover all keys", "notes": [ "hf mf staticnested --mini --blk 0 -a -k FFFFFFFFFFFF", "hf mf staticnested --1k --blk 0 -a -k FFFFFFFFFFFF", @@ -5740,7 +5855,7 @@ }, "hf mfdes list": { "command": "hf mfdes list", - "description": "Alias of `trace list -t des` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t des -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf mfdes list --frame -> show frame delay times", "hf mfdes list -1 -> use trace buffer" @@ -6153,10 +6268,10 @@ }, "hf mfp list": { "command": "hf mfp list", - "description": "Alias of `trace list -t mf` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t mfp -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ - "hf mf list --frame -> show frame delay times", - "hf mf list -1 -> use trace buffer" + "hf mfp list --frame -> show frame delay times", + "hf mfp list -1 -> use trace buffer" ], "offline": true, "options": [ @@ -6170,7 +6285,7 @@ "or to import into Wireshark using encapsulation type \"ISO 14443\"", "-f, --file filename of dictionary" ], - "usage": "hf mf list [-h1crux] [--frame] [-f ]" + "usage": "hf mfp list [-h1crux] [--frame] [-f ]" }, "hf mfp mad": { "command": "hf mfp mad", @@ -6363,9 +6478,10 @@ "options": [ "-h, --help This help", "-f, --file Filename of dump", - "-q, --qty Number of blocks to load from eml file" + "-q, --qty Number of blocks to load from eml file", + "-v, --verbose verbose output" ], - "usage": "hf mfu eload [-h] -f [-q ]" + "usage": "hf mfu eload [-hv] -f [-q ]" }, "hf mfu esave": { "command": "hf mfu esave", @@ -6428,6 +6544,27 @@ ], "usage": "hf mfu keygen [-hr] [-u ]" }, + "hf mfu list": { + "command": "hf mfu list", + "description": "Alias of `trace list -t 14a -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "notes": [ + "hf 14a list --frame -> show frame delay times", + "hf 14a list -1 -> use trace buffer" + ], + "offline": true, + "options": [ + "-h, --help This help", + "-1, --buffer use data from trace buffer", + "--frame show frame delay times", + "-c mark CRC bytes", + "-r show relative times (gap and duration)", + "-u display times in microseconds instead of clock cycles", + "-x show hexdump to convert to pcap(ng)", + "or to import into Wireshark using encapsulation type \"ISO 14443\"", + "-f, --file filename of dictionary" + ], + "usage": "hf 14a list [-h1crux] [--frame] [-f ]" + }, "hf mfu ndefread": { "command": "hf mfu ndefread", "description": "Prints NFC Data Exchange Format (NDEF)", @@ -6561,12 +6698,12 @@ "offline": false, "options": [ "-h, --help This help", - "-t, --type <1..10> Simulation type to use", + "-t, --type <1..12> Simulation type to use", "-u, --uid <4|7|10> hex bytes UID", "-n, --num Exit simulation after blocks. 0 = infinite", "-v, --verbose Verbose output" ], - "usage": "hf mfu sim [-hv] -t <1..10> [-u ] [-n ]" + "usage": "hf mfu sim [-hv] -t <1..12> [-u ] [-n ]" }, "hf mfu tamper": { "command": "hf mfu tamper", @@ -6979,7 +7116,7 @@ }, "hf topaz list": { "command": "hf topaz list", - "description": "Alias of `trace list -t topaz` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "Alias of `trace list -t topaz -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf topaz list --frame -> show frame delay times", "hf topaz list -1 -> use trace buffer" @@ -7629,9 +7766,10 @@ ], "offline": true, "options": [ - "-h, --help This help" + "-h, --help This help", + "-v, --verbose verbose output" ], - "usage": "lf cotag demod [-h]" + "usage": "lf cotag demod [-hv]" }, "lf cotag reader": { "command": "lf cotag reader", @@ -8631,19 +8769,29 @@ }, "lf hitag dump": { "command": "lf hitag dump", - "description": "Read all card memory and save to fileIn password mode the default key is 4D494B52 (MIKR) In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", + "description": "Read all Hitag 2 card memory and save to file Crypto mode key format: ISK high + ISK low", "notes": [ - "lf hitag dump -k 4F4E4D494B52", - "lf hitag dump -k 4D494B52" + "Password mode => use default key 4D494B52 (MIKR)", + "lf hitag dump --pwd", + "Short key = password mode", + "lf hitag dump -k 4D494B52", + "Challenge mode", + "lf hitag dump --nrar 0102030411223344", + "Crypto mode => use default key 4F4E4D494B52 (ONMIKR)", + "lf hitag dump --crypto", + "Long key = crypto mode", + "lf hitag dump -k 4F4E4D494B52" ], "offline": false, "options": [ "-h, --help This help", - "-f, --file specify file name", + "--pwd password mode", + "--nrar nonce / answer reader, 8 hex bytes", + "--crypto crypto mode", "-k, --key key, 4 or 6 hex bytes", - "--nrar nonce / answer reader, 8 hex bytes" + "-f, --file specify file name" ], - "usage": "lf hitag dump [-h] [-f ] [-k ] [--nrar ]" + "usage": "lf hitag dump [-h] [--pwd] [--nrar ] [--crypto] [-k ] [-f ]" }, "lf hitag eload": { "command": "lf hitag eload", @@ -8654,11 +8802,11 @@ "offline": false, "options": [ "-h, --help This help", - "-f, --file Specfiy dump filename", - "-1 Card type Hitag1", - "-2 Card type Hitag2", - "-s Card type HitagS", - "-m Card type HitagM" + "-f, --file Specify dump filename", + "-1, --ht1 Card type Hitag 1", + "-2, --ht2 Card type Hitag 2", + "-s, --hts Card type Hitag S", + "-m, --htm Card type Hitag \u00ce\u00bc" ], "usage": "lf hitag eload [-h12sm] -f " }, @@ -8695,46 +8843,54 @@ ], "usage": "lf hitag list [-h1crux] [--frame] [-f ]" }, - "lf hitag reader": { - "command": "lf hitag reader", - "description": "Act like a Hitag Reader", + "lf hitag read": { + "command": "lf hitag read", + "description": "Read Hitag memory Crypto mode key format: ISK high + ISK low", "notes": [ - "Hitag S", - "lf hitag reader --01 --nrar 0102030411223344", - "lf hitag reader --02 -k 4F4E4D494B52", - "Hitag 2", - "lf hitag reader --21 -k 4D494B52", - "lf hitag reader --22 --nrar 0102030411223344", - "lf hitag reader --23 -k 4F4E4D494B52", - "lf hitag reader --26" + "Hitag S, plain mode", + "lf hitag read --hts", + "Hitag S, challenge mode", + "lf hitag read --hts --nrar 0102030411223344", + "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)", + "lf hitag read --hts --crypto", + "Hitag S, long key = crypto mode", + "lf hitag read --hts -k 4F4E4D494B52", + "", + "Hitag 2, password mode => use default key 4D494B52 (MIKR)", + "lf hitag read --ht2 --pwd", + "Hitag 2, providing a short key = password mode", + "lf hitag read --ht2 -k 4D494B52", + "Hitag 2, challenge mode", + "lf hitag read --ht2 --nrar 0102030411223344", + "Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)", + "lf hitag read --ht2 --crypto", + "Hitag 2, providing a long key = crypto mode", + "lf hitag read --ht2 -k 4F4E4D494B52" ], "offline": false, "options": [ "-h, --help This help", - "--01 HitagS, read all pages, challenge mode", - "--02 HitagS, read all pages, crypto mode. Set key=0 for no auth", - "--21 Hitag2, read all pages, password mode. def 4D494B52 (MIKR)", - "--22 Hitag2, read all pages, challenge mode", - "--23 Hitag2, read all pages, crypto mode. Key ISK high + ISK low. def 4F4E4D494B52 (ONMIKR)", - "--25 Hitag2, test recorded authentications (replay?)", - "--26 Hitag2, read UID", - "-k, --key key, 4 or 6 hex bytes", - "--nrar nonce / answer reader, 8 hex bytes" + "-s, --hts Hitag S", + "-2, --ht2 Hitag 2", + "--pwd password mode", + "--nrar nonce / answer writer, 8 hex bytes", + "--crypto crypto mode", + "-k, --key key, 4 or 6 hex bytes" ], - "usage": "lf hitag reader [-h] [--01] [--02] [--21] [--22] [--23] [--25] [--26] [-k ] [--nrar ]" + "usage": "lf hitag read [-hs2] [--pwd] [--nrar ] [--crypto] [-k ]" }, "lf hitag sim": { "command": "lf hitag sim", - "description": "Simulate Hitag2 / HitagS transponder You need to `lf hitag eload` first", + "description": "Simulate Hitag transponder You need to `lf hitag eload` first", "notes": [ "lf hitag sim -2" ], "offline": false, "options": [ "-h, --help This help", - "-1 simulate Hitag1", - "-2 simulate Hitag2", - "-s simulate HitagS" + "-1, --ht1 simulate Hitag 1", + "-2, --ht2 simulate Hitag 2", + "-s, --hts simulate Hitag S" ], "usage": "lf hitag sim [-h12s]" }, @@ -8750,30 +8906,43 @@ ], "usage": "lf hitag sniff [-h]" }, - "lf hitag writer": { - "command": "lf hitag writer", - "description": "Act like a Hitag writerIn password mode the default key is 4D494B52 (MIKR) In crypto mode the default key is 4F4E4D494B52 (ONMIKR) format: ISK high + ISK low.", + "lf hitag wrbl": { + "command": "lf hitag wrbl", + "description": "Write a page in Hitag memory Crypto mode key format: ISK high + ISK low", "notes": [ - "Hitag S", - "lf hitag writer --03 --nrar 0102030411223344 -p 3 -d 01020304", - "lf hitag writer --04 -k 4F4E4D494B52 -p 3 -d 01020304", - "Hitag 2", - "lf hitag writer --24 -k 4F4E4D494B52 -p 3 -d 01020304", - "lf hitag writer --27 -k 4D494B52 -p 3 -d 01020304" + "Hitag S, plain mode", + "lf hitag wrbl --hts -p 6 -d 01020304", + "Hitag S, challenge mode", + "lf hitag wrbl --hts --nrar 0102030411223344 -p 6 -d 01020304", + "Hitag S, crypto mode => use default key 4F4E4D494B52 (ONMIKR)", + "lf hitag wrbl --hts --crypto -p 6 -d 01020304", + "Hitag S, long key = crypto mode", + "lf hitag wrbl --hts -k 4F4E4D494B52 -p 6 -d 01020304", + "", + "Hitag 2, password mode => use default key 4D494B52 (MIKR)", + "lf hitag wrbl --ht2 --pwd -p 6 -d 01020304", + "Hitag 2, providing a short key = password mode", + "lf hitag wrbl --ht2 -k 4D494B52 -p 6 -d 01020304", + "Hitag 2, challenge mode", + "lf hitag wrbl --ht2 --nrar 0102030411223344 -p 6 -d 01020304", + "Hitag 2, crypto mode => use default key 4F4E4D494B52 (ONMIKR)", + "lf hitag wrbl --ht2 --crypto -p 6 -d 01020304", + "Hitag 2, providing a long key = crypto mode", + "lf hitag wrbl --ht2 -k 4F4E4D494B52 -p 6 -d 01020304" ], "offline": false, "options": [ "-h, --help This help", - "--03 HitagS, write page, challenge mode", - "--04 HitagS, write page, crypto mode. Set key=0 for no auth", - "--24 Hitag2, write page, crypto mode.", - "--27 Hitag2, write page, password mode", - "-p, --page page address to write to", - "-d, --data data, 4 hex bytes", + "-s, --hts Hitag S", + "-2, --ht2 Hitag 2", + "--pwd password mode", + "--nrar nonce / answer writer, 8 hex bytes", + "--crypto crypto mode", "-k, --key key, 4 or 6 hex bytes", - "--nrar nonce / answer writer, 8 hex bytes" + "-p, --page page address to write to", + "-d, --data data, 4 hex bytes" ], - "usage": "lf hitag writer [-h] [--03] [--04] [--24] [--27] -p [-d ] [-k ] [--nrar ]" + "usage": "lf hitag wrbl [-hs2] [--pwd] [--nrar ] [--crypto] [-k ] -p -d " }, "lf idteck clone": { "command": "lf idteck clone", @@ -9141,7 +9310,7 @@ }, "lf motorola demod": { "command": "lf motorola demod", - "description": "Try to find Motorola preamble, if found decode / descramble data", + "description": "Try to find Motorola Flexpass preamble, if found decode / descramble data", "notes": [ "lf motorola demod" ], @@ -9153,7 +9322,7 @@ }, "lf motorola reader": { "command": "lf motorola reader", - "description": "read a Motorola tag", + "description": "read a Motorola Flexpass tag", "notes": [ "lf motorola reader -@ -> continuous reader mode" ], @@ -11481,6 +11650,7 @@ "trace list -t seos -> interpret as SEOS", "trace list -t thinfilm -> interpret as Thinfilm", "trace list -t topaz -> interpret as Topaz", + "trace list -t mfp -> interpret as MIFARE Plus", "", "trace list -t mf -f mfc_default_keys.dic -> use default dictionary file", "trace list -t 14a --frame -> show frame delay times", @@ -11685,8 +11855,8 @@ } }, "metadata": { - "commands_extracted": 679, + "commands_extracted": 687, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2023-07-10T18:33:37" + "extracted_on": "2023-09-10T12:59:25" } } \ No newline at end of file diff --git a/doc/commands.md b/doc/commands.md index ce203b57a..0c94700e6 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -98,10 +98,11 @@ Check column "offline" for their availability. |`data manrawdecode `|Y |`Manchester decode binary stream in DemodBuffer` |`data modulation `|Y |`Identify LF signal for clock and modulation` |`data rawdemod `|Y |`Demodulate the data in the GraphBuffer and output binary` -|`data askedgedetect `|Y |`Adjust Graph for manual ASK demod using the length of sample differences to detect the edge of a wave` +|`data askedgedetect `|Y |`Adjust Graph for manual ASK demod` |`data autocorr `|Y |`Autocorrelation over window` -|`data dirthreshold `|Y |`Max rising higher up-thres/ Min falling lower down-thres, keep rest as prev.` +|`data dirthreshold `|Y |`Max rising higher up-thres/ Min falling lower down-thres` |`data decimate `|Y |`Decimate samples` +|`data envelope `|Y |`Generate square envelope of samples` |`data undecimate `|Y |`Un-decimate samples` |`data hide `|Y |`Hide graph window` |`data hpf `|Y |`Remove DC offset from trace` @@ -111,18 +112,20 @@ Check column "offline" for their availability. |`data mtrim `|Y |`Trim out samples from the specified start to the specified stop` |`data norm `|Y |`Normalize max/min to +/-128` |`data plot `|Y |`Show graph window` +|`data cthreshold `|Y |`Average out all values between` |`data rtrim `|Y |`Trim samples from right of trace` |`data setgraphmarkers `|Y |`Set blue and orange marker in graph window` |`data shiftgraphzero `|Y |`Shift 0 for Graphed wave + or - shift value` -|`data timescale `|Y |`Set a timescale to get a differential reading between the yellow and purple markers as time duration` +|`data timescale `|Y |`Set cursor display timescale` |`data zerocrossings `|Y |`Count time between zero-crossings` |`data convertbitstream `|Y |`Convert GraphBuffer's 0/1 values to 127 / -127` |`data getbitstream `|Y |`Convert GraphBuffer's >=1 values to 1 and <1 to 0` -|`data asn1 `|Y |`asn1 decoder` +|`data asn1 `|Y |`ASN1 decoder` +|`data atr `|Y |`ATR lookup` |`data bin2hex `|Y |`Converts binary to hexadecimal` |`data bitsamples `|N |`Get raw samples as bitstring` |`data clear `|Y |`Clears bigbuf on deviceside and graph window` -|`data diff `|Y |`diff of input files` +|`data diff `|Y |`Diff of input files` |`data hexsamples `|N |`Dump big buffer as hex bytes` |`data hex2bin `|Y |`Converts hexadecimal to binary` |`data load `|Y |`Load contents of file into graph window` @@ -234,10 +237,12 @@ Check column "offline" for their availability. |`hf 15 reader `|N |`Act like an ISO-15693 reader` |`hf 15 restore `|N |`Restore from file to all memory pages of an ISO-15693 tag` |`hf 15 samples `|N |`Acquire samples as reader (enables carrier, sends inquiry)` +|`hf 15 view `|Y |`Display content from tag dump file` +|`hf 15 wrbl `|N |`Write a block` +|`hf 15 sim `|N |`Fake an ISO-15693 tag` |`hf 15 eload `|N |`Load image file into emulator to be used by 'sim' command` |`hf 15 esave `|N |`Save emulator memory into image file` |`hf 15 eview `|N |`View emulator memory` -|`hf 15 sim `|N |`Fake an ISO-15693 tag` |`hf 15 slixwritepwd `|N |`Writes a password on a SLIX ISO-15693 tag` |`hf 15 slixeasdisable `|N |`Disable EAS mode on SLIX ISO-15693 tag` |`hf 15 slixeasenable `|N |`Enable EAS mode on SLIX ISO-15693 tag` @@ -245,7 +250,6 @@ Check column "offline" for their availability. |`hf 15 slixprivacyenable`|N |`Enable privacy mode on SLIX ISO-15693 tag` |`hf 15 passprotectafi `|N |`Password protect AFI - Cannot be undone` |`hf 15 passprotecteas `|N |`Password protect EAS - Cannot be undone` -|`hf 15 wrbl `|N |`Write a block` |`hf 15 findafi `|N |`Brute force AFI of an ISO-15693 tag` |`hf 15 writeafi `|N |`Writes the AFI on an ISO-15693 tag` |`hf 15 writedsfid `|N |`Writes the DSFID on an ISO-15693 tag` @@ -402,20 +406,23 @@ Check column "offline" for their availability. |command |offline |description |------- |------- |----------- |`hf iclass help `|Y |`This help` +|`hf iclass list `|Y |`List iclass history` |`hf iclass dump `|N |`Dump Picopass / iCLASS tag to file` |`hf iclass info `|Y |`Tag information` -|`hf iclass list `|Y |`List iclass history` |`hf iclass rdbl `|N |`Read Picopass / iCLASS block` |`hf iclass reader `|N |`Act like a Picopass / iCLASS reader` |`hf iclass restore `|N |`Restore a dump file onto a Picopass / iCLASS tag` |`hf iclass sniff `|N |`Eavesdrop Picopass / iCLASS communication` +|`hf iclass view `|Y |`Display content from tag dump file` |`hf iclass wrbl `|N |`Write Picopass / iCLASS block` +|`hf iclass creditepurse `|N |`Credit epurse value` |`hf iclass chk `|N |`Check keys` |`hf iclass loclass `|Y |`Use loclass to perform bruteforce reader attack` |`hf iclass lookup `|Y |`Uses authentication trace to check for key in dictionary file` |`hf iclass sim `|N |`Simulate iCLASS tag` |`hf iclass eload `|N |`Load Picopass / iCLASS dump file into emulator memory` |`hf iclass esave `|N |`Save emulator memory to file` +|`hf iclass esetblk `|N |`Set emulator memory block data` |`hf iclass eview `|N |`View emulator memory` |`hf iclass configcard `|Y |`Reader configuration card` |`hf iclass calcnewkey `|Y |`Calc diversified keys (blocks 3 & 4) to write new keys` @@ -424,7 +431,7 @@ Check column "offline" for their availability. |`hf iclass decrypt `|Y |`Decrypt given block data or tag dump file` |`hf iclass managekeys `|Y |`Manage keys to use with iclass commands` |`hf iclass permutekey `|Y |`Permute function from 'heart of darkness' paper` -|`hf iclass view `|Y |`Display content from tag dump file` +|`hf iclass sam `|N |`SAM tests` ### hf legic @@ -563,6 +570,7 @@ Check column "offline" for their availability. |command |offline |description |------- |------- |----------- |`hf mfu help `|Y |`This help` +|`hf mfu list `|Y |`List MIFARE Ultralight / NTAG history` |`hf mfu keygen `|Y |`Generate 3DES MIFARE diversified keys` |`hf mfu pwdgen `|Y |`Generate pwd from known algos` |`hf mfu otptear `|N |`Tear-off test on OTP bits` @@ -875,14 +883,14 @@ Check column "offline" for their availability. |`lf em 4x05 help `|Y |`This help` |`lf em 4x05 brute `|N |`Bruteforce password` |`lf em 4x05 chk `|N |`Check passwords from dictionary` -|`lf em 4x05 demod `|Y |`demodulate a EM4x05/EM4x69 tag from the GraphBuffer` -|`lf em 4x05 dump `|N |`dump EM4x05/EM4x69 tag` -|`lf em 4x05 info `|N |`tag information EM4x05/EM4x69` -|`lf em 4x05 read `|N |`read word data from EM4x05/EM4x69` +|`lf em 4x05 demod `|Y |`Demodulate a EM4x05/EM4x69 tag from the GraphBuffer` +|`lf em 4x05 dump `|N |`Dump EM4x05/EM4x69 tag` +|`lf em 4x05 info `|N |`Tag information` +|`lf em 4x05 read `|N |`Read word data from EM4x05/EM4x69` |`lf em 4x05 sniff `|Y |`Attempt to recover em4x05 commands from sample buffer` -|`lf em 4x05 unlock `|N |`execute tear off against EM4x05/EM4x69` -|`lf em 4x05 wipe `|N |`wipe EM4x05/EM4x69 tag` -|`lf em 4x05 write `|N |`write word data to EM4x05/EM4x69` +|`lf em 4x05 unlock `|N |`Execute tear off against EM4x05/EM4x69` +|`lf em 4x05 wipe `|N |`Wipe EM4x05/EM4x69 tag` +|`lf em 4x05 write `|N |`Write word data to EM4x05/EM4x69` ### lf em 4x50 @@ -986,15 +994,16 @@ Check column "offline" for their availability. |command |offline |description |------- |------- |----------- |`lf hitag help `|Y |`This help` -|`lf hitag eload `|N |`Load Hitag dump file into emulator memory` |`lf hitag list `|Y |`List Hitag trace history` -|`lf hitag info `|N |`Hitag2 tag information` -|`lf hitag reader `|N |`Act like a Hitag reader` -|`lf hitag sim `|N |`Simulate Hitag transponder` +|`lf hitag info `|N |`Hitag 2 tag information` +|`lf hitag dump `|N |`Dump Hitag 2 tag` +|`lf hitag read `|N |`Read Hitag memory` +|`lf hitag wrbl `|N |`Write a block (page) in Hitag memory` |`lf hitag sniff `|N |`Eavesdrop Hitag communication` -|`lf hitag writer `|N |`Act like a Hitag writer` -|`lf hitag dump `|N |`Dump Hitag2 tag` -|`lf hitag cc `|N |`Test all challenges` +|`lf hitag cc `|N |`Hitag S: test all provided challenges` +|`lf hitag ta `|N |`Hitag 2: test all recorded authentications` +|`lf hitag eload `|N |`Load Hitag dump file into emulator memory` +|`lf hitag sim `|N |`Simulate Hitag transponder` ### lf idteck @@ -1067,7 +1076,7 @@ Check column "offline" for their availability. ### lf motorola - { Motorola RFIDs... } + { Motorola Flexpass RFIDs... } |command |offline |description |------- |------- |----------- diff --git a/doc/datasheets/W25X40CL_H 20220301.pdf b/doc/datasheets/W25X40CL_H 20220301.pdf new file mode 100644 index 000000000..c847a3b81 Binary files /dev/null and b/doc/datasheets/W25X40CL_H 20220301.pdf differ diff --git a/doc/datasheets/XILINX Spartan-II FPGA Family.pdf b/doc/datasheets/XILINX Spartan-II FPGA Family.pdf new file mode 100644 index 000000000..1b1eb4d23 Binary files /dev/null and b/doc/datasheets/XILINX Spartan-II FPGA Family.pdf differ diff --git a/doc/md/Development/Makefile-vs-CMake.md b/doc/md/Development/Makefile-vs-CMake.md index c54e911ff..934e4b138 100644 --- a/doc/md/Development/Makefile-vs-CMake.md +++ b/doc/md/Development/Makefile-vs-CMake.md @@ -58,7 +58,8 @@ At the moment both are maintained because they don't perfectly overlap yet. | `SKIPLUASYSTEM` | yes | **no** | | | lualibs/pm3_cmd.lua | yes | add_custom_command **but unused** | | | lualibs/mfc_default_keys.lua | yes | add_custom_command **but unused** | | -| dep lz4 | | | (in_common) not yet used, future. See `get_lz4.sh` for upstream fetch & patch | +| dep lz4 | sys | sys | + in_common only used by FW. See `get_lz4.sh` for upstream fetch & patch | +| lz4 detection | **none** | find, Cross:gitclone | | | dep libm | sys | sys | | | libm detection | **none** | **none** (1) | (1) cf https://cmake.org/pipermail/cmake/2019-March/069168.html ? | | dep mbedtls | in_common | in_common | no sys lib: missing support for CMAC in def conf (btw no .pc available) | diff --git a/doc/md/Installation_Instructions/Linux-Installation-Instructions.md b/doc/md/Installation_Instructions/Linux-Installation-Instructions.md index e7fe580cd..3172fdecc 100644 --- a/doc/md/Installation_Instructions/Linux-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/Linux-Installation-Instructions.md @@ -50,7 +50,7 @@ Install the requirements ```sh sudo apt-get install --no-install-recommends git ca-certificates build-essential pkg-config \ -libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev +libreadline-dev gcc-arm-none-eabi libnewlib-dev qtbase5-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev ``` If you don't need the native Bluetooth support in the client, you can skip the installation of `libbluetooth-dev`. @@ -65,7 +65,7 @@ If you get some (non blocking) error at runtime such as _Gtk-Message: Failed to ^[Top](#top) ```sh -sudo pacman -Syu git base-devel readline bzip2 arm-none-eabi-gcc arm-none-eabi-newlib qt5-base bluez python --needed +sudo pacman -Syu git base-devel readline bzip2 lz4 arm-none-eabi-gcc arm-none-eabi-newlib qt5-base bluez python --needed ``` If you don't need the native Bluetooth support in the client, you can skip the installation of `bluez`. @@ -78,7 +78,7 @@ If you don't need support for Python3 scripts in the Proxmark3 client, you can s ^[Top](#top) ```sh -sudo dnf install git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel qt5-qtbase-devel bluez-libs-devel python3-devel libatomic openssl-devel +sudo dnf install git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel lz4-devel qt5-qtbase-devel bluez-libs-devel python3-devel libatomic openssl-devel ``` If you don't need the native Bluetooth support in the client, you can skip the installation of `bluez-libs-devel`. @@ -91,7 +91,7 @@ If you don't need support for Python3 scripts in the Proxmark3 client, you can s ^[Top](#top) ```sh -sudo zypper install git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel cross-arm-none-gcc9 cross-arm-none-newlib-devel python3-devel libqt5-qtbase-devel libopenssl-devel +sudo zypper install git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel liblz4-devel cross-arm-none-gcc9 cross-arm-none-newlib-devel python3-devel libqt5-qtbase-devel libopenssl-devel ``` Note that Bluez is not available on openSUSE so the native Bluetooth support won't be available in the client. diff --git a/doc/md/Installation_Instructions/Troubleshooting.md b/doc/md/Installation_Instructions/Troubleshooting.md index d3fbab571..d63e49b75 100644 --- a/doc/md/Installation_Instructions/Troubleshooting.md +++ b/doc/md/Installation_Instructions/Troubleshooting.md @@ -38,7 +38,7 @@ client/proxmark3 ... Refer to the installation guide specific to your OS for details about ports. * [Linux](/doc/md/Installation_Instructions/Linux-Installation-Instructions.md) -* [Mac OSX](/doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md) +* [macOS](/doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md) * [Windows](/doc/md/Installation_Instructions/Windows-Installation-Instructions.md) Note that with the Bluetooth adapter, you *have to* use directly the client, and flasher over Bluetooth is not possible. diff --git a/doc/md/Installation_Instructions/Windows-Installation-Instructions.md b/doc/md/Installation_Instructions/Windows-Installation-Instructions.md index 6ac9e53b3..bc29aba6a 100644 --- a/doc/md/Installation_Instructions/Windows-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/Windows-Installation-Instructions.md @@ -168,7 +168,7 @@ Install dependencies: ```sh sudo apt-get install --no-install-recommends git ca-certificates build-essential pkg-config \ -libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libpython3-dev qtbase5-dev libssl-dev +libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libpython3-dev qtbase5-dev libssl-dev ``` _note_ If you don't need the graphical components of the Proxmark3 client, you can skip the installation of `qtbase5-dev`. diff --git a/doc/md/Installation_Instructions/Windows-WSL2-Installation-Instructions.md b/doc/md/Installation_Instructions/Windows-WSL2-Installation-Instructions.md index 9519b4849..0869ab04e 100644 --- a/doc/md/Installation_Instructions/Windows-WSL2-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/Windows-WSL2-Installation-Instructions.md @@ -108,7 +108,7 @@ then, install proxmark dependencies: sudo apt-get install --no-install-recommends \ git ca-certificates build-essential pkg-config \ libreadline-dev gcc-arm-none-eabi libnewlib-dev \ - libbz2-dev libpython3-dev qtbase5-dev libssl-dev + libbz2-dev liblz4-dev libpython3-dev qtbase5-dev libssl-dev ``` _note_ @@ -156,27 +156,18 @@ However, it may be necessary to give the `udev` service a kind reminder: ## Inform udev that it really, really should work -The following workaround appears to work to get udev to apply the permissions -appropriately. Note that this may need to be run again, such as when the WSL2 -distributions have been restarted. I don't know why ... but it's a small hiccup. +As of August 2023, the following needs to be done anytime the WSL2 subsystem +has been restarted (e.g., host machine reboot, first WSL2 console window, etc.). +Otherwise, it appears that `udev` service will not see the arrival of devices, +and therefore won't modify permissions on `/dev/ttyACM*` devices. -```sh -sudo udevadm trigger --action=change -``` - -General instructions suggested to use `sudo udevadm control --reload-rules`. However, -this may simply result in the following cryptic error message: - -```sh -$ sudo udevadm control --reload-rules -[sudo] password for root: -Failed to send reload request: No such file or directory -``` - -_Note that the following should **NOT** be required:_ +After this is run once, `udev` appears to work correctly (at least until the +host machine reboots or the last WSL console window is closed for a while). +One workaround is to simply ensure you keep at least one WSL2 console open. ```sh sudo service udev restart +sudo udevadm trigger --action=change ``` ## Verify Device Exists diff --git a/doc/md/Installation_Instructions/Mac-OS-X-Compile-From-Source-Instructions.md b/doc/md/Installation_Instructions/macOS-Compile-From-Source-Instructions.md similarity index 82% rename from doc/md/Installation_Instructions/Mac-OS-X-Compile-From-Source-Instructions.md rename to doc/md/Installation_Instructions/macOS-Compile-From-Source-Instructions.md index 049ddb31d..c9f101a40 100644 --- a/doc/md/Installation_Instructions/Mac-OS-X-Compile-From-Source-Instructions.md +++ b/doc/md/Installation_Instructions/macOS-Compile-From-Source-Instructions.md @@ -1,9 +1,9 @@ -# Mac OS X - Compilation from source instructions +# macOS - Compilation from source instructions # Table of Contents -- [Mac OS X - Compilation from source instructions](x#mac-os-x---compilation-from-source-instructions) +- [macOS - Compilation from source instructions](#macos---compilation-from-source-instructions) - [Table of Contents](#table-of-contents) - [Follow Homebrew developer instructions](#follow-homebrew-developer-instructions) - [(optional) Running without sudo](#optional-running-without-sudo) @@ -12,7 +12,7 @@ ## Follow Homebrew developer instructions ^[Top](#top) -Follow the instructions here [developer instructions](/doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md#homebrew-mac-os-x-developer-installation) and you are done. +Follow the instructions here [developer instructions](/doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md#homebrew-macos-developer-installation) and you are done. ## (optional) Running without sudo ^[Top](#top) diff --git a/doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md b/doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md similarity index 96% rename from doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md rename to doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md index 3b2e31530..c4622641a 100644 --- a/doc/md/Installation_Instructions/Mac-OS-X-Homebrew-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/macOS-Homebrew-Installation-Instructions.md @@ -1,11 +1,11 @@ -# Mac OS X - Homebrew automatic installation +# macOS - Homebrew automatic installation # Table of Contents -- [Mac OS X - Homebrew automatic installation](#mac-os-x---homebrew-automatic-installation) +- [macOS - Homebrew automatic installation](#macos---homebrew-automatic-installation) - [Table of Contents](#table-of-contents) - [macOS Ventura Beta users](#macos-ventura-beta-users) - [Apple Silicon (M1) Notes](#apple-silicon-m1-notes) @@ -14,7 +14,7 @@ - [Flash the BOOTROM & FULLIMAGE](#flash-the-bootrom--fullimage) - [Run the client](#run-the-client) - [Next steps](#next-steps) -- [Homebrew (Mac OS X), developer installation](#homebrew-mac-os-x-developer-installation) +- [Homebrew (macOS), developer installation](#homebrew-macos-developer-installation) - [Clone the Iceman repository](#clone-the-iceman-repository) - [Compile the project](#compile-the-project) - [the button trick](#the-button-trick) @@ -151,7 +151,7 @@ For the next steps, please read the following pages: -# Homebrew (Mac OS X), developer installation +# Homebrew (macOS), developer installation ^[Top](#top) These instructions will show how to setup the environment on OSX to the point where you'll be able to clone and compile the repo by yourself, as on Linux, Windows, etc. diff --git a/doc/md/Installation_Instructions/Mac-OS-X-MacPorts-Installation-Instructions.md b/doc/md/Installation_Instructions/macOS-MacPorts-Installation-Instructions.md similarity index 94% rename from doc/md/Installation_Instructions/Mac-OS-X-MacPorts-Installation-Instructions.md rename to doc/md/Installation_Instructions/macOS-MacPorts-Installation-Instructions.md index 3ea25c20d..2c36d1371 100644 --- a/doc/md/Installation_Instructions/Mac-OS-X-MacPorts-Installation-Instructions.md +++ b/doc/md/Installation_Instructions/macOS-MacPorts-Installation-Instructions.md @@ -1,10 +1,10 @@ -# Mac OS X - MacPorts automatic installation +# macOS - MacPorts automatic installation # Table of Contents -- [Mac OS X - MacPorts automatic installation](#mac-os-x---macports-automatic-installation) +- [macOS - MacPorts automatic installation](#macOS---macports-automatic-installation) - [Table of Contents](#table-of-contents) - [Main prerequisite](#main-prerequisite) - [Installing latest releases](#installing-latest-releases) @@ -61,7 +61,7 @@ These instructions will show how to setup the environment on OSX to the point wh 2. Install dependencies: ```bash - sudo port install readline jansson lua52 python311 bzip2 openssl11 arm-none-eabi-gcc arm-none-eabi-binutils coreutils qt5 qt5-qtbase pkgconfig + sudo port install readline jansson lua52 python311 bzip2 lz4 openssl11 arm-none-eabi-gcc arm-none-eabi-binutils coreutils qt5 qt5-qtbase pkgconfig ``` 3. Clamp Python version for pkg-config diff --git a/doc/md/Use_of_Proxmark/3_Commands-and-Features.md b/doc/md/Use_of_Proxmark/3_Commands-and-Features.md index d0bff17b6..d7212261a 100644 --- a/doc/md/Use_of_Proxmark/3_Commands-and-Features.md +++ b/doc/md/Use_of_Proxmark/3_Commands-and-Features.md @@ -8,6 +8,7 @@ - [To get interactive help](#to-get-interactive-help) - [New Features in RDV4](#new-features-in-rdv4) - [Useful commands](#useful-commands) +- [Hardnested tables](#hardnested-tables) @@ -58,3 +59,31 @@ A good starting point is the following [Cheat sheet](/doc/cheatsheet.md) Or this compilation of links to [Proxmark3 walk throughs](https://github.com/RfidResearchGroup/proxmark3/wiki/More-cheat-sheets) + +# Hardnested tables +^[Top](#top) + +Hardnested tables are compressed with LZ4 for a good compromise between space and decompression speed. + +If you are under very space constrained environment, you can recompress the tables with BZip2 and delete the LZ4. It will break the git workdir but if space is a concern, you're not deploying the source and `.git` of > 80Mb anyway, do you? + +```sh +cd client/resources/hardnested_tables +lz4 -dm --rm *lz4 +bzip2 *.bin +``` + +If you want top speed, you can decompress the tables in advance. Keep the `.lz4` files, so you can always just `rm *.bin` to save space again. + +```sh +cd client/resources/hardnested_tables +lz4 -dkm *lz4 +``` + +| Compression | Size in Mb | Speed(*) | +|-------------|:----------:|:-----------:| +| LZ4 | 9 | 1 | +| BZip2 | 2 | 6.5x slower | +| None | 704 | 2.5x faster | + +(*) rough idea of relative speeds, real numbers depend on your actual system diff --git a/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md b/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md index 53726b9dd..823e527da 100644 --- a/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md +++ b/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md @@ -121,6 +121,7 @@ Here are the supported values you can assign to `STANDALONE` in `Makefile.platfo | HF_15SNIFF | 15693 sniff storing to flashmem - Glaser | HF_AVEFUL | MIFARE Ultralight read/simulation - Ave Ozkal | HF_BOG | 14a sniff with ULC/ULEV1/NTAG auth storing in flashmem - Bogito +| HF_CARDHOPPER | Long distance (over IP) relay of 14a protocols - Sam Haskins | HF_COLIN | Mifare ultra fast sniff/sim/clone - Colin Brigato | HF_CRAFTBYTE | UID stealer - Emulates scanned 14a UID - Anze Jensterle | HF_ICECLASS | iCLASS 4-1 mode sim/read & dump/loclass/glitch & config to flashmem - Iceman1001 diff --git a/docker/archlinux/Dockerfile b/docker/archlinux/Dockerfile index 93584c098..18f573cb2 100644 --- a/docker/archlinux/Dockerfile +++ b/docker/archlinux/Dockerfile @@ -5,10 +5,9 @@ RUN pacman -Syu --noconfirm RUN pacman-db-upgrade # qt5-base skipped # bluez skipped, can't be installed in docker -RUN pacman -S --noconfirm sudo git base-devel cmake libusb readline bzip2 arm-none-eabi-gcc arm-none-eabi-newlib python --needed +RUN pacman -S --noconfirm sudo git base-devel cmake libusb readline bzip2 lz4 arm-none-eabi-gcc arm-none-eabi-newlib python --needed RUN pacman -S --noconfirm python-pip -RUN python3 -m pip install ansicolors sslcrypto # OpenCL for hitag2crack RUN pacman -S --noconfirm ocl-icd diff --git a/docker/archlinux/README.md b/docker/archlinux/README.md index 872d46cb4..7c699e524 100644 --- a/docker/archlinux/README.md +++ b/docker/archlinux/README.md @@ -47,5 +47,11 @@ Or if you want to run single test, ``` make clean; make -j + +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto tools/pm3_tests.sh --long +deactivate ``` diff --git a/docker/archlinux/docker_rm.sh b/docker/archlinux/docker_rm.sh index b4d9e7738..0c2d24f4e 100644 --- a/docker/archlinux/docker_rm.sh +++ b/docker/archlinux/docker_rm.sh @@ -1,6 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-arch:1.0) docker image rm pm3-arch:1.0 -docker image rm archlinux:base -# old ref: -docker image rm archlinux/base diff --git a/docker/archlinux/run_tests.sh b/docker/archlinux/run_tests.sh index 53eeda9a3..67715f92f 100755 --- a/docker/archlinux/run_tests.sh +++ b/docker/archlinux/run_tests.sh @@ -39,4 +39,9 @@ pacman -Ss '^gcc$' # sudo pacman -S testing/gcc # sudo pacman -S gcc +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto tools/release_tests.sh +deactivate diff --git a/docker/build-all.sh b/docker/build-all.sh index aba45382f..ed56a0972 100755 --- a/docker/build-all.sh +++ b/docker/build-all.sh @@ -1,5 +1,5 @@ #!/bin/bash -for os in archlinux debian-buster fedora-36 fedora-37 homebrew kali opensuse-leap opensuse-tumbleweed parrot-core-latest ubuntu-18.04 ubuntu-20.04 ubuntu-22.04; do +for os in archlinux debian-12-bookworm fedora-36 fedora-37 homebrew kali opensuse-leap opensuse-tumbleweed parrot-core-latest ubuntu-20.04 ubuntu-22.04; do ( cd $os && ./docker_build.sh ) done diff --git a/docker/debian-bullseye/Dockerfile b/docker/debian-11-bullseye/Dockerfile similarity index 88% rename from docker/debian-bullseye/Dockerfile rename to docker/debian-11-bullseye/Dockerfile index ff456b558..46cac1b2d 100644 --- a/docker/debian-bullseye/Dockerfile +++ b/docker/debian-11-bullseye/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/debian-bullseye/README.md b/docker/debian-11-bullseye/README.md similarity index 91% rename from docker/debian-bullseye/README.md rename to docker/debian-11-bullseye/README.md index e86881019..3a7775b7c 100644 --- a/docker/debian-bullseye/README.md +++ b/docker/debian-11-bullseye/README.md @@ -9,7 +9,7 @@ If all tests OK, the script will finish with PASS. The script is to be run in proxmark root folder inside the docker env. ``` -docker/debian-bullseye/run_tests.sh; +docker/debian-11-bullseye/run_tests.sh; ``` Or if you want to run single test, diff --git a/docker/debian-bullseye/docker_build.sh b/docker/debian-11-bullseye/docker_build.sh similarity index 100% rename from docker/debian-bullseye/docker_build.sh rename to docker/debian-11-bullseye/docker_build.sh diff --git a/docker/debian-11-bullseye/docker_rm.sh b/docker/debian-11-bullseye/docker_rm.sh new file mode 100644 index 000000000..b8ce5b834 --- /dev/null +++ b/docker/debian-11-bullseye/docker_rm.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker rm $(docker ps -aq --filter ancestor=pm3-debian-bullseye:1.0) +docker image rm pm3-debian-bullseye:1.0 diff --git a/docker/debian-bullseye/docker_run.sh b/docker/debian-11-bullseye/docker_run.sh similarity index 100% rename from docker/debian-bullseye/docker_run.sh rename to docker/debian-11-bullseye/docker_run.sh diff --git a/docker/debian-bullseye/run_tests.sh b/docker/debian-11-bullseye/run_tests.sh similarity index 80% rename from docker/debian-bullseye/run_tests.sh rename to docker/debian-11-bullseye/run_tests.sh index 25e6d2a21..9c7128942 100755 --- a/docker/debian-bullseye/run_tests.sh +++ b/docker/debian-11-bullseye/run_tests.sh @@ -2,7 +2,7 @@ # Iceman 2022 # # This script is to be run from proxmark root folder inside the docker env -# docker/debian-bullseye/run_tests.sh; +# docker/debian-11-bullseye/run_tests.sh; sudo apt update && sudo apt upgrade -y tools/release_tests.sh diff --git a/docker/debian-12-bookworm/Dockerfile b/docker/debian-12-bookworm/Dockerfile new file mode 100644 index 000000000..92527289c --- /dev/null +++ b/docker/debian-12-bookworm/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:bookworm-slim + +ENV LANG C +ENV DEBIAN_FRONTEND noninteractive +# qtbase5-dev skipped +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get dist-upgrade -y && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get clean + +RUN apt-get install -y --no-install-recommends python3-minimal python3-pip python3-venv && \ + apt-get clean + +RUN apt-get install -y opencl-dev && \ + apt-get clean + +# Create rrg user +RUN useradd -ms /bin/bash rrg +RUN passwd -d rrg +RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers + +USER rrg +WORKDIR "/home/rrg" + +CMD ["/bin/bash"] diff --git a/docker/debian-12-bookworm/README.md b/docker/debian-12-bookworm/README.md new file mode 100644 index 000000000..67c0f6a8b --- /dev/null +++ b/docker/debian-12-bookworm/README.md @@ -0,0 +1,26 @@ +# Notes on run_tests.sh script +This script runs a bunch of different builds with make and cmake together +with the different combos of RDV4, GENERIC, BTADDON combos. + +If all tests OK, the script will finish with PASS. + + +# Notes to run tests +The script is to be run in proxmark root folder inside the docker env. + +``` +docker/debian-12-bookworm/run_tests.sh; +``` + +Or if you want to run single test, + +``` +sudo apt update +make clean; make -j +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto +tools/pm3_tests.sh --long +deactivate +``` diff --git a/docker/debian-12-bookworm/docker_build.sh b/docker/debian-12-bookworm/docker_build.sh new file mode 100755 index 000000000..0059348cf --- /dev/null +++ b/docker/debian-12-bookworm/docker_build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build -t "pm3-debian-bookworm:1.0" . diff --git a/docker/debian-12-bookworm/docker_rm.sh b/docker/debian-12-bookworm/docker_rm.sh new file mode 100644 index 000000000..5818564e0 --- /dev/null +++ b/docker/debian-12-bookworm/docker_rm.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker rm $(docker ps -aq --filter ancestor=pm3-debian-bookworm:1.0) +docker image rm pm3-debian-bookworm:1.0 diff --git a/docker/debian-12-bookworm/docker_run.sh b/docker/debian-12-bookworm/docker_run.sh new file mode 100755 index 000000000..ae264581a --- /dev/null +++ b/docker/debian-12-bookworm/docker_run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-debian-bookworm:1.0 diff --git a/docker/debian-12-bookworm/run_tests.sh b/docker/debian-12-bookworm/run_tests.sh new file mode 100755 index 000000000..06837fc99 --- /dev/null +++ b/docker/debian-12-bookworm/run_tests.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# This script is to be run from proxmark root folder inside the docker env +# docker/debian-12-bookworm/run_tests.sh; + +sudo apt update && sudo apt upgrade -y +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto +tools/release_tests.sh +deactivate diff --git a/docker/debian-13-trixie/Dockerfile b/docker/debian-13-trixie/Dockerfile new file mode 100644 index 000000000..c64707ceb --- /dev/null +++ b/docker/debian-13-trixie/Dockerfile @@ -0,0 +1,26 @@ +FROM debian:trixie-slim + +ENV LANG C +ENV DEBIAN_FRONTEND noninteractive +# qtbase5-dev skipped +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get dist-upgrade -y && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get clean + +RUN apt-get install -y --no-install-recommends python3-minimal python3-pip python3-venv && \ + apt-get clean + +RUN apt-get install -y opencl-dev && \ + apt-get clean + +# Create rrg user +RUN useradd -ms /bin/bash rrg +RUN passwd -d rrg +RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers + +USER rrg +WORKDIR "/home/rrg" + +CMD ["/bin/bash"] diff --git a/docker/debian-13-trixie/README.md b/docker/debian-13-trixie/README.md new file mode 100644 index 000000000..53d448546 --- /dev/null +++ b/docker/debian-13-trixie/README.md @@ -0,0 +1,26 @@ +# Notes on run_tests.sh script +This script runs a bunch of different builds with make and cmake together +with the different combos of RDV4, GENERIC, BTADDON combos. + +If all tests OK, the script will finish with PASS. + + +# Notes to run tests +The script is to be run in proxmark root folder inside the docker env. + +``` +docker/debian-13-trixie/run_tests.sh; +``` + +Or if you want to run single test, + +``` +sudo apt update +make clean; make -j +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto +tools/pm3_tests.sh --long +deactivate +``` diff --git a/docker/debian-13-trixie/docker_build.sh b/docker/debian-13-trixie/docker_build.sh new file mode 100755 index 000000000..22a5bdbc3 --- /dev/null +++ b/docker/debian-13-trixie/docker_build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build -t "pm3-debian-trixie:1.0" . diff --git a/docker/debian-13-trixie/docker_rm.sh b/docker/debian-13-trixie/docker_rm.sh new file mode 100644 index 000000000..0afb68014 --- /dev/null +++ b/docker/debian-13-trixie/docker_rm.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker rm $(docker ps -aq --filter ancestor=pm3-debian-trixie:1.0) +docker image rm pm3-debian-trixie:1.0 diff --git a/docker/debian-13-trixie/docker_run.sh b/docker/debian-13-trixie/docker_run.sh new file mode 100755 index 000000000..bc81286fc --- /dev/null +++ b/docker/debian-13-trixie/docker_run.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run --volume=$(pwd)/../..:/home/rrg/proxmark3 -w /home/rrg/proxmark3 -it pm3-debian-trixie:1.0 diff --git a/docker/debian-13-trixie/run_tests.sh b/docker/debian-13-trixie/run_tests.sh new file mode 100755 index 000000000..dc76107e4 --- /dev/null +++ b/docker/debian-13-trixie/run_tests.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# This script is to be run from proxmark root folder inside the docker env +# docker/debian-13-trixie/run_tests.sh; + +sudo apt update && sudo apt upgrade -y +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto +tools/release_tests.sh +deactivate diff --git a/docker/debian-bullseye/docker_rm.sh b/docker/debian-bullseye/docker_rm.sh deleted file mode 100644 index d9609e2dd..000000000 --- a/docker/debian-bullseye/docker_rm.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -docker image rm pm3-debian-bullseye:1.0 -docker image rm bullseye-slim diff --git a/docker/fedora-36/Dockerfile b/docker/fedora-36/Dockerfile index 007af68c3..3cb7b93c6 100644 --- a/docker/fedora-36/Dockerfile +++ b/docker/fedora-36/Dockerfile @@ -2,7 +2,7 @@ FROM fedora:36 ENV LANG C # qt5-qtbase-devel skipped -RUN dnf install -y passwd sudo git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel bluez-libs-devel python3-devel openssl-devel libatomic findutils +RUN dnf install -y passwd sudo git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel lz4-devel bluez-libs-devel python3-devel openssl-devel libatomic findutils RUN yum -y update RUN yum -y install cmake python-pip diff --git a/docker/fedora-36/docker_rm.sh b/docker/fedora-36/docker_rm.sh index ea2b28809..a14c31e80 100644 --- a/docker/fedora-36/docker_rm.sh +++ b/docker/fedora-36/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-fedora-36:1.0) docker image rm pm3-fedora-36:1.0 -docker image rm fedora:36 diff --git a/docker/fedora-37/Dockerfile b/docker/fedora-37/Dockerfile index 930767853..122834560 100644 --- a/docker/fedora-37/Dockerfile +++ b/docker/fedora-37/Dockerfile @@ -2,7 +2,7 @@ FROM fedora:37 ENV LANG C # qt5-qtbase-devel skipped -RUN dnf install -y passwd sudo git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel bluez-libs-devel python3-devel openssl-devel libatomic findutils +RUN dnf install -y passwd sudo git make gcc gcc-c++ arm-none-eabi-gcc-cs arm-none-eabi-newlib readline-devel bzip2-devel lz4-devel bluez-libs-devel python3-devel openssl-devel libatomic findutils RUN yum -y update RUN yum -y install cmake python-pip diff --git a/docker/fedora-37/docker_rm.sh b/docker/fedora-37/docker_rm.sh index a9359d0fd..6f0bd7e56 100644 --- a/docker/fedora-37/docker_rm.sh +++ b/docker/fedora-37/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-fedora-37:1.0) docker image rm pm3-fedora-37:1.0 -docker image rm fedora:37 diff --git a/docker/homebrew/Dockerfile b/docker/homebrew/Dockerfile index 57e12dd87..fba5e84a7 100644 --- a/docker/homebrew/Dockerfile +++ b/docker/homebrew/Dockerfile @@ -4,6 +4,6 @@ ENV LANG C USER linuxbrew WORKDIR "/home/linuxbrew" -RUN brew install cmake pkg-config bzip2 && rm -rf ~/.cache/Homebrew +RUN brew install cmake pkg-config bzip2 lz4 && rm -rf ~/.cache/Homebrew CMD ["/bin/bash"] diff --git a/docker/homebrew/README.md b/docker/homebrew/README.md index 07c92e573..549896b33 100644 --- a/docker/homebrew/README.md +++ b/docker/homebrew/README.md @@ -21,6 +21,6 @@ make -j fpga_compress cd client mkdir build cd build -cmake -DEMBED_BZIP2=1 .. +cmake -DEMBED_BZIP2=1 -DEMBED_LZ4=1 .. make -j ``` diff --git a/docker/homebrew/docker_rm.sh b/docker/homebrew/docker_rm.sh index 717156495..aa782d4a3 100644 --- a/docker/homebrew/docker_rm.sh +++ b/docker/homebrew/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-brew:1.0) docker image rm pm3-brew:1.0 -docker image rm homebrew/brew diff --git a/docker/homebrew/docker_run.sh b/docker/homebrew/docker_run.sh index 16c744594..efde1649b 100755 --- a/docker/homebrew/docker_run.sh +++ b/docker/homebrew/docker_run.sh @@ -1,4 +1,4 @@ #!/bin/bash -docker run --volume=$(pwd)/../..:/home/linuxbrew/proxmark3 -w /home/rrg/proxmark3 -it pm3-brew:1.0 +docker run --volume=$(pwd)/../..:/home/linuxbrew/proxmark3 -w /home/linuxbrew/proxmark3 -it pm3-brew:1.0 # if needed, run brew as user linuxbrew diff --git a/docker/kali/Dockerfile b/docker/kali/Dockerfile index 79d4bb9a6..0cf70c603 100644 --- a/docker/kali/Dockerfile +++ b/docker/kali/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/kali/docker_rm.sh b/docker/kali/docker_rm.sh index 4cc73265d..fee4f07cf 100644 --- a/docker/kali/docker_rm.sh +++ b/docker/kali/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-kali:1.0) docker image rm pm3-kali:1.0 -#docker image rm kalilinux/kali-rolling diff --git a/docker/opensuse-leap/Dockerfile b/docker/opensuse-leap/Dockerfile index 1af777d23..7e82c5f61 100644 --- a/docker/opensuse-leap/Dockerfile +++ b/docker/opensuse-leap/Dockerfile @@ -2,7 +2,7 @@ FROM opensuse/leap ENV LANG C # libqt5-qtbase-devel skipped -RUN zypper --non-interactive install --no-recommends shadow sudo git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel bluez-devel python3-devel libopenssl-devel +RUN zypper --non-interactive install --no-recommends shadow sudo git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel liblz4-devel bluez-devel python3-devel libopenssl-devel RUN zypper addrepo https://download.opensuse.org/repositories/home:wkazubski/15.4/home:wkazubski.repo && \ zypper --gpg-auto-import-keys refresh && \ diff --git a/docker/opensuse-leap/docker_rm.sh b/docker/opensuse-leap/docker_rm.sh index 9f120b8e1..12302b6f7 100644 --- a/docker/opensuse-leap/docker_rm.sh +++ b/docker/opensuse-leap/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-suse-leap:1.0) docker image rm pm3-suse-leap:1.0 -docker image rm opensuse/leap diff --git a/docker/opensuse-tumbleweed/Dockerfile b/docker/opensuse-tumbleweed/Dockerfile index 169d087c3..8a18c7d43 100644 --- a/docker/opensuse-tumbleweed/Dockerfile +++ b/docker/opensuse-tumbleweed/Dockerfile @@ -2,14 +2,13 @@ FROM opensuse/tumbleweed ENV LANG C # libqt5-qtbase-devel skipped -RUN zypper --non-interactive install --no-recommends shadow sudo git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel bluez-devel python3-devel libopenssl-devel cross-arm-none-gcc12 cross-arm-none-newlib-devel +RUN zypper --non-interactive install --no-recommends shadow sudo git patterns-devel-base-devel_basis gcc-c++ readline-devel libbz2-devel liblz4-devel bluez-devel python3-devel libopenssl-devel cross-arm-none-gcc12 cross-arm-none-newlib-devel #RUN zypper addrepo https://download.opensuse.org/repositories/home:wkazubski/openSUSE_Tumbleweed/home:wkazubski.repo && \ # zypper --gpg-auto-import-keys refresh && \ # zypper --non-interactive install cross-arm-none-eabi-gcc12 cross-arm-none-eabi-newlib -RUN zypper --non-interactive install cmake python3 python3-pip && \ - python3 -m pip install ansicolors sslcrypto +RUN zypper --non-interactive install cmake python311 python311-pip python311-virtualenv RUN zypper --non-interactive install ocl-icd-devel diff --git a/docker/opensuse-tumbleweed/README.md b/docker/opensuse-tumbleweed/README.md index bd55e0c9d..282d3f4f7 100644 --- a/docker/opensuse-tumbleweed/README.md +++ b/docker/opensuse-tumbleweed/README.md @@ -16,5 +16,10 @@ Or if you want to run single test, ``` sudo zypper refresh && sudo zypper --non-interactive update make clean; make -j +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto tools/pm3_tests.sh --long +deactivate ``` diff --git a/docker/opensuse-tumbleweed/docker_rm.sh b/docker/opensuse-tumbleweed/docker_rm.sh index f4d019f2b..c4b1b1d53 100644 --- a/docker/opensuse-tumbleweed/docker_rm.sh +++ b/docker/opensuse-tumbleweed/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-suse-tumbleweed:1.0) docker image rm pm3-suse-tumbleweed:1.0 -docker image rm opensuse/tumbleweed diff --git a/docker/opensuse-tumbleweed/run_tests.sh b/docker/opensuse-tumbleweed/run_tests.sh index 9002131e9..bb613ffc0 100755 --- a/docker/opensuse-tumbleweed/run_tests.sh +++ b/docker/opensuse-tumbleweed/run_tests.sh @@ -5,4 +5,9 @@ # docker/opensuse-tumbleweed/run_tests.sh; sudo zypper refresh && sudo zypper --non-interactive update +python3 -m venv /tmp/venv +source /tmp/venv/bin/activate +python3 -m pip install --use-pep517 pyaes +python3 -m pip install ansicolors sslcrypto tools/release_tests.sh +deactivate diff --git a/docker/parrot-core-latest/Dockerfile b/docker/parrot-core-latest/Dockerfile index a33af1d4c..557ca4d17 100644 --- a/docker/parrot-core-latest/Dockerfile +++ b/docker/parrot-core-latest/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/parrot-core-latest/docker_rm.sh b/docker/parrot-core-latest/docker_rm.sh index 4874bdec5..9bf1605e5 100644 --- a/docker/parrot-core-latest/docker_rm.sh +++ b/docker/parrot-core-latest/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-parrotsec-core-latest:1.0) docker image rm pm3-parrotsec-core-latest:1.0 -docker image rm parrotsec/core:latest diff --git a/docker/ubuntu-18.04/Dockerfile b/docker/ubuntu-18.04/Dockerfile index 29c958a4d..f2747bc33 100644 --- a/docker/ubuntu-18.04/Dockerfile +++ b/docker/ubuntu-18.04/Dockerfile @@ -7,7 +7,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/ubuntu-18.04/docker_rm.sh b/docker/ubuntu-18.04/docker_rm.sh index c566f0e8d..20dcb80b2 100644 --- a/docker/ubuntu-18.04/docker_rm.sh +++ b/docker/ubuntu-18.04/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-ubuntu-18.04:1.0) docker image rm pm3-ubuntu-18.04:1.0 -docker image rm ubuntu:18.04 diff --git a/docker/ubuntu-20.04/Dockerfile b/docker/ubuntu-20.04/Dockerfile index 72f6ec6cf..8a1cf03ef 100644 --- a/docker/ubuntu-20.04/Dockerfile +++ b/docker/ubuntu-20.04/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/ubuntu-20.04/docker_rm.sh b/docker/ubuntu-20.04/docker_rm.sh index 37b6fd8b2..d71954339 100644 --- a/docker/ubuntu-20.04/docker_rm.sh +++ b/docker/ubuntu-20.04/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-ubuntu-20.04:1.0) docker image rm pm3-ubuntu-20.04:1.0 -docker image rm ubuntu:20.04 diff --git a/docker/ubuntu-22.04/Dockerfile b/docker/ubuntu-22.04/Dockerfile index 9d867e785..e2d93c665 100644 --- a/docker/ubuntu-22.04/Dockerfile +++ b/docker/ubuntu-22.04/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ - apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ + apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev sudo && \ apt-get clean RUN apt-get install -y python3-minimal && \ diff --git a/docker/ubuntu-22.04/docker_rm.sh b/docker/ubuntu-22.04/docker_rm.sh index e6a5f0302..d1b82948b 100644 --- a/docker/ubuntu-22.04/docker_rm.sh +++ b/docker/ubuntu-22.04/docker_rm.sh @@ -1,4 +1,4 @@ #!/bin/bash +docker rm $(docker ps -aq --filter ancestor=pm3-ubuntu-22.04:1.0) docker image rm pm3-ubuntu-22.04:1.0 -docker image rm ubuntu:22.04 diff --git a/fpga/Makefile b/fpga/Makefile index 068b75255..1731d4869 100644 --- a/fpga/Makefile +++ b/fpga/Makefile @@ -104,7 +104,6 @@ TARGET_COMMON_FILES += hi_flite.v TARGET_COMMON_FILES += hi_get_trace.v TARGET_COMMON_FILES += hi_iso14443a.v TARGET_COMMON_FILES += hi_reader.v -TARGET_COMMON_FILES += hi_reader_15.v TARGET_COMMON_FILES += hi_simulate.v TARGET_COMMON_FILES += hi_sniffer.v TARGET_COMMON_FILES += lf_edge_detect.v diff --git a/fpga/clk_divider.v b/fpga/clk_divider.v index 0bcc2e608..7cb9925f3 100644 --- a/fpga/clk_divider.v +++ b/fpga/clk_divider.v @@ -22,7 +22,7 @@ module clk_divider( ); reg [7:0] div_cnt_ = 0; - reg div_clk_; + reg div_clk_ = 0; assign div_cnt = div_cnt_; assign div_clk = div_clk_; diff --git a/fpga/define.v b/fpga/define.v index b7423278b..05cbd6d7e 100644 --- a/fpga/define.v +++ b/fpga/define.v @@ -129,6 +129,7 @@ `define FPGA_HF_READER_MODE_SNIFF_AMPLITUDE 6 `define FPGA_HF_READER_MODE_SNIFF_PHASE 7 `define FPGA_HF_READER_MODE_SEND_JAM 8 +`define FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4 9 `define FPGA_HF_READER_SUBCARRIER_848_KHZ 0 `define FPGA_HF_READER_SUBCARRIER_424_KHZ 1 diff --git a/fpga/fpga_icopyx_hf.bit b/fpga/fpga_icopyx_hf.bit index 053f5cce8..c49849667 100644 Binary files a/fpga/fpga_icopyx_hf.bit and b/fpga/fpga_icopyx_hf.bit differ diff --git a/fpga/fpga_icopyx_hf.v b/fpga/fpga_icopyx_hf.v index b7730875d..233c1aeab 100644 --- a/fpga/fpga_icopyx_hf.v +++ b/fpga/fpga_icopyx_hf.v @@ -20,14 +20,6 @@ // frequency modes, the FPGA might perform some demodulation first, to // reduce the amount of data that we must send to the ARM. //----------------------------------------------------------------------------- -//`include "define.v" - -//`include "hi_reader.v" -//`include "hi_simulate.v" -//`include "hi_iso14443a.v" -//`include "hi_flite.v" -//`include "hi_sniffer.v" -//`include "hi_get_trace.v" module fpga_hf( input spck, diff --git a/fpga/fpga_icopyx_lf.v b/fpga/fpga_icopyx_lf.v index 0ca4739b7..d1495498a 100644 --- a/fpga/fpga_icopyx_lf.v +++ b/fpga/fpga_icopyx_lf.v @@ -20,13 +20,6 @@ // frequency modes, the FPGA might perform some demodulation first, to // reduce the amount of data that we must send to the ARM. //----------------------------------------------------------------------------- -//`include "define.v" - -//`include "lo_read.v" -//`include "lo_passthru.v" -//`include "lo_edge_detect.v" -//`include "lo_adc.v" -//`include "clk_divider.v" module fpga_lf( input spck, @@ -78,7 +71,13 @@ reg [7:0] lf_ed_threshold; wire [7:0] pck_cnt; wire pck_divclk; reg [7:0] divisor; -clk_divider div_clk(pck0, divisor, pck_cnt, pck_divclk); + +clk_divider div_clk( + .clk (pck0), + .divisor (divisor), + .div_cnt (pck_cnt), + .div_clk (pck_divclk) +); // We switch modes between transmitting to the 13.56 MHz tag and receiving // from it, which means that we must make sure that we can do so without diff --git a/fpga/fpga_icopyx_top.v b/fpga/fpga_icopyx_top.v index 81aacb73c..39981e6cf 100644 --- a/fpga/fpga_icopyx_top.v +++ b/fpga/fpga_icopyx_top.v @@ -20,11 +20,6 @@ // frequency modes, the FPGA might perform some demodulation first, to // reduce the amount of data that we must send to the ARM. //----------------------------------------------------------------------------- -//`include "fpga_lf.v" -//`include "fpga_hf.v" -//`include "mux2_onein.v" -//`include "mux2_oneout.v" -//`include "util.v" module fpga_top( input spck, diff --git a/fpga/fpga_pm3_felica.bit b/fpga/fpga_pm3_felica.bit index 13338bda0..a60a914d2 100644 Binary files a/fpga/fpga_pm3_felica.bit and b/fpga/fpga_pm3_felica.bit differ diff --git a/fpga/fpga_pm3_hf.bit b/fpga/fpga_pm3_hf.bit index 3b9372dc0..1fd05b3e1 100644 Binary files a/fpga/fpga_pm3_hf.bit and b/fpga/fpga_pm3_hf.bit differ diff --git a/fpga/fpga_pm3_hf_15.bit b/fpga/fpga_pm3_hf_15.bit index 366c1c281..c19f86bed 100644 Binary files a/fpga/fpga_pm3_hf_15.bit and b/fpga/fpga_pm3_hf_15.bit differ diff --git a/fpga/fpga_pm3_lf.bit b/fpga/fpga_pm3_lf.bit index 864274cca..c00af088c 100644 Binary files a/fpga/fpga_pm3_lf.bit and b/fpga/fpga_pm3_lf.bit differ diff --git a/fpga/fpga_pm3_top.v b/fpga/fpga_pm3_top.v index 89bd2e56b..89b03d3ad 100644 --- a/fpga/fpga_pm3_top.v +++ b/fpga/fpga_pm3_top.v @@ -20,18 +20,8 @@ // frequency modes, the FPGA might perform some demodulation first, to // reduce the amount of data that we must send to the ARM. //----------------------------------------------------------------------------- -/* -Once upon a time the FPGA had a 16 input mux so we could have all LF and HF modules enabled and selectable -As the functionality grew, we run out of space in the FPGA and we had to split into an "LF only" and an "HF only" FPGA bitstream -But even then after a while it was not possible to fit all the HF functions at the same time so now we have multiple "HF only" bitstreams -For example "Felica but without ISO14443", or "ISO14443 but without Felica" or "HF_15 but without Felica and ISO14443" -Because of all of the above, you can not enable both HF and LF modes at the same time, because some LF modules outputs -map to the same mux inputs as some HF modules outputs (thanks to reducing the mux from 16 to 8 inputs) and you can not have -multiple outputs connected together therefore leading to a failed compilation -*/ - -// These defines are meant to be passed by the Makefile so do not uncomment them here +// These defines are for reference only, they are passed by the Makefile so do not uncomment them here // Proxmark3 RDV4 target //`define PM3RDV4 // Proxmark3 generic target @@ -64,20 +54,13 @@ multiple outputs connected together therefore leading to a failed compilation // WITH_HF5 enables module get trace //`define WITH_HF5 -//`include "define.v" -//`include "util.v" -// //`ifdef WITH_LF `include "clk_divider.v" `endif //`ifdef WITH_LF0 `include "lo_read.v" `endif //`ifdef WITH_LF1 `include "lo_edge_detect.v" `endif //`ifdef WITH_LF2 `include "lo_passthru.v" `endif //`ifdef WITH_LF3 `include "lo_adc.v" `endif // -//`ifdef WITH_HF_15 -//`ifdef WITH_HF0 `include "hi_reader_15.v" `endif -//`else //`ifdef WITH_HF0 `include "hi_reader.v" `endif -//`endif //`ifdef WITH_HF1 `include "hi_simulate.v" `endif //`ifdef WITH_HF2 `include "hi_iso14443a.v" `endif //`ifdef WITH_HF3 `include "hi_sniffer.v" `endif @@ -277,11 +260,7 @@ assign mux6_pwr_lo = 1'b1; // HF reader `ifdef WITH_HF0 -`ifdef WITH_HF_15 -hi_reader_15 hr( -`else hi_reader hr( -`endif .ck_1356meg (ck_1356megb), .adc_d (adc_d), .subcarrier_frequency (conf_word[5:4]), diff --git a/fpga/hi_flite.v b/fpga/hi_flite.v index ac9e7e069..8346e49f2 100644 --- a/fpga/hi_flite.v +++ b/fpga/hi_flite.v @@ -66,7 +66,7 @@ assign adc_clk = ck_1356meg; `define min_bitdelay_212 8 //minimum values and corresponding thresholds -reg [8:0] curmin=`imin; +reg [8:0] curmin=`imin; reg [8:0] curminthres=`ithrmin; reg [8:0] curmaxthres=`ithrmax; reg [8:0] curmax=`imax; @@ -75,10 +75,10 @@ reg [8:0] curmax=`imax; reg after_hysteresis = 1'b1; //state machine for envelope tracking -reg [1:0] state=1'd0; +reg [1:0] state = 1'd0; //lower edge detected, trying to detect first bit of SYNC (b24d, 1011001001001101) -reg try_sync=1'b0; +reg try_sync = 1'b0; //detected first sync bit, phase frozen reg did_sync=0; @@ -105,32 +105,32 @@ reg zero = 1'b0; // Manchester first halfbit low second high corresponds to this reg [8:0] ssp_cnt = 9'd0; always @(posedge adc_clk) - ssp_cnt <= (ssp_cnt + 1); + ssp_cnt <= (ssp_cnt + 1); //maybe change it so that ARM sends preamble as well. //then: ready bits sent to ARM, 8 bits sent from ARM (all ones), then preamble (all zeros, presumably) - which starts modulation always @(negedge adc_clk) begin - //count fc/64 - transfer bits to ARM at the rate they are received - if( ((~speed) && (ssp_cnt[5:0] == 6'b000000)) || (speed && (ssp_cnt[4:0] == 5'b00000))) - begin - ssp_clk <= 1'b1; - //send current bit (detected in SNIFF mode or the one being modulated in MOD mode, 0 otherwise) - ssp_din <= curbit; - end - if( ( (~speed) && (ssp_cnt[5:0] == 6'b100000)) ||(speed && ssp_cnt[4:0] == 5'b10000)) - ssp_clk <= 1'b0; + //count fc/64 - transfer bits to ARM at the rate they are received + if( ((~speed) && (ssp_cnt[5:0] == 6'b000000) ) || (speed && (ssp_cnt[4:0] == 5'b00000)) ) + begin + ssp_clk <= 1'b1; + //send current bit (detected in SNIFF mode or the one being modulated in MOD mode, 0 otherwise) + ssp_din <= curbit; + end + if( ( (~speed) && (ssp_cnt[5:0] == 6'b100000)) ||(speed && ssp_cnt[4:0] == 5'b10000)) + ssp_clk <= 1'b0; //create frame pulses. TBH, I still don't know what they do exactly, but they are crucial for ARM->FPGA transfer. If the frame is in the beginning of the byte, transfer slows to a crawl for some reason // took me a day to figure THAT out. - if(( (~speed) && (ssp_cnt[8:0] == 9'd31)) || (speed && ssp_cnt[7:0] == 8'd15)) - begin - ssp_frame <= 1'b1; - end - if(( (~speed) && (ssp_cnt[8:0] == 9'b1011111)) || (speed &&ssp_cnt[7:0] == 8'b101111) ) - begin - ssp_frame <= 1'b0; - end + if(( (~speed) && (ssp_cnt[8:0] == 9'd31)) || (speed && ssp_cnt[7:0] == 8'd15)) + begin + ssp_frame <= 1'b1; + end + if(( (~speed) && (ssp_cnt[8:0] == 9'b1011111)) || (speed &&ssp_cnt[7:0] == 8'b101111) ) + begin + ssp_frame <= 1'b0; + end end //previous signal value, mostly to detect SYNC @@ -144,206 +144,200 @@ reg[7:0] mid = 8'd128; // reg sending = 1'b0; // are we actively modulating? reg [11:0] bit_counts = 12'd0; // for timeslots. only support ts=0 for now, at 212 speed -512 fullbits from end of frame. One hopes. might remove those? - //we need some way to flush bit_counts triggers on mod_type changes don't compile reg dlay; always @(negedge adc_clk) // every data ping? begin - //envelope follow code... + //envelope follow code... //////////// - if (fccount == bitmlen) - begin + if (fccount == bitmlen) + begin if ((~try_sync) && (adc_d < curminthres) && disabl ) begin - fccount <= 1; - end - else - begin - fccount <= 0; - end - dlay <= ssp_dout; - if (bit_counts > 768) // should be over ts0 now, without ARM interference... stop counting... - begin - bit_counts <= 0; - end - else - if (power) - bit_counts <= 0; - else - bit_counts <= bit_counts + 1; + fccount <= 1; end else begin + fccount <= 0; + end + dlay <= ssp_dout; + if (bit_counts > 768) // should be over ts0 now, without ARM interference... stop counting... + begin + bit_counts <= 0; + end + else + if (power) + bit_counts <= 0; + else + bit_counts <= bit_counts + 1; + end + else + begin if((~try_sync) && (adc_d < curminthres) && disabl) begin - fccount <= 1; - end - else - begin - fccount <= fccount + 1; - end + fccount <= 1; end + else + begin + fccount <= fccount + 1; + end + end - // rising edge - if (adc_d > curmaxthres) - begin + // rising edge + if (adc_d > curmaxthres) + begin case (state) - 0: begin - curmax <= adc_d > `imax? adc_d : `imax; - state <= 2; + 0: begin + curmax <= adc_d > `imax? adc_d : `imax; + state <= 2; end - 1: begin - curminthres <= ((curmin >> 1) + (curmin >> 2) + (curmin >> 4) + (curmax >> 3) + (curmax >> 4)); //threshold: 0.1875 max + 0.8125 min - curmaxthres <= ((curmax >> 1) + (curmax >> 2) + (curmax >> 4) + (curmin >> 3) + (curmin >> 4)); - curmax <= adc_d > 155 ? adc_d : 155; // to hopefully prevent overflow from spikes going up to 255 - state <= 2; + 1: begin + curminthres <= ((curmin >> 1) + (curmin >> 2) + (curmin >> 4) + (curmax >> 3) + (curmax >> 4)); //threshold: 0.1875 max + 0.8125 min + curmaxthres <= ((curmax >> 1) + (curmax >> 2) + (curmax >> 4) + (curmin >> 3) + (curmin >> 4)); + curmax <= adc_d > 155 ? adc_d : 155; // to hopefully prevent overflow from spikes going up to 255 + state <= 2; end - 2: begin - if (adc_d > curmax) - curmax <= adc_d; - end - default: + 2: begin + if (adc_d > curmax) + curmax <= adc_d; + end + default: begin end endcase after_hysteresis <= 1'b1; if(try_sync) - tsinceedge <= 0; - end - else if (adc_d> 1) + (curmin >> 2) + (curmin >> 4) + (curmax >> 3) + (curmax >> 4)); curmaxthres <= ( (curmax >> 1) + (curmax >> 2) + (curmax >> 4) + (curmin >> 3) + (curmin >> 4)); curmin <= adc_d < `imin ? adc_d : `imin; state <= 1; - end - default: - begin - end - endcase - after_hysteresis <= 0; - if (~try_sync ) //begin modulation, lower edge... - begin - try_sync <= 1; - fccount <= 1; - did_sync <= 0; - curbit <= 0; - mid <= 8'd127; - tsinceedge <= 0; - prv <= 1; - end - else - begin - tsinceedge <= 0; - end - end - else //stable state, low or high - begin - curminthres <= ( (curmin >> 1) + (curmin >> 2) + (curmin >> 4) + (curmax >> 3) + (curmax >> 4)); - curmaxthres <= ( (curmax >> 1) + (curmax >> 2) + (curmax >> 4) + (curmin >> 3) + (curmin >> 4)); - state <= 0; - - if (try_sync ) - begin - if (tsinceedge >= (128)) - begin - //we might need to start counting... assuming ARM wants to reply to the frame. - bit_counts <= 1;// i think? 128 is about 2 bits passed... but 1 also works - try_sync <= 0; - did_sync <= 0;//desync - curmin <= `imin; //reset envelope - curmax <= `imax; - curminthres <= `ithrmin; - curmaxthres <= `ithrmax; - prv <= 1; - tsinceedge <= 0; - after_hysteresis <= 1'b1; - curbit <= 0; - mid <= 8'd128; - end - else - tsinceedge <= (tsinceedge + 1); - end - end - - - if (try_sync && tsinceedge < 128) + end + default: begin - //detect bits in their middle ssp sampling is in sync, so it would sample all bits in order - if (fccount == bithalf) - begin - if ((~did_sync) && ((prv == 1 && (mid > 128))||(prv == 0 && (mid <= 128)))) - begin - //sync the Zero, and set curbit roperly - did_sync <= 1'b1; - zero <= ~prv;// 1-prv - curbit <= 1; - end + end + endcase + after_hysteresis <= 0; + if (~try_sync ) //begin modulation, lower edge... + begin + try_sync <= 1; + fccount <= 1; + did_sync <= 0; + curbit <= 0; + mid <= 8'd127; + tsinceedge <= 0; + prv <= 1; + end + else + begin + tsinceedge <= 0; + end + end + else //stable state, low or high + begin + curminthres <= ( (curmin >> 1) + (curmin >> 2) + (curmin >> 4) + (curmax >> 3) + (curmax >> 4)); + curmaxthres <= ( (curmax >> 1) + (curmax >> 2) + (curmax >> 4) + (curmin >> 3) + (curmin >> 4)); + state <= 0; + + if (try_sync ) + begin + if (tsinceedge >= (128)) + begin + //we might need to start counting... assuming ARM wants to reply to the frame. + bit_counts <= 1;// i think? 128 is about 2 bits passed... but 1 also works + try_sync <= 0; + did_sync <= 0;//desync + curmin <= `imin; //reset envelope + curmax <= `imax; + curminthres <= `ithrmin; + curmaxthres <= `ithrmax; + prv <= 1; + tsinceedge <= 0; + after_hysteresis <= 1'b1; + curbit <= 0; + mid <= 8'd128; + end + else + tsinceedge <= (tsinceedge + 1); + end + end + + if (try_sync && tsinceedge < 128) + begin + //detect bits in their middle ssp sampling is in sync, so it would sample all bits in order + if (fccount == bithalf) + begin + if ((~did_sync) && ((prv == 1 && (mid > 128))||(prv == 0 && (mid <= 128)))) + begin + //sync the Zero, and set curbit roperly + did_sync <= 1'b1; + zero <= ~prv;// 1-prv + curbit <= 1; + end + else + curbit <= (mid > 128) ? (~zero) : zero; + + prv <= (mid > 128) ? 1 : 0; + + if (adc_d > curmaxthres) + mid <= 8'd129; + else if (adc_d < curminthres) + mid <= 8'd127; + else + begin + if (after_hysteresis) + begin + mid <= 8'd129; + end else - curbit <= (mid > 128) ? (~zero) : zero; - - prv <= (mid > 128) ? 1 : 0; - - if (adc_d > curmaxthres) - mid <= 8'd129; - else if (adc_d < curminthres) - mid <= 8'd127; - else - begin - if (after_hysteresis) - begin - mid <= 8'd129; - end - else - begin - mid <= 8'd127; - end - end - - end - else - begin - if (fccount==bitmlen) - begin - // fccount <= 0; - prv <= (mid > 128) ? 1 : 0; - mid <= 128; - end - else - begin + begin + mid <= 8'd127; + end + end + end + else + begin + if (fccount==bitmlen) + begin + // fccount <= 0; + prv <= (mid > 128) ? 1 : 0; + mid <= 128; + end + else + begin // minimum-maximum calc - if(adc_d > curmaxthres) - mid <= mid + 1; - else if (adc_d < curminthres) + if(adc_d > curmaxthres) + mid <= mid + 1; + else if (adc_d < curminthres) mid <= mid - 1; - else + else begin - if (after_hysteresis) - begin - mid <= mid + 1; - end - else - begin - mid <= mid - 1; - end + if (after_hysteresis) + begin + mid <= mid + 1; + end + else + begin + mid <= mid - 1; + end end - end - end end - else - begin - end -// sending <= 0; + end + end +// sending <= 0; end //put modulation here to maintain the correct clock. Seems that some readers are sensitive to that @@ -353,23 +347,23 @@ wire mod = ((fccount >= bithalf) ^ dlay) & (~disabl); always @(ck_1356meg or ssp_dout or power or disabl or mod) begin if (power) - begin + begin pwr_hi <= ck_1356meg; pwr_lo <= 1'b0; pwr_oe1 <= 1'b0;//mod; pwr_oe2 <= 1'b0;//mod; pwr_oe3 <= 1'b0;//mod; pwr_oe4 <= mod;//1'b0; - end + end else - begin + begin pwr_hi <= 1'b0; pwr_lo <= 1'b0; pwr_oe1 <= 1'b0; pwr_oe2 <= 1'b0; pwr_oe3 <= 1'b0; pwr_oe4 <= mod; - end + end end endmodule diff --git a/fpga/hi_get_trace.v b/fpga/hi_get_trace.v index 9bf32bc64..b577ff6be 100644 --- a/fpga/hi_get_trace.v +++ b/fpga/hi_get_trace.v @@ -13,7 +13,6 @@ // // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -//`include "define.v" module hi_get_trace( input ck_1356megb, @@ -106,13 +105,12 @@ begin write_enable1 <= 1'b0; write_enable2 <= 1'b0; if (previous_major_mode != `FPGA_MAJOR_MODE_OFF && previous_major_mode != `FPGA_MAJOR_MODE_HF_GET_TRACE) // just switched off - begin + begin start_addr <= addr; - end + end end end - // (2+1)k RAM reg [7:0] D_out1, D_out2; reg [7:0] ram1 [2047:0]; // 2048 u8 @@ -128,7 +126,7 @@ begin else D_out1 <= ram1[addr[10:0]]; if (write_enable2) -begin + begin ram2[addr[9:0]] <= adc_d; D_out2 <= adc_d; end @@ -136,7 +134,6 @@ begin D_out2 <= ram2[addr[9:0]]; end - reg [7:0] shift_out; always @(negedge ck_1356megb) @@ -151,10 +148,10 @@ begin shift_out <= D_out2; end else - begin - // or shift left - shift_out[7:1] <= shift_out[6:0]; - end + begin + // or shift left + shift_out[7:1] <= shift_out[6:0]; + end end ssp_clk <= ~clock_cnt[3]; // ssp_clk frequency = 13,56MHz / 16 = 847,5 kHz diff --git a/fpga/hi_iso14443a.v b/fpga/hi_iso14443a.v index 6fd450528..0ceac6d95 100644 --- a/fpga/hi_iso14443a.v +++ b/fpga/hi_iso14443a.v @@ -14,7 +14,6 @@ // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- // ISO14443-A support for the Proxmark III -//`include "define.v" module hi_iso14443a( input ck_1356meg, @@ -105,8 +104,6 @@ begin end end - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Tag -> PM3 // filter the input for a tag's signal. The filter box needs the 4 previous input values and is a gaussian derivative filter @@ -133,7 +130,6 @@ wire [9:0] tmp2 = adc_d_times_2 + input_prev_1; // convert intermediate signals to signed and calculate the filter output wire signed [10:0] adc_d_filtered = {1'b0, tmp1} - {1'b0, tmp2}; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // internal FPGA timing. Maximum required period is 128 carrier clock cycles for a full 8 Bit transfer to ARM. (i.e. we need a // 7 bit counter). Adjust its frequency to external reader's clock when simulating a tag or sniffing. @@ -177,7 +173,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Tag -> PM3: // determine best possible time for starting/resetting the modulation detector. @@ -209,7 +204,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Tag -> PM3: // modulation detector. Looks for the steepest falling and rising edges within a 16 clock period. If there is both a significant @@ -229,27 +223,27 @@ always @(negedge adc_clk) begin if(negedge_cnt[3:0] == mod_detect_reset_time) begin - if (mod_type == `FPGA_HF_ISO14443A_SNIFFER) - begin - // detect modulation signal: if modulating, there must have been a falling AND a rising edge - if ((rx_mod_falling_edge_max > `EDGE_DETECT_THRESHOLDHIGH) && (rx_mod_rising_edge_max < -`EDGE_DETECT_THRESHOLDHIGH)) - curbit <= 1'b1; // modulation - else - curbit <= 1'b0; // no modulation - end - else - begin - // detect modulation signal: if modulating, there must have been a falling AND a rising edge - if ((rx_mod_falling_edge_max > `EDGE_DETECT_THRESHOLD) && (rx_mod_rising_edge_max < -`EDGE_DETECT_THRESHOLD)) - curbit <= 1'b1; // modulation - else - curbit <= 1'b0; // no modulation - end + if (mod_type == `FPGA_HF_ISO14443A_SNIFFER) + begin + // detect modulation signal: if modulating, there must have been a falling AND a rising edge + if ((rx_mod_falling_edge_max > `EDGE_DETECT_THRESHOLDHIGH) && (rx_mod_rising_edge_max < -`EDGE_DETECT_THRESHOLDHIGH)) + curbit <= 1'b1; // modulation + else + curbit <= 1'b0; // no modulation + end + else + begin + // detect modulation signal: if modulating, there must have been a falling AND a rising edge + if ((rx_mod_falling_edge_max > `EDGE_DETECT_THRESHOLD) && (rx_mod_rising_edge_max < -`EDGE_DETECT_THRESHOLD)) + curbit <= 1'b1; // modulation + else + curbit <= 1'b0; // no modulation + end // reset modulation detector rx_mod_rising_edge_max <= 0; rx_mod_falling_edge_max <= 0; end - else // look for steepest edges (slopes) + else // look for steepest edges (slopes) begin if (adc_d_filtered > 0) begin @@ -265,7 +259,6 @@ begin end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Tag+Reader -> PM3 // sample 4 bits reader data and 4 bits tag data for sniffing @@ -281,7 +274,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PM3 -> Reader: // a delay line to ensure that we send the (emulated) tag's answer at the correct time according to ISO14443-3 @@ -304,7 +296,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PM3 -> Reader, internal timing: // a timer for the 1172 cycles fdt (Frame Delay Time). Start the timer with a rising edge of the reader's signal. @@ -367,7 +358,6 @@ begin if(fdt_counter == `FDT_INDICATOR_COUNT) fdt_indicator <= 1'b1; end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PM3 -> Reader or Tag // assign a modulation signal to the antenna. This signal is either a delayed signal (to achieve fdt when sending to a reader) @@ -396,7 +386,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // PM3 -> Reader // determine the required delay in the mod_sig_buf (set mod_sig_ptr). @@ -439,7 +428,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FPGA -> ARM communication: // buffer 8 bits data to be sent to ARM. Shift them out bit by bit. @@ -483,10 +471,8 @@ begin to_arm[7:1] <= to_arm[6:0]; end end - end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FPGA <-> ARM communication: // generate a ssp clock and ssp frame signal for the synchronous transfer from/to the ARM @@ -521,7 +507,6 @@ begin end end - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // FPGA -> ARM communication: // select the data to be sent to ARM @@ -566,7 +551,6 @@ assign sub_carrier = ~sub_carrier_cnt[3]; // in FPGA_HF_ISO14443A_READER_LISTEN: carrier always on; in other modes: carrier always off assign pwr_hi = (ck_1356meg & (((mod_type == `FPGA_HF_ISO14443A_READER_MOD) & ~mod_sig_coil) || (mod_type == `FPGA_HF_ISO14443A_READER_LISTEN))); - // Enable HF antenna drivers: assign pwr_oe1 = 1'b0; assign pwr_oe3 = 1'b0; diff --git a/fpga/hi_reader.v b/fpga/hi_reader.v index ffa2634d8..1a0b375d3 100644 --- a/fpga/hi_reader.v +++ b/fpga/hi_reader.v @@ -13,7 +13,7 @@ // // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -//`include "define.v" +// with optional support for iso15 2sc mode slected with compiler define WITH_HF_15 module hi_reader( input ck_1356meg, @@ -28,7 +28,7 @@ module hi_reader( output adc_clk, output pwr_lo, output reg pwr_hi, - output pwr_oe1, + output reg pwr_oe1, output pwr_oe2, output pwr_oe3, output reg pwr_oe4, @@ -63,7 +63,6 @@ begin end end - // Let us report a correlation every 64 samples. I.e. // one Q/I pair after 4 subcarrier cycles for the 848kHz subcarrier, // one Q/I pair after 2 subcarrier cycles for the 424kHz subcarriers, @@ -71,10 +70,105 @@ end // We need a 6-bit counter for the timing. reg [5:0] corr_i_cnt; always @(negedge adc_clk) -begin corr_i_cnt <= corr_i_cnt + 1; -end +`ifdef WITH_HF_15 +reg [1:0] fskout = 2'd0; +reg last0 = 1'b0; + +reg [7:0] avg = 8'd0; +reg [127:0] avg128 = 128'd0; +reg [7:0] diff16 = 8'd0; +reg [7:0] diff28 = 8'd0; +reg [7:0] diff32 = 8'd0; + +reg [11:0] match16 = 12'd0; +reg [11:0] match32 = 12'd0; +reg [11:0] match28 = 12'd0; + +always @(negedge adc_clk) +begin + if (corr_i_cnt[0] == 1'b0) // every 2 clock + avg = adc_d[7:1]; + else + begin + avg = avg + adc_d[7:1]; + if (corr_i_cnt[0] == 1'b1) // every 2 clock + begin + if (avg > avg128[63:56]) + diff16 = avg - avg128[63:56]; + else + diff16 = avg128[63:56] - avg; + + if (avg > avg128[111:104]) + diff28 = avg - avg128[111:104]; + else + diff28 = avg128[111:104] - avg; + + if (avg > avg128[127:120]) + diff32 = avg - avg128[127:120]; + else + diff32 = avg128[127:120] - avg; + + avg128[127:8] = avg128[119:0]; + avg128[7:0] = avg; + + if (corr_i_cnt[4:1] == 4'b0000) // every 32 clock (8*4) + begin + match16 = diff16; + match28 = diff28; + match32 = diff32; + end + else + begin + match16 = match16 + diff16; + match28 = match28 + diff28; + match32 = match32 + diff32; + + if (corr_i_cnt[4:1] == 4'b1111) // every 32 clock (8*4) + begin + last0 = (fskout == 2'b0); + if (match16 < 12'd64 && last0) + fskout = 2'b00; // not yet started + else if ((match16 | match28 | match32) == 12'b0) + fskout = 2'b00; // signal likely ended + else if (((match16 <= match28 + 12'd16) && (match16 <= match32+ 12'd16)) || + (match28 <= 12'd16 && match32 <= 12'd16)) + begin + if (!last0) + fskout = 2'b11; // 16 match better than 28 or 32 but already started + end + else + begin + if (match28 < match32) + begin + diff28 = match32 - match28; + diff16 = match16 - match28; + if (diff28*2 > diff16) + fskout = 2'b01; + else if (!last0) + begin + fskout = 2'b01; + end + end + else //if (match32 <= match28) + begin + diff32 = match28 - match32; + diff16 = match16 - match32; + if (diff32*2 > diff16) + fskout = 2'b10; + else if (!last0) + begin + fskout = 2'b10; + end + end + end + end + end + end + end +end +`endif // A couple of registers in which to accumulate the correlations. From the 64 samples // we would add at most 32 times the difference between unmodulated and modulated signal. It should @@ -89,7 +183,6 @@ reg signed [13:0] corr_q_accum; reg signed [7:0] corr_i_out; reg signed [7:0] corr_q_out; - // the amplitude of the subcarrier is sqrt(ci^2 + cq^2). // approximate by amplitude = max(|ci|,|cq|) + 1/2*min(|ci|,|cq|) reg [13:0] corr_amplitude, abs_ci, abs_cq, max_ci_cq; @@ -122,7 +215,6 @@ begin end - // The subcarrier reference signals reg subcarrier_I; reg subcarrier_Q; @@ -130,23 +222,22 @@ reg subcarrier_Q; always @(*) begin if (subcarrier_frequency == `FPGA_HF_READER_SUBCARRIER_848_KHZ) - begin - subcarrier_I = ~corr_i_cnt[3]; - subcarrier_Q = ~(corr_i_cnt[3] ^ corr_i_cnt[2]); - end + begin + subcarrier_I = ~corr_i_cnt[3]; + subcarrier_Q = ~(corr_i_cnt[3] ^ corr_i_cnt[2]); + end else if (subcarrier_frequency == `FPGA_HF_READER_SUBCARRIER_212_KHZ) - begin - subcarrier_I = ~corr_i_cnt[5]; - subcarrier_Q = ~(corr_i_cnt[5] ^ corr_i_cnt[4]); - end + begin + subcarrier_I = ~corr_i_cnt[5]; + subcarrier_Q = ~(corr_i_cnt[5] ^ corr_i_cnt[4]); + end else - begin // 424 kHz - subcarrier_I = ~corr_i_cnt[4]; - subcarrier_Q = ~(corr_i_cnt[4] ^ corr_i_cnt[3]); - end + begin // 424 kHz + subcarrier_I = ~corr_i_cnt[4]; + subcarrier_Q = ~(corr_i_cnt[4] ^ corr_i_cnt[3]); + end end - // ADC data appears on the rising edge, so sample it on the falling edge always @(negedge adc_clk) begin @@ -157,9 +248,20 @@ begin begin if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_AMPLITUDE) begin - // send amplitude plus 2 bits reader signal - corr_i_out <= corr_amplitude[13:6]; - corr_q_out <= {corr_amplitude[5:0], after_hysteresis_prev_prev, after_hysteresis_prev}; +`ifdef WITH_HF_15 + if (subcarrier_frequency == `FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ) + begin + // send amplitude + 2 bits fsk (2sc) signal + 2 bits reader signal + corr_i_out <= corr_amplitude[13:6]; + corr_q_out <= {corr_amplitude[5:2], fskout, after_hysteresis_prev_prev, after_hysteresis_prev}; + end + else +`endif + begin + // send amplitude plus 2 bits reader signal + corr_i_out <= corr_amplitude[13:6]; + corr_q_out <= {corr_amplitude[5:0], after_hysteresis_prev_prev, after_hysteresis_prev}; + end end else if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_IQ) begin @@ -183,13 +285,23 @@ begin end else if (minor_mode == `FPGA_HF_READER_MODE_RECEIVE_AMPLITUDE) begin - // send amplitude - corr_i_out <= {2'b00, corr_amplitude[13:8]}; - corr_q_out <= corr_amplitude[7:0]; +`ifdef WITH_HF_15 + if (subcarrier_frequency == `FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ) + begin + // send 2 bits fsk (2sc) signal + amplitude + corr_i_out <= {fskout, corr_amplitude[13:8]}; + corr_q_out <= corr_amplitude[7:0]; + end + else +`endif + begin + // send amplitude + corr_i_out <= {2'b00, corr_amplitude[13:8]}; + corr_q_out <= corr_amplitude[7:0]; + end end else if (minor_mode == `FPGA_HF_READER_MODE_RECEIVE_IQ) begin - // Send 8 bits of in phase tag signal if (corr_i_accum[13:11] == 3'b000 || corr_i_accum[13:11] == 3'b111) corr_i_out <= corr_i_accum[11:4]; @@ -251,7 +363,6 @@ begin end - // ssp clock and frame signal for communication to and from ARM // _____ _____ _____ _ // ssp_clk | |_____| |_____| |_____| @@ -262,7 +373,6 @@ end // // corr_i_cnt 0 1 2 3 4 5 6 7 8 9 10 11 12 ... // - always @(negedge adc_clk) begin if (corr_i_cnt[1:0] == 2'b00) @@ -280,10 +390,8 @@ begin ssp_frame <= 1'b0; end - assign ssp_din = corr_i_out[7]; - // a jamming signal reg jam_signal; reg [3:0] jam_counter; @@ -299,11 +407,19 @@ end always @(*) begin + pwr_oe1 = 1'b0; + pwr_oe4 = 1'b0; + if (minor_mode == `FPGA_HF_READER_MODE_SEND_SHALLOW_MOD) begin pwr_hi = ck_1356meg; pwr_oe4 = ssp_dout; end + else if (minor_mode == `FPGA_HF_READER_MODE_SEND_SHALLOW_MOD_RDV4) + begin + pwr_hi = ck_1356meg; + pwr_oe1 = ssp_dout; + end else if (minor_mode == `FPGA_HF_READER_MODE_SEND_FULL_MOD) begin pwr_hi = ck_1356meg & ~ssp_dout; @@ -328,13 +444,10 @@ begin end end -// always on -assign pwr_oe1 = 1'b0; -assign pwr_oe3 = 1'b0; - -// Unused. -assign pwr_lo = 1'b0; +// unused assign pwr_oe2 = 1'b0; +assign pwr_oe3 = 1'b0; +assign pwr_lo = 1'b0; // Debug Output assign debug = corr_i_cnt[3]; diff --git a/fpga/hi_reader_15.v b/fpga/hi_reader_15.v deleted file mode 100644 index ad41e771c..000000000 --- a/fpga/hi_reader_15.v +++ /dev/null @@ -1,459 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// See LICENSE.txt for the text of the license. -//----------------------------------------------------------------------------- -// modified to add support for iso15 2sc mode - -module hi_reader_15( - input ck_1356meg, - input [7:0] adc_d, - input [1:0] subcarrier_frequency, - input [3:0] minor_mode, - input ssp_dout, - - output ssp_din, - output reg ssp_frame, - output reg ssp_clk, - output adc_clk, - output pwr_lo, - output reg pwr_hi, - output pwr_oe1, - output pwr_oe2, - output pwr_oe3, - output reg pwr_oe4, - output debug -); - -assign adc_clk = ck_1356meg; // sample frequency is 13,56 MHz - -// When we're a reader, we just need to do the BPSK demod; but when we're an -// eavesdropper, we also need to pick out the commands sent by the reader, -// using AM. Do this the same way that we do it for the simulated tag. -reg after_hysteresis, after_hysteresis_prev, after_hysteresis_prev_prev; -reg [11:0] has_been_low_for; -always @(negedge adc_clk) -begin - if (& adc_d[7:0]) after_hysteresis <= 1'b1; - else if (~(| adc_d[7:0])) after_hysteresis <= 1'b0; - - if (after_hysteresis) - begin - has_been_low_for <= 12'd0; - end - else - begin - if (has_been_low_for == 12'd4095) - begin - has_been_low_for <= 12'd0; - after_hysteresis <= 1'b1; - end - else - has_been_low_for <= has_been_low_for + 1; - end -end - - -// Let us report a correlation every 64 samples. I.e. -// one Q/I pair after 4 subcarrier cycles for the 848kHz subcarrier, -// one Q/I pair after 2 subcarrier cycles for the 424kHz subcarriers, -// one Q/I pair for each subcarrier cyle for the 212kHz subcarrier. -// We need a 6-bit counter for the timing. -reg [5:0] corr_i_cnt; -always @(negedge adc_clk) -begin - corr_i_cnt <= corr_i_cnt + 1; -end - - -reg [1:0] fskout = 2'd0; -reg last0 = 1'b0; - -reg [7:0] avg = 8'd0; -reg [127:0] avg128 = 128'd0; -reg [7:0] diff16 = 8'd0; -reg [7:0] diff28 = 8'd0; -reg [7:0] diff32 = 8'd0; - -reg [11:0] match16 = 12'd0; -reg [11:0] match32 = 12'd0; -reg [11:0] match28 = 12'd0; - -always @(negedge adc_clk) -begin - if (corr_i_cnt[0] == 1'b0) // every 2 clock - begin - avg = adc_d[7:1]; - end - else - begin - avg = avg + adc_d[7:1]; - if (corr_i_cnt[0] == 1'b1) // every 2 clock - begin - if (avg > avg128[63:56]) - diff16 = avg - avg128[63:56]; - else - diff16 = avg128[63:56] - avg; - - if (avg > avg128[111:104]) - diff28 = avg - avg128[111:104]; - else - diff28 = avg128[111:104] - avg; - - if (avg > avg128[127:120]) - diff32 = avg - avg128[127:120]; - else - diff32 = avg128[127:120] - avg; - - avg128[127:8] = avg128[119:0]; - avg128[7:0] = avg; - - - if (corr_i_cnt[4:1] == 4'b0000) // every 32 clock (8*4) - begin - match16 = diff16; - match28 = diff28; - match32 = diff32; - end - else - begin - match16 = match16 + diff16; - match28 = match28 + diff28; - match32 = match32 + diff32; - - if (corr_i_cnt[4:1] == 4'b1111) // every 32 clock (8*4) - begin - last0 = (fskout == 2'b0); - if (match16 < 12'd64 && last0) - fskout = 2'b00; // not yet started - else if ((match16 | match28 | match32) == 12'b0) - fskout = 2'b00; // signal likely ended - else if (((match16 <= match28 + 12'd16) && (match16 <= match32+ 12'd16)) || - (match28 <= 12'd16 && match32 <= 12'd16)) - begin - if (!last0) - fskout = 2'b11; // 16 match better than 28 or 32 but already started - end - else - begin - if (match28 < match32) - begin - diff28 = match32 - match28; - diff16 = match16 - match28; - if (diff28*2 > diff16) - fskout = 2'b01; - else if (!last0) - begin - fskout = 2'b01; - end - end - else //if (match32 <= match28) - begin - diff32 = match28 - match32; - diff16 = match16 - match32; - if (diff32*2 > diff16) - fskout = 2'b10; - else if (!last0) - begin - fskout = 2'b10; - end - end - end - end - end - end - end -end - - -// A couple of registers in which to accumulate the correlations. From the 64 samples -// we would add at most 32 times the difference between unmodulated and modulated signal. It should -// be safe to assume that a tag will not be able to modulate the carrier signal by more than 25%. -// 32 * 255 * 0,25 = 2040, which can be held in 11 bits. Add 1 bit for sign. -// Temporary we might need more bits. For the 212kHz subcarrier we could possible add 32 times the -// maximum signal value before a first subtraction would occur. 32 * 255 = 8160 can be held in 13 bits. -// Add one bit for sign -> need 14 bit registers but final result will fit into 12 bits. -reg signed [13:0] corr_i_accum; -reg signed [13:0] corr_q_accum; -// we will report maximum 8 significant bits -reg signed [7:0] corr_i_out; -reg signed [7:0] corr_q_out; - - -// the amplitude of the subcarrier is sqrt(ci^2 + cq^2). -// approximate by amplitude = max(|ci|,|cq|) + 1/2*min(|ci|,|cq|) -reg [13:0] corr_amplitude, abs_ci, abs_cq, max_ci_cq; -reg [12:0] min_ci_cq_2; // min_ci_cq / 2 - -always @(*) -begin - if (corr_i_accum[13] == 1'b0) - abs_ci <= corr_i_accum; - else - abs_ci <= -corr_i_accum; - - if (corr_q_accum[13] == 1'b0) - abs_cq <= corr_q_accum; - else - abs_cq <= -corr_q_accum; - - if (abs_ci > abs_cq) - begin - max_ci_cq <= abs_ci; - min_ci_cq_2 <= abs_cq / 2; - end - else - begin - max_ci_cq <= abs_cq; - min_ci_cq_2 <= abs_ci / 2; - end - - corr_amplitude <= max_ci_cq + min_ci_cq_2; - -end - - -// The subcarrier reference signals -reg subcarrier_I; -reg subcarrier_Q; - -always @(*) -begin - if (subcarrier_frequency == `FPGA_HF_READER_SUBCARRIER_848_KHZ) - begin - subcarrier_I = ~corr_i_cnt[3]; - subcarrier_Q = ~(corr_i_cnt[3] ^ corr_i_cnt[2]); - end - else if (subcarrier_frequency == `FPGA_HF_READER_SUBCARRIER_212_KHZ) - begin - subcarrier_I = ~corr_i_cnt[5]; - subcarrier_Q = ~(corr_i_cnt[5] ^ corr_i_cnt[4]); - end - else - begin // 424 kHz - subcarrier_I = ~corr_i_cnt[4]; - subcarrier_Q = ~(corr_i_cnt[4] ^ corr_i_cnt[3]); - end -end - - -// ADC data appears on the rising edge, so sample it on the falling edge -always @(negedge adc_clk) -begin - // These are the correlators: we correlate against in-phase and quadrature - // versions of our reference signal, and keep the (signed) results or the - // resulting amplitude to send out later over the SSP. - if (corr_i_cnt == 6'd0) - begin - if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_AMPLITUDE) - begin - if (subcarrier_frequency == `FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ) - begin - // send amplitude + 2 bits fsk (2sc) signal + 2 bits reader signal - corr_i_out <= corr_amplitude[13:6]; - corr_q_out <= {corr_amplitude[5:2], fskout, after_hysteresis_prev_prev, after_hysteresis_prev}; - end - else - begin - // send amplitude plus 2 bits reader signal - corr_i_out <= corr_amplitude[13:6]; - corr_q_out <= {corr_amplitude[5:0], after_hysteresis_prev_prev, after_hysteresis_prev}; - end - end - else if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_IQ) - begin - // Send 7 most significant bits of in phase tag signal (signed), plus 1 bit reader signal - if (corr_i_accum[13:11] == 3'b000 || corr_i_accum[13:11] == 3'b111) - corr_i_out <= {corr_i_accum[11:5], after_hysteresis_prev_prev}; - else // truncate to maximum value - if (corr_i_accum[13] == 1'b0) - corr_i_out <= {7'b0111111, after_hysteresis_prev_prev}; - else - corr_i_out <= {7'b1000000, after_hysteresis_prev_prev}; - - // Send 7 most significant bits of quadrature phase tag signal (signed), plus 1 bit reader signal - if (corr_q_accum[13:11] == 3'b000 || corr_q_accum[13:11] == 3'b111) - corr_q_out <= {corr_q_accum[11:5], after_hysteresis_prev}; - else // truncate to maximum value - if (corr_q_accum[13] == 1'b0) - corr_q_out <= {7'b0111111, after_hysteresis_prev}; - else - corr_q_out <= {7'b1000000, after_hysteresis_prev}; - end - else if (minor_mode == `FPGA_HF_READER_MODE_RECEIVE_AMPLITUDE) - begin - if (subcarrier_frequency == `FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ) - begin - // send 2 bits fsk (2sc) signal + amplitude - corr_i_out <= {fskout, corr_amplitude[13:8]}; - corr_q_out <= corr_amplitude[7:0]; - end - else - begin - // send amplitude - corr_i_out <= {2'b00, corr_amplitude[13:8]}; - corr_q_out <= corr_amplitude[7:0]; - end - end - else if (minor_mode == `FPGA_HF_READER_MODE_RECEIVE_IQ) - begin - // Send 8 bits of in phase tag signal - if (corr_i_accum[13:11] == 3'b000 || corr_i_accum[13:11] == 3'b111) - corr_i_out <= corr_i_accum[11:4]; - else // truncate to maximum value - if (corr_i_accum[13] == 1'b0) - corr_i_out <= 8'b01111111; - else - corr_i_out <= 8'b10000000; - - // Send 8 bits of quadrature phase tag signal - if (corr_q_accum[13:11] == 3'b000 || corr_q_accum[13:11] == 3'b111) - corr_q_out <= corr_q_accum[11:4]; - else // truncate to maximum value - if (corr_q_accum[13] == 1'b0) - corr_q_out <= 8'b01111111; - else - corr_q_out <= 8'b10000000; - end - - // for each Q/I pair report two reader signal samples when sniffing. Store the 1st. - after_hysteresis_prev_prev <= after_hysteresis; - - // Initialize next correlation. - // Both I and Q reference signals are high when corr_i_nct == 0. Therefore need to accumulate. - corr_i_accum <= $signed({1'b0, adc_d}); - corr_q_accum <= $signed({1'b0, adc_d}); - end - else - begin - if (subcarrier_I) - corr_i_accum <= corr_i_accum + $signed({1'b0, adc_d}); - else - corr_i_accum <= corr_i_accum - $signed({1'b0, adc_d}); - - if (subcarrier_Q) - corr_q_accum <= corr_q_accum + $signed({1'b0, adc_d}); - else - corr_q_accum <= corr_q_accum - $signed({1'b0, adc_d}); - end - - // for each Q/I pair report two reader signal samples when sniffing. Store the 2nd. - if (corr_i_cnt == 6'd32) - after_hysteresis_prev <= after_hysteresis; - - // Then the result from last time is serialized and send out to the ARM. - // We get one report each cycle, and each report is 16 bits, so the - // ssp_clk should be the adc_clk divided by 64/16 = 4. - // ssp_clk frequency = 13,56MHz / 4 = 3.39MHz - - if (corr_i_cnt[1:0] == 2'b00) - begin - // Don't shift if we just loaded new data, obviously. - if (corr_i_cnt != 6'd0) - begin - corr_i_out[7:0] <= {corr_i_out[6:0], corr_q_out[7]}; - corr_q_out[7:1] <= corr_q_out[6:0]; - end - end - -end - - -// ssp clock and frame signal for communication to and from ARM -// _____ _____ _____ _ -// ssp_clk | |_____| |_____| |_____| -// _____ -// ssp_frame ___| |____________________________ -// ___________ ___________ ___________ _ -// ssp_d_in X___________X___________X___________X_ -// -// corr_i_cnt 0 1 2 3 4 5 6 7 8 9 10 11 12 ... -// - -always @(negedge adc_clk) -begin - if (corr_i_cnt[1:0] == 2'b00) - ssp_clk <= 1'b1; - - if (corr_i_cnt[1:0] == 2'b10) - ssp_clk <= 1'b0; - - // set ssp_frame signal for corr_i_cnt = 1..3 - // (send one frame with 16 Bits) - if (corr_i_cnt == 6'd1) - ssp_frame <= 1'b1; - - if (corr_i_cnt == 6'd3) - ssp_frame <= 1'b0; -end - - -assign ssp_din = corr_i_out[7]; - - -// a jamming signal -reg jam_signal; -reg [3:0] jam_counter; - -always @(negedge adc_clk) -begin - if (corr_i_cnt == 6'd0) - begin - jam_counter <= jam_counter + 1; - jam_signal <= jam_counter[1] ^ jam_counter[3]; - end -end - -always @(*) -begin - if (minor_mode == `FPGA_HF_READER_MODE_SEND_SHALLOW_MOD) - begin - pwr_hi = ck_1356meg; - pwr_oe4 = ssp_dout; - end - else if (minor_mode == `FPGA_HF_READER_MODE_SEND_FULL_MOD) - begin - pwr_hi = ck_1356meg & ~ssp_dout; - pwr_oe4 = 1'b0; - end - else if (minor_mode == `FPGA_HF_READER_MODE_SEND_JAM) - begin - pwr_hi = ck_1356meg & jam_signal; - pwr_oe4 = 1'b0; - end - else if (minor_mode == `FPGA_HF_READER_MODE_SNIFF_IQ - || minor_mode == `FPGA_HF_READER_MODE_SNIFF_AMPLITUDE - || minor_mode == `FPGA_HF_READER_MODE_SNIFF_PHASE) - begin // all off - pwr_hi = 1'b0; - pwr_oe4 = 1'b0; - end - else // receiving from tag - begin - pwr_hi = ck_1356meg; - pwr_oe4 = 1'b0; - end -end - -// always on -assign pwr_oe1 = 1'b0; -assign pwr_oe3 = 1'b0; - -// Unused. -assign pwr_lo = 1'b0; -assign pwr_oe2 = 1'b0; - -// Debug Output -assign debug = corr_i_cnt[3]; - -endmodule diff --git a/fpga/hi_simulate.v b/fpga/hi_simulate.v index 97346eb9b..77b9a44ed 100644 --- a/fpga/hi_simulate.v +++ b/fpga/hi_simulate.v @@ -30,7 +30,6 @@ // // Jonathan Westhues, October 2006 //----------------------------------------------------------------------------- -//`include "define.v" module hi_simulate( input ck_1356meg, @@ -89,7 +88,6 @@ begin end end - // Divide 13.56 MHz to produce various frequencies for SSP_CLK // and modulation. reg [8:0] ssp_clk_divider; @@ -100,17 +98,16 @@ always @(negedge adc_clk) always @(negedge adc_clk) begin if (mod_type == `FPGA_HF_SIMULATOR_MODULATE_424K_8BIT) - // Get bit every at 53KHz (every 8th carrier bit of 424kHz) - ssp_clk <= ~ssp_clk_divider[7]; + // Get bit every at 53KHz (every 8th carrier bit of 424kHz) + ssp_clk <= ~ssp_clk_divider[7]; else if (mod_type == `FPGA_HF_SIMULATOR_MODULATE_212K) - // Get next bit at 212kHz - ssp_clk <= ~ssp_clk_divider[5]; + // Get next bit at 212kHz + ssp_clk <= ~ssp_clk_divider[5]; else - // Get next bit at 424kHz - ssp_clk <= ~ssp_clk_divider[4]; + // Get next bit at 424kHz + ssp_clk <= ~ssp_clk_divider[4]; end - // Produce the byte framing signal; the phase of this signal // is arbitrary, because it's just a bit stream in this module. always @(negedge adc_clk) @@ -131,7 +128,6 @@ begin end end - // Synchronize up the after-hysteresis signal, to produce DIN. always @(posedge ssp_clk) ssp_din = after_hysteresis; @@ -148,9 +144,7 @@ always @(*) else if(mod_type == `FPGA_HF_SIMULATOR_MODULATE_424K || mod_type == `FPGA_HF_SIMULATOR_MODULATE_424K_8BIT) modulating_carrier <= ssp_dout & ssp_clk_divider[4]; // switch 424kHz modulation on/off else - modulating_carrier <= 1'b0; // yet unused - - + modulating_carrier <= 1'b0; // yet unused // Load modulation. Toggle only one of these, since we are already producing much deeper // modulation than a real tag would. diff --git a/fpga/hi_sniffer.v b/fpga/hi_sniffer.v index 11781ca5a..8cfb0fe9a 100644 --- a/fpga/hi_sniffer.v +++ b/fpga/hi_sniffer.v @@ -48,10 +48,7 @@ assign ssp_din = adc_d_out[0]; always @(posedge ssp_clk) begin - if(ssp_cnt[2:0] == 3'd7) - ssp_cnt[2:0] <= 3'd0; - else - ssp_cnt <= ssp_cnt + 1; + ssp_cnt <= ssp_cnt + 1; if(ssp_cnt[2:0] == 3'b000) // set frame length begin diff --git a/fpga/lf_edge_detect.v b/fpga/lf_edge_detect.v index 2a58331d1..27d7f6901 100644 --- a/fpga/lf_edge_detect.v +++ b/fpga/lf_edge_detect.v @@ -1,4 +1,3 @@ - //----------------------------------------------------------------------------- // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. // @@ -15,9 +14,6 @@ // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -// input clk is 24MHz -//`include "min_max_tracker.v" - module lf_edge_detect( input clk, input [7:0] adc_d, @@ -33,73 +29,74 @@ module lf_edge_detect( output edge_toggle ); - min_max_tracker tracker( - .clk (clk), - .adc_d (adc_d), - .threshold (lf_ed_threshold), - .min (min), - .max (max) +min_max_tracker tracker( + .clk (clk), + .adc_d (adc_d), + .threshold (lf_ed_threshold), + .min (min), + .max (max) ); - // auto-tune - assign high_threshold = (max + min) / 2 + (max - min) / 4; - assign highz_threshold = (max + min) / 2 + (max - min) / 8; - assign lowz_threshold = (max + min) / 2 - (max - min) / 8; - assign low_threshold = (max + min) / 2 - (max - min) / 4; +// auto-tune +assign high_threshold = (max + min) / 2 + (max - min) / 4; +assign highz_threshold = (max + min) / 2 + (max - min) / 8; +assign lowz_threshold = (max + min) / 2 - (max - min) / 8; +assign low_threshold = (max + min) / 2 - (max - min) / 4; - // heuristic to see if it makes sense to try to detect an edge - wire enabled = - (high_threshold > highz_threshold) - & (highz_threshold > lowz_threshold) - & (lowz_threshold > low_threshold) - & ((high_threshold - highz_threshold) > 8) - & ((highz_threshold - lowz_threshold) > 16) - & ((lowz_threshold - low_threshold) > 8); +// heuristic to see if it makes sense to try to detect an edge +wire enabled = + (high_threshold > highz_threshold) + & (highz_threshold > lowz_threshold) + & (lowz_threshold > low_threshold) + & ((high_threshold - highz_threshold) > 8) + & ((highz_threshold - lowz_threshold) > 16) + & ((lowz_threshold - low_threshold) > 8); - // Toggle the output with hysteresis - // Set to high if the ADC value is above the threshold - // Set to low if the ADC value is below the threshold - reg is_high = 0; - reg is_low = 0; - reg is_zero = 0; - reg trigger_enabled = 1; - reg output_edge = 0; - reg output_state; +// Toggle the output with hysteresis +// Set to high if the ADC value is above the threshold +// Set to low if the ADC value is below the threshold +reg is_high = 0; +reg is_low = 0; +reg is_zero = 0; +reg trigger_enabled = 1; +reg output_edge = 0; +reg output_state; - always @(posedge clk) +always @(posedge clk) +begin + is_high <= (adc_d >= high_threshold); + is_low <= (adc_d <= low_threshold); + is_zero <= ((adc_d > lowz_threshold) & (adc_d < highz_threshold)); +end + +// all edges detection +always @(posedge clk) +if (enabled) +begin + // To enable detecting two consecutive peaks at the same level + // (low or high) we check whether or not we went back near 0 in-between. + // This extra check is necessary to prevent from noise artifacts + // around the threshold values. + if (trigger_enabled & (is_high | is_low)) begin - is_high <= (adc_d >= high_threshold); - is_low <= (adc_d <= low_threshold); - is_zero <= ((adc_d > lowz_threshold) & (adc_d < highz_threshold)); + output_edge <= ~output_edge; + trigger_enabled <= 0; end + else + trigger_enabled <= trigger_enabled | is_zero; +end - // all edges detection - always @(posedge clk) - if (enabled) - begin - // To enable detecting two consecutive peaks at the same level - // (low or high) we check whether or not we went back near 0 in-between. - // This extra check is necessary to prevent from noise artifacts - // around the threshold values. - if (trigger_enabled & (is_high | is_low)) - begin - output_edge <= ~output_edge; - trigger_enabled <= 0; - end else - trigger_enabled <= trigger_enabled | is_zero; - end +// edge states +always @(posedge clk) +if (enabled) +begin + if (is_high) + output_state <= 1'd1; + else if (is_low) + output_state <= 1'd0; +end - // edge states - always @(posedge clk) - if (enabled) - begin - if (is_high) - output_state <= 1'd1; - else if (is_low) - output_state <= 1'd0; - end - - assign edge_state = output_state; - assign edge_toggle = output_edge; +assign edge_state = output_state; +assign edge_toggle = output_edge; endmodule diff --git a/fpga/lo_edge_detect.v b/fpga/lo_edge_detect.v index c820466f7..c29fdccb3 100644 --- a/fpga/lo_edge_detect.v +++ b/fpga/lo_edge_detect.v @@ -25,9 +25,6 @@ // - ssp_frame (wired to TIOA1 on the arm) for the edge detection/state // - ssp_clk: cross_lo -//`include "lp20khz_1MSa_iir_filter.v" -//`include "lf_edge_detect.v" - module lo_edge_detect( input pck0, input pck_divclk, @@ -54,8 +51,8 @@ wire tag_modulation = ssp_dout & !lf_field; wire reader_modulation = !ssp_dout & lf_field & pck_divclk; // No logic, straight through. -assign pwr_oe1 = 1'b0; // not used in LF mode -assign pwr_oe3 = 1'b0; // base antenna load = 33 Ohms +assign pwr_oe1 = 1'b0; // not used in LF mode +assign pwr_oe3 = 1'b0; // base antenna load = 33 Ohms // when modulating, add another 33 Ohms and 10k Ohms in parallel: assign pwr_oe2 = tag_modulation; assign pwr_oe4 = tag_modulation; diff --git a/fpga/lo_read.v b/fpga/lo_read.v index 06bd0ae5a..87279e8ec 100644 --- a/fpga/lo_read.v +++ b/fpga/lo_read.v @@ -51,13 +51,10 @@ reg [7:0] to_arm_shiftreg; // we read the ADC value when pck_cnt=7 and shift it out on counts 8..15 always @(posedge pck0) begin - if((pck_cnt == 8'd7) && !pck_divclk) + if ((pck_cnt == 8'd7) && !pck_divclk) to_arm_shiftreg <= adc_d; else - begin - to_arm_shiftreg[7:1] <= to_arm_shiftreg[6:0]; - to_arm_shiftreg[0] <= 1'b0; - end + to_arm_shiftreg <= {to_arm_shiftreg[6:0], 1'b0}; end // ADC samples on falling edge of adc_clk, data available on the rising edge @@ -73,14 +70,15 @@ end // _ _ _ _ _ _ _ _ _ _ // ssp_clk |_| |_| |_| |_| |_| |_| |_| |_| |_| |_ -// serialized SSP data is gated by ant_lo to suppress unwanted signal +// serialized SSP data is gated by pck_divclk to suppress unwanted signal assign ssp_din = to_arm_shiftreg[7] && !pck_divclk; // SSP clock always runs at 24MHz assign ssp_clk = pck0; -// SSP frame is gated by ant_lo and goes high when pck_divider=8..15 +// SSP frame is gated by pck_divclk and goes high when pck_cnt=8..15 assign ssp_frame = (pck_cnt[7:3] == 5'd1) && !pck_divclk; // unused signals tied low assign pwr_hi = 1'b0; +// always on outputs, unused assign pwr_oe1 = 1'b0; assign pwr_oe2 = 1'b0; assign pwr_oe3 = 1'b0; diff --git a/fpga/min_max_tracker.v b/fpga/min_max_tracker.v index 2f6e06017..2aaab66bb 100644 --- a/fpga/min_max_tracker.v +++ b/fpga/min_max_tracker.v @@ -31,50 +31,50 @@ module min_max_tracker( output [7:0] max ); - reg [7:0] min_val = 255; - reg [7:0] max_val = 0; - reg [7:0] cur_min_val = 255; - reg [7:0] cur_max_val = 0; - reg [1:0] state = 0; +reg [7:0] min_val = 255; +reg [7:0] max_val = 0; +reg [7:0] cur_min_val = 255; +reg [7:0] cur_max_val = 0; +reg [1:0] state = 0; - always @(posedge clk) - begin - case (state) - 0: // initialize - begin - if (cur_max_val >= ({1'b0, adc_d} + threshold)) - state <= 2; - else if (adc_d >= ({1'b0, cur_min_val} + threshold)) - state <= 1; - if (cur_max_val <= adc_d) - cur_max_val <= adc_d; - else if (adc_d <= cur_min_val) - cur_min_val <= adc_d; +always @(posedge clk) +begin + case (state) + 0: // initialize + begin + if (cur_max_val >= ({1'b0, adc_d} + threshold)) + state <= 2; + else if (adc_d >= ({1'b0, cur_min_val} + threshold)) + state <= 1; + if (cur_max_val <= adc_d) + cur_max_val <= adc_d; + else if (adc_d <= cur_min_val) + cur_min_val <= adc_d; + end + 1: // high phase + begin + if (cur_max_val <= adc_d) + cur_max_val <= adc_d; + else if (({1'b0, adc_d} + threshold) <= cur_max_val) begin + state <= 2; + cur_min_val <= adc_d; + max_val <= cur_max_val; end - 1: // high phase - begin - if (cur_max_val <= adc_d) - cur_max_val <= adc_d; - else if (({1'b0, adc_d} + threshold) <= cur_max_val) begin - state <= 2; - cur_min_val <= adc_d; - max_val <= cur_max_val; - end + end + 2: // low phase + begin + if (adc_d <= cur_min_val) + cur_min_val <= adc_d; + else if (adc_d >= ({1'b0, cur_min_val} + threshold)) begin + state <= 1; + cur_max_val <= adc_d; + min_val <= cur_min_val; end - 2: // low phase - begin - if (adc_d <= cur_min_val) - cur_min_val <= adc_d; - else if (adc_d >= ({1'b0, cur_min_val} + threshold)) begin - state <= 1; - cur_max_val <= adc_d; - min_val <= cur_min_val; - end - end - endcase - end + end + endcase +end - assign min = min_val; - assign max = max_val; +assign min = min_val; +assign max = max_val; endmodule diff --git a/fpga/mux16.v b/fpga/mux16.v index 1d9777706..b22ee6bf7 100644 --- a/fpga/mux16.v +++ b/fpga/mux16.v @@ -13,9 +13,6 @@ // // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -// -// General-purpose miscellany. -// // 16 inputs to 1 output multiplexer module mux16( diff --git a/fpga/mux2_onein.v b/fpga/mux2_onein.v index baefa72c8..24a53bbe4 100644 --- a/fpga/mux2_onein.v +++ b/fpga/mux2_onein.v @@ -1,9 +1,20 @@ //----------------------------------------------------------------------------- -// Two way MUX. +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. // -// kombi, 2020.05 +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- +// 2 inputs to 1 output multiplexer module mux2_one( input [1:0] sel, output reg y, diff --git a/fpga/mux2_oneout.v b/fpga/mux2_oneout.v index fa61205a2..d312b68c6 100644 --- a/fpga/mux2_oneout.v +++ b/fpga/mux2_oneout.v @@ -1,9 +1,20 @@ //----------------------------------------------------------------------------- -// Two way MUX. +// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details. // -// kombi, 2020.05 +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- +// 1 input to 2 outputs multiplexer module mux2_oneout( input [1:0] sel, input y, diff --git a/fpga/mux8.v b/fpga/mux8.v index d9118d243..1918db2d8 100644 --- a/fpga/mux8.v +++ b/fpga/mux8.v @@ -13,9 +13,6 @@ // // See LICENSE.txt for the text of the license. //----------------------------------------------------------------------------- -// -// General-purpose miscellany. -// // 8 inputs to 1 output multiplexer module mux8( diff --git a/include/at91sam7s512.h b/include/at91sam7s512.h index b43f0dbb1..25e03506e 100644 --- a/include/at91sam7s512.h +++ b/include/at91sam7s512.h @@ -1,7 +1,7 @@ // ---------------------------------------------------------------------------- // ATMEL Microcontroller Software Support - ROUSSET - // ---------------------------------------------------------------------------- -// Copyright (c) 2006, Atmel Corporation +// Copyright (c) 2008, Atmel Corporation // // All rights reserved. // @@ -27,14 +27,14 @@ // ---------------------------------------------------------------------------- // File Name : AT91SAM7S512.h // Object : AT91SAM7S512 definitions -// Generated : AT91 SW Application Group 07/07/2008 (16:13:20) +// Generated : AT91 SW Application Group 01/23/2009 (11:51:35) // -// CVS Reference : /AT91SAM7S512.pl/1.6/Wed Aug 30 14:08:44 2006// +// CVS Reference : /AT91SAM7S512.pl/1.6/Wed Jan 21 10:52:45 2009// // CVS Reference : /SYS_SAM7S.pl/1.2/Thu Feb 3 10:47:39 2005// // CVS Reference : /MC_SAM7SE.pl/1.10/Thu Feb 16 16:35:28 2006// // CVS Reference : /PMC_SAM7S_USB.pl/1.4/Tue Feb 8 14:00:19 2005// // CVS Reference : /RSTC_SAM7S.pl/1.2/Wed Jul 13 15:25:17 2005// -// CVS Reference : /UDP_4ept.pl/1.1/Thu Aug 3 12:26:00 2006// +// CVS Reference : /UDP_4ept.pl/1.1/Wed Jan 21 10:53:24 2009// // CVS Reference : /PWM_SAM7S.pl/1.1/Tue May 10 12:38:54 2005// // CVS Reference : /AIC_6075B.pl/1.3/Fri May 20 14:21:42 2005// // CVS Reference : /PIO_6057A.pl/1.2/Thu Feb 3 10:29:42 2005// @@ -48,7 +48,7 @@ // CVS Reference : /US_6089C.pl/1.1/Mon Jan 31 13:56:02 2005// // CVS Reference : /SSC_6078A.pl/1.1/Tue Jul 13 07:10:41 2004// // CVS Reference : /TWI_6061A.pl/1.2/Fri Oct 27 11:40:48 2006// -// CVS Reference : /TC_6082A.pl/1.7/Wed Mar 9 16:31:51 2005// +// CVS Reference : /TC_6082A.pl/1.8/Fri Oct 17 13:27:58 2008// // CVS Reference : /ADC_6051C.pl/1.1/Mon Jan 31 13:12:40 2005// // CVS Reference : /EBI_SAM7SE512.pl/1.22/Fri Nov 18 17:47:47 2005// // CVS Reference : /SMC_1783A.pl/1.4/Thu Feb 3 10:30:06 2005// @@ -337,7 +337,7 @@ typedef struct _AT91S_DBGU { #define DBGU_RHR (AT91_CAST(AT91_REG *) 0x00000018) // (DBGU_RHR) Receiver Holding Register #define DBGU_THR (AT91_CAST(AT91_REG *) 0x0000001C) // (DBGU_THR) Transmitter Holding Register #define DBGU_BRGR (AT91_CAST(AT91_REG *) 0x00000020) // (DBGU_BRGR) Baud Rate Generator Register -//#define DBGU_CIDR (AT91_CAST(AT91_REG *) 0x00000040) // (DBGU_CIDR) Chip ID Register +#define DBGU_CIDR (AT91_CAST(AT91_REG *) 0x00000040) // (DBGU_CIDR) Chip ID Register #define DBGU_EXID (AT91_CAST(AT91_REG *) 0x00000044) // (DBGU_EXID) Chip ID Extension Register #define DBGU_FNTR (AT91_CAST(AT91_REG *) 0x00000048) // (DBGU_FNTR) Force NTRST Register @@ -1455,12 +1455,12 @@ typedef struct _AT91S_TC { #define AT91C_TC_CPCTRG (0x1 << 14) // (TC) RC Compare Trigger Enable #define AT91C_TC_WAVE (0x1 << 15) // (TC) #define AT91C_TC_ACPA (0x3 << 16) // (TC) RA Compare Effect on TIOA -#define T91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none +#define AT91C_TC_ACPA_NONE (0x0 << 16) // (TC) Effect: none #define AT91C_TC_ACPA_SET (0x1 << 16) // (TC) Effect: set #define AT91C_TC_ACPA_CLEAR (0x2 << 16) // (TC) Effect: clear #define AT91C_TC_ACPA_TOGGLE (0x3 << 16) // (TC) Effect: toggle #define AT91C_TC_LDRA (0x3 << 16) // (TC) RA Loading Selection -#define T91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None +#define AT91C_TC_LDRA_NONE (0x0 << 16) // (TC) Edge: None #define AT91C_TC_LDRA_RISING (0x1 << 16) // (TC) Edge: rising edge of TIOA #define AT91C_TC_LDRA_FALLING (0x2 << 16) // (TC) Edge: falling edge of TIOA #define AT91C_TC_LDRA_BOTH (0x3 << 16) // (TC) Edge: each edge of TIOA @@ -1533,10 +1533,21 @@ typedef struct _AT91S_TCB { AT91_REG Reserved2[4]; // AT91_REG TCB_BCR; // TC Block Control Register AT91_REG TCB_BMR; // TC Block Mode Register + AT91_REG Reserved3[9]; // + AT91_REG TCB_ADDRSIZE; // TC ADDRSIZE REGISTER + AT91_REG TCB_IPNAME1; // TC IPNAME1 REGISTER + AT91_REG TCB_IPNAME2; // TC IPNAME2 REGISTER + AT91_REG TCB_FEATURES; // TC FEATURES REGISTER + AT91_REG TCB_VER; // Version Register } AT91S_TCB, *AT91PS_TCB; #else #define TCB_BCR (AT91_CAST(AT91_REG *) 0x000000C0) // (TCB_BCR) TC Block Control Register #define TCB_BMR (AT91_CAST(AT91_REG *) 0x000000C4) // (TCB_BMR) TC Block Mode Register +#define TC_ADDRSIZE (AT91_CAST(AT91_REG *) 0x000000EC) // (TC_ADDRSIZE) TC ADDRSIZE REGISTER +#define TC_IPNAME1 (AT91_CAST(AT91_REG *) 0x000000F0) // (TC_IPNAME1) TC IPNAME1 REGISTER +#define TC_IPNAME2 (AT91_CAST(AT91_REG *) 0x000000F4) // (TC_IPNAME2) TC IPNAME2 REGISTER +#define TC_FEATURES (AT91_CAST(AT91_REG *) 0x000000F8) // (TC_FEATURES) TC FEATURES REGISTER +#define TC_VER (AT91_CAST(AT91_REG *) 0x000000FC) // (TC_VER) Version Register #endif // -------- TCB_BCR : (TCB Offset: 0xc0) TC Block Control Register -------- @@ -1727,13 +1738,13 @@ typedef struct _AT91S_UDP { #define AT91C_UDP_RX_DATA_BK1 (0x1 << 6) // (UDP) Receive Data Bank 1 (only used by endpoints with ping-pong attributes). #define AT91C_UDP_DIR (0x1 << 7) // (UDP) Transfer Direction #define AT91C_UDP_EPTYPE (0x7 << 8) // (UDP) Endpoint type -#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control -#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT -#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT -#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT -#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN -#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN -#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN +#define AT91C_UDP_EPTYPE_CTRL (0x0 << 8) // (UDP) Control +#define AT91C_UDP_EPTYPE_ISO_OUT (0x1 << 8) // (UDP) Isochronous OUT +#define AT91C_UDP_EPTYPE_BULK_OUT (0x2 << 8) // (UDP) Bulk OUT +#define AT91C_UDP_EPTYPE_INT_OUT (0x3 << 8) // (UDP) Interrupt OUT +#define AT91C_UDP_EPTYPE_ISO_IN (0x5 << 8) // (UDP) Isochronous IN +#define AT91C_UDP_EPTYPE_BULK_IN (0x6 << 8) // (UDP) Bulk IN +#define AT91C_UDP_EPTYPE_INT_IN (0x7 << 8) // (UDP) Interrupt IN #define AT91C_UDP_DTGLE (0x1 << 11) // (UDP) Data Toggle #define AT91C_UDP_EPEDS (0x1 << 15) // (UDP) Endpoint Enable Disable #define AT91C_UDP_RXBYTECNT (0x7FF << 16) // (UDP) Number Of Bytes Available in the FIFO @@ -2048,178 +2059,183 @@ typedef struct _AT91S_UDP { #define AT91C_TC2_IER (AT91_CAST(AT91_REG *) 0xFFFA00A4) // (TC2) Interrupt Enable Register #define AT91C_TC2_SR (AT91_CAST(AT91_REG *) 0xFFFA00A0) // (TC2) Status Register // ========== Register definition for TCB peripheral ========== -#define AT91C_TCB_BMR (AT91_CAST(AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register -#define AT91C_TCB_BCR (AT91_CAST(AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +#define AT91C_TCB_ADDRSIZE (AT91_CAST(AT91_REG *) 0xFFFA00EC) // (TCB) TC ADDRSIZE REGISTER +#define AT91C_TCB_BMR (AT91_CAST(AT91_REG *) 0xFFFA00C4) // (TCB) TC Block Mode Register +#define AT91C_TCB_VER (AT91_CAST(AT91_REG *) 0xFFFA00FC) // (TCB) Version Register +#define AT91C_TCB_FEATURES (AT91_CAST(AT91_REG *) 0xFFFA00F8) // (TCB) TC FEATURES REGISTER +#define AT91C_TCB_IPNAME1 (AT91_CAST(AT91_REG *) 0xFFFA00F0) // (TCB) TC IPNAME1 REGISTER +#define AT91C_TCB_BCR (AT91_CAST(AT91_REG *) 0xFFFA00C0) // (TCB) TC Block Control Register +#define AT91C_TCB_IPNAME2 (AT91_CAST(AT91_REG *) 0xFFFA00F4) // (TCB) TC IPNAME2 REGISTER // ========== Register definition for PWMC_CH3 peripheral ========== -#define AT91C_PWMC_CH3_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register +#define AT91C_PWMC_CH3_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC270) // (PWMC_CH3) Channel Update Register #define AT91C_PWMC_CH3_Reserved (AT91_CAST(AT91_REG *) 0xFFFCC274) // (PWMC_CH3) Reserved -#define AT91C_PWMC_CH3_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register -#define AT91C_PWMC_CH3_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register -#define AT91C_PWMC_CH3_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register -#define AT91C_PWMC_CH3_CMR (AT91_CAST(AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register +#define AT91C_PWMC_CH3_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC268) // (PWMC_CH3) Channel Period Register +#define AT91C_PWMC_CH3_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC264) // (PWMC_CH3) Channel Duty Cycle Register +#define AT91C_PWMC_CH3_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC26C) // (PWMC_CH3) Channel Counter Register +#define AT91C_PWMC_CH3_CMR (AT91_CAST(AT91_REG *) 0xFFFCC260) // (PWMC_CH3) Channel Mode Register // ========== Register definition for PWMC_CH2 peripheral ========== #define AT91C_PWMC_CH2_Reserved (AT91_CAST(AT91_REG *) 0xFFFCC254) // (PWMC_CH2) Reserved -#define AT91C_PWMC_CH2_CMR (AT91_CAST(AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register -#define AT91C_PWMC_CH2_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register -#define AT91C_PWMC_CH2_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register -#define AT91C_PWMC_CH2_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register -#define AT91C_PWMC_CH2_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register +#define AT91C_PWMC_CH2_CMR (AT91_CAST(AT91_REG *) 0xFFFCC240) // (PWMC_CH2) Channel Mode Register +#define AT91C_PWMC_CH2_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC24C) // (PWMC_CH2) Channel Counter Register +#define AT91C_PWMC_CH2_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC248) // (PWMC_CH2) Channel Period Register +#define AT91C_PWMC_CH2_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC250) // (PWMC_CH2) Channel Update Register +#define AT91C_PWMC_CH2_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC244) // (PWMC_CH2) Channel Duty Cycle Register // ========== Register definition for PWMC_CH1 peripheral ========== #define AT91C_PWMC_CH1_Reserved (AT91_CAST(AT91_REG *) 0xFFFCC234) // (PWMC_CH1) Reserved -#define AT91C_PWMC_CH1_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register -#define AT91C_PWMC_CH1_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register -#define AT91C_PWMC_CH1_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register -#define AT91C_PWMC_CH1_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register -#define AT91C_PWMC_CH1_CMR (AT91_CAST(AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register +#define AT91C_PWMC_CH1_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC230) // (PWMC_CH1) Channel Update Register +#define AT91C_PWMC_CH1_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC228) // (PWMC_CH1) Channel Period Register +#define AT91C_PWMC_CH1_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC22C) // (PWMC_CH1) Channel Counter Register +#define AT91C_PWMC_CH1_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC224) // (PWMC_CH1) Channel Duty Cycle Register +#define AT91C_PWMC_CH1_CMR (AT91_CAST(AT91_REG *) 0xFFFCC220) // (PWMC_CH1) Channel Mode Register // ========== Register definition for PWMC_CH0 peripheral ========== #define AT91C_PWMC_CH0_Reserved (AT91_CAST(AT91_REG *) 0xFFFCC214) // (PWMC_CH0) Reserved -#define AT91C_PWMC_CH0_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register -#define AT91C_PWMC_CH0_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register -#define AT91C_PWMC_CH0_CMR (AT91_CAST(AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register -#define AT91C_PWMC_CH0_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register -#define AT91C_PWMC_CH0_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register +#define AT91C_PWMC_CH0_CPRDR (AT91_CAST(AT91_REG *) 0xFFFCC208) // (PWMC_CH0) Channel Period Register +#define AT91C_PWMC_CH0_CDTYR (AT91_CAST(AT91_REG *) 0xFFFCC204) // (PWMC_CH0) Channel Duty Cycle Register +#define AT91C_PWMC_CH0_CMR (AT91_CAST(AT91_REG *) 0xFFFCC200) // (PWMC_CH0) Channel Mode Register +#define AT91C_PWMC_CH0_CUPDR (AT91_CAST(AT91_REG *) 0xFFFCC210) // (PWMC_CH0) Channel Update Register +#define AT91C_PWMC_CH0_CCNTR (AT91_CAST(AT91_REG *) 0xFFFCC20C) // (PWMC_CH0) Channel Counter Register // ========== Register definition for PWMC peripheral ========== -#define AT91C_PWMC_IDR (AT91_CAST(AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register -#define AT91C_PWMC_DIS (AT91_CAST(AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register -#define AT91C_PWMC_IER (AT91_CAST(AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register -#define AT91C_PWMC_VR (AT91_CAST(AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register -#define AT91C_PWMC_ISR (AT91_CAST(AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register -#define AT91C_PWMC_SR (AT91_CAST(AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register -#define AT91C_PWMC_IMR (AT91_CAST(AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register -#define AT91C_PWMC_MR (AT91_CAST(AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register -#define AT91C_PWMC_ENA (AT91_CAST(AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register +#define AT91C_PWMC_IDR (AT91_CAST(AT91_REG *) 0xFFFCC014) // (PWMC) PWMC Interrupt Disable Register +#define AT91C_PWMC_DIS (AT91_CAST(AT91_REG *) 0xFFFCC008) // (PWMC) PWMC Disable Register +#define AT91C_PWMC_IER (AT91_CAST(AT91_REG *) 0xFFFCC010) // (PWMC) PWMC Interrupt Enable Register +#define AT91C_PWMC_VR (AT91_CAST(AT91_REG *) 0xFFFCC0FC) // (PWMC) PWMC Version Register +#define AT91C_PWMC_ISR (AT91_CAST(AT91_REG *) 0xFFFCC01C) // (PWMC) PWMC Interrupt Status Register +#define AT91C_PWMC_SR (AT91_CAST(AT91_REG *) 0xFFFCC00C) // (PWMC) PWMC Status Register +#define AT91C_PWMC_IMR (AT91_CAST(AT91_REG *) 0xFFFCC018) // (PWMC) PWMC Interrupt Mask Register +#define AT91C_PWMC_MR (AT91_CAST(AT91_REG *) 0xFFFCC000) // (PWMC) PWMC Mode Register +#define AT91C_PWMC_ENA (AT91_CAST(AT91_REG *) 0xFFFCC004) // (PWMC) PWMC Enable Register // ========== Register definition for UDP peripheral ========== -#define AT91C_UDP_IMR (AT91_CAST(AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register -#define AT91C_UDP_FADDR (AT91_CAST(AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register -#define AT91C_UDP_NUM (AT91_CAST(AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register -#define AT91C_UDP_FDR (AT91_CAST(AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register -#define AT91C_UDP_ISR (AT91_CAST(AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register -#define AT91C_UDP_CSR (AT91_CAST(AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register -#define AT91C_UDP_IDR (AT91_CAST(AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register -#define AT91C_UDP_ICR (AT91_CAST(AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register -#define AT91C_UDP_RSTEP (AT91_CAST(AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register -#define AT91C_UDP_TXVC (AT91_CAST(AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register -#define AT91C_UDP_GLBSTATE (AT91_CAST(AT91_REG *) 0xFFFB0004) // (UDP) Global State Register -#define AT91C_UDP_IER (AT91_CAST(AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register +#define AT91C_UDP_IMR (AT91_CAST(AT91_REG *) 0xFFFB0018) // (UDP) Interrupt Mask Register +#define AT91C_UDP_FADDR (AT91_CAST(AT91_REG *) 0xFFFB0008) // (UDP) Function Address Register +#define AT91C_UDP_NUM (AT91_CAST(AT91_REG *) 0xFFFB0000) // (UDP) Frame Number Register +#define AT91C_UDP_FDR (AT91_CAST(AT91_REG *) 0xFFFB0050) // (UDP) Endpoint FIFO Data Register +#define AT91C_UDP_ISR (AT91_CAST(AT91_REG *) 0xFFFB001C) // (UDP) Interrupt Status Register +#define AT91C_UDP_CSR (AT91_CAST(AT91_REG *) 0xFFFB0030) // (UDP) Endpoint Control and Status Register +#define AT91C_UDP_IDR (AT91_CAST(AT91_REG *) 0xFFFB0014) // (UDP) Interrupt Disable Register +#define AT91C_UDP_ICR (AT91_CAST(AT91_REG *) 0xFFFB0020) // (UDP) Interrupt Clear Register +#define AT91C_UDP_RSTEP (AT91_CAST(AT91_REG *) 0xFFFB0028) // (UDP) Reset Endpoint Register +#define AT91C_UDP_TXVC (AT91_CAST(AT91_REG *) 0xFFFB0074) // (UDP) Transceiver Control Register +#define AT91C_UDP_GLBSTATE (AT91_CAST(AT91_REG *) 0xFFFB0004) // (UDP) Global State Register +#define AT91C_UDP_IER (AT91_CAST(AT91_REG *) 0xFFFB0010) // (UDP) Interrupt Enable Register // ***************************************************************************** // PIO DEFINITIONS FOR AT91SAM7S512 // ***************************************************************************** -#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 -#define AT91C_PA0_PWM0 (AT91C_PIO_PA0) // PWM Channel 0 -#define AT91C_PA0_TIOA0 (AT91C_PIO_PA0) // Timer Counter 0 Multipurpose Timer I/O Pin A -#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 -#define AT91C_PA1_PWM1 (AT91C_PIO_PA1) // PWM Channel 1 -#define AT91C_PA1_TIOB0 (AT91C_PIO_PA1) // Timer Counter 0 Multipurpose Timer I/O Pin B -#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 -#define AT91C_PA2_PWM2 (AT91C_PIO_PA2) // PWM Channel 2 -#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock -#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 -#define AT91C_PA3_TWD (AT91C_PIO_PA3) // TWI Two-wire Serial Data -#define AT91C_PA3_NPCS3 (AT91C_PIO_PA3) // SPI Peripheral Chip Select 3 -#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 -#define AT91C_PA4_TWCK (AT91C_PIO_PA4) // TWI Two-wire Serial Clock -#define AT91C_PA4_TCLK0 (AT91C_PIO_PA4) // Timer Counter 0 external clock input -#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 -#define AT91C_PA5_RXD0 (AT91C_PIO_PA5) // USART 0 Receive Data -#define AT91C_PA5_NPCS3 (AT91C_PIO_PA5) // SPI Peripheral Chip Select 3 -#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 -#define AT91C_PA6_TXD0 (AT91C_PIO_PA6) // USART 0 Transmit Data -#define AT91C_PA6_PCK0 (AT91C_PIO_PA6) // PMC Programmable Clock Output 0 -#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 -#define AT91C_PA7_RTS0 (AT91C_PIO_PA7) // USART 0 Ready To Send -#define AT91C_PA7_PWM3 (AT91C_PIO_PA7) // PWM Channel 3 -#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 -#define AT91C_PA8_CTS0 (AT91C_PIO_PA8) // USART 0 Clear To Send -#define AT91C_PA8_ADTRG (AT91C_PIO_PA8) // ADC External Trigger -#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 -#define AT91C_PA9_DRXD (AT91C_PIO_PA9) // DBGU Debug Receive Data -#define AT91C_PA9_NPCS1 (AT91C_PIO_PA9) // SPI Peripheral Chip Select 1 -#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 +#define AT91C_PIO_PA0 (1 << 0) // Pin Controlled by PA0 +#define AT91C_PA0_PWM0 (AT91C_PIO_PA0) // PWM Channel 0 +#define AT91C_PA0_TIOA0 (AT91C_PIO_PA0) // Timer Counter 0 Multipurpose Timer I/O Pin A +#define AT91C_PIO_PA1 (1 << 1) // Pin Controlled by PA1 +#define AT91C_PA1_PWM1 (AT91C_PIO_PA1) // PWM Channel 1 +#define AT91C_PA1_TIOB0 (AT91C_PIO_PA1) // Timer Counter 0 Multipurpose Timer I/O Pin B +#define AT91C_PIO_PA2 (1 << 2) // Pin Controlled by PA2 +#define AT91C_PA2_PWM2 (AT91C_PIO_PA2) // PWM Channel 2 +#define AT91C_PA2_SCK0 (AT91C_PIO_PA2) // USART 0 Serial Clock +#define AT91C_PIO_PA3 (1 << 3) // Pin Controlled by PA3 +#define AT91C_PA3_TWD (AT91C_PIO_PA3) // TWI Two-wire Serial Data +#define AT91C_PA3_NPCS3 (AT91C_PIO_PA3) // SPI Peripheral Chip Select 3 +#define AT91C_PIO_PA4 (1 << 4) // Pin Controlled by PA4 +#define AT91C_PA4_TWCK (AT91C_PIO_PA4) // TWI Two-wire Serial Clock +#define AT91C_PA4_TCLK0 (AT91C_PIO_PA4) // Timer Counter 0 external clock input +#define AT91C_PIO_PA5 (1 << 5) // Pin Controlled by PA5 +#define AT91C_PA5_RXD0 (AT91C_PIO_PA5) // USART 0 Receive Data +#define AT91C_PA5_NPCS3 (AT91C_PIO_PA5) // SPI Peripheral Chip Select 3 +#define AT91C_PIO_PA6 (1 << 6) // Pin Controlled by PA6 +#define AT91C_PA6_TXD0 (AT91C_PIO_PA6) // USART 0 Transmit Data +#define AT91C_PA6_PCK0 (AT91C_PIO_PA6) // PMC Programmable Clock Output 0 +#define AT91C_PIO_PA7 (1 << 7) // Pin Controlled by PA7 +#define AT91C_PA7_RTS0 (AT91C_PIO_PA7) // USART 0 Ready To Send +#define AT91C_PA7_PWM3 (AT91C_PIO_PA7) // PWM Channel 3 +#define AT91C_PIO_PA8 (1 << 8) // Pin Controlled by PA8 +#define AT91C_PA8_CTS0 (AT91C_PIO_PA8) // USART 0 Clear To Send +#define AT91C_PA8_ADTRG (AT91C_PIO_PA8) // ADC External Trigger +#define AT91C_PIO_PA9 (1 << 9) // Pin Controlled by PA9 +#define AT91C_PA9_DRXD (AT91C_PIO_PA9) // DBGU Debug Receive Data +#define AT91C_PA9_NPCS1 (AT91C_PIO_PA9) // SPI Peripheral Chip Select 1 +#define AT91C_PIO_PA10 (1 << 10) // Pin Controlled by PA10 #define AT91C_PA10_DTXD (AT91C_PIO_PA10) // DBGU Debug Transmit Data #define AT91C_PA10_NPCS2 (AT91C_PIO_PA10) // SPI Peripheral Chip Select 2 -#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 +#define AT91C_PIO_PA11 (1 << 11) // Pin Controlled by PA11 #define AT91C_PA11_NPCS0 (AT91C_PIO_PA11) // SPI Peripheral Chip Select 0 #define AT91C_PA11_PWM0 (AT91C_PIO_PA11) // PWM Channel 0 -#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 +#define AT91C_PIO_PA12 (1 << 12) // Pin Controlled by PA12 #define AT91C_PA12_MISO (AT91C_PIO_PA12) // SPI Master In Slave #define AT91C_PA12_PWM1 (AT91C_PIO_PA12) // PWM Channel 1 -#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 +#define AT91C_PIO_PA13 (1 << 13) // Pin Controlled by PA13 #define AT91C_PA13_MOSI (AT91C_PIO_PA13) // SPI Master Out Slave #define AT91C_PA13_PWM2 (AT91C_PIO_PA13) // PWM Channel 2 -#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 +#define AT91C_PIO_PA14 (1 << 14) // Pin Controlled by PA14 #define AT91C_PA14_SPCK (AT91C_PIO_PA14) // SPI Serial Clock #define AT91C_PA14_PWM3 (AT91C_PIO_PA14) // PWM Channel 3 -#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 +#define AT91C_PIO_PA15 (1 << 15) // Pin Controlled by PA15 #define AT91C_PA15_TF (AT91C_PIO_PA15) // SSC Transmit Frame Sync #define AT91C_PA15_TIOA1 (AT91C_PIO_PA15) // Timer Counter 1 Multipurpose Timer I/O Pin A -#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 +#define AT91C_PIO_PA16 (1 << 16) // Pin Controlled by PA16 #define AT91C_PA16_TK (AT91C_PIO_PA16) // SSC Transmit Clock #define AT91C_PA16_TIOB1 (AT91C_PIO_PA16) // Timer Counter 1 Multipurpose Timer I/O Pin B -#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 +#define AT91C_PIO_PA17 (1 << 17) // Pin Controlled by PA17 #define AT91C_PA17_TD (AT91C_PIO_PA17) // SSC Transmit data #define AT91C_PA17_PCK1 (AT91C_PIO_PA17) // PMC Programmable Clock Output 1 -#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 +#define AT91C_PIO_PA18 (1 << 18) // Pin Controlled by PA18 #define AT91C_PA18_RD (AT91C_PIO_PA18) // SSC Receive Data #define AT91C_PA18_PCK2 (AT91C_PIO_PA18) // PMC Programmable Clock Output 2 -#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 +#define AT91C_PIO_PA19 (1 << 19) // Pin Controlled by PA19 #define AT91C_PA19_RK (AT91C_PIO_PA19) // SSC Receive Clock #define AT91C_PA19_FIQ (AT91C_PIO_PA19) // AIC Fast Interrupt Input -#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 +#define AT91C_PIO_PA20 (1 << 20) // Pin Controlled by PA20 #define AT91C_PA20_RF (AT91C_PIO_PA20) // SSC Receive Frame Sync #define AT91C_PA20_IRQ0 (AT91C_PIO_PA20) // External Interrupt 0 -#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 +#define AT91C_PIO_PA21 (1 << 21) // Pin Controlled by PA21 #define AT91C_PA21_RXD1 (AT91C_PIO_PA21) // USART 1 Receive Data #define AT91C_PA21_PCK1 (AT91C_PIO_PA21) // PMC Programmable Clock Output 1 -#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 +#define AT91C_PIO_PA22 (1 << 22) // Pin Controlled by PA22 #define AT91C_PA22_TXD1 (AT91C_PIO_PA22) // USART 1 Transmit Data #define AT91C_PA22_NPCS3 (AT91C_PIO_PA22) // SPI Peripheral Chip Select 3 -#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 +#define AT91C_PIO_PA23 (1 << 23) // Pin Controlled by PA23 #define AT91C_PA23_SCK1 (AT91C_PIO_PA23) // USART 1 Serial Clock #define AT91C_PA23_PWM0 (AT91C_PIO_PA23) // PWM Channel 0 -#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 +#define AT91C_PIO_PA24 (1 << 24) // Pin Controlled by PA24 #define AT91C_PA24_RTS1 (AT91C_PIO_PA24) // USART 1 Ready To Send #define AT91C_PA24_PWM1 (AT91C_PIO_PA24) // PWM Channel 1 -#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 +#define AT91C_PIO_PA25 (1 << 25) // Pin Controlled by PA25 #define AT91C_PA25_CTS1 (AT91C_PIO_PA25) // USART 1 Clear To Send #define AT91C_PA25_PWM2 (AT91C_PIO_PA25) // PWM Channel 2 -#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 +#define AT91C_PIO_PA26 (1 << 26) // Pin Controlled by PA26 #define AT91C_PA26_DCD1 (AT91C_PIO_PA26) // USART 1 Data Carrier Detect #define AT91C_PA26_TIOA2 (AT91C_PIO_PA26) // Timer Counter 2 Multipurpose Timer I/O Pin A -#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 +#define AT91C_PIO_PA27 (1 << 27) // Pin Controlled by PA27 #define AT91C_PA27_DTR1 (AT91C_PIO_PA27) // USART 1 Data Terminal ready #define AT91C_PA27_TIOB2 (AT91C_PIO_PA27) // Timer Counter 2 Multipurpose Timer I/O Pin B -#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 +#define AT91C_PIO_PA28 (1 << 28) // Pin Controlled by PA28 #define AT91C_PA28_DSR1 (AT91C_PIO_PA28) // USART 1 Data Set ready #define AT91C_PA28_TCLK1 (AT91C_PIO_PA28) // Timer Counter 1 external clock input -#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 +#define AT91C_PIO_PA29 (1 << 29) // Pin Controlled by PA29 #define AT91C_PA29_RI1 (AT91C_PIO_PA29) // USART 1 Ring Indicator #define AT91C_PA29_TCLK2 (AT91C_PIO_PA29) // Timer Counter 2 external clock input -#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 +#define AT91C_PIO_PA30 (1 << 30) // Pin Controlled by PA30 #define AT91C_PA30_IRQ1 (AT91C_PIO_PA30) // External Interrupt 1 #define AT91C_PA30_NPCS2 (AT91C_PIO_PA30) // SPI Peripheral Chip Select 2 -#define AT91C_PIO_PA31 (1u << 31) // Pin Controlled by PA31 +#define AT91C_PIO_PA31 (1u << 31) // Pin Controlled by PA31 #define AT91C_PA31_NPCS1 (AT91C_PIO_PA31) // SPI Peripheral Chip Select 1 #define AT91C_PA31_PCK2 (AT91C_PIO_PA31) // PMC Programmable Clock Output 2 // ***************************************************************************** // PERIPHERAL ID DEFINITIONS FOR AT91SAM7S512 // ***************************************************************************** -#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) -#define AT91C_ID_SYS ( 1) // System Peripheral -#define AT91C_ID_PIOA ( 2) // Parallel IO Controller -#define AT91C_ID_3_Reserved ( 3) // Reserved -#define AT91C_ID_ADC ( 4) // Analog-to-Digital Converter -#define AT91C_ID_SPI ( 5) // Serial Peripheral Interface -#define AT91C_ID_US0 ( 6) // USART 0 -#define AT91C_ID_US1 ( 7) // USART 1 -#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller -#define AT91C_ID_TWI ( 9) // Two-Wire Interface -#define AT91C_ID_PWMC (10) // PWM Controller -#define AT91C_ID_UDP (11) // USB Device Port -#define AT91C_ID_TC0 (12) // Timer Counter 0 -#define AT91C_ID_TC1 (13) // Timer Counter 1 -#define AT91C_ID_TC2 (14) // Timer Counter 2 +#define AT91C_ID_FIQ ( 0) // Advanced Interrupt Controller (FIQ) +#define AT91C_ID_SYS ( 1) // System Peripheral +#define AT91C_ID_PIOA ( 2) // Parallel IO Controller +#define AT91C_ID_3_Reserved ( 3) // Reserved +#define AT91C_ID_ADC ( 4) // Analog-to-Digital Converter +#define AT91C_ID_SPI ( 5) // Serial Peripheral Interface +#define AT91C_ID_US0 ( 6) // USART 0 +#define AT91C_ID_US1 ( 7) // USART 1 +#define AT91C_ID_SSC ( 8) // Serial Synchronous Controller +#define AT91C_ID_TWI ( 9) // Two-Wire Interface +#define AT91C_ID_PWMC (10) // PWM Controller +#define AT91C_ID_UDP (11) // USB Device Port +#define AT91C_ID_TC0 (12) // Timer Counter 0 +#define AT91C_ID_TC1 (13) // Timer Counter 1 +#define AT91C_ID_TC2 (14) // Timer Counter 2 #define AT91C_ID_15_Reserved (15) // Reserved #define AT91C_ID_16_Reserved (16) // Reserved #define AT91C_ID_17_Reserved (17) // Reserved @@ -2235,8 +2251,8 @@ typedef struct _AT91S_UDP { #define AT91C_ID_27_Reserved (27) // Reserved #define AT91C_ID_28_Reserved (28) // Reserved #define AT91C_ID_29_Reserved (29) // Reserved -#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) -#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) +#define AT91C_ID_IRQ0 (30) // Advanced Interrupt Controller (IRQ0) +#define AT91C_ID_IRQ1 (31) // Advanced Interrupt Controller (IRQ1) #define AT91C_ALL_INT (0xC0007FF7) // ALL VALID INTERRUPTS // ***************************************************************************** @@ -2283,14 +2299,14 @@ typedef struct _AT91S_UDP { // MEMORY MAPPING DEFINITIONS FOR AT91SAM7S512 // ***************************************************************************** // ISRAM -#define AT91C_ISRAM (0x00200000) // Internal SRAM base address -#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) +#define AT91C_ISRAM (0x00200000) // Internal SRAM base address +#define AT91C_ISRAM_SIZE (0x00010000) // Internal SRAM size in byte (64 Kbytes) // IFLASH -#define AT91C_IFLASH (0x00100000) // Internal FLASH base address -#define AT91C_IFLASH_SIZE (0x00080000) // Internal FLASH size in byte (512 Kbytes) -#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes -#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes -#define AT91C_IFLASH_NB_OF_PAGES (2048) // Internal FLASH Number of Pages: 2048 bytes +#define AT91C_IFLASH (0x00100000) // Internal FLASH base address +#define AT91C_IFLASH_SIZE (0x00080000) // Internal FLASH size in byte (512 Kbytes) +#define AT91C_IFLASH_PAGE_SIZE (256) // Internal FLASH Page Size: 256 bytes +#define AT91C_IFLASH_LOCK_REGION_SIZE (16384) // Internal FLASH Lock Region Size: 16 Kbytes +#define AT91C_IFLASH_NB_OF_PAGES (2048) // Internal FLASH Number of Pages: 2048 bytes #define AT91C_IFLASH_NB_OF_LOCK_BITS (32) // Internal FLASH Number of Lock Bits: 32 bytes #endif diff --git a/include/iclass_cmd.h b/include/iclass_cmd.h index bc7c1e6ca..dca08b6aa 100644 --- a/include/iclass_cmd.h +++ b/include/iclass_cmd.h @@ -87,6 +87,12 @@ typedef struct { uint8_t mac[4]; } PACKED iclass_writeblock_req_t; +// iCLASS write block request data structure +typedef struct { + iclass_auth_req_t req; + uint8_t epurse[4]; +} PACKED iclass_credit_epurse_t; + // iCLASS dump data structure typedef struct { uint8_t blockno; diff --git a/include/iso14b.h b/include/iso14b.h index 88ba0c2be..e809ef2c0 100644 --- a/include/iso14b.h +++ b/include/iso14b.h @@ -65,13 +65,18 @@ typedef struct { } PACKED iso14b_raw_cmd_t; -#define US_TO_SSP(x) ( (uint32_t)((x) * 3.39) ) -#define SSP_TO_US(x) ( (uint32_t)((x) / 3.39) ) +#define US_TO_SSP(x) ( (int32_t) ((x) * 3.39) ) +#define SSP_TO_US(x) ( (int32_t)((x) / 3.39) ) -#define ETU_TO_SSP(x) ((uint32_t)((x) * 32)) -#define SSP_TO_ETU(x) ((uint32_t)((x) / 32)) +#define HF14_ETU_TO_SSP(x) ((x) << 5) // 1 ETU = 32 SSP +#define HF14_SSP_TO_ETU(x) ((x) >> 5) // -#define ETU_TO_US(x) ((uint32_t)((((x) * 9440000) / 1000000) + 0.5)) -#define US_TO_ETU(x) ((uint32_t)(((x) * 1000000 / 9440000) + 0.5)) +#define HF14_ETU_TO_US(x) ( (float)((x) * 9.4396) ) +#define HF14_ETU_TO_US_2(x) ( (int32_t)( ((x) * 9439600) / 1000000) ) + +// #define US_TO_ETU(x) ( (int32_t)( ((x) * 1000000) / 9439600) ) + +#define US_TO_ETU(x) ( (float)((x) / 9.4396) ) #endif // _ISO14B_H_ + diff --git a/include/mifare.h b/include/mifare.h index e66df50aa..b59b29c8d 100644 --- a/include/mifare.h +++ b/include/mifare.h @@ -75,9 +75,27 @@ typedef enum ISO14A_COMMAND { ISO14A_NO_RATS = (1 << 9), ISO14A_SEND_CHAINING = (1 << 10), ISO14A_USE_ECP = (1 << 11), - ISO14A_USE_MAGSAFE = (1 << 12) + ISO14A_USE_MAGSAFE = (1 << 12), + ISO14A_USE_CUSTOM_POLLING = (1 << 13) } iso14a_command_t; +// Defines a frame that will be used in a polling sequence +// ECP Frames are up to (7 + 16) bytes long, 24 bytes should cover future and other cases +typedef struct { + uint8_t frame[24]; + uint8_t frame_length; + uint8_t last_byte_bits; + uint16_t extra_delay; +} PACKED iso14a_polling_frame_t; + +// Defines polling sequence configuration +// 6 would be enough for 4 magsafe, 1 wupa, 1 ecp, +typedef struct { + iso14a_polling_frame_t frames[6]; + uint8_t frame_count; + uint16_t extra_timeout; +} PACKED iso14a_polling_parameters_t; + typedef struct { uint8_t *response; uint8_t *modulation; @@ -137,5 +155,4 @@ typedef struct { } state; } PACKED nonces_t; - #endif // _MIFARE_H_ diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index 0983ee2e1..e84a4183b 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -271,7 +271,7 @@ typedef struct { typedef struct { uint8_t type; uint16_t len; - uint8_t *data; + uint8_t data[]; } PACKED lf_hitag_t; typedef struct { @@ -416,6 +416,8 @@ typedef struct { #define CMD_SPIFFS_WIPE 0x013A +#define CMD_SET_FPGAMODE 0x013F + // This take a +0x2000 as they are high level helper and special functions // As the others, they may have safety level argument if it makes sense #define CMD_SPIFFS_PRINT_TREE 0x2130 @@ -563,7 +565,7 @@ typedef struct { #define CMD_HF_EPA_COLLECT_NONCE 0x038A #define CMD_HF_EPA_REPLAY 0x038B -#define CMD_HF_EPA_PACE_SIMULATE 0x039C +#define CMD_HF_EPA_PACE_SIMULATE 0x038C #define CMD_HF_LEGIC_INFO 0x03BC #define CMD_HF_LEGIC_ESET 0x03BD @@ -579,6 +581,7 @@ typedef struct { #define CMD_HF_ICLASS_EML_MEMSET 0x0398 #define CMD_HF_ICLASS_CHKKEYS 0x039A #define CMD_HF_ICLASS_RESTORE 0x039B +#define CMD_HF_ICLASS_CREDIT_EPURSE 0x039C // For ISO1092 / FeliCa #define CMD_HF_FELICA_SIMULATE 0x03A0 diff --git a/include/protocols.h b/include/protocols.h index 721dccaf5..b4de7da1a 100644 --- a/include/protocols.h +++ b/include/protocols.h @@ -178,6 +178,7 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. #define ISO14443A_CMD_RATS 0xE0 #define ISO14443A_CMD_PPS 0xD0 #define ISO14443A_CMD_NXP_DESELECT 0xC2 +#define ISO14443A_CMD_WTX 0xF2 #define MIFARE_SELECT_CT 0x88 #define MIFARE_AUTH_KEYA 0x60 @@ -428,6 +429,7 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. #define PROTO_HITAGS 14 #define PROTO_CRYPTORF 15 #define SEOS 16 +#define PROTO_MFPLUS 17 // Picopass fuses #define FUSE_FPERS 0x80 @@ -530,95 +532,150 @@ ISO 7816-4 Basic interindustry commands. For command APDU's. // MIFARE DESFire command set: -#define MFDES_AUTHENTICATE 0x0A // AUTHENTICATE_NATIVE -#define MFDES_AUTHENTICATE_ISO 0x1A // AUTHENTICATE_STANDARD -#define MFDES_AUTHENTICATE_AES 0xAA +#define MFDES_AUTHENTICATE 0x0A // AUTHENTICATE_NATIVE +#define MFDES_AUTHENTICATE_ISO 0x1A // AUTHENTICATE_STANDARD +#define MFDES_AUTHENTICATE_AES 0xAA // Leakage Resilient Primitive (LRP) -#define MFDES_AUTHENTICATE_EV2F 0x71 // LRP, AuthenticateLRPFirst -#define MFDES_AUTHENTICATE_EV2NF 0x77 // LRP, AuthenticateLRPNonFirst +#define MFDES_AUTHENTICATE_EV2F 0x71 // LRP, AuthenticateLRPFirst +#define MFDES_AUTHENTICATE_EV2NF 0x77 // LRP, AuthenticateLRPNonFirst + +#define MFDES_CREDIT 0x0C +#define MFDES_LIMITED_CREDIT 0x1C +#define MFDES_WRITE_RECORD 0x3B +#define MFDES_READSIG 0x3C +#define MFDES_WRITE_DATA 0x3D +#define MFDES_GET_KEY_SETTINGS 0x45 +#define MFDES_GET_UID 0x51 +#define MFDES_CHANGE_KEY_SETTINGS 0x54 +#define MFDES_ROLL_KEY_SETTINGS 0x55 +#define MFDES_INIT_KEY_SETTINGS 0x56 +#define MFDES_FINALIZE_KEY_SETTINGS 0x57 +#define MFDES_SELECT_APPLICATION 0x5A +#define MFDES_CHANGE_CONFIGURATION 0x5C +#define MFDES_CHANGE_FILE_SETTINGS 0x5F +#define MFDES_GET_VERSION 0x60 +#define MFDES_GET_ISOFILE_IDS 0x61 +#define MFDES_GET_KEY_VERSION 0x64 +#define MFDES_GET_DELEGATE_INFO 0x69 +#define MFDES_GET_APPLICATION_IDS 0x6A +#define MFDES_GET_VALUE 0x6C +#define MFDES_GET_FREE_MEMORY 0x6E +#define MFDES_GET_DF_NAMES 0x6D +#define MFDES_GET_FILE_IDS 0x6F +#define MFDES_WRITE_RECORD2 0x8B +#define MFDES_WRITE_DATA2 0x8D +#define MFDES_ABORT_TRANSACTION 0xA7 +#define MFDES_READ_RECORDS2 0xAB +#define MFDES_READ_DATA2 0xAD +#define MFDES_ADDITIONAL_FRAME 0xAF +#define MFDES_UPDATE_RECORD2 0xBA +#define MFDES_READ_RECORDS 0xBB +#define MFDES_READ_DATA 0xBD +#define MFDES_CREATE_CYCLIC_RECORD_FILE 0xC0 +#define MFDES_CREATE_LINEAR_RECORD_FILE 0xC1 +#define MFDES_CHANGE_KEY 0xC4 +#define MFDES_CHANGE_KEY_EV2 0xC6 +#define MFDES_COMMIT_TRANSACTION 0xC7 +#define MFDES_COMMIT_READER_ID 0xC8 +#define MFDES_CREATE_DELEGATE_APP 0xC9 +#define MFDES_CREATE_APPLICATION 0xCA +#define MFDES_CREATE_BACKUP_DATA_FILE 0xCB +#define MFDES_CREATE_VALUE_FILE 0xCC +#define MFDES_CREATE_STD_DATA_FILE 0xCD +#define MFDES_CREATE_TRANS_MAC_FILE 0xCE +#define MFDES_DELETE_APPLICATION 0xDA +#define MFDES_UPDATE_RECORD 0xDB +#define MFDES_DEBIT 0xDC +#define MFDES_DELETE_FILE 0xDF +#define MFDES_CLEAR_RECORD_FILE 0xEB +#define MFDES_NOTIFY_TRANSACTION_SUCCESS 0xEE // New command. Used by Apple-ECP-compliant DESFire readers to signify successful transaction +#define MFDES_PREPARE_PC 0xF0 +#define MFDES_PROXIMITY_CHECK 0xF2 +#define MFDES_GET_FILE_SETTINGS 0xF5 +#define MFDES_FORMAT_PICC 0xFC +#define MFDES_VERIFY_PC 0xFD +#define MFDES_NATIVE_ISO7816_WRAP_CLA 0x90 -#define MFDES_CREDIT 0x0C -#define MFDES_LIMITED_CREDIT 0x1C -#define MFDES_WRITE_RECORD 0x3B -#define MFDES_READSIG 0x3C -#define MFDES_WRITE_DATA 0x3D -#define MFDES_GET_KEY_SETTINGS 0x45 -#define MFDES_GET_UID 0x51 -#define MFDES_CHANGE_KEY_SETTINGS 0x54 -#define MFDES_ROLL_KEY_SETTINGS 0x55 -#define MFDES_INIT_KEY_SETTINGS 0x56 -#define MFDES_FINALIZE_KEY_SETTINGS 0x57 -#define MFDES_SELECT_APPLICATION 0x5A -#define MFDES_CHANGE_CONFIGURATION 0x5C -#define MFDES_CHANGE_FILE_SETTINGS 0x5F -#define MFDES_GET_VERSION 0x60 -#define MFDES_GET_ISOFILE_IDS 0x61 -#define MFDES_GET_KEY_VERSION 0x64 -#define MFDES_GET_DELEGATE_INFO 0x69 -#define MFDES_GET_APPLICATION_IDS 0x6A -#define MFDES_GET_VALUE 0x6C -#define MFDES_GET_FREE_MEMORY 0x6E -#define MFDES_GET_DF_NAMES 0x6D -#define MFDES_GET_FILE_IDS 0x6F -#define MFDES_WRITE_RECORD2 0x8B -#define MFDES_WRITE_DATA2 0x8D -#define MFDES_ABORT_TRANSACTION 0xA7 -#define MFDES_READ_RECORDS2 0xAB -#define MFDES_READ_DATA2 0xAD -#define MFDES_ADDITIONAL_FRAME 0xAF -#define MFDES_UPDATE_RECORD2 0xBA -#define MFDES_READ_RECORDS 0xBB -#define MFDES_READ_DATA 0xBD -#define MFDES_CREATE_CYCLIC_RECORD_FILE 0xC0 -#define MFDES_CREATE_LINEAR_RECORD_FILE 0xC1 -#define MFDES_CHANGE_KEY 0xC4 -#define MFDES_CHANGE_KEY_EV2 0xC6 -#define MFDES_COMMIT_TRANSACTION 0xC7 -#define MFDES_COMMIT_READER_ID 0xC8 -#define MFDES_CREATE_DELEGATE_APP 0xC9 -#define MFDES_CREATE_APPLICATION 0xCA -#define MFDES_CREATE_BACKUP_DATA_FILE 0xCB -#define MFDES_CREATE_VALUE_FILE 0xCC -#define MFDES_CREATE_STD_DATA_FILE 0xCD -#define MFDES_CREATE_TRANS_MAC_FILE 0xCE -#define MFDES_DELETE_APPLICATION 0xDA -#define MFDES_UPDATE_RECORD 0xDB -#define MFDES_DEBIT 0xDC -#define MFDES_DELETE_FILE 0xDF -#define MFDES_CLEAR_RECORD_FILE 0xEB -#define MFDES_PREPARE_PC 0xF0 -#define MFDES_PROXIMITY_CHECK 0xF2 -#define MFDES_GET_FILE_SETTINGS 0xF5 -#define MFDES_FORMAT_PICC 0xFC -#define MFDES_VERIFY_PC 0xFD -#define MFDES_NATIVE_ISO7816_WRAP_CLA 0x90 // MIFARE DESFire status & error codes: -#define MFDES_S_OPERATION_OK 0x00 -#define MFDES_S_NO_CHANGES 0x0C -#define MFDES_S_SIGNATURE 0x90 -#define MFDES_S_ADDITIONAL_FRAME 0xAF +#define MFDES_S_OPERATION_OK 0x00 +#define MFDES_S_NO_CHANGES 0x0C +#define MFDES_S_SIGNATURE 0x90 +#define MFDES_S_ADDITIONAL_FRAME 0xAF -#define MFDES_E_OUT_OF_EEPROM 0x0E -#define MFDES_E_ILLEGAL_COMMAND_CODE 0x1C -#define MFDES_E_INTEGRITY_ERROR 0x1E -#define MFDES_E_NO_SUCH_KEY 0x40 -#define MFDES_E_LENGTH 0x7E -#define MFDES_E_PERMISSION_DENIED 0x9D -#define MFDES_E_PARAMETER_ERROR 0x9E -#define MFDES_E_APPLICATION_NOT_FOUND 0xA0 -#define MFDES_E_APPL_INTEGRITY 0xA1 -#define MFDES_E_AUTHENTICATION_ERROR 0xAE -#define MFDES_E_BOUNDARY 0xBE -#define MFDES_E_PICC_INTEGRITY 0xC1 -#define MFDES_E_COMMAND_ABORTED 0xCA -#define MFDES_E_PICC_DISABLED 0xCD -#define MFDES_E_COUNT 0xCE -#define MFDES_E_DUPLICATE 0xDE -#define MFDES_E_EEPROM 0xEE -#define MFDES_E_FILE_NOT_FOUND 0xF0 -#define MFDES_E_FILE_INTEGRITY 0xF1 +#define MFDES_E_OUT_OF_EEPROM 0x0E +#define MFDES_E_ILLEGAL_COMMAND_CODE 0x1C +#define MFDES_E_INTEGRITY_ERROR 0x1E +#define MFDES_E_NO_SUCH_KEY 0x40 +#define MFDES_E_LENGTH 0x7E +#define MFDES_E_PERMISSION_DENIED 0x9D +#define MFDES_E_PARAMETER_ERROR 0x9E +#define MFDES_E_APPLICATION_NOT_FOUND 0xA0 +#define MFDES_E_APPL_INTEGRITY 0xA1 +#define MFDES_E_AUTHENTICATION_ERROR 0xAE +#define MFDES_E_BOUNDARY 0xBE +#define MFDES_E_PICC_INTEGRITY 0xC1 +#define MFDES_E_COMMAND_ABORTED 0xCA +#define MFDES_E_PICC_DISABLED 0xCD +#define MFDES_E_COUNT 0xCE +#define MFDES_E_DUPLICATE 0xDE +#define MFDES_E_EEPROM 0xEE +#define MFDES_E_FILE_NOT_FOUND 0xF0 +#define MFDES_E_FILE_INTEGRITY 0xF1 + + +// MIFARE PLus EV2 Command set +// source: https://www.nxp.com/docs/en/data-sheet/MF1P(H)x2.pdf in Look-Up Tables + +#define MFP_READ_SIG 0x3C // same as DESFIRE +#define MFP_WRITEPERSO 0xA8 +#define MFP_COMMITPERSO 0xAA + +#define MFP_AUTHENTICATEFIRST 0x70 +#define MFP_AUTHENTICATEFIRST_VARIANT 0x73 +#define MFP_AUTHENTICATENONFIRST 0x76 +#define MFP_AUTHENTICATECONTINUE 0x72 +#define MFP_AUTHENTICATESECTORSWITCH 0x7A +#define MFP_RESETAUTH 0x78 + +#define MFP_VCSUPPORTLASTISOL3 0x4B +#define MFP_ISOSELECT 0xA4 + +#define MFP_GETVERSION 0x60 // same as DESFIRE +#define MFP_ADDITIONALFRAME 0xAF +#define MFP_SETCONFIGSL1 0x44 +#define MFP_MF_PERSONALIZEUIDUSAGE 0x40 + +// read commands +#define MFP_READENCRYPTEDNOMAC_MACED 0X30 +#define MFP_READENCRYPTEDMAC_MACED 0x31 +#define MFP_READPLAINNOMAC_MACED 0x32 +#define MFP_READPLAINMAC_MACED 0x33 +#define MFP_READENCRYPTEDNOMAC_UNMACED 0x34 +#define MFP_READENCRYPTEDMAC_UNMACED 0X35 +#define MFP_READPLAINNOMAC_UNMACED 0x36 +#define MFP_READPLAINMAC_UNMACED 0x37 + +// write commands +#define MFP_WRITEENCRYPTEDNOMAC 0xA0 +#define MFP_WRITEENCRYPTEDMAC 0xA1 +#define MFP_WRITEPLAINNOMAC 0xA2 +#define MFP_WRITEPLAINMAC 0xA3 + +// value commands +#define MFP_INCREMENTNOMAC 0xB0 +#define MFP_INCREMENTMAC 0xB1 +#define MFP_DECREMENTNOMAC 0xB2 +#define MFP_DECREMENTMAC 0xB3 +#define MFP_TRANSFERNOMAC 0xB4 +#define MFP_TRANSFERMAC 0xB5 +#define MFP_INCREMENTTRANSFERNOMAC 0xB6 +#define MFP_INCREMENTTRANSFERMAC 0xB7 +#define MFP_DECREMENTTRANSFERNOMAC 0xB8 +#define MFP_DECREMENTTRANSFERMAC 0xB9 +#define MFP_RESTORENOMAC 0xC2 +#define MFP_RESTOREMAC 0xC3 // LEGIC Commands diff --git a/rdv40.txt b/rdv40.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tools/build_all_firmwares.sh b/tools/build_all_firmwares.sh index 4a0fe5947..261d89135 100755 --- a/tools/build_all_firmwares.sh +++ b/tools/build_all_firmwares.sh @@ -32,9 +32,9 @@ mv bootrom/obj/bootrom.elf "$DEST/PM3BOOTROM.elf" # cf armsrc/Standalone/Makefile.hal STANDALONE_MODES=(LF_SKELETON) STANDALONE_MODES+=(LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RSWW LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_MULTIHID LF_NEDAP_SIM LF_NEXID LF_PROXBRUTE LF_PROX2BRUTE LF_SAMYRUN LF_THAREXDE) -STANDALONE_MODES+=(HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_AVEFUL HF_BOG HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_TCPRST HF_TMUDFORD HF_YOUNG) +STANDALONE_MODES+=(HF_14ASNIFF HF_14BSNIFF HF_15SNIFF HF_AVEFUL HF_BOG HF_CARDHOPPER HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_LEGICSIM HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_REBLAY HF_TCPRST HF_TMUDFORD HF_YOUNG) STANDALONE_MODES+=(DANKARMULTI) -STANDALONE_MODES_REQ_BT=(HF_REBLAY) +STANDALONE_MODES_REQ_BT=(HF_CARDHOPPER HF_REBLAY) STANDALONE_MODES_REQ_SMARTCARD=() STANDALONE_MODES_REQ_FLASH=(LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_BOG HF_COLIN HF_ICECLASS HF_LEGICSIM HF_MFCSIM) diff --git a/tools/cryptorf/Makefile b/tools/cryptorf/Makefile index 5ff3250e6..96ac9393d 100644 --- a/tools/cryptorf/Makefile +++ b/tools/cryptorf/Makefile @@ -3,11 +3,24 @@ MYSRCS = cryptolib.c util.c MYINCLUDES = -I../../common/cryptorf MYCFLAGS = MYDEFS = -MYLDLIBS = -lpthread + +platform = $(shell uname) + +# Atomic +# RPi Zero gcc requires -latomic +# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld +# doesn't recognize option --as-needed +ifneq ($(platform),Darwin) + LDLIBS += -lpthread -Wl,--as-needed -latomic -Wl,--no-as-needed +endif BINS = cm sm sma sma_multi INSTALLTOOLS = $(BINS) +ifeq ($(platform),Darwin) + CXXFLAGS = -std=c++14 +endif + include ../../Makefile.host # checking platform can be done only after Makefile.host diff --git a/tools/cryptorf/sma.cpp b/tools/cryptorf/sma.cpp index d15b0e6a2..d5839f487 100644 --- a/tools/cryptorf/sma.cpp +++ b/tools/cryptorf/sma.cpp @@ -32,6 +32,10 @@ #include "cryptolib.h" #include "util.h" +#ifdef __cplusplus +extern "C" { +#endif + using namespace std; #ifdef _MSC_VER @@ -159,6 +163,10 @@ void print_cs(const char *text, pcs s) { } static inline uint8_t mod(uint8_t a, uint8_t m) { + if (m == 0) { + return 0; // Actually, divide by zero error + } + // Just return the input when this is less or equal than the modular value if (a < m) return a; @@ -663,13 +671,12 @@ static inline void search_gc_candidates_left(const uint64_t lstate_before_gc, co void combine_valid_left_right_states(vector *plcstates, vector *prcstates, vector *pgc_candidates) { vector::iterator itl, itr; - size_t pos, count; + size_t pos; uint64_t gc; bool valid; // Clean up the candidate list pgc_candidates->clear(); - count = 0; for (itl = plcstates->begin(); itl != plcstates->end(); ++itl) { for (itr = prcstates->begin(); itr != prcstates->end(); ++itr) { valid = true; @@ -692,7 +699,6 @@ void combine_valid_left_right_states(vector *plcstates, vector *prcs // printf("%09llx - ",itl->l); // printf("%07llx\n",itr->r); } - count++; } } printf("Found a total of " _YELLOW_("%llu")" combinations, ", ((unsigned long long)plcstates->size()) * prcstates->size()); @@ -754,7 +760,7 @@ int main(int argc, const char *argv[]) { Q[pos] = rand(); } sm_auth(Gc, Ci, Q, Ch, Ci_1, &ostate); - printf(" Gc: "); + printf(" Gc... "); print_bytes(Gc, 8); } else { sscanf(argv[1], "%016" SCNx64, &nCi); @@ -765,7 +771,7 @@ int main(int argc, const char *argv[]) { num_to_bytes(nCh, 8, Ch); sscanf(argv[4], "%016" SCNx64, &nCi_1); num_to_bytes(nCi_1, 8, Ci_1); - printf(" Gc: unknown\n"); + printf(" Gc... unknown\n"); } for (pos = 0; pos < 8; pos++) { @@ -773,16 +779,16 @@ int main(int argc, const char *argv[]) { ks[(2 * pos) + 1] = Ch[pos]; } - printf(" Ci: "); + printf(" Ci... "); print_bytes(Ci, 8); - printf(" Q: "); + printf(" Q... "); print_bytes(Q, 8); - printf(" Ch: "); + printf(" Ch... "); print_bytes(Ch, 8); - printf("Ci+1: "); + printf("Ci+1... "); print_bytes(Ci_1, 8); printf("\n"); - printf(" Ks: "); + printf(" Ks... "); print_bytes(ks, 16); printf("\n"); @@ -840,7 +846,7 @@ int main(int argc, const char *argv[]) { num_to_bytes(*itgc, 8, Gc_chk); sm_auth(Gc_chk, Ci, Q, Ch_chk, Ci_1_chk, &ostate); if ((memcmp(Ch_chk, Ch, 8) == 0) && (memcmp(Ci_1_chk, Ci_1, 8) == 0)) { - printf("\nFound valid key: " _GREEN_("%016" PRIx64)"\n\n", *itgc); + printf("\nValid key found [ " _GREEN_("%016" PRIx64)" ]\n\n", *itgc); return 0; } } @@ -848,3 +854,7 @@ int main(int argc, const char *argv[]) { } return 0; } + +#if defined(__cplusplus) +} +#endif diff --git a/tools/cryptorf/sma_multi.cpp b/tools/cryptorf/sma_multi.cpp index 50b962248..c8f6ec0ec 100644 --- a/tools/cryptorf/sma_multi.cpp +++ b/tools/cryptorf/sma_multi.cpp @@ -35,6 +35,10 @@ #include "cryptolib.h" #include "util.h" +#ifdef __cplusplus +extern "C" { +#endif + using namespace std; #ifdef _MSC_VER @@ -168,6 +172,7 @@ static inline uint8_t mod(uint8_t a, uint8_t m) { if (m == 0) { return 0; // Actually, divide by zero error } + // Just return the input when this is less or equal than the modular value if (a < m) return a; @@ -935,9 +940,19 @@ static void ice_compare( uint8_t *Ch, uint8_t *Ci_1 ) { - uint8_t Gc_chk[8]; - uint8_t Ch_chk[ 8]; - uint8_t Ci_1_chk[ 8]; + uint8_t Gc_chk[8] = {0}; + uint8_t Ch_chk[8] = {0}; + uint8_t Ci_1_chk[8] = {0}; + + crypto_state_t ls; + ls.b0 = ostate->b0; + ls.b1 = ostate->b1; + ls.b1l = ostate->b1l; + ls.b1r = ostate->b1r; + ls.b1s = ostate->b1s; + ls.l = ostate->l; + ls.m = ostate->m; + ls.r = ostate->r; for (std::size_t i = offset; i < candidates->size(); i += skips) { if (key_found.load(std::memory_order_relaxed)) @@ -946,7 +961,7 @@ static void ice_compare( uint64_t tkey = candidates->at(i); num_to_bytes(tkey, 8, Gc_chk); - sm_auth(Gc_chk, Ci, Q, Ch_chk, Ci_1_chk, ostate); + sm_auth(Gc_chk, Ci, Q, Ch_chk, Ci_1_chk, &ls); if ((memcmp(Ch_chk, Ch, 8) == 0) && (memcmp(Ci_1_chk, Ci_1, 8) == 0)) { g_ice_mtx.lock(); key_found = true; @@ -1008,7 +1023,7 @@ int main(int argc, const char *argv[]) { Q[pos] = rand(); } sm_auth(Gc, Ci, Q, Ch, Ci_1, &ostate); - printf(" Gc: "); + printf(" Gc... "); print_bytes(Gc, 8); } else { sscanf(argv[1], "%016" SCNx64, &nCi); @@ -1019,7 +1034,7 @@ int main(int argc, const char *argv[]) { num_to_bytes(nCh, 8, Ch); sscanf(argv[4], "%016" SCNx64, &nCi_1); num_to_bytes(nCi_1, 8, Ci_1); - printf(" Gc: unknown\n"); + printf(" Gc... unknown\n"); } for (pos = 0; pos < 8; pos++) { @@ -1027,16 +1042,16 @@ int main(int argc, const char *argv[]) { ks[(2 * pos) + 1] = Ch[pos]; } - printf(" Ci: "); + printf(" Ci... "); print_bytes(Ci, 8); - printf(" Q: "); + printf(" Q... "); print_bytes(Q, 8); - printf(" Ch: "); + printf(" Ch... "); print_bytes(Ch, 8); - printf("Ci+1: "); + printf("Ci+1... "); print_bytes(Ci_1, 8); printf("\n"); - printf(" Ks: "); + printf(" Ks... "); print_bytes(ks, 16); printf("\n"); @@ -1117,7 +1132,7 @@ int main(int argc, const char *argv[]) { } if (key_found) { - printf("\nFound valid key: " _GREEN_("%016lX")"\n\n", key.load()); + printf("\nValid key found [ " _GREEN_("%016" PRIx64)" ]\n\n", key.load()); break; } @@ -1125,3 +1140,7 @@ int main(int argc, const char *argv[]) { } return 0; } + +#if defined(__cplusplus) +} +#endif diff --git a/tools/fpga_compress/fpga_compress.c b/tools/fpga_compress/fpga_compress.c index 135125bfc..ab1d93243 100644 --- a/tools/fpga_compress/fpga_compress.c +++ b/tools/fpga_compress/fpga_compress.c @@ -21,6 +21,10 @@ #include "fpga.h" #include "lz4hc.h" +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + static void usage(void) { fprintf(stdout, "Usage: fpga_compress ... \n"); fprintf(stdout, " Combine n FPGA bitstream files and compress them into one.\n\n"); @@ -57,10 +61,6 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) { , num_infiles * FPGA_CONFIG_SIZE ); - for (uint16_t j = 0; j < num_infiles; j++) { - fclose(infile[j]); - } - free(fpga_config); return (EXIT_FAILURE); } @@ -77,59 +77,75 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) { } } - } while (!all_feof(infile, num_infiles)); + } while (all_feof(infile, num_infiles) == false); uint32_t buffer_size = FPGA_RING_BUFFER_BYTES; - if (num_infiles == 1) - buffer_size = 1024 * 1024; //1M for now + if (num_infiles == 1) { + // 1M bytes for now + buffer_size = 1024 * 1024; + } uint32_t outsize_max = LZ4_compressBound(buffer_size); char *outbuf = calloc(outsize_max, sizeof(char)); + if (outbuf == NULL) { + fprintf(stderr, "failed to allocate memory"); + free(fpga_config); + return (EXIT_FAILURE); + } + + char *ring_buffer = calloc(buffer_size, sizeof(char)); + if (ring_buffer == NULL) { + fprintf(stderr, "failed to allocate memory"); + free(outbuf); + free(fpga_config); + return (EXIT_FAILURE); + } LZ4_streamHC_t *lz4_streamhc = LZ4_createStreamHC(); LZ4_resetStreamHC_fast(lz4_streamhc, LZ4HC_CLEVEL_MAX); int current_in = 0; int current_out = 0; - char *ring_buffer = calloc(buffer_size, sizeof(char)); + while (current_in < total_size) { - int bytes_to_copy = FPGA_RING_BUFFER_BYTES; - if (total_size - current_in < FPGA_RING_BUFFER_BYTES) - bytes_to_copy = total_size - current_in; + + int bytes_to_copy = MIN(FPGA_RING_BUFFER_BYTES, (total_size - current_in)); memcpy(ring_buffer, fpga_config + current_in, bytes_to_copy); + int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max); if (cmp_bytes < 0) { - fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes); + fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d", cmp_bytes); free(ring_buffer); free(outbuf); free(fpga_config); + LZ4_freeStreamHC(lz4_streamhc); return (EXIT_FAILURE); } + + // write size fwrite(&cmp_bytes, sizeof(int), 1, outfile); + + // write compressed data fwrite(outbuf, sizeof(char), cmp_bytes, outfile); current_in += bytes_to_copy; current_out += cmp_bytes; } + // free allocated buffers free(ring_buffer); free(outbuf); free(fpga_config); - - fclose(outfile); - for (uint16_t j = 0; j < num_infiles; j++) { - fclose(infile[j]); - } LZ4_freeStreamHC(lz4_streamhc); - fprintf(stdout, "compressed %u input bytes to %d output bytes\n", total_size, current_out); - if (current_out == 0) { fprintf(stderr, "error in lz4"); return (EXIT_FAILURE); + } else { + fprintf(stdout, "compressed %u input bytes to %d output bytes\n", total_size, current_out); } return (EXIT_SUCCESS); } @@ -144,41 +160,43 @@ typedef struct lz4_stream_s { // Call it either with opened infile + outsize=0 // or with opened infile, opened outfiles, num_outfiles and valid outsize static int zlib_decompress(FILE *infile, FILE *outfiles[], uint8_t num_outfiles, long *outsize) { + if (num_outfiles > 10) { return (EXIT_FAILURE); } - LZ4_streamDecode_t lz4StreamDecode_body = {{ 0 }}; - char outbuf[FPGA_RING_BUFFER_BYTES]; + LZ4_streamDecode_t lz4StreamDecode_body = {{ 0 }}; + char outbuf[FPGA_RING_BUFFER_BYTES] = {0}; + + // file size fseek(infile, 0L, SEEK_END); long infile_size = ftell(infile); fseek(infile, 0L, SEEK_SET); if (infile_size <= 0) { printf("error, when getting filesize"); - if (*outsize > 0) { - fclose(infile); - for (uint16_t j = 0; j < num_outfiles; j++) { - fclose(outfiles[j]); - } - } return (EXIT_FAILURE); } char *outbufall = NULL; if (*outsize > 0) { outbufall = calloc(*outsize, sizeof(char)); + if (outbufall == NULL) { + return (EXIT_FAILURE); + } } + char *inbuf = calloc(infile_size, sizeof(char)); + if (inbuf == NULL) { + if (outbufall) { + free(outbufall); + } + return (EXIT_FAILURE); + } + size_t num_read = fread(inbuf, sizeof(char), infile_size, infile); if (num_read != infile_size) { - if (*outsize > 0) { - fclose(infile); - for (uint16_t j = 0; j < num_outfiles; j++) { - fclose(outfiles[j]); - } - } if (outbufall) { free(outbufall); } @@ -198,22 +216,26 @@ static int zlib_decompress(FILE *infile, FILE *outfiles[], uint8_t num_outfiles, memcpy(&cmp_bytes, compressed_fpga_stream.next_in, sizeof(int)); compressed_fpga_stream.next_in += 4; compressed_fpga_stream.avail_in -= cmp_bytes + 4; + const int decBytes = LZ4_decompress_safe_continue(compressed_fpga_stream.lz4StreamDecode, compressed_fpga_stream.next_in, outbuf, cmp_bytes, FPGA_RING_BUFFER_BYTES); if (decBytes <= 0) { break; } + if (outbufall != NULL) { memcpy(outbufall + total_size, outbuf, decBytes); } + total_size += decBytes; compressed_fpga_stream.next_in += cmp_bytes; } + if (outbufall == NULL) { *outsize = total_size; fseek(infile, 0L, SEEK_SET); return EXIT_SUCCESS; } else { - fclose(infile); + // seeking for trailing zeroes long offset = 0; long outfilesizes[10] = {0}; @@ -227,17 +249,21 @@ static int zlib_decompress(FILE *infile, FILE *outfiles[], uint8_t num_outfiles, offset += FPGA_INTERLEAVE_SIZE; } } + total_size = 0; // FPGA bit file ends with 16 zeroes for (uint16_t j = 0; j < num_outfiles; j++) { outfilesizes[j] += 16; total_size += outfilesizes[j]; } + offset = 0; for (long k = 0; k < *outsize / (FPGA_INTERLEAVE_SIZE * num_outfiles); k++) { for (uint16_t j = 0; j < num_outfiles; j++) { if (k * FPGA_INTERLEAVE_SIZE < outfilesizes[j]) { - uint16_t chunk = outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) < FPGA_INTERLEAVE_SIZE ? outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) : FPGA_INTERLEAVE_SIZE; + uint16_t chunk = (outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) < FPGA_INTERLEAVE_SIZE) ? + outfilesizes[j] - (k * FPGA_INTERLEAVE_SIZE) : FPGA_INTERLEAVE_SIZE; + fwrite(outbufall + offset, chunk, sizeof(char), outfiles[j]); } offset += FPGA_INTERLEAVE_SIZE; @@ -245,13 +271,9 @@ static int zlib_decompress(FILE *infile, FILE *outfiles[], uint8_t num_outfiles, } printf("uncompressed %li input bytes to %li output bytes\n", infile_size, total_size); } - if (*outsize > 0) { - for (uint16_t j = 0; j < num_outfiles; j++) { - fclose(outfiles[j]); - } - } free(outbufall); + free(inbuf); return (EXIT_SUCCESS); } @@ -417,7 +439,7 @@ static int generate_fpga_version_info(FILE *infile[], char *infile_names[], int fprintf(outfile, "\n"); } fprintf(outfile, "};\n"); - return 0; + return EXIT_SUCCESS; } int main(int argc, char **argv) { @@ -432,6 +454,7 @@ int main(int argc, char **argv) { usage(); return (EXIT_FAILURE); } + uint8_t num_output_files = argc - 3; FILE **outfiles = calloc(num_output_files, sizeof(FILE *)); char **outfile_names = calloc(num_output_files, sizeof(char *)); @@ -445,9 +468,16 @@ int main(int argc, char **argv) { return (EXIT_FAILURE); } } + FILE *infile = fopen(argv[2], "rb"); if (infile == NULL) { fprintf(stderr, "Error. Cannot open input file %s\n\n", argv[2]); + + // close file handlers + for (uint16_t j = 0; j < num_output_files; j++) { + fclose(outfiles[j]); + } + free(outfile_names); free(outfiles); return (EXIT_FAILURE); @@ -461,9 +491,17 @@ int main(int argc, char **argv) { // Second call to create files ret = zlib_decompress(infile, outfiles, num_output_files, &outsize); } + + // close file handlers + fclose(infile); + for (uint16_t j = 0; j < num_output_files; j++) { + fclose(outfiles[j]); + } + free(outfile_names); free(outfiles); return (ret); + } else { // Compress or generate version info bool generate_version_file = false; @@ -487,23 +525,37 @@ int main(int argc, char **argv) { return (EXIT_FAILURE); } } + FILE *outfile = fopen(argv[argc - 1], "wb"); if (outfile == NULL) { fprintf(stderr, "Error. Cannot open output file %s\n\n", argv[argc - 1]); + + // close file handlers + for (uint16_t j = 0; j < num_input_files; j++) { + fclose(infiles[j]); + } + free(infile_names); free(infiles); return (EXIT_FAILURE); } + + int ret = 0; if (generate_version_file) { - int ret = generate_fpga_version_info(infiles, infile_names, num_input_files, outfile); - free(infile_names); - free(infiles); - return (ret); + ret = generate_fpga_version_info(infiles, infile_names, num_input_files, outfile); } else { - int ret = zlib_compress(infiles, num_input_files, outfile); - free(infile_names); - free(infiles); - return (ret); + ret = zlib_compress(infiles, num_input_files, outfile); } + + // close file handlers + fclose(outfile); + for (uint16_t j = 0; j < num_input_files; j++) { + fclose(infiles[j]); + } + + // free file name allocs + free(infile_names); + free(infiles); + return (ret); } } diff --git a/tools/hitag2crack/crack2/.gitignore b/tools/hitag2crack/crack2/.gitignore index 71494d126..7cf31896d 100644 --- a/tools/hitag2crack/crack2/.gitignore +++ b/tools/hitag2crack/crack2/.gitignore @@ -1,6 +1,6 @@ -ht2crack2buildtable -ht2crack2search -ht2crack2gentest +ht2crack2buildtable +ht2crack2search +ht2crack2gentest ht2crack2buildtable.exe ht2crack2search.exe diff --git a/tools/hitag2crack/crack3/ht2crack3.c b/tools/hitag2crack/crack3/ht2crack3.c index a81d33d40..f50ea6af4 100644 --- a/tools/hitag2crack/crack3/ht2crack3.c +++ b/tools/hitag2crack/crack3/ht2crack3.c @@ -386,13 +386,14 @@ int main(int argc, char *argv[]) { // debug mode only runs one thread from klowerstart tdata[0].klowerstart = klowerstart; crack(tdata); - } else { - // run full threaded mode - for (i = 0; i < NUM_THREADS; i++) { - if (pthread_create(&(threads[i]), NULL, crack, (void *)(tdata + i))) { - printf("cannot start thread %d\n", i); - exit(1); - } + return 0; + } + + // run full threaded mode + for (i = 0; i < NUM_THREADS; i++) { + if (pthread_create(&(threads[i]), NULL, crack, (void *)(tdata + i))) { + printf("cannot start thread %d\n", i); + exit(1); } } diff --git a/tools/hitag2crack/crack5opencl/ht2crack5opencl_kernel.cl b/tools/hitag2crack/crack5opencl/ht2crack5opencl_kernel.cl index 1d4bd9653..f914b229c 100644 --- a/tools/hitag2crack/crack5opencl/ht2crack5opencl_kernel.cl +++ b/tools/hitag2crack/crack5opencl/ht2crack5opencl_kernel.cl @@ -603,7 +603,7 @@ void find_state(const uint candidate_index_base, const bitslice_t filter9_3 = f_b_bs(state[-2 + 37], state[-2 + 38], state[-2 + 40], state[-2 + 42]); const bitslice_t filter9 = f_c_bs(filter9_0, filter9_1, filter9_2, filter9_3, filter9_4); - + results8 &= (filter9 ^ keystream[9]); if (!results8) continue; diff --git a/tools/mf_nonce_brute/mf_nonce_brute.c b/tools/mf_nonce_brute/mf_nonce_brute.c index 161f1c749..2491c502d 100644 --- a/tools/mf_nonce_brute/mf_nonce_brute.c +++ b/tools/mf_nonce_brute/mf_nonce_brute.c @@ -533,7 +533,7 @@ static int usage(void) { return 1; } -int main(int argc, char *argv[]) { +int main(int argc, const char *argv[]) { printf("\nMifare classic nested auth key recovery\n\n"); if (argc < 9) return usage(); diff --git a/tools/mf_nonce_brute/mf_trace_brute.c b/tools/mf_nonce_brute/mf_trace_brute.c index 1d8a7c6fb..c416c006f 100644 --- a/tools/mf_nonce_brute/mf_trace_brute.c +++ b/tools/mf_nonce_brute/mf_trace_brute.c @@ -247,7 +247,7 @@ static int usage(void) { return 1; } -int main(int argc, char *argv[]) { +int main(int argc, const char *argv[]) { printf("Mifare classic nested auth key recovery Phase 2\n"); if (argc < 3) return usage(); diff --git a/tools/mfd_aes_brute/readme.txt b/tools/mfd_aes_brute/readme.txt index c69835609..4d0ac2ec3 100644 --- a/tools/mfd_aes_brute/readme.txt +++ b/tools/mfd_aes_brute/readme.txt @@ -42,10 +42,10 @@ expected result: 261c07a23f2bc8262f69f10a5bdf3764 -Bruteforce using 8 threads -Found timestamp........ 1631100305 ( '2021-09-08 13:25:05' ) -key.................... 261c07a23f2bc8262f69f10a5bdf3764 -execution time 1.00 sec +Bruteforce using 8 threads +Found timestamp........ 1631100305 ( '2021-09-08 13:25:05' ) +key.................... 261c07a23f2bc8262f69f10a5bdf3764 +execution time 1.00 sec # # complex @@ -55,8 +55,8 @@ expected result: e757178e13516a4f3171bc6ea85e165a -Bruteforce using 8 threads -Found timestamp........ 1606834416 ( '2020-12-01 15:53:36' ) -key.................... e757178e13516a4f3171bc6ea85e165a -execution time 18.54 sec +Bruteforce using 8 threads +Found timestamp........ 1606834416 ( '2020-12-01 15:53:36' ) +key.................... e757178e13516a4f3171bc6ea85e165a +execution time 18.54 sec diff --git a/tools/mfkey/example_trace.txt b/tools/mfkey/example_trace.txt index 3705cebd1..b068c0577 100644 --- a/tools/mfkey/example_trace.txt +++ b/tools/mfkey/example_trace.txt @@ -10,20 +10,20 @@ + 1287: : a1 e4 58 ce 6e ea 41 e0 + 64: 0: TAG 5c ad f4 39 -:: Sample of trace above, +:: Sample of trace above, ./mfkey64 9c599b32 82a4166c a1e458ce 6eea41e0 5cadf439 ----------------------------------------------------------------------------------------------------- :: For mfkey32, you want to get two different NR_0/NR_1 values. :: -./mfkey32 52B0F519 5417D1F8 4D545EA7 E15AC8C2 DAC1A7F4 5AE5C37F +./mfkey32 52B0F519 5417D1F8 4D545EA7 E15AC8C2 DAC1A7F4 5AE5C37F :: For mfkey32v2 (moebius), you want to get two different NT/NT1 values. (like in the SIM commands) :: ./mfkey32v2 12345678 1AD8DF2B 1D316024 620EF048 30D6CB07 C52077E2 837AC61A -./mfkey32v2 52B0F519 5417D1F8 4D545EA7 E15AC8C2 A1BA88C6 DAC1A7F4 5AE5C37F +./mfkey32v2 52B0F519 5417D1F8 4D545EA7 E15AC8C2 A1BA88C6 DAC1A7F4 5AE5C37F :: for mfkey64, you want to have the AT response from tag. @@ -32,7 +32,7 @@ ./mfkey64 52B0F519 5417D1F8 4D545EA7 E15AC8C2 5056E41B ----------------------------------------------------------------------------------------------------- -New functionality from @zhovner, +New functionality from @zhovner, ----------------------------------------------------------------------------------------------------- ### Communication decryption RDR 26 diff --git a/tools/mkversion.sh b/tools/mkversion.sh index f741f2980..dd95e0441 100755 --- a/tools/mkversion.sh +++ b/tools/mkversion.sh @@ -1,5 +1,13 @@ #!/usr/bin/env sh +if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "" ]; then + echo "To report a short string about the current version:" + echo " $0 --short" + echo "To regenerate version_pm3.c if needed:" + echo " $0 [--force] [--undecided] path/to/version_pm3.c" + exit 0 +fi + # Output a version_pm3.c file that includes information about the current build # From mkversion.pl # pure sh POSIX as now even on Windows we use WSL or ProxSpace with sh available @@ -13,6 +21,27 @@ if [ "$1" = "--short" ]; then SHORT=true shift fi +FORCE=false +if [ "$1" = "--force" ]; then + FORCE=true + shift +fi +UNDECIDED=false +if [ "$1" = "--undecided" ]; then + UNDECIDED=true + shift +fi +VERSIONSRC="$1" + +if ! $SHORT && [ "$VERSIONSRC" = "" ]; then + echo "Error: $0 is missing its destination filename" + exit 1 +fi + +if $SHORT && [ "$VERSIONSRC" != "" ]; then + echo "Error: can't output a short string and generate file at the same time" + exit 1 +fi # if you are making your own fork, change this line to reflect your fork-name fullgitinfo="Iceman" @@ -27,7 +56,7 @@ if [ "$commandGIT" != "" ]; then # now avoiding the "fatal: No names found, cannot describe anything." error by fallbacking to abbrev hash in such case gitversion=$(git describe --dirty --always) gitbranch=$(git rev-parse --abbrev-ref HEAD) - if [ "$1" != "--undecided" ]; then + if $UNDECIDED; then if [ "$gitversion" != "${gitversion%-dirty}" ]; then clean=0 else @@ -68,7 +97,21 @@ sha=$( if [ "$sha" = "" ]; then sha="no sha256" fi -cat < "${VERSIONSRC}.tmp" <&1" "OK"; then break; fi if ! CheckExecute "pm3_eml_mfd test" "tools/pm3_eml_mfd_test.py 2>&1" "OK"; then break; fi if ! CheckExecute "recover_pk test" "tools/recover_pk.py selftests 2>&1" "Tests:.*\[OK\]"; then break; fi - if ! CheckExecute "mkversion sha256 test" "tools/mkversion.sh" '"[0-9a-f]{9}"'; then break; fi + if ! CheckExecute "mkversion create test" "tools/mkversion.sh --short" 'Iceman/'; then break; fi fi if $TESTALL || $TESTBOOTROM; then echo -e "\n${C_BLUE}Testing bootrom:${C_NC}" @@ -288,13 +301,21 @@ while true; do if ! CheckFileExist "mf_nonce_brute exists" "$MFNONCEBRUTEBIN"; then break; fi if ! CheckExecute slow "mf_nonce_brute test 1/2" "$MFNONCEBRUTEBIN 9c599b32 5a920d85 1011 98d76b77 d6c6e870 0000 ca7e0b63 0111 3e709c8a" "Key found \[.*ffffffffffff.*\]"; then break; fi if ! CheckExecute slow "mf_nonce_brute test 2/2" "$MFNONCEBRUTEBIN 96519578 d7e3c6ac 0011 cd311951 9da49e49 0010 2bb22e00 0100 a4f7f398" "Key found \[.*3b7e4fd575ad.*\]"; then break; fi - fi + fi if $TESTALL || $TESTMFDAESBRUTE; then echo -e "\n${C_BLUE}Testing mfd_aes_brute:${C_NC} ${MFDASEBRUTEBIN:=./tools/mfd_aes_brute/mfd_aes_brute}" if ! CheckFileExist "mfd_aes_brute exists" "$MFDASEBRUTEBIN"; then break; fi - if ! CheckExecute "mfd_aes_brute test 1/2" "$MFDASEBRUTEBIN 1605394800 bb6aea729414a5b1eff7b16328ce37fd 82f5f498dbc29f7570102397a2e5ef2b6dc14a864f665b3c54d11765af81e95c" "key.................... .*261C07A23F2BC8262F69F10A5BDF3764"; then break; fi + if ! CheckExecute "mfd_aes_brute test 1/2" "$MFDASEBRUTEBIN 1629394800 bb6aea729414a5b1eff7b16328ce37fd 82f5f498dbc29f7570102397a2e5ef2b6dc14a864f665b3c54d11765af81e95c" "key.................... .*261C07A23F2BC8262F69F10A5BDF3764"; then break; fi if ! CheckExecute slow "mfd_aes_brute test 2/2" "$MFDASEBRUTEBIN 1546300800 3fda933e2953ca5e6cfbbf95d1b51ddf 97fe4b5de24188458d102959b888938c988e96fb98469ce7426f50f108eaa583" "key.................... .*E757178E13516A4F3171BC6EA85E165A"; then break; fi fi + + if $TESTALL || $TESTCRYPTORF; then + echo -e "\n${C_BLUE}Testing CryptoRF sma:${C_NC} ${CRYPTRFBRUTEBIN:=./tools/cryptorf/sma} ${CRYPTRF_MULTI_BRUTEBIN:=./tools/cryptorf/sma_multi}" + if ! CheckFileExist "sma exists" "$CRYPTRFBRUTEBIN"; then break; fi + if ! CheckFileExist "sma_multi exists" "$CRYPTRF_MULTI_BRUTEBIN"; then break; fi +# if ! CheckExecute slow "sma test" "$CRYPTRFBRUTEBIN ffffffffffffffff 1234567812345678 88c9d4466a501a87 dec2ee1b1c9276e9" "key found \[.*4f794a463ff81d81.*\]"; then break; fi + if ! CheckExecute slow "sma_multi test" "$CRYPTRF_MULTI_BRUTEBIN ffffffffffffffff 1234567812345678 88c9d4466a501a87 dec2ee1b1c9276e9" "key found \[.*4f794a463ff81d81.*\]"; then break; fi + fi # hitag2crack not yet part of "all" # if $TESTALL || $TESTHITAG2CRACK; then if $TESTHITAG2CRACK; then @@ -384,13 +405,15 @@ while true; do if ! CheckExecute "jooki encode test" "$CLIENTBIN -c 'hf jooki encode -t'" "04 28 F4 DA F0 4A 81 \( ok \)"; then break; fi if ! CheckExecute "trace load/list 14a" "$CLIENTBIN -c 'trace load -f traces/hf_14a_mfu.trace; trace list -1 -t 14a;'" "READBLOCK\(8\)"; then break; fi if ! CheckExecute "trace load/list x" "$CLIENTBIN -c 'trace load -f traces/hf_14a_mfu.trace; trace list -x1 -t 14a;'" "0.0101840425"; then break; fi - if ! CheckExecute "nfc decode test - oob" "$CLIENTBIN -c 'nfc decode -d DA2010016170706C69636174696F6E2F766E642E626C7565746F6F74682E65702E6F6F62301000649201B96DFB0709466C65782032'" "Flex 2"; then break; fi - if ! CheckExecute "nfc decode test - device info" "$CLIENTBIN -c 'nfc decode -d d1025744690004536f6e79010752432d533338300220426c61636b204e46432052656164657220636f6e6e656374656420746f2050430310123e4567e89b12d3a45642665544000004124e464320506f72742d3130302076312e3032'" "NFC Port-100 v1.02"; then break; fi - if ! CheckExecute "nfc decode test - vcard" "$CLIENTBIN -c 'nfc decode -d d20ca3746578742f782d7643617264424547494e3a56434152440a56455253494f4e3a332e300a4e3a43687269733b4963656d616e3b3b3b0a464e3a476f7468656e627572670a5245563a323032312d30362d32345432303a31353a30385a0a6974656d322e582d4142444154453b747970653d707265663a323032302d30362d32340a4954454d322e582d41424c4142454c3a5f24213c416e6e69766572736172793e21245f0a454e443a56434152440a'" "END:VCARD"; then break; fi - if ! CheckExecute "nfc decode test - apple wallet" "$CLIENTBIN -c 'nfc decode -d 031AD10116550077616C6C65743A2F2F61637469766174652F6E6663FE'" "activate/nfc"; then break; fi - if ! CheckExecute "nfc decode test - signature" "$CLIENTBIN -c 'nfc decode -d 03FF010194113870696C65742E65653A656B616172743A3266195F26063132303832325904202020205F28033233335F2701316E1B5A13333038363439303039303030323636343030355304EBF2CE704103000000AC536967010200803A2448FCA7D354A654A81BD021150D1A152D1DF4D7A55D2B771F12F094EAB6E5E10F2617A2F8DAD4FD38AFF8EA39B71C19BD42618CDA86EE7E144636C8E0E7CFC4096E19C3680E09C78A0CDBC05DA2D698E551D5D709717655E56FE3676880B897D2C70DF5F06ECE07C71435255144F8EE41AF110E7B180DA0E6C22FB8FDEF61800025687474703A2F2F70696C65742E65652F6372742F33303836343930302D303030312E637274FE'" "30864900-0001.crt"; then break; fi + if ! CheckExecute "nfc decode test - oob" "$CLIENTBIN -c 'nfc decode -d DA2010016170706C69636174696F6E2F766E642E626C7565746F6F74682E65702E6F6F62301000649201B96DFB0709466C65782032'" "Flex 2"; then break; fi + if ! CheckExecute "nfc decode test - device info" "$CLIENTBIN -c 'nfc decode -d d1025744690004536f6e79010752432d533338300220426c61636b204e46432052656164657220636f6e6e656374656420746f2050430310123e4567e89b12d3a45642665544000004124e464320506f72742d3130302076312e3032'" "NFC Port-100 v1.02"; then break; fi + if ! CheckExecute "nfc decode test - vcard" "$CLIENTBIN -c 'nfc decode -d d20ca3746578742f782d7643617264424547494e3a56434152440a56455253494f4e3a332e300a4e3a43687269733b4963656d616e3b3b3b0a464e3a476f7468656e627572670a5245563a323032312d30362d32345432303a31353a30385a0a6974656d322e582d4142444154453b747970653d707265663a323032302d30362d32340a4954454d322e582d41424c4142454c3a5f24213c416e6e69766572736172793e21245f0a454e443a56434152440a'" "END:VCARD"; then break; fi + if ! CheckExecute "nfc decode test - apple wallet" "$CLIENTBIN -c 'nfc decode -d 031AD10116550077616C6C65743A2F2F61637469766174652F6E6663FE'" "activate/nfc"; then break; fi + if ! CheckExecute "nfc decode test - signature" "$CLIENTBIN -c 'nfc decode -d 03FF010194113870696C65742E65653A656B616172743A3266195F26063132303832325904202020205F28033233335F2701316E1B5A13333038363439303039303030323636343030355304EBF2CE704103000000AC536967010200803A2448FCA7D354A654A81BD021150D1A152D1DF4D7A55D2B771F12F094EAB6E5E10F2617A2F8DAD4FD38AFF8EA39B71C19BD42618CDA86EE7E144636C8E0E7CFC4096E19C3680E09C78A0CDBC05DA2D698E551D5D709717655E56FE3676880B897D2C70DF5F06ECE07C71435255144F8EE41AF110E7B180DA0E6C22FB8FDEF61800025687474703A2F2F70696C65742E65652F6372742F33303836343930302D303030312E637274FE'" "30864900-0001.crt"; then break; fi echo -e "\n${C_BLUE}Testing LF:${C_NC}" + if ! CheckExecute "lf cotag demod test" "$CLIENTBIN -c 'data load -f traces/lf_cotag_220_8331.pm3; data norm; data cthreshold -u 50 -d -20; data envelope; data raw --ar -c 272; lf cotag demod'" \ + "COTAG Found: FC 220, CN: 8331 Raw: FFB841170363FFFE00001E7F00000000"; then break; fi if ! CheckExecute "lf AWID test" "$CLIENTBIN -c 'data load -f traces/lf_AWID-15-259.pm3;lf search -1'" "AWID ID found"; then break; fi if ! CheckExecute "lf EM410x test" "$CLIENTBIN -c 'data load -f traces/lf_EM4102-1.pm3;lf search -1'" "EM410x ID found"; then break; fi if ! CheckExecute "lf EM4x05 test" "$CLIENTBIN -c 'data load -f traces/lf_EM4x05.pm3;lf search -1'" "FDX-B ID found"; then break; fi @@ -505,7 +528,7 @@ while true; do if ! CheckExecute slow "hf iclass loclass long test" "$CLIENTBIN -c 'hf iclass loclass --long'" "verified \( ok \)"; then break; fi if ! CheckExecute slow "emv long test" "$CLIENTBIN -c 'emv test -l'" "Test\(s\) \[ ok"; then break; fi if ! CheckExecute "hf iclass lookup test" "$CLIENTBIN -c 'hf iclass lookup --csn 9655a400f8ff12e0 --epurse f0ffffffffffffff --macs 0000000089cb984b -f $DICPATH/iclass_default_keys.dic'" \ - "valid key AE A6 84 A6 DA B2 32 78"; then break; fi + "valid key AE A6 84 A6 DA B2 32 78"; then break; fi if ! CheckExecute "hf iclass loclass test" "$CLIENTBIN -c 'hf iclass loclass --test'" "key diversification \( ok \)"; then break; fi if ! CheckExecute "emv test" "$CLIENTBIN -c 'emv test'" "Test\(s\) \[ ok"; then break; fi if ! CheckExecute "hf cipurse test" "$CLIENTBIN -c 'hf cipurse test'" "Tests \[ ok"; then break; fi diff --git a/traces/lf_ATA5577.txt b/traces/lf_ATA5577.txt index 7d9ac4561..0ae92af08 100644 --- a/traces/lf_ATA5577.txt +++ b/traces/lf_ATA5577.txt @@ -44,7 +44,7 @@ lf indala clone --fc 123 --cn 1337 lf read s 10000 data save f lf_ATA5577_indala -lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5 +lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5 lf read s 10000 data save f lf_ATA5577_indala_224 @@ -92,7 +92,7 @@ lf noralsy clone 112233 lf read s 10000 data save f lf_ATA5577_noralsy -lf pac clone c CD4F5552 +lf pac clone c CD4F5552 lf read s 10000 data save f lf_ATA5577_pac diff --git a/traces/lf_cotag_220_8331.pm3 b/traces/lf_cotag_220_8331.pm3 new file mode 100644 index 000000000..49e96ecb5 --- /dev/null +++ b/traces/lf_cotag_220_8331.pm3 @@ -0,0 +1,42523 @@ +28 +16 +21 +24 +14 +17 +9 +5 +13 +6 +5 +4 +2 +4 +0 +0 +4 +2 +2 +9 +2 +3 +14 +-2 +7 +-3 +-4 +5 +-3 +-1 +-1 +-2 +-2 +-5 +8 +2 +-5 +2 +5 +0 +-1 +-1 +4 +-2 +-2 +0 +2 +4 +12 +-1 +0 +-2 +-4 +-3 +-3 +-1 +1 +8 +-2 +-1 +6 +16 +0 +2 +-1 +4 +-4 +0 +0 +-5 +2 +5 +7 +-4 +-1 +7 +-4 +10 +-2 +-4 +-3 +-3 +15 +1 +0 +4 +0 +-5 +12 +-1 +-4 +-6 +0 +7 +5 +-4 +-6 +-4 +13 +8 +-5 +-4 +-1 +14 +-2 +-3 +0 +-4 +3 +7 +3 +-5 +1 +11 +0 +-4 +-1 +0 +-5 +-4 +0 +3 +11 +10 +7 +-1 +0 +-31 +9 +-28 +-44 +11 +-23 +-42 +29 +-11 +-37 +26 +-13 +-37 +25 +-10 +-33 +21 +-14 +-29 +35 +-1 +-18 +25 +-12 +-15 +29 +-10 +-22 +35 +-6 +-30 +25 +-5 +-26 +24 +-5 +-15 +45 +2 +-26 +32 +-8 +-31 +27 +-11 +-32 +27 +-7 +-18 +29 +-11 +-30 +32 +-6 +-29 +31 +-8 +-26 +36 +-4 +-21 +37 +-4 +-27 +39 +-2 +-16 +31 +-9 +-16 +28 +-10 +-30 +42 +0 +-27 +28 +-6 +-26 +32 +-8 +-29 +26 +-11 +-22 +37 +-5 +-29 +27 +-10 +-22 +41 +3 +-25 +34 +-5 +-30 +26 +-12 +-23 +35 +-5 +-24 +42 +-2 +-24 +24 +-5 +-17 +39 +-2 +-27 +28 +-10 +-30 +26 +-11 +-29 +27 +-9 +-26 +32 +4 +-23 +29 +-7 +-27 +34 +-3 +-18 +42 +7 +-23 +30 +-9 +-29 +27 +-3 +-20 +28 +-12 +-18 +28 +-9 +10 +25 +35 +24 +28 +19 +6 +12 +2 +0 +9 +18 +12 +-2 +3 +0 +3 +-1 +-2 +3 +-1 +-1 +9 +0 +-2 +4 +2 +-4 +0 +-5 +-3 +0 +9 +1 +2 +5 +1 +3 +-4 +-3 +-5 +14 +2 +-3 +-3 +5 +-2 +-3 +2 +1 +2 +-1 +-1 +1 +0 +12 +9 +-1 +12 +-2 +-5 +-1 +15 +0 +-1 +-1 +-2 +-4 +-3 +0 +-3 +-4 +-3 +7 +-3 +-2 +-2 +-2 +-2 +5 +-2 +4 +5 +0 +0 +-4 +4 +1 +-2 +1 +5 +2 +-2 +-1 +2 +6 +1 +-3 +5 +2 +-4 +-2 +-2 +0 +1 +-1 +1 +-1 +13 +6 +-4 +-2 +2 +2 +1 +0 +-1 +-1 +4 +-2 +-3 +-3 +-3 +8 +2 +1 +-3 +1 +21 +-17 +-40 +15 +-23 +-40 +12 +-23 +-33 +18 +-17 +-36 +21 +-15 +-34 +26 +-12 +-26 +29 +-8 +-30 +26 +-12 +-23 +29 +-7 +-29 +31 +-8 +-22 +39 +-2 +-13 +37 +-5 +-27 +34 +-3 +-28 +39 +-4 +-28 +44 +1 +-23 +25 +-13 +-33 +26 +-11 +-27 +27 +-10 +-20 +31 +-8 +-20 +31 +-8 +-28 +33 +0 +-21 +30 +-9 +-23 +28 +-9 +-28 +42 +-1 +-26 +32 +-7 +-30 +27 +-9 +-15 +37 +2 +-26 +27 +-10 +-25 +29 +-4 +-15 +32 +-8 +-20 +28 +-8 +-30 +28 +-8 +-29 +33 +-4 +-22 +32 +-7 +-27 +47 +3 +-23 +38 +-4 +-20 +30 +-8 +-31 +30 +-7 +-16 +30 +-9 +-30 +28 +-9 +-30 +29 +-9 +-28 +32 +-7 +-18 +29 +-9 +-26 +33 +-4 +-25 +40 +-2 +-20 +34 +-7 +-17 +31 +-4 +-26 +30 +-9 +-24 +18 +21 +19 +19 +28 +25 +8 +11 +10 +16 +6 +13 +7 +8 +0 +3 +5 +-1 +2 +0 +-3 +-3 +4 +10 +6 +2 +-3 +-1 +15 +1 +-2 +4 +0 +-1 +-1 +3 +0 +10 +4 +-4 +15 +1 +-4 +1 +-6 +-4 +-7 +1 +-5 +1 +3 +2 +4 +-3 +-2 +0 +0 +6 +0 +2 +8 +5 +0 +-2 +11 +2 +-1 +0 +3 +-4 +-3 +-6 +6 +-2 +2 +9 +-3 +-4 +-7 +4 +-2 +-4 +-6 +3 +1 +3 +3 +9 +-3 +8 +1 +2 +7 +-4 +-3 +-4 +-4 +17 +0 +-3 +-2 +-1 +-4 +-2 +1 +-3 +8 +-2 +-4 +-4 +4 +0 +8 +-1 +-2 +-2 +-1 +0 +9 +7 +4 +-3 +9 +-2 +14 +1 +-5 +-4 +11 +-25 +-49 +6 +-28 +-46 +11 +-19 +-38 +20 +-15 +-35 +27 +-4 +-25 +30 +-10 +-30 +30 +-1 +-16 +28 +-5 +-16 +42 +-1 +-27 +24 +-12 +-25 +21 +-15 +-32 +25 +-12 +-30 +45 +2 +-22 +27 +-10 +-14 +30 +-9 +-31 +34 +-7 +-27 +32 +-4 +-29 +28 +-10 +-27 +28 +-8 +-28 +27 +1 +-23 +32 +-6 +-20 +45 +1 +-21 +33 +-7 +-28 +27 +-11 +-28 +25 +-1 +-18 +31 +-9 +-28 +30 +-7 +-28 +36 +-5 +-25 +31 +-7 +-28 +30 +-8 +-24 +31 +-3 +-25 +27 +-6 +-25 +29 +-8 +-23 +31 +-1 +-25 +45 +3 +-23 +29 +-9 +-25 +30 +-8 +-25 +29 +-7 +-26 +37 +-3 +-29 +30 +-4 +-26 +49 +4 +-25 +34 +-7 +-27 +27 +-11 +-30 +40 +-3 +-25 +27 +-8 +-27 +37 +-1 +-22 +26 +-11 +-30 +30 +-5 +-17 +34 +-5 +-9 +33 +2 +-25 +24 +-10 +-31 +27 +-9 +-29 +32 +-7 +-25 +37 +-5 +-23 +34 +-5 +-29 +31 +-5 +-27 +40 +4 +-17 +28 +-7 +-25 +25 +0 +-26 +27 +-11 +-26 +32 +-2 +-22 +31 +-5 +-24 +34 +-6 +-30 +27 +2 +-24 +43 +1 +-19 +27 +-11 +-31 +26 +-5 +-17 +28 +-12 +-31 +25 +-11 +27 +-10 +-26 +35 +-7 +-30 +30 +-9 +-16 +44 +4 +-25 +30 +-7 +-32 +28 +-9 +-23 +39 +-3 +-29 +34 +-7 +-30 +28 +-9 +-19 +27 +-7 +-29 +24 +-12 +-30 +28 +-8 +-29 +31 +-6 +-25 +45 +7 +-10 +32 +-7 +-27 +38 +-3 +-29 +28 +-10 +-29 +25 +-9 +-24 +29 +-8 +-29 +32 +-8 +-27 +33 +-6 +-22 +33 +-7 +-27 +31 +-7 +-26 +29 +-9 +32 +-5 +-28 +35 +-2 +-24 +45 +1 +-26 +33 +44 +17 +14 +12 +11 +19 +12 +6 +22 +6 +2 +2 +7 +-2 +3 +0 +10 +-1 +0 +-2 +0 +3 +1 +0 +1 +-3 +-2 +0 +2 +10 +1 +-4 +-4 +13 +3 +3 +1 +2 +-2 +-1 +0 +-1 +2 +-5 +-1 +0 +1 +3 +0 +-6 +1 +6 +-3 +-1 +1 +0 +8 +4 +-2 +3 +3 +0 +-1 +-1 +4 +-1 +1 +7 +3 +6 +4 +-5 +-6 +-4 +-1 +-6 +13 +12 +1 +-1 +11 +15 +10 +-4 +-8 +-6 +1 +-5 +-3 +-3 +-3 +2 +1 +-5 +4 +9 +-3 +-4 +3 +2 +3 +3 +10 +0 +10 +-3 +-1 +-6 +-3 +-1 +-3 +10 +-3 +-1 +-4 +3 +-3 +-2 +0 +-6 +-1 +-4 +-2 +3 +-3 +-3 +4 +7 +1 +-4 +6 +0 +-6 +-1 +-1 +4 +2 +-4 +-5 +3 +-4 +-2 +16 +2 +6 +16 +4 +-5 +-4 +2 +-6 +-5 +8 +-2 +1 +5 +18 +0 +-6 +-7 +-5 +8 +-3 +-2 +13 +2 +-2 +-1 +-5 +-3 +-1 +-2 +8 +2 +-5 +0 +1 +-5 +1 +8 +-2 +-5 +-2 +0 +5 +-1 +-3 +3 +-3 +-6 +-5 +17 +2 +0 +-3 +-3 +1 +12 +10 +3 +4 +0 +-4 +1 +-5 +-7 +5 +0 +1 +-2 +3 +1 +-2 +0 +-3 +-3 +3 +-2 +-1 +13 +3 +3 +8 +-2 +-5 +-4 +8 +-4 +11 +10 +-2 +-9 +-5 +0 +0 +-5 +0 +0 +1 +-6 +-4 +-2 +2 +6 +2 +0 +3 +10 +-2 +-5 +-4 +-2 +-3 +5 +9 +-2 +-33 +-50 +19 +-20 +-40 +16 +-17 +-37 +29 +-11 +-33 +20 +-16 +-34 +34 +-7 +-29 +38 +-4 +-29 +27 +-11 +-20 +30 +-9 +-29 +32 +-8 +-29 +28 +-7 +-20 +31 +-6 +-19 +30 +-8 +-25 +38 +-4 +-22 +30 +-8 +-29 +29 +-7 +-24 +29 +-3 +-18 +38 +-4 +-22 +29 +-9 +-30 +43 +-1 +-27 +37 +0 +-27 +28 +-11 +-26 +36 +-4 +-28 +32 +-9 +-30 +28 +-9 +-21 +28 +-11 +-27 +35 +-5 +-28 +41 +5 +-23 +43 +0 +-25 +28 +-11 +-14 +29 +-10 +-31 +28 +-6 +-29 +30 +-7 +-23 +25 +-11 +-19 +38 +3 +-12 +31 +-6 +-27 +24 +-5 +-21 +29 +-8 +-26 +40 +-2 +-29 +31 +-7 +-20 +39 +-2 +-15 +26 +-12 +-26 +38 +-1 +-25 +23 +-15 +-28 +26 +-6 +-28 +30 +-10 +-31 +30 +-6 +-30 +29 +-3 +-27 +48 +4 +-25 +25 +-4 +-28 +28 +-10 +-29 +29 +-10 +-20 +32 +-4 +-24 +32 +-4 +-25 +29 +-9 +-30 +32 +-7 +-27 +28 +-8 +-24 +40 +3 +-17 +39 +4 +-18 +28 +-10 +-26 +42 +-1 +-26 +27 +-11 +-27 +32 +-3 +-25 +35 +-4 +-27 +26 +-2 +-28 +30 +-6 +-30 +29 +-9 +-31 +30 +-10 +-12 +32 +-5 +-13 +30 +-10 +-19 +32 +-8 +-30 +33 +-3 +-26 +32 +-7 +-22 +35 +-2 +-27 +27 +0 +-27 +35 +-4 +-29 +29 +-9 +-32 +32 +-7 +-28 +32 +-5 +-26 +25 +-7 +-23 +31 +-7 +-27 +28 +-10 +-22 +35 +-2 +-13 +49 +3 +-12 +29 +-10 +-28 +28 +-11 +-32 +43 +0 +-26 +34 +-7 +-30 +30 +-9 +-32 +30 +-9 +-18 +31 +-8 +-25 +29 +-6 +-28 +28 +-9 +-16 +44 +0 +-25 +28 +-6 +-29 +26 +-6 +-25 +26 +46 +22 +15 +13 +15 +8 +10 +10 +10 +16 +25 +4 +10 +6 +11 +1 +3 +-5 +-1 +-2 +-2 +-2 +5 +5 +-6 +-1 +-3 +15 +0 +2 +5 +1 +4 +-3 +-2 +11 +-2 +-5 +1 +7 +-4 +5 +10 +1 +-4 +-4 +-3 +-6 +-4 +-3 +0 +-1 +-4 +2 +-1 +-2 +-3 +4 +-2 +6 +1 +0 +5 +12 +2 +-4 +10 +-3 +-1 +-4 +-4 +6 +1 +-3 +-1 +0 +9 +1 +-2 +4 +-1 +-5 +1 +-3 +-3 +4 +2 +2 +2 +-3 +11 +15 +7 +-6 +-6 +-3 +-4 +-4 +0 +-1 +10 +-2 +-3 +-3 +1 +-4 +-3 +4 +-3 +-1 +16 +0 +-2 +10 +1 +-2 +-2 +-6 +11 +11 +-1 +-4 +0 +-8 +1 +2 +-4 +-3 +-35 +-52 +17 +-20 +-35 +30 +-11 +-38 +29 +-11 +-36 +21 +-9 +-34 +25 +-12 +-31 +25 +-9 +-31 +24 +-12 +-24 +26 +-4 +-27 +30 +-9 +-15 +36 +0 +-18 +28 +-9 +-29 +30 +-8 +-20 +32 +-2 +-25 +43 +0 +-28 +33 +-7 +-17 +36 +-4 +-29 +26 +-13 +-27 +25 +-3 +-28 +41 +-3 +-20 +33 +-7 +-24 +35 +-7 +-30 +36 +-4 +-30 +35 +-6 +-20 +39 +-3 +-27 +27 +-12 +-29 +25 +-12 +-21 +30 +-5 +-17 +43 +0 +-25 +32 +-9 +-29 +28 +-11 +-32 +27 +-8 +-28 +26 +-10 +-25 +29 +3 +-23 +32 +0 +-17 +30 +-9 +-29 +30 +-9 +-23 +29 +-8 +-25 +31 +-7 +-28 +29 +-9 +-29 +37 +1 +-24 +40 +-1 +-26 +28 +-9 +-30 +35 +-4 +-26 +29 +-8 +-27 +33 +-7 +-28 +35 +-3 +-27 +31 +2 +-20 +27 +30 +20 +26 +14 +13 +13 +9 +23 +19 +4 +3 +9 +12 +0 +0 +0 +0 +20 +4 +-3 +10 +2 +-2 +-1 +-2 +0 +-1 +4 +-2 +-2 +8 +5 +0 +4 +0 +-2 +5 +3 +6 +-2 +2 +-3 +-3 +-4 +-3 +6 +-1 +1 +-2 +-2 +8 +11 +-1 +-4 +-5 +-2 +1 +-4 +-6 +-4 +-1 +4 +12 +6 +1 +-2 +3 +-2 +1 +1 +2 +-2 +6 +-3 +-5 +3 +0 +5 +6 +15 +1 +-5 +-6 +-4 +-3 +3 +6 +-1 +-5 +-4 +-1 +3 +2 +-4 +7 +-2 +4 +-1 +-5 +-4 +-2 +-2 +18 +2 +5 +-4 +-2 +8 +1 +-7 +-2 +7 +-4 +5 +-3 +3 +-5 +9 +-3 +0 +-1 +8 +-2 +3 +-3 +-7 +2 +-4 +-36 +6 +-27 +-46 +13 +-23 +-34 +17 +-17 +-37 +24 +-12 +-31 +24 +-8 +-29 +41 +-1 +-28 +36 +-5 +-29 +27 +-10 +-20 +40 +0 +-28 +32 +-7 +-30 +29 +-9 +-27 +39 +-2 +-22 +29 +-10 +-24 +30 +-10 +-29 +31 +-7 +-29 +26 +-9 +-27 +40 +-2 +-27 +35 +-5 +-26 +25 +-4 +-28 +29 +-10 +-24 +32 +-5 +-29 +31 +-8 +-25 +36 +-5 +-23 +33 +-5 +-27 +31 +-7 +-26 +34 +-6 +-17 +30 +-5 +-27 +39 +-1 +-16 +28 +-9 +-19 +29 +-10 +-29 +31 +-8 +-26 +28 +-7 +-24 +29 +-7 +-28 +48 +3 +-21 +27 +-10 +-28 +40 +-2 +-15 +28 +-9 +-30 +29 +-6 +-19 +26 +-7 +-29 +27 +-6 +-28 +30 +-8 +-20 +32 +-8 +-26 +31 +-1 +-20 +32 +-7 +-27 +32 +-7 +-29 +30 +-9 +-27 +37 +-3 +-23 +31 +-8 +19 +27 +21 +15 +19 +21 +18 +13 +19 +5 +5 +3 +4 +2 +9 +-1 +0 +2 +0 +16 +2 +13 +16 +14 +1 +-6 +2 +-2 +7 +-5 +6 +7 +0 +4 +-5 +-4 +0 +-7 +12 +0 +-4 +1 +-5 +-2 +-4 +-3 +-3 +-2 +-1 +-4 +9 +-3 +6 +-2 +0 +-2 +-2 +-2 +4 +-1 +-2 +-1 +-5 +5 +7 +14 +2 +-4 +-1 +11 +1 +4 +-2 +10 +1 +9 +0 +-5 +0 +-7 +4 +2 +-1 +-2 +-1 +-5 +-5 +12 +2 +7 +-2 +4 +-4 +-9 +3 +-3 +6 +1 +-4 +-6 +-4 +0 +-5 +3 +2 +8 +-2 +2 +1 +0 +0 +7 +-2 +-4 +-1 +4 +2 +16 +2 +-2 +-4 +0 +1 +-3 +-3 +-1 +-5 +9 +3 +0 +4 +2 +-6 +-2 +1 +-2 +1 +-5 +0 +-2 +-1 +3 +12 +10 +3 +0 +-5 +-5 +-3 +1 +5 +-4 +12 +5 +-4 +-1 +-3 +10 +-3 +1 +-6 +-7 +-3 +-4 +18 +1 +0 +-3 +-1 +-4 +-3 +-2 +-3 +12 +5 +0 +11 +9 +-4 +1 +-1 +-4 +-4 +-5 +-5 +2 +-2 +2 +0 +0 +-2 +-5 +4 +1 +14 +3 +-1 +-2 +-4 +3 +10 +2 +-2 +8 +-1 +-4 +9 +-1 +10 +-1 +-6 +-5 +-2 +11 +10 +7 +-6 +-5 +0 +-8 +-6 +0 +3 +-1 +-3 +-4 +4 +11 +-2 +-3 +-4 +16 +1 +-1 +-4 +-5 +-5 +4 +1 +-3 +3 +-2 +1 +13 +6 +-4 +-2 +13 +-2 +-4 +-4 +2 +-3 +-1 +2 +-6 +16 +-23 +-42 +10 +-25 +-43 +12 +-20 +-35 +23 +-14 +-33 +22 +-6 +-22 +22 +-11 +-32 +40 +-3 +-25 +32 +-8 +-29 +26 +-9 +-30 +37 +-3 +-28 +27 +-11 +-30 +32 +-6 +-26 +28 +-9 +-28 +33 +-6 +-28 +30 +-2 +-26 +39 +-2 +-27 +32 +-7 +-25 +40 +-2 +-24 +37 +-5 +-12 +29 +-9 +-22 +26 +-12 +-24 +25 +-12 +-28 +27 +-10 +-29 +35 +-5 +-25 +32 +-8 +-10 +34 +-4 +-27 +27 +-9 +-28 +26 +-9 +-27 +36 +-6 +-26 +36 +-2 +-23 +43 +0 +-26 +29 +-6 +-28 +29 +-1 +-20 +27 +-10 +-26 +33 +-7 +-27 +28 +-8 +-29 +28 +-8 +-24 +32 +-3 +-25 +32 +-5 +-26 +31 +-6 +-24 +30 +-8 +-8 +34 +-5 +-28 +30 +0 +-24 +41 +1 +-27 +26 +-10 +-25 +27 +-9 +-29 +42 +-1 +-18 +36 +-5 +-29 +28 +-11 +-23 +30 +-9 +-24 +44 +0 +-26 +33 +-6 +-27 +32 +-9 +-23 +31 +-8 +-26 +45 +1 +-24 +27 +-9 +-29 +39 +1 +-23 +23 +-12 +-32 +32 +-5 +-26 +26 +-10 +-30 +38 +-3 +-27 +28 +-7 +-16 +36 +-5 +-27 +31 +4 +-24 +29 +-9 +-16 +31 +-9 +-30 +29 +-8 +-16 +47 +4 +-24 +28 +-5 +-22 +28 +-8 +-28 +34 +-3 +-23 +25 +-3 +-29 +27 +-10 +-25 +34 +-1 +-22 +30 +-10 +-25 +34 +-6 +-29 +26 +-4 +-25 +33 +-5 +-28 +41 +-1 +-23 +32 +-7 +-25 +39 +-4 +-28 +32 +-8 +-13 +30 +-9 +-31 +26 +-11 +-24 +26 +-10 +-27 +44 +6 +-24 +30 +-9 +-26 +41 +-1 +-27 +30 +-9 +-31 +27 +-10 +-22 +28 +-10 +-29 +32 +-8 +-28 +29 +1 +-23 +30 +-8 +-11 +32 +-8 +-21 +28 +-10 +-26 +24 +23 +27 +18 +25 +20 +12 +12 +8 +5 +8 +16 +12 +5 +4 +2 +15 +12 +0 +-4 +-2 +-2 +0 +3 +3 +-3 +10 +-2 +-2 +12 +10 +-4 +-1 +-2 +16 +0 +4 +-5 +-2 +-2 +-4 +8 +-3 +-1 +4 +9 +16 +-2 +-6 +9 +-4 +-7 +1 +-4 +4 +9 +4 +-6 +-7 +-5 +-3 +2 +-6 +1 +4 +-2 +14 +0 +-4 +1 +-6 +-5 +6 +-4 +0 +-1 +6 +10 +1 +-3 +-3 +-5 +6 +0 +6 +5 +1 +-2 +-1 +3 +19 +-1 +3 +-8 +-2 +-9 +-7 +-3 +-3 +6 +-1 +-1 +5 +5 +0 +-1 +-6 +-4 +1 +-5 +6 +5 +-2 +7 +4 +-3 +-3 +-4 +11 +1 +-2 +11 +4 +0 +-3 +-7 +1 +-2 +11 +-26 +-40 +14 +-23 +-45 +15 +-22 +-39 +15 +-20 +-38 +22 +-12 +-29 +26 +-5 +-28 +28 +-5 +-17 +38 +-3 +-30 +28 +-7 +-28 +27 +-8 +-30 +29 +-5 +-27 +28 +-9 +-29 +46 +2 +-26 +30 +-1 +-27 +26 +-12 +-27 +29 +-6 +-14 +43 +2 +-19 +31 +-8 +-19 +32 +-9 +-31 +29 +-3 +-29 +28 +-11 +-27 +33 +-7 +-30 +32 +-8 +-29 +29 +-9 +-27 +38 +-4 +-27 +31 +-6 +-26 +49 +3 +-24 +28 +-9 +-30 +36 +-6 +-27 +28 +-10 +-27 +33 +-7 +-26 +28 +-7 +-29 +41 +8 +-22 +32 +-7 +-29 +27 +-10 +-23 +43 +0 +-25 +27 +-8 +-19 +28 +-11 +-30 +27 +-10 +-11 +32 +-7 +-28 +27 +-6 +-21 +30 +-8 +-27 +33 +-6 +-28 +45 +4 +-25 +28 +-10 +-21 +28 +-10 +-26 +28 +-8 +-23 +45 +2 +-21 +16 +20 +26 +19 +14 +16 +10 +15 +8 +6 +16 +5 +21 +5 +6 +1 +-1 +6 +18 +1 +2 +-4 +9 +6 +-6 +-1 +-2 +6 +1 +-5 +-2 +-2 +2 +-1 +-2 +-1 +-2 +-1 +4 +1 +0 +8 +11 +-3 +-4 +9 +-3 +-4 +3 +-4 +2 +-4 +9 +14 +4 +-6 +-3 +-7 +-1 +10 +0 +-4 +-2 +7 +-3 +-5 +-4 +1 +12 +0 +4 +2 +-3 +10 +-2 +2 +-2 +5 +-3 +1 +-5 +-5 +-2 +1 +-2 +11 +8 +0 +-5 +-6 +-4 +0 +4 +-4 +-1 +-3 +8 +15 +6 +-5 +1 +3 +1 +-7 +-6 +-4 +16 +2 +2 +-5 +-3 +-2 +-1 +1 +-1 +2 +1 +2 +-5 +-5 +3 +-1 +-2 +-4 +1 +4 +-4 +-1 +22 +-18 +-44 +10 +-15 +-41 +14 +-22 +-42 +31 +-9 +-32 +24 +-16 +-32 +23 +-11 +-33 +43 +-1 +-28 +28 +-9 +-17 +27 +-11 +-32 +26 +-11 +-18 +28 +-9 +-29 +35 +-4 +-30 +35 +-4 +-23 +32 +-8 +-26 +43 +-1 +-15 +29 +-7 +-31 +25 +-13 +-30 +25 +-11 +29 +-7 +-30 +29 +-5 +-29 +37 +-4 +-27 +45 +1 +-21 +25 +-9 +-29 +28 +-9 +-30 +27 +-9 +-30 +28 +-9 +-20 +33 +-5 +-22 +42 +-1 +-20 +29 +-8 +-25 +37 +-4 +-29 +35 +-6 +-29 +32 +-7 +-18 +37 +-5 +-30 +31 +-5 +-21 +24 +-11 +-29 +26 +-10 +-29 +32 +3 +-16 +37 +-1 +-21 +25 +-12 +-29 +30 +-9 +-29 +31 +-8 +-26 +28 +-10 +-27 +28 +-8 +-10 +34 +-6 +-24 +34 +-4 +-27 +32 +-8 +-27 +31 +-7 +-25 +37 +-4 +-25 +26 +28 +36 +27 +13 +14 +10 +8 +7 +12 +6 +23 +8 +4 +4 +-2 +-1 +4 +1 +0 +-1 +12 +0 +1 +-2 +0 +2 +1 +8 +17 +0 +0 +-2 +-1 +6 +1 +4 +3 +-2 +-5 +3 +8 +8 +-4 +8 +-3 +2 +-1 +16 +-1 +-3 +0 +-8 +1 +-4 +-3 +15 +0 +-7 +-3 +-1 +-1 +-3 +-4 +2 +-3 +1 +1 +5 +4 +-4 +10 +8 +7 +4 +6 +0 +-3 +2 +-7 +0 +-5 +-1 +-6 +15 +0 +-4 +8 +1 +-7 +-6 +-4 +-4 +5 +-5 +0 +-2 +7 +-1 +-2 +-4 +-4 +-3 +3 +9 +2 +-3 +4 +-3 +10 +4 +-3 +-4 +-2 +3 +0 +3 +-4 +0 +4 +5 +-2 +1 +-4 +1 +2 +5 +-1 +-5 +-36 +-43 +23 +-16 +-39 +14 +-13 +-38 +18 +-19 +-35 +28 +-11 +-22 +26 +-3 +-28 +24 +-13 +-32 +28 +-9 +-19 +42 +-1 +-26 +31 +-8 +-22 +38 +-4 +-30 +31 +-9 +-29 +28 +-10 +-25 +43 +0 +-27 +25 +-12 +-29 +24 +-13 +-30 +31 +-7 +-28 +42 +-1 +-25 +32 +-7 +-25 +26 +-11 +-29 +36 +-2 +-23 +31 +2 +-24 +27 +4 +-24 +34 +-5 +-16 +42 +1 +-26 +26 +-12 +-31 +41 +-1 +-28 +26 +-9 +-31 +31 +-8 +-26 +44 +-1 +-27 +33 +-2 +-24 +31 +-2 +-26 +29 +-7 +-22 +25 +-10 +-24 +25 +-12 +-30 +30 +-6 +-24 +28 +-9 +-20 +29 +-6 +-23 +30 +-8 +-28 +33 +-6 +-18 +29 +-9 +-22 +30 +-8 +-27 +34 +-5 +-26 +35 +-6 +-21 +29 +-8 +-29 +32 +5 +-21 +45 +2 +-27 +31 +-9 +-30 +30 +32 +23 +24 +21 +12 +8 +9 +8 +2 +14 +12 +22 +7 +-2 +1 +5 +9 +2 +14 +3 +-2 +7 +-2 +-3 +0 +11 +0 +5 +-3 +-7 +-1 +4 +8 +-4 +-4 +-2 +-1 +3 +-4 +-4 +-2 +9 +0 +-4 +8 +-2 +-1 +-5 +-3 +-2 +0 +4 +10 +-2 +-2 +13 +1 +3 +-4 +1 +12 +2 +7 +-6 +5 +-1 +-3 +-2 +15 +-1 +-2 +2 +0 +0 +-2 +-4 +4 +-5 +-3 +-4 +1 +16 +0 +0 +-3 +3 +9 +-6 +-2 +1 +-2 +3 +1 +13 +2 +-6 +1 +-4 +10 +-5 +-6 +-3 +3 +-5 +-8 +-4 +8 +0 +-7 +-6 +3 +17 +0 +-5 +-2 +13 +-2 +-1 +0 +13 +-1 +-5 +5 +-3 +8 +4 +1 +-4 +-37 +-46 +7 +-27 +-33 +16 +-21 +-40 +23 +-12 +-31 +23 +-14 +-35 +25 +-11 +-31 +30 +-5 +-27 +27 +-10 +-22 +31 +-8 +-28 +40 +-2 +-19 +29 +-10 +-30 +32 +-8 +-26 +39 +-2 +-20 +27 +-11 +-29 +30 +-5 +-29 +36 +-4 +-26 +28 +-7 +-29 +31 +-7 +-28 +38 +-2 +-26 +43 +-1 +-25 +37 +-1 +-27 +26 +-13 +-31 +32 +-4 +-12 +33 +-3 +-22 +25 +-10 +-20 +41 +2 +-22 +24 +-13 +-28 +29 +-7 +-29 +28 +-8 +-15 +29 +-10 +-28 +34 +-6 +-21 +27 +-11 +-26 +28 +-9 +-26 +26 +-10 +-27 +32 +-5 +-27 +30 +-7 +-27 +44 +2 +-24 +29 +-4 +-17 +52 +6 +-18 +26 +-13 +-31 +34 +-7 +-27 +32 +-9 +-19 +33 +-7 +-28 +27 +-6 +-25 +46 +2 +-24 +27 +-4 +-28 +26 +-10 +-28 +30 +-10 +-31 +23 +26 +23 +19 +20 +15 +12 +14 +10 +7 +22 +25 +8 +14 +3 +4 +3 +2 +4 +-1 +-3 +2 +1 +-4 +-2 +-2 +7 +-2 +0 +-1 +15 +2 +-3 +0 +14 +-2 +2 +-6 +-3 +-3 +-3 +6 +-3 +5 +1 +2 +4 +0 +-2 +-4 +-2 +8 +-2 +-5 +-1 +2 +-1 +0 +4 +0 +3 +3 +-1 +-4 +-7 +-4 +13 +6 +0 +-2 +3 +-2 +-3 +0 +2 +10 +-3 +-2 +1 +1 +-4 +3 +-3 +4 +4 +3 +13 +1 +14 +-1 +0 +-4 +-9 +-2 +-2 +-2 +-1 +-4 +13 +15 +-1 +-5 +-2 +3 +-3 +-4 +-2 +0 +2 +1 +1 +-4 +-4 +0 +-4 +12 +2 +-2 +3 +12 +0 +-4 +-1 +7 +-5 +5 +0 +1 +0 +-2 +9 +18 +-1 +-2 +-6 +-2 +-7 +-7 +-1 +6 +7 +-3 +1 +1 +-7 +-6 +0 +0 +-1 +-2 +5 +10 +-3 +16 +0 +-1 +-5 +-8 +-3 +0 +0 +2 +-1 +2 +-4 +-3 +-4 +2 +-1 +3 +7 +3 +-1 +16 +2 +-3 +5 +-2 +-5 +2 +7 +-3 +-5 +0 +-5 +-2 +1 +-3 +-2 +-2 +10 +6 +2 +-1 +0 +-2 +-1 +-2 +-1 +-1 +-2 +2 +7 +11 +3 +5 +0 +-5 +0 +0 +-4 +-4 +-2 +-6 +4 +3 +-2 +-2 +8 +3 +-3 +2 +4 +1 +-2 +-4 +4 +-2 +0 +-2 +-2 +-1 +7 +0 +12 +-1 +-1 +-3 +1 +7 +5 +9 +4 +0 +0 +-2 +-3 +-3 +-6 +10 +5 +-1 +7 +1 +-2 +-5 +-3 +-36 +-51 +23 +-17 +-38 +20 +-12 +-34 +15 +-21 +-37 +22 +-14 +-31 +39 +-4 +-16 +36 +-6 +-29 +26 +-12 +-32 +26 +-10 +-27 +29 +-10 +-25 +46 +3 +-26 +28 +-12 +-27 +26 +-11 +26 +-11 +-32 +29 +-9 +-29 +32 +-7 +-27 +28 +-7 +-23 +27 +-5 +-27 +38 +2 +-23 +39 +-2 +-27 +28 +-9 +-30 +32 +-5 +-28 +30 +-2 +-26 +29 +-7 +-29 +32 +-7 +-28 +34 +-5 +-28 +32 +-5 +-21 +36 +-1 +-27 +29 +-8 +-26 +28 +-8 +-21 +35 +-6 +-28 +30 +-7 +-28 +26 +-11 +-26 +28 +-5 +-25 +40 +0 +-19 +30 +-8 +-27 +32 +-7 +-26 +35 +-4 +-20 +30 +3 +-22 +32 +-6 +-28 +37 +-3 +-24 +33 +-6 +-18 +29 +-7 +-28 +31 +-7 +-27 +29 +-10 +-25 +31 +-1 +-12 +31 +-8 +-29 +31 +-8 +-30 +30 +-8 +-29 +29 +-8 +-22 +49 +4 +-22 +26 +-11 +-24 +33 +-7 +-22 +37 +-4 +-29 +38 +-4 +-27 +36 +-5 +-26 +29 +-10 +-28 +34 +-6 +-29 +31 +-9 +-27 +33 +-4 +-29 +36 +-6 +-16 +28 +-9 +-28 +26 +1 +-23 +26 +-10 +-24 +31 +-9 +-29 +31 +-7 +-27 +38 +2 +-16 +33 +-6 +-26 +29 +-9 +-29 +44 +4 +-26 +31 +-4 +-20 +29 +-7 +-26 +38 +-4 +-28 +24 +-12 +-25 +33 +-3 +-26 +29 +-5 +-20 +33 +-8 +-20 +34 +-5 +-29 +26 +-9 +-30 +26 +-11 +-26 +28 +-10 +-24 +39 +-3 +-23 +30 +-9 +-29 +32 +0 +-9 +31 +-6 +-29 +28 +-10 +-27 +30 +-2 +-24 +31 +-6 +-16 +46 +1 +-27 +28 +-10 +-24 +25 +-12 +-30 +38 +-1 +-26 +34 +-2 +-25 +44 +4 +-23 +24 +-12 +-29 +38 +-1 +-25 +31 +35 +16 +13 +14 +10 +12 +13 +6 +4 +7 +13 +7 +3 +1 +1 +5 +11 +3 +-2 +16 +15 +-1 +-4 +-1 +-3 +-2 +-2 +0 +2 +-3 +5 +1 +-1 +2 +-4 +-1 +-2 +3 +10 +3 +-4 +0 +6 +1 +-1 +-3 +6 +11 +-2 +-5 +1 +1 +-3 +-1 +-1 +2 +14 +1 +-6 +0 +-1 +-4 +-4 +-1 +4 +1 +-4 +-2 +4 +1 +2 +1 +-1 +-1 +5 +12 +-3 +4 +9 +14 +-2 +-4 +9 +10 +-5 +-7 +-7 +-5 +-5 +5 +-5 +1 +4 +5 +1 +-2 +-3 +3 +-5 +-2 +-5 +2 +3 +11 +0 +-4 +-2 +-7 +-3 +1 +-2 +6 +4 +6 +4 +1 +14 +-3 +4 +-5 +-4 +8 +12 +7 +-7 +-7 +-6 +-6 +-39 +-53 +11 +-23 +-42 +31 +-10 +-22 +19 +-16 +-35 +23 +-12 +-34 +29 +-10 +-26 +26 +-12 +-25 +27 +-7 +-30 +35 +-6 +-16 +44 +0 +-25 +24 +-14 +-33 +25 +-7 +-27 +35 +-6 +-26 +32 +-6 +28 +-10 +-31 +44 +0 +-26 +22 +-14 +-33 +34 +-7 +-23 +26 +-7 +-22 +25 +-1 +-25 +29 +-8 +-16 +41 +-2 +-16 +34 +-7 +-31 +24 +-14 +-21 +30 +-5 +-20 +41 +-3 +-27 +29 +-9 +-29 +46 +1 +-25 +26 +-11 +-27 +44 +0 +-28 +28 +-7 +-32 +28 +-3 +-29 +34 +-5 +-16 +43 +3 +-24 +22 +-7 +-26 +27 +-10 +-33 +36 +0 +-16 +30 +-10 +-32 +25 +-11 +-25 +27 +-10 +-29 +35 +-4 +-28 +28 +-10 +-25 +28 +-9 +-29 +29 +-9 +-28 +46 +3 +-22 +34 +-6 +-23 +44 +0 +-18 +26 +-13 +-16 +28 +-8 +6 +18 +17 +19 +11 +18 +11 +8 +7 +10 +6 +21 +9 +6 +2 +3 +2 +9 +18 +4 +3 +-1 +0 +4 +2 +4 +10 +11 +12 +-3 +-7 +-6 +-8 +0 +-2 +6 +-5 +-6 +14 +15 +7 +-5 +-3 +-6 +-4 +2 +10 +-3 +0 +-5 +-4 +-4 +-5 +-2 +-2 +-3 +2 +1 +9 +0 +-2 +-4 +-3 +9 +-1 +-1 +-2 +7 +-3 +-4 +3 +1 +-3 +7 +-2 +-4 +2 +-1 +-1 +13 +9 +-3 +5 +0 +-3 +-3 +-3 +2 +-3 +3 +9 +3 +13 +0 +-3 +7 +-5 +-5 +12 +-3 +-4 +7 +-5 +-6 +-5 +-3 +-5 +10 +-3 +14 +-1 +-6 +1 +0 +-6 +-5 +2 +-3 +-1 +-5 +4 +5 +0 +2 +0 +0 +-2 +-3 +17 +-21 +-47 +11 +-25 +-44 +13 +-21 +-41 +20 +-16 +-34 +26 +-10 +-32 +25 +-13 +-27 +29 +-9 +-26 +35 +-4 +-27 +28 +-8 +-15 +37 +-1 +-9 +30 +-9 +-29 +33 +1 +-25 +32 +-8 +-24 +26 +-10 +-28 +28 +-4 +-29 +31 +-9 +-28 +28 +-4 +-24 +31 +-4 +-18 +27 +-10 +-27 +36 +-5 +-24 +26 +-6 +-24 +32 +-6 +31 +-7 +-29 +27 +-9 +-30 +32 +-5 +-26 +29 +-8 +-25 +31 +-7 +-26 +29 +-4 +-21 +33 +-6 +-25 +31 +0 +-24 +27 +-5 +-28 +30 +-1 +-12 +34 +-7 +-28 +31 +-7 +-29 +31 +-1 +-21 +29 +-9 +-24 +32 +-7 +-28 +30 +-6 +-26 +28 +-6 +-26 +34 +-2 +-25 +45 +7 +-20 +33 +-6 +-29 +30 +-8 +-17 +31 +-6 +-31 +29 +-11 +-26 +37 +-4 +-29 +30 +-1 +-25 +26 +-8 +-29 +26 +48 +23 +21 +16 +14 +12 +9 +7 +5 +7 +5 +6 +2 +6 +4 +3 +5 +4 +6 +4 +3 +0 +-1 +1 +4 +5 +2 +1 +3 +-1 +-2 +5 +7 +9 +7 +9 +11 +8 +11 +3 +7 +-2 +-3 +-8 +-7 +2 +-4 +1 +-5 +-7 +-1 +-3 +-1 +-5 +-5 +1 +-4 +13 +-1 +-3 +11 +9 +12 +-1 +3 +3 +7 +3 +-3 +0 +-2 +-7 +-7 +1 +-7 +-2 +-2 +-4 +-4 +4 +4 +-1 +-6 +8 +-3 +10 +-1 +-4 +-4 +1 +-4 +-1 +3 +-3 +7 +7 +0 +-3 +0 +4 +-6 +-6 +5 +12 +0 +-3 +-3 +0 +-3 +-2 +2 +5 +1 +6 +-3 +-3 +-6 +-5 +-3 +-1 +-2 +-1 +3 +5 +1 +5 +11 +9 +-29 +-49 +8 +-26 +-42 +28 +-12 +-27 +21 +-16 +-33 +37 +-6 +-32 +31 +-9 +-31 +20 +-14 +-24 +35 +-6 +-21 +28 +-12 +-30 +36 +-2 +-27 +26 +-11 +-29 +27 +-12 +-15 +30 +-10 +-31 +25 +-11 +-31 +35 +-5 +-22 +28 +-9 +-28 +31 +-9 +-23 +31 +-6 +-27 +34 +-4 +-22 +46 +4 +-24 +30 +-8 +-31 +27 +-9 +-30 +49 +3 +-23 +28 +-7 +-27 +25 +-12 +-30 +37 +-3 +-25 +33 +-6 +-20 +33 +-5 +-26 +28 +-5 +-25 +30 +-3 +-27 +29 +-9 +-28 +34 +1 +-18 +30 +-7 +-14 +29 +-9 +-30 +37 +-5 +-26 +32 +1 +-18 +31 +-7 +-21 +26 +-12 +-31 +43 +-1 +-27 +27 +-6 +-28 +28 +-10 +-28 +34 +-1 +-25 +27 +-8 +-28 +27 +-6 +-24 +38 +-3 +-27 +31 +-2 +-24 +33 +-7 +-25 +30 +-1 +-25 +40 +29 +24 +16 +15 +16 +11 +7 +9 +6 +5 +7 +8 +18 +16 +3 +14 +-1 +0 +0 +6 +10 +0 +0 +8 +1 +-4 +-6 +-4 +-7 +0 +-1 +8 +3 +8 +-2 +-1 +-2 +7 +-4 +3 +-2 +-4 +-2 +16 +0 +0 +-2 +-3 +-4 +1 +-3 +-3 +-4 +5 +3 +3 +9 +0 +1 +-3 +-2 +-1 +-4 +1 +-4 +1 +9 +-1 +-1 +7 +-4 +0 +3 +-5 +-3 +10 +-1 +9 +6 +3 +-1 +-1 +3 +7 +14 +6 +-2 +-6 +-4 +5 +4 +-5 +0 +5 +-6 +0 +1 +-2 +-5 +0 +-2 +6 +3 +6 +-4 +11 +-3 +-2 +-8 +1 +-4 +5 +17 +6 +9 +-4 +-6 +-6 +-6 +-6 +0 +1 +-4 +-1 +0 +7 +1 +-6 +-1 +-3 +-4 +-1 +0 +1 +1 +2 +-2 +-1 +-1 +-1 +-4 +3 +6 +12 +0 +-1 +2 +-3 +5 +7 +11 +0 +-4 +-1 +4 +4 +-3 +2 +-2 +-5 +16 +1 +-1 +2 +-6 +-5 +-4 +1 +3 +7 +7 +0 +-5 +4 +1 +-6 +-4 +-2 +3 +4 +0 +-2 +1 +0 +-4 +0 +2 +-2 +-1 +1 +-2 +5 +15 +7 +-5 +1 +-4 +14 +-1 +-5 +-6 +0 +8 +15 +5 +1 +-4 +-7 +-6 +0 +0 +-4 +2 +1 +6 +-4 +-7 +-3 +-3 +2 +4 +-2 +-2 +-3 +12 +2 +2 +-3 +-4 +1 +-2 +12 +-2 +-3 +-6 +6 +6 +-1 +8 +3 +14 +10 +0 +-4 +-6 +1 +-3 +-2 +-8 +8 +-4 +14 +-2 +9 +3 +8 +-30 +-51 +17 +-21 +-43 +11 +-24 +-42 +24 +-10 +-31 +25 +-15 +-30 +21 +-14 +-35 +32 +-9 +-30 +24 +-9 +-31 +31 +-9 +-29 +32 +-7 +-25 +31 +-8 +-28 +31 +-7 +-22 +29 +-7 +-14 +52 +6 +-21 +30 +-9 +-22 +30 +-9 +-29 +27 +-4 +-28 +28 +-10 +-29 +38 +-5 +-27 +28 +-9 +-28 +41 +-1 +-27 +27 +-1 +-21 +31 +-9 +-25 +34 +-5 +-24 +25 +-13 +-30 +29 +-7 +-25 +32 +-7 +-27 +32 +4 +-23 +31 +-8 +-27 +35 +-6 +-28 +40 +-3 +-27 +31 +-7 +-25 +32 +-6 +-23 +26 +-7 +-29 +30 +-8 +-28 +37 +-2 +-28 +31 +-8 +-25 +28 +5 +-23 +38 +-4 +-28 +31 +-6 +-27 +39 +-3 +-27 +31 +-8 +-23 +37 +-4 +-24 +32 +-4 +-28 +28 +-11 +-30 +32 +-7 +-22 +29 +-10 +-26 +37 +4 +-23 +35 +38 +19 +14 +19 +14 +29 +10 +14 +7 +2 +2 +18 +5 +6 +1 +6 +0 +-2 +2 +11 +2 +12 +2 +3 +-3 +-4 +-3 +-2 +-3 +-2 +-2 +1 +8 +-2 +-4 +-3 +-2 +5 +8 +-2 +-5 +-4 +1 +4 +-1 +9 +6 +-3 +-3 +-3 +2 +7 +1 +-2 +4 +9 +-4 +-2 +-1 +5 +3 +-4 +-4 +3 +1 +3 +13 +11 +-5 +-5 +-4 +-1 +-4 +-7 +8 +0 +-3 +-1 +-1 +0 +-5 +8 +12 +3 +-3 +0 +-3 +-4 +1 +6 +4 +-1 +0 +0 +-4 +-2 +3 +-2 +1 +7 +2 +-2 +4 +0 +-4 +5 +-3 +0 +-5 +-2 +-2 +10 +2 +5 +8 +-3 +-1 +2 +5 +-4 +9 +5 +4 +-3 +0 +-1 +-2 +6 +-31 +-50 +12 +-24 +-35 +18 +-18 +-38 +27 +-12 +-36 +21 +-15 +-30 +22 +-6 +-28 +23 +-14 +-31 +27 +-10 +-25 +32 +-2 +-26 +28 +-1 +-22 +33 +-5 +-24 +26 +-11 +-28 +30 +-8 +-23 +40 +-1 +-19 +33 +-7 +-27 +32 +-6 +-26 +28 +-9 +-24 +43 +0 +-11 +30 +-9 +-25 +27 +-11 +-29 +29 +-10 +-28 +44 +5 +-25 +35 +-3 +-9 +30 +-9 +-30 +30 +-10 +-26 +28 +-6 +-27 +27 +-11 +-29 +27 +-4 +-11 +34 +-7 +-17 +40 +-2 +-28 +28 +-8 +-30 +27 +-7 +-28 +44 +1 +-26 +26 +-10 +-30 +32 +-9 +-28 +33 +-6 +-27 +28 +-9 +-29 +35 +3 +-22 +27 +-2 +-26 +33 +-5 +-21 +27 +-11 +-30 +42 +1 +-26 +30 +-2 +-27 +30 +-9 +-26 +28 +-3 +-26 +34 +-5 +-21 +29 +-9 +-16 +45 +1 +-28 +22 +25 +21 +15 +21 +11 +10 +8 +26 +9 +12 +11 +0 +19 +3 +-3 +-6 +7 +-1 +-2 +-1 +-1 +2 +11 +16 +16 +11 +-5 +-6 +0 +-3 +7 +7 +-5 +3 +-4 +-4 +11 +-1 +0 +2 +-6 +-6 +-6 +-5 +-4 +-3 +0 +-2 +-2 +-4 +10 +4 +-4 +-2 +1 +15 +-2 +2 +-1 +6 +-3 +4 +6 +-5 +-5 +2 +-1 +-3 +2 +5 +3 +-2 +1 +-3 +-1 +-3 +-4 +-1 +4 +-5 +0 +5 +-1 +-5 +4 +6 +1 +10 +-2 +-1 +3 +-2 +4 +3 +-2 +4 +-4 +-5 +2 +4 +6 +-4 +3 +-4 +-6 +3 +-1 +-1 +-1 +-4 +-4 +-4 +11 +3 +1 +-2 +1 +3 +-3 +5 +1 +7 +-2 +1 +11 +-1 +-3 +1 +-34 +-49 +15 +-20 +-43 +20 +-14 +-37 +25 +-9 +-27 +26 +-13 +-33 +34 +-6 +-31 +27 +-9 +-30 +22 +-9 +-19 +32 +-7 +-30 +26 +-11 +-27 +29 +-8 +-28 +39 +0 +-25 +26 +-9 +-28 +30 +-8 +29 +-9 +-30 +31 +-9 +-26 +28 +3 +-24 +28 +2 +-24 +30 +-8 +-30 +30 +-9 +-24 +29 +-9 +-28 +29 +-9 +-25 +29 +-6 +-27 +31 +-4 +-25 +29 +-3 +-23 +43 +5 +-18 +47 +3 +-26 +27 +-8 +-30 +28 +-9 +-25 +45 +3 +-25 +25 +-13 +-32 +34 +-7 +-26 +31 +-8 +-28 +37 +2 +-24 +28 +-8 +-26 +28 +-10 +-28 +29 +-9 +-27 +47 +3 +-25 +33 +-6 +-27 +33 +-7 +-30 +28 +-8 +-27 +28 +-1 +-16 +28 +-7 +-23 +28 +-9 +-22 +31 +-8 +-21 +36 +-1 +-17 +35 +-5 +-30 +37 +-5 +-29 +26 +-8 +-28 +32 +-8 +-24 +38 +-4 +-26 +28 +-11 +-22 +26 +-3 +-22 +27 +-11 +-23 +29 +-8 +-28 +45 +6 +-22 +34 +-6 +-28 +32 +-9 +-29 +41 +6 +-23 +32 +-7 +-26 +36 +-3 +-28 +26 +-8 +-30 +33 +-5 +-26 +25 +-9 +-29 +31 +-6 +-28 +39 +-2 +-26 +28 +-11 +-28 +26 +-6 +-27 +29 +-7 +-15 +30 +-9 +-29 +35 +-2 +-26 +47 +2 +-22 +30 +-9 +-29 +30 +-10 +-26 +28 +-10 +-28 +31 +-7 +-27 +31 +-2 +-26 +42 +5 +-13 +29 +-10 +-28 +31 +-9 +-25 +30 +-8 +-11 +32 +-8 +-24 +28 +-8 +-19 +28 +-10 +-27 +29 +-5 +-25 +27 +-9 +-25 +30 +-7 +-27 +36 +-5 +-27 +44 +1 +-23 +37 +-3 +-26 +30 +-8 +-25 +29 +-11 +-28 +25 +-11 +-27 +32 +-6 +-28 +31 +-5 +-15 +46 +2 +-21 +34 +29 +17 +18 +10 +10 +21 +13 +13 +16 +4 +19 +23 +4 +1 +-3 +16 +1 +-1 +-3 +8 +-4 +-5 +-5 +-3 +-1 +4 +2 +4 +22 +2 +12 +-1 +0 +-9 +-7 +2 +7 +-1 +-3 +-1 +5 +-3 +-6 +-4 +-5 +14 +0 +-3 +-1 +-2 +-3 +-3 +2 +-4 +0 +-1 +-3 +2 +16 +-1 +3 +-5 +-3 +-4 +-1 +9 +7 +-3 +-1 +1 +-1 +-2 +1 +0 +3 +-1 +-2 +0 +4 +-6 +-2 +4 +8 +6 +7 +-1 +-4 +-4 +5 +14 +1 +-3 +-6 +-4 +-2 +10 +10 +-4 +5 +-1 +5 +4 +4 +-6 +-1 +1 +-4 +-6 +-3 +12 +0 +3 +-1 +-3 +-5 +-1 +-2 +-5 +-3 +-3 +-2 +9 +3 +-4 +2 +-1 +4 +9 +-6 +-3 +-2 +-2 +7 +9 +-2 +-1 +3 +0 +1 +12 +0 +-4 +-3 +-1 +-4 +1 +1 +2 +-2 +0 +15 +5 +11 +8 +6 +11 +-4 +-7 +-4 +2 +-5 +-6 +-6 +10 +8 +1 +-3 +-2 +5 +-5 +5 +2 +-6 +3 +5 +0 +-3 +-1 +-6 +-1 +-5 +-3 +-2 +-1 +0 +-5 +-1 +4 +4 +-3 +0 +2 +-2 +0 +3 +1 +-2 +-3 +14 +12 +13 +6 +-6 +14 +-2 +-1 +0 +3 +4 +-7 +1 +-6 +-1 +-1 +-6 +9 +14 +-1 +-6 +-4 +0 +0 +1 +-1 +-2 +6 +-5 +-6 +-1 +5 +-5 +-4 +3 +-2 +-2 +-1 +3 +0 +3 +0 +-5 +5 +8 +-3 +10 +-4 +-2 +3 +-5 +11 +0 +-6 +0 +-2 +-4 +4 +-27 +-44 +9 +-25 +-42 +14 +-20 +-36 +22 +-14 +-34 +23 +-7 +-31 +33 +-6 +-25 +23 +-3 +-27 +34 +-4 +-26 +37 +-5 +-29 +33 +-6 +-29 +32 +-7 +-28 +26 +-12 +-29 +28 +-8 +-26 +36 +-5 +-28 +36 +-3 +-26 +47 +8 +-22 +34 +2 +-26 +22 +-10 +-25 +30 +-8 +-25 +25 +-12 +-31 +35 +-5 +-19 +41 +-2 +-24 +24 +-11 +-31 +44 +4 +-19 +25 +-12 +-29 +35 +-6 +-26 +26 +-10 +-31 +27 +-10 +-24 +35 +-5 +-26 +31 +-8 +-25 +40 +-2 +-28 +31 +-8 +-26 +33 +-5 +-25 +46 +1 +-26 +31 +-9 +-30 +33 +-6 +-29 +28 +-10 +-29 +27 +-11 +-25 +26 +-10 +-29 +38 +3 +-14 +30 +-3 +-26 +32 +-8 +-29 +33 +-4 +-28 +30 +-7 +-21 +30 +1 +-25 +30 +-7 +-23 +33 +2 +-25 +38 +-4 +-24 +34 +23 +17 +14 +13 +27 +15 +9 +8 +8 +8 +22 +9 +3 +10 +3 +-2 +0 +16 +1 +-1 +-2 +-1 +6 +12 +3 +0 +-1 +14 +4 +-5 +-3 +-3 +1 +2 +-5 +12 +11 +0 +6 +12 +6 +-3 +-1 +-7 +-4 +-10 +-6 +-1 +-3 +-3 +0 +-2 +-3 +-1 +2 +3 +4 +19 +1 +3 +11 +4 +-6 +-1 +4 +-2 +-6 +1 +-3 +-8 +1 +-2 +0 +-1 +13 +-2 +3 +-1 +-4 +2 +1 +15 +0 +-4 +4 +-4 +-8 +-6 +2 +-2 +-1 +-6 +1 +18 +1 +-1 +-4 +-1 +9 +6 +3 +-3 +-5 +-1 +-4 +1 +7 +-2 +4 +-4 +3 +-2 +0 +-2 +11 +19 +2 +-8 +2 +-3 +0 +-4 +-6 +-8 +-3 +18 +2 +10 +-26 +-50 +13 +-25 +-38 +14 +-22 +-32 +19 +-18 +-35 +17 +-11 +-24 +25 +-14 +-30 +26 +-11 +-32 +36 +-5 +-28 +26 +-7 +-29 +28 +-8 +-25 +28 +-9 +-29 +39 +-4 +-26 +28 +-9 +-19 +31 +-5 +-28 +34 +-5 +-23 +31 +-9 +-23 +41 +-1 +-26 +27 +-10 +-28 +28 +-3 +-27 +28 +-4 +-27 +28 +-9 +-22 +31 +-7 +-27 +30 +-7 +-24 +31 +-8 +-26 +46 +3 +-25 +29 +-10 +-29 +30 +-7 +-28 +31 +-7 +-27 +41 +3 +-20 +28 +-10 +-28 +41 +0 +-24 +29 +-9 +-28 +40 +0 +-23 +37 +-4 +-24 +28 +-10 +-29 +32 +-8 +-28 +28 +-7 +-25 +28 +-8 +-18 +30 +1 +-24 +32 +-5 +-25 +32 +-8 +-24 +28 +-9 +-28 +27 +-7 +-28 +32 +-8 +-14 +39 +8 +-22 +34 +-6 +-27 +28 +-1 +-9 +30 +-10 +-27 +27 +40 +18 +21 +28 +11 +8 +12 +4 +11 +2 +13 +3 +16 +6 +12 +3 +-2 +0 +-2 +-1 +-4 +-4 +-1 +-1 +5 +2 +-4 +13 +8 +-1 +2 +-3 +5 +0 +3 +-4 +0 +-4 +-1 +3 +-3 +4 +-1 +-4 +-2 +16 +4 +0 +8 +0 +-6 +-4 +-3 +-3 +-1 +0 +15 +12 +13 +1 +-3 +-2 +-4 +-2 +4 +2 +-3 +3 +6 +-5 +1 +-2 +-3 +-4 +-2 +-4 +-2 +-4 +11 +-1 +-3 +-2 +-3 +0 +11 +14 +2 +3 +1 +4 +-4 +12 +9 +-5 +-6 +6 +-5 +-7 +-4 +-6 +2 +-1 +-3 +4 +-3 +-4 +4 +10 +-3 +-4 +-5 +5 +5 +-4 +3 +0 +3 +-5 +6 +-2 +1 +-2 +6 +10 +1 +-6 +-3 +-2 +-36 +-51 +9 +-25 +-33 +19 +-18 +-36 +23 +-15 +-33 +31 +-9 +-30 +27 +-11 +-27 +23 +-13 +-25 +26 +-11 +-24 +30 +-8 +-27 +47 +3 +-22 +30 +-6 +-30 +27 +-8 +-29 +38 +0 +-25 +30 +-9 +-28 +28 +-10 +-26 +30 +-9 +-24 +26 +-9 +-26 +30 +-3 +-12 +47 +3 +-26 +27 +-9 +-23 +27 +-10 +-27 +39 +-3 +-24 +29 +-8 +-31 +32 +-8 +-21 +36 +-4 +-23 +32 +-8 +-26 +26 +-9 +-28 +30 +-9 +-26 +46 +2 +-26 +39 +-4 +-16 +39 +3 +-27 +25 +-14 +-33 +36 +-5 +-30 +29 +-6 +-26 +31 +-8 +-27 +27 +-8 +-28 +36 +-4 +-29 +28 +-9 +-22 +46 +3 +-20 +27 +-11 +-29 +34 +-3 +-21 +31 +-8 +-30 +25 +-8 +-28 +27 +-10 +-27 +29 +-7 +-27 +29 +-5 +-25 +33 +-6 +-12 +32 +-8 +-16 +29 +24 +17 +18 +24 +13 +16 +10 +12 +7 +12 +5 +12 +12 +19 +14 +12 +-2 +-5 +-3 +-5 +-3 +8 +3 +-7 +5 +-3 +-1 +11 +-1 +-4 +-1 +-2 +0 +-5 +-3 +-4 +5 +12 +8 +-1 +-4 +2 +1 +-1 +-2 +-4 +2 +2 +14 +11 +11 +0 +-4 +0 +-7 +-1 +-2 +-4 +-3 +-3 +-2 +-1 +-1 +7 +-1 +14 +3 +0 +-4 +3 +4 +4 +-4 +4 +-4 +-4 +5 +-5 +5 +-4 +-3 +11 +5 +-6 +1 +1 +-4 +-2 +-4 +-1 +12 +-2 +-1 +-7 +-3 +11 +16 +1 +-3 +15 +-1 +-6 +-7 +0 +2 +1 +-6 +-1 +-6 +-6 +-6 +0 +5 +11 +4 +8 +12 +13 +12 +-2 +-9 +-8 +-6 +-6 +-5 +-7 +6 +3 +-33 +-51 +11 +-25 +-44 +20 +-18 +-38 +29 +-11 +-34 +30 +-9 +-29 +23 +-12 +-30 +25 +-8 +-14 +30 +-9 +-16 +26 +-9 +-32 +29 +-10 +-18 +37 +-4 +-28 +29 +-6 +-29 +25 +-11 +-31 +30 +-7 +-28 +32 +-3 +-21 +33 +-7 +-17 +36 +-5 +-26 +26 +-1 +-25 +32 +-7 +-28 +34 +-7 +-23 +29 +-9 +-27 +30 +-8 +-22 +29 +-9 +-28 +39 +-3 +-23 +31 +-1 +-17 +38 +-4 +-27 +31 +-6 +-30 +33 +-4 +-27 +30 +-7 +-29 +36 +-2 +-26 +34 +-6 +-28 +33 +-7 +-16 +30 +-5 +-29 +26 +-6 +-20 +38 +-3 +-28 +33 +-4 +-27 +38 +6 +-24 +30 +-10 +-27 +30 +-8 +-31 +33 +-3 +-14 +44 +1 +-28 +30 +-10 +-32 +30 +0 +-28 +31 +-10 +-31 +34 +-4 +-24 +31 +-4 +-26 +30 +-6 +-28 +26 +-11 +-28 +27 +26 +19 +34 +16 +15 +11 +15 +14 +8 +7 +5 +4 +7 +9 +2 +2 +0 +4 +3 +5 +1 +-1 +-2 +2 +1 +11 +4 +2 +-3 +5 +15 +8 +0 +-2 +5 +-5 +5 +-3 +1 +6 +8 +-6 +-1 +-6 +-6 +-3 +-1 +-3 +2 +9 +4 +-4 +0 +2 +-1 +-2 +-1 +2 +6 +-2 +-5 +-3 +5 +5 +-1 +-1 +7 +-1 +-7 +-6 +3 +-1 +-1 +-1 +5 +6 +-2 +-1 +3 +-3 +4 +-3 +-1 +-1 +5 +0 +-1 +1 +-3 +-1 +1 +-3 +7 +14 +14 +-2 +11 +-3 +-6 +-5 +-5 +-2 +-5 +-2 +4 +-4 +2 +-1 +-2 +16 +1 +-3 +0 +-4 +-3 +-1 +5 +-4 +0 +2 +-1 +15 +11 +12 +-1 +4 +8 +4 +-32 +-51 +16 +-23 +-43 +11 +-21 +-38 +14 +-20 +-35 +19 +-13 +-33 +22 +-14 +-32 +39 +-3 +-28 +39 +-3 +-29 +25 +-12 +-31 +29 +-9 +-20 +29 +0 +-24 +42 +0 +-17 +27 +-9 +-30 +38 +-4 +-16 +34 +-6 +-28 +45 +0 +-27 +25 +-10 +-32 +34 +-6 +-30 +27 +-6 +-28 +26 +-7 +-23 +26 +-10 +-31 +34 +-6 +-10 +31 +-6 +-30 +39 +-3 +-25 +28 +-10 +-22 +31 +-8 +-28 +45 +1 +-20 +41 +-2 +-18 +35 +-5 +-20 +33 +-8 +-31 +25 +-7 +-31 +31 +-9 +-27 +33 +-3 +-29 +32 +-9 +-28 +28 +-9 +-28 +32 +-3 +-27 +32 +-5 +-29 +25 +-10 +-28 +29 +-8 +-24 +32 +-7 +-24 +31 +-7 +-18 +35 +-1 +-20 +29 +-9 +-29 +29 +-8 +-28 +37 +-4 +-27 +36 +-2 +-25 +33 +-4 +-19 +29 +-2 +-24 +28 +26 +33 +20 +15 +16 +9 +17 +12 +5 +4 +9 +12 +3 +2 +2 +0 +1 +2 +5 +-1 +6 +5 +1 +1 +7 +0 +5 +2 +4 +-2 +-1 +2 +-1 +4 +-2 +9 +3 +-3 +-4 +-2 +9 +7 +-1 +6 +-1 +-3 +7 +10 +-4 +0 +-3 +0 +9 +0 +-5 +-8 +1 +-5 +-1 +-2 +-2 +7 +-3 +-3 +4 +-5 +3 +-1 +0 +7 +1 +-2 +5 +-2 +0 +1 +2 +4 +1 +-4 +-2 +5 +-3 +2 +-3 +0 +-2 +0 +-2 +-1 +-2 +7 +-1 +-1 +2 +2 +-2 +4 +-1 +6 +0 +5 +1 +-3 +2 +0 +-4 +4 +4 +3 +-2 +5 +-1 +-4 +-6 +3 +4 +7 +5 +0 +-1 +10 +4 +5 +-3 +0 +-3 +-3 +-36 +2 +-29 +-48 +14 +-23 +-41 +17 +-15 +-37 +21 +-9 +-13 +27 +-10 +-33 +25 +-9 +-28 +32 +-7 +-19 +27 +-12 +-22 +40 +1 +-21 +39 +-4 +-29 +25 +-11 +-32 +28 +-7 +-30 +27 +-11 +-26 +33 +-8 +-27 +31 +-7 +-26 +33 +1 +-24 +28 +-1 +-24 +44 +0 +-24 +28 +-7 +-26 +31 +-9 +-29 +44 +1 +-25 +28 +0 +-27 +31 +-8 +-26 +33 +-8 +-29 +42 +1 +-27 +28 +-12 +-31 +27 +-9 +-18 +32 +-7 +-16 +30 +-9 +-16 +32 +-3 +-25 +27 +0 +-27 +27 +-5 +-22 +32 +-7 +-25 +33 +-5 +-28 +29 +-7 +-29 +33 +-8 +-26 +29 +-9 +-16 +30 +-10 +-28 +38 +-4 +-24 +27 +-12 +-28 +29 +-6 +-25 +32 +-1 +-24 +28 +-9 +-28 +31 +-2 +-24 +31 +-7 +-27 +29 +-3 +-24 +39 +-2 +-24 +42 +-1 +17 +20 +28 +21 +23 +20 +9 +6 +13 +10 +7 +2 +0 +-1 +6 +9 +1 +13 +4 +-2 +0 +5 +-4 +-3 +0 +8 +5 +0 +-2 +-1 +1 +2 +-2 +5 +3 +-1 +-2 +8 +2 +-2 +6 +1 +6 +-4 +11 +-2 +-2 +-2 +6 +-1 +9 +-4 +0 +-4 +0 +-2 +-3 +0 +-3 +-3 +5 +-3 +17 +0 +1 +-4 +-2 +-5 +16 +0 +0 +-1 +-4 +-1 +5 +14 +-3 +-4 +-5 +-1 +-1 +-5 +2 +0 +-4 +16 +2 +0 +-4 +-3 +5 +-2 +-4 +-3 +-5 +-6 +-4 +-1 +9 +9 +16 +-1 +3 +-5 +-2 +-1 +11 +-1 +-2 +0 +-3 +0 +-4 +-2 +2 +0 +-2 +-1 +2 +8 +0 +4 +8 +8 +-2 +5 +19 +-1 +9 +-28 +-49 +4 +-26 +-30 +15 +-21 +-39 +21 +-14 +-30 +26 +-4 +-31 +21 +-15 +-34 +24 +-12 +-24 +28 +-10 +-27 +33 +-6 +-18 +30 +-8 +-27 +33 +-8 +-26 +27 +-10 +-14 +35 +-7 +-26 +36 +-5 +-29 +29 +-11 +-27 +33 +-8 +-28 +29 +-9 +-25 +28 +-10 +-28 +29 +-8 +-26 +33 +-5 +-27 +34 +-5 +-26 +28 +-4 +-26 +33 +-6 +-26 +29 +-7 +-26 +42 +1 +-24 +31 +-5 +-24 +33 +-5 +-19 +45 +1 +-26 +37 +-4 +-28 +29 +-9 +-29 +29 +-9 +-18 +38 +-1 +-17 +42 +2 +-27 +23 +-14 +-32 +27 +-9 +-20 +33 +-5 +-29 +27 +-8 +-26 +26 +-11 +-27 +30 +-7 +-22 +39 +6 +-23 +28 +1 +-24 +31 +-7 +-24 +38 +-1 +-26 +27 +-10 +-32 +26 +-13 +-28 +33 +-1 +-22 +48 +3 +-24 +28 +-10 +-18 +20 +16 +27 +21 +32 +16 +9 +6 +4 +10 +7 +5 +3 +6 +15 +14 +7 +2 +3 +-3 +-2 +-1 +-4 +2 +2 +-4 +13 +-1 +3 +-3 +3 +-4 +1 +1 +2 +-3 +-3 +-2 +-2 +5 +11 +6 +-1 +9 +3 +-4 +-2 +-4 +9 +11 +2 +13 +8 +-2 +-4 +-7 +-3 +-2 +-1 +3 +1 +-6 +0 +2 +20 +0 +-1 +-2 +-4 +-4 +-5 +-6 +0 +2 +1 +-5 +1 +-3 +1 +-3 +11 +8 +-2 +6 +7 +-1 +-4 +-4 +5 +6 +12 +2 +-7 +7 +5 +0 +11 +-5 +-6 +-2 +-6 +-5 +8 +-2 +-4 +-1 +-1 +4 +3 +-7 +8 +0 +-6 +-2 +-4 +-8 +-6 +-4 +-3 +15 +17 +-1 +-1 +4 +15 +13 +1 +-6 +8 +-29 +-45 +9 +-24 +-47 +14 +-22 +-42 +17 +-14 +-33 +19 +-6 +-30 +28 +-7 +-32 +25 +-12 +-22 +26 +-10 +-32 +42 +-1 +-27 +27 +-10 +-31 +36 +1 +-27 +27 +-10 +-28 +26 +-12 +-21 +35 +-5 +-28 +36 +-3 +-25 +28 +0 +-22 +46 +1 +-27 +26 +2 +-26 +34 +-7 +-30 +30 +-7 +-17 +30 +-10 +-31 +28 +-10 +-30 +27 +-10 +-29 +28 +-8 +-26 +32 +-7 +-21 +29 +-7 +-25 +39 +-2 +-25 +39 +-3 +-24 +29 +-9 +-28 +30 +-6 +-29 +41 +-2 +-23 +28 +-7 +-27 +27 +-7 +-24 +31 +-6 +-27 +44 +4 +-12 +34 +-7 +-29 +27 +-9 +-29 +38 +-3 +-21 +40 +-1 +-26 +30 +-2 +-27 +25 +-2 +-26 +44 +1 +-26 +28 +-10 +-32 +26 +-11 +-29 +27 +-5 +-15 +46 +2 +-13 +30 +-11 +-30 +24 +-11 +-31 +18 +23 +22 +26 +17 +13 +14 +24 +9 +5 +8 +5 +1 +15 +21 +4 +-1 +1 +-1 +3 +5 +0 +1 +-4 +0 +5 +3 +17 +1 +10 +11 +-5 +6 +-6 +3 +-5 +-2 +0 +-2 +1 +3 +-2 +1 +-6 +-5 +0 +4 +2 +-3 +-2 +-1 +-3 +1 +4 +-2 +-4 +13 +9 +-2 +-5 +5 +-2 +-2 +-2 +-1 +3 +10 +-2 +-5 +-3 +3 +1 +3 +5 +-1 +1 +10 +16 +-1 +-4 +-5 +-3 +0 +5 +-2 +9 +-4 +-4 +12 +-3 +-5 +4 +-1 +-5 +6 +8 +-3 +-6 +-7 +10 +-2 +-6 +-6 +-4 +0 +15 +1 +10 +3 +3 +-1 +-4 +-5 +1 +-2 +-1 +8 +5 +1 +-5 +-5 +-3 +-2 +7 +5 +-4 +-2 +-3 +14 +-24 +-47 +12 +-23 +-45 +15 +-22 +-39 +16 +-19 +-25 +23 +-13 +-34 +32 +-7 +-31 +24 +-11 +-28 +31 +-7 +-26 +28 +-6 +-9 +31 +-6 +-21 +27 +-11 +-17 +37 +-3 +-23 +34 +-8 +-30 +37 +-4 +-25 +27 +-11 +-31 +38 +-3 +-27 +31 +0 +-26 +41 +-1 +-25 +25 +-11 +-29 +23 +-11 +-15 +32 +-8 +-26 +36 +-4 +-16 +30 +-3 +-19 +24 +-4 +-24 +28 +-10 +-31 +27 +-10 +-29 +37 +-3 +-22 +41 +-1 +-21 +26 +-13 +-20 +26 +-9 +-30 +33 +-7 +-27 +40 +2 +-12 +31 +-9 +-26 +25 +-7 +-17 +27 +-11 +-26 +36 +-5 +-27 +26 +-11 +-19 +32 +-7 +-22 +42 +0 +-27 +30 +-8 +-15 +32 +-9 +-23 +47 +3 +-24 +23 +-3 +-28 +28 +-10 +-25 +29 +-8 +-28 +46 +2 +-26 +32 +-7 +-25 +29 +-10 +-32 +30 +-9 +-21 +30 +-9 +-31 +33 +-8 +-27 +31 +-7 +-30 +45 +5 +-13 +42 +1 +-26 +21 +-15 +-25 +24 +-10 +-32 +25 +-11 +-29 +28 +-9 +-30 +35 +-4 +-26 +32 +-1 +-22 +28 +-11 +-28 +33 +-5 +-26 +29 +-7 +-29 +32 +-2 +-24 +46 +4 +-21 +30 +-9 +-24 +27 +-9 +-22 +31 +-3 +-28 +28 +2 +-24 +29 +-9 +-24 +37 +-4 +-24 +37 +-3 +-26 +33 +-8 +-29 +32 +-7 +-27 +37 +-3 +-26 +35 +-6 +-22 +41 +-3 +-25 +35 +-5 +-18 +32 +-9 +-30 +27 +-1 +-28 +29 +-7 +-28 +42 +-1 +-26 +37 +-6 +-25 +36 +-1 +-29 +28 +-11 +-30 +40 +-2 +-30 +25 +-12 +-28 +32 +-8 +-21 +30 +-4 +-21 +25 +-7 +-24 +27 +-1 +-26 +39 +4 +-23 +27 +-11 +-30 +24 +-12 +-26 +30 +-9 +-25 +46 +2 +-21 +15 +27 +28 +19 +16 +20 +15 +12 +12 +11 +4 +2 +8 +5 +5 +1 +2 +-2 +5 +7 +10 +11 +2 +-4 +-4 +-4 +4 +1 +-2 +-1 +0 +-2 +8 +1 +15 +0 +1 +5 +-4 +3 +16 +0 +-2 +-5 +12 +13 +10 +-7 +-5 +-5 +-4 +8 +1 +-4 +-5 +-1 +-5 +-1 +-2 +-5 +18 +0 +-2 +2 +-5 +-8 +11 +-3 +0 +-3 +-2 +-4 +3 +9 +1 +-2 +3 +0 +-2 +-5 +-2 +-3 +-4 +-1 +0 +9 +1 +-1 +6 +-1 +2 +-6 +-2 +-1 +5 +-1 +14 +4 +-4 +-5 +1 +3 +-5 +-5 +2 +4 +2 +2 +-5 +-2 +5 +0 +-2 +2 +10 +2 +-1 +-3 +0 +0 +2 +0 +2 +-3 +13 +-1 +0 +-2 +5 +11 +-2 +-7 +6 +15 +15 +-3 +-5 +-2 +-5 +-4 +-4 +-5 +-1 +-3 +-2 +14 +2 +-5 +-4 +4 +4 +-5 +2 +8 +4 +-4 +-5 +-2 +9 +-4 +-2 +3 +7 +0 +-4 +-4 +-1 +-2 +-2 +-2 +9 +-2 +-5 +0 +3 +-3 +-1 +0 +3 +-3 +12 +6 +-4 +-3 +-2 +3 +4 +6 +3 +-3 +-3 +3 +-3 +5 +0 +13 +10 +-2 +-5 +-4 +6 +-3 +0 +-4 +6 +-4 +-1 +6 +1 +-4 +13 +0 +-4 +-3 +-5 +2 +2 +-3 +-1 +-1 +9 +11 +11 +2 +-3 +-4 +-6 +2 +-3 +-2 +-2 +-1 +-6 +0 +2 +6 +4 +3 +14 +11 +3 +-1 +-4 +-5 +4 +15 +-1 +-6 +-6 +-8 +0 +0 +-2 +6 +-2 +1 +13 +-25 +-48 +8 +-27 +-46 +18 +-19 +-36 +18 +-16 +-37 +30 +-6 +-29 +24 +-13 +-31 +26 +-11 +-27 +29 +-4 +-27 +30 +-8 +-23 +34 +0 +-27 +29 +-9 +-30 +28 +-9 +-26 +46 +2 +-11 +45 +1 +-28 +29 +-11 +-27 +26 +-9 +-23 +30 +-10 +-18 +34 +-7 +-23 +40 +-4 +-28 +25 +-12 +-31 +31 +-9 +-20 +27 +-8 +-27 +34 +-1 +-25 +27 +-10 +-21 +30 +-10 +-30 +29 +-6 +-18 +33 +-6 +-23 +43 +2 +-26 +27 +-11 +-31 +38 +-3 +-25 +27 +-11 +-25 +27 +-7 +-29 +31 +-3 +-14 +34 +-5 +-26 +30 +-10 +-30 +29 +-8 +-23 +29 +-10 +-24 +30 +-6 +-24 +30 +-8 +-26 +32 +1 +-23 +31 +-7 +-27 +43 +5 +-24 +37 +-4 +-28 +28 +-6 +-15 +35 +-6 +-30 +38 +-3 +-29 +33 +-8 +-27 +28 +-8 +-26 +17 +22 +26 +16 +19 +22 +28 +22 +9 +4 +11 +9 +2 +-1 +0 +4 +4 +1 +2 +5 +2 +0 +4 +0 +5 +-2 +0 +13 +5 +-3 +4 +-1 +3 +-3 +-4 +1 +0 +-5 +2 +0 +-2 +1 +5 +7 +1 +3 +12 +-1 +-3 +1 +-3 +10 +3 +-1 +-5 +2 +0 +8 +-2 +6 +-3 +-4 +-3 +-4 +12 +-1 +3 +4 +0 +-2 +15 +0 +-1 +2 +-5 +6 +-4 +14 +-1 +-6 +3 +10 +10 +-5 +-4 +-6 +-5 +-7 +-1 +-4 +1 +-5 +-1 +2 +0 +-2 +-2 +-2 +-1 +9 +-1 +-3 +-1 +0 +-2 +3 +-5 +0 +1 +-1 +2 +-3 +2 +2 +-2 +7 +3 +-2 +1 +-1 +-2 +1 +9 +9 +1 +12 +6 +13 +-24 +6 +-29 +-51 +9 +-27 +-44 +13 +-16 +-26 +20 +-18 +-36 +25 +-11 +-32 +25 +-13 +-30 +27 +-10 +-22 +30 +-9 +-26 +27 +-10 +-30 +39 +-3 +-12 +33 +-6 +-30 +29 +-6 +-22 +38 +0 +-25 +33 +-8 +-25 +33 +-4 +-26 +26 +-11 +-16 +28 +-9 +-20 +30 +-10 +-29 +36 +-5 +-16 +29 +-10 +-31 +47 +3 +-22 +30 +-4 +-26 +33 +-1 +-28 +27 +-12 +-29 +29 +-3 +-27 +39 +0 +-23 +27 +-10 +-31 +27 +-11 +-30 +33 +-6 +-24 +39 +1 +-16 +34 +-6 +-26 +33 +-5 +-25 +25 +-12 +-30 +29 +-8 +-26 +30 +-8 +-21 +42 +-1 +-26 +40 +-1 +-25 +30 +-8 +-25 +27 +-11 +-27 +41 +0 +-20 +26 +-6 +-19 +27 +-11 +-31 +29 +4 +-25 +31 +-9 +-30 +33 +-7 +-29 +27 +-11 +-19 +29 +-9 +-22 +29 +-8 +27 +23 +28 +17 +25 +25 +28 +7 +3 +18 +11 +0 +8 +-2 +9 +0 +3 +4 +-2 +-2 +2 +-3 +0 +-3 +5 +-2 +1 +0 +-1 +-1 +2 +-3 +3 +0 +0 +8 +0 +-2 +4 +-1 +-1 +18 +3 +-2 +-5 +-3 +-2 +1 +-2 +-2 +2 +0 +6 +9 +-3 +0 +-1 +10 +10 +7 +0 +-5 +-4 +2 +-3 +-1 +-6 +-3 +7 +1 +5 +10 +0 +-1 +-3 +-4 +8 +-4 +8 +6 +-4 +-4 +11 +-1 +-5 +-3 +-2 +-8 +5 +7 +0 +9 +-1 +-8 +-5 +3 +2 +-4 +-2 +-6 +0 +-4 +-2 +2 +-2 +-1 +1 +-4 +15 +10 +-2 +-3 +1 +13 +3 +-3 +-1 +3 +12 +-1 +4 +-2 +-3 +1 +-3 +-4 +-4 +-2 +7 +-21 +-45 +12 +-25 +-44 +20 +-18 +-37 +21 +-16 +-28 +27 +-13 +-32 +28 +-10 +-31 +27 +-11 +-28 +25 +-7 +-30 +31 +-7 +-25 +27 +-9 +-28 +33 +-7 +-24 +29 +-7 +-11 +33 +-7 +-27 +28 +-10 +-25 +29 +-6 +-23 +29 +-7 +-8 +34 +-4 +-27 +30 +-7 +-25 +30 +-8 +-20 +32 +-6 +-24 +39 +0 +-23 +39 +0 +-27 +27 +-6 +-29 +27 +-8 +-23 +28 +-6 +-28 +32 +-6 +-24 +28 +-8 +-29 +33 +-4 +-24 +28 +-7 +-25 +28 +-8 +-27 +40 +-2 +-23 +30 +-5 +-29 +28 +-11 +-28 +32 +-3 +-25 +30 +-7 +-18 +46 +7 +-23 +27 +-6 +-24 +43 +1 +-25 +26 +-10 +-31 +32 +-6 +-29 +31 +3 +-24 +37 +-4 +-26 +25 +-6 +-9 +29 +-8 +-31 +28 +-9 +-29 +31 +-7 +-30 +28 +-8 +-22 +33 +-6 +-23 +21 +23 +24 +35 +20 +20 +11 +14 +11 +4 +15 +6 +8 +0 +2 +4 +8 +3 +0 +0 +10 +-3 +-3 +9 +3 +-2 +4 +-2 +15 +16 +15 +8 +1 +-3 +-6 +-5 +-5 +-3 +11 +-2 +8 +-4 +14 +0 +-1 +-7 +-2 +-6 +-4 +5 +10 +-5 +5 +-5 +-6 +-2 +10 +-1 +2 +1 +3 +-5 +-4 +-1 +-2 +-3 +-1 +-1 +-1 +-1 +0 +2 +3 +15 +2 +-2 +-2 +-1 +-2 +-1 +-1 +-1 +10 +1 +-3 +0 +4 +8 +-4 +-6 +-4 +3 +-4 +-3 +4 +13 +2 +-5 +-2 +-4 +-4 +-3 +-5 +-3 +6 +-2 +-1 +6 +2 +-1 +-1 +-2 +2 +-4 +1 +7 +4 +8 +5 +8 +1 +7 +-4 +-5 +-5 +5 +2 +9 +20 +-17 +-44 +9 +-27 +-44 +17 +-21 +-32 +15 +-17 +-31 +22 +-9 +-32 +18 +-16 +-29 +30 +-11 +-30 +35 +-5 +-26 +43 +-1 +-24 +25 +-12 +-28 +25 +-11 +-24 +34 +-6 +-26 +34 +0 +-23 +34 +-2 +-23 +27 +-10 +-27 +26 +-10 +-27 +33 +-8 +-29 +29 +5 +-22 +27 +-11 +-21 +41 +-1 +-20 +32 +-6 +-20 +37 +-5 +-27 +32 +-9 +-21 +24 +-13 +-30 +28 +-11 +-28 +35 +-4 +-29 +27 +-8 +-24 +33 +-2 +-23 +34 +-2 +-27 +31 +-7 +-29 +30 +-4 +-27 +29 +-4 +-19 +31 +-9 +-26 +30 +-5 +-28 +35 +-3 +-27 +33 +-3 +-28 +28 +-8 +-28 +35 +3 +-12 +31 +-9 +-27 +31 +-7 +-29 +33 +-4 +32 +-7 +-30 +30 +-6 +-29 +28 +-6 +-27 +31 +-8 +-26 +43 +-1 +-27 +34 +-5 +-30 +28 +-9 +-29 +20 +34 +31 +19 +17 +10 +9 +14 +9 +7 +11 +4 +4 +17 +5 +7 +0 +3 +1 +0 +6 +1 +4 +1 +-1 +15 +15 +15 +0 +-1 +-6 +-5 +-2 +12 +-4 +-3 +5 +13 +12 +3 +0 +-5 +-8 +-6 +-10 +-1 +2 +0 +11 +8 +-3 +4 +12 +-1 +-3 +2 +2 +-5 +-7 +-5 +-5 +-6 +5 +-3 +-7 +6 +0 +9 +5 +2 +4 +-2 +-6 +6 +11 +2 +-7 +-2 +-4 +-4 +-2 +11 +1 +5 +2 +-4 +-5 +-5 +-1 +11 +10 +-2 +-6 +-1 +-4 +0 +-4 +-5 +-4 +3 +14 +-1 +0 +-2 +2 +-4 +1 +2 +-1 +-2 +-2 +3 +-3 +-2 +-3 +5 +4 +2 +1 +8 +-4 +3 +1 +14 +2 +-5 +6 +9 +-4 +-37 +-54 +13 +-24 +-38 +20 +-15 +-37 +20 +-16 +-37 +19 +-16 +-27 +24 +-12 +-26 +26 +-7 +-29 +28 +-10 +29 +-9 +-26 +27 +-4 +-24 +26 +-10 +-18 +30 +-9 +-28 +32 +-8 +-28 +28 +-9 +-28 +38 +-4 +-23 +28 +-10 +-27 +49 +4 +-24 +34 +-6 +-14 +31 +-8 +-29 +34 +-2 +-29 +28 +-10 +-29 +36 +-4 +-22 +26 +-10 +-30 +28 +-8 +-28 +46 +1 +-22 +31 +-6 +-26 +35 +-7 +-29 +30 +-8 +-24 +33 +-2 +-15 +38 +-4 +-30 +32 +-9 +-29 +24 +-12 +-26 +29 +-8 +-17 +36 +-1 +-23 +36 +-6 +-24 +26 +-10 +-30 +33 +-7 +-30 +35 +-1 +-14 +31 +-8 +-30 +39 +-2 +-24 +32 +-8 +-30 +26 +-10 +-24 +42 +-2 +-25 +28 +-9 +-18 +36 +-6 +-28 +30 +-9 +-30 +30 +3 +-23 +28 +-7 +-23 +26 +24 +21 +19 +22 +15 +12 +13 +10 +10 +10 +9 +3 +9 +0 +-1 +0 +7 +5 +0 +-1 +-1 +3 +0 +-1 +4 +2 +4 +0 +2 +1 +-1 +1 +-1 +-1 +0 +1 +13 +16 +11 +-1 +-3 +-5 +-4 +10 +9 +-3 +0 +-1 +11 +-1 +-2 +-6 +-4 +-3 +-7 +-5 +-2 +8 +12 +7 +-4 +3 +-5 +0 +14 +1 +-2 +2 +-3 +4 +2 +-6 +-5 +-5 +3 +-4 +-4 +-2 +18 +1 +14 +0 +-4 +11 +13 +6 +-7 +-5 +-7 +-2 +1 +-5 +-6 +4 +-4 +-3 +-5 +-1 +-2 +-3 +-4 +3 +1 +1 +16 +3 +2 +-4 +-3 +3 +-3 +-1 +13 +5 +0 +4 +16 +2 +-2 +-4 +-7 +-5 +-4 +-4 +-5 +-3 +2 +4 +-32 +5 +-28 +-36 +32 +-10 +-37 +24 +-14 +-38 +20 +-17 +-37 +34 +-5 +-31 +29 +-11 +-27 +26 +-13 +-28 +33 +-8 +-30 +33 +-9 +-32 +26 +-8 +-29 +30 +-10 +-16 +36 +-1 +-28 +45 +0 +-27 +31 +-6 +-29 +26 +-13 +-31 +27 +-4 +-23 +32 +-7 +-29 +29 +-6 +-23 +35 +-6 +-17 +31 +-7 +-28 +31 +-9 +-25 +25 +-12 +-27 +34 +-2 +-19 +33 +-4 +-22 +31 +-9 +-30 +31 +4 +-24 +32 +-8 +-25 +25 +-10 +-25 +41 +-3 +-27 +27 +-10 +-17 +35 +-7 +-13 +31 +-9 +-28 +37 +-5 +-23 +35 +-6 +-29 +31 +-5 +-24 +25 +-11 +-32 +28 +-8 +-29 +28 +-9 +-28 +29 +-8 +-23 +41 +-1 +-23 +31 +-9 +-28 +35 +3 +-12 +41 +0 +-27 +27 +-8 +-28 +24 +-13 +-29 +27 +-8 +-28 +34 +-4 +-25 +33 +-5 +15 +33 +29 +32 +16 +13 +18 +7 +16 +6 +9 +9 +15 +1 +4 +10 +4 +-3 +-4 +1 +2 +-2 +7 +-1 +-3 +-3 +-2 +5 +2 +9 +-1 +-2 +-1 +-2 +-3 +-3 +0 +-1 +2 +4 +3 +10 +-1 +5 +0 +5 +16 +1 +4 +-4 +0 +-6 +-2 +-6 +-1 +1 +-3 +5 +4 +2 +1 +0 +3 +4 +4 +1 +-3 +-2 +7 +3 +-5 +3 +-3 +-3 +-4 +-5 +-2 +-4 +6 +8 +2 +0 +0 +4 +-2 +-1 +-1 +-2 +2 +-2 +1 +3 +-3 +-1 +2 +7 +11 +4 +2 +-4 +-3 +3 +13 +2 +-1 +14 +0 +1 +-4 +-3 +-4 +2 +-4 +8 +-3 +0 +-3 +1 +15 +5 +-4 +-2 +-8 +2 +-2 +3 +-5 +-4 +25 +-14 +-42 +21 +-16 +-38 +10 +-25 +-45 +22 +-17 +-38 +19 +-17 +-37 +30 +-6 +-31 +24 +-12 +-33 +35 +-5 +-29 +26 +-11 +-26 +25 +-11 +-22 +34 +-6 +-28 +30 +-9 +-28 +33 +-6 +-20 +31 +-7 +-28 +34 +-6 +-23 +31 +-8 +-27 +31 +-7 +-26 +40 +-2 +-22 +41 +2 +-22 +32 +-9 +-30 +27 +-7 +-27 +30 +-8 +-23 +35 +-2 +-24 +32 +-8 +-25 +29 +-9 +-28 +32 +-8 +-24 +35 +-3 +-24 +43 +-1 +-24 +36 +-3 +-29 +29 +-10 +-29 +42 +2 +-23 +28 +-7 +-26 +30 +-6 +-30 +29 +-8 +-27 +29 +-8 +-26 +27 +-11 +-23 +33 +-4 +-23 +45 +0 +-26 +44 +3 +-26 +24 +-11 +-23 +32 +-5 +-20 +29 +-11 +-19 +37 +-5 +-29 +30 +-9 +-28 +22 +-14 +-29 +30 +2 +-23 +25 +-11 +-24 +31 +-8 +-19 +24 +24 +20 +16 +16 +18 +17 +14 +11 +6 +7 +16 +7 +4 +3 +5 +6 +0 +10 +21 +5 +-2 +-3 +16 +3 +2 +-3 +-2 +-2 +5 +0 +-2 +9 +-3 +-1 +1 +-4 +-4 +0 +6 +2 +1 +-4 +0 +-4 +5 +0 +-2 +-2 +3 +0 +11 +10 +-3 +0 +-6 +6 +14 +-4 +1 +-1 +2 +-6 +5 +7 +15 +6 +-2 +-7 +-1 +-8 +9 +-3 +8 +12 +5 +-10 +-2 +-1 +-8 +11 +-1 +-6 +-3 +-3 +-7 +-5 +-3 +7 +-5 +-4 +-1 +2 +-2 +0 +1 +-2 +4 +8 +0 +4 +9 +-3 +11 +12 +0 +-4 +-2 +-6 +-2 +2 +7 +8 +-2 +0 +4 +-5 +-5 +9 +1 +-2 +8 +-3 +-6 +-7 +-4 +-5 +4 +9 +-25 +-47 +18 +-21 +-44 +13 +-22 +-42 +22 +-13 +-33 +25 +-12 +-30 +24 +-12 +-31 +34 +-6 +-24 +26 +-12 +-29 +38 +5 +-23 +27 +-11 +-19 +40 +-2 +-21 +36 +-1 +-25 +24 +-9 +-29 +30 +-10 +-19 +40 +-2 +-22 +32 +-9 +-32 +24 +-12 +-32 +43 +-1 +-24 +42 +3 +-15 +28 +-12 +-27 +38 +-4 +-28 +28 +-12 +-31 +24 +-5 +-20 +42 +0 +-25 +41 +2 +-28 +29 +-11 +-32 +26 +-11 +-32 +35 +-3 +-25 +32 +-4 +-28 +22 +-12 +-28 +29 +-8 +-27 +30 +-6 +-26 +25 +-9 +-25 +34 +-6 +-25 +30 +-8 +-20 +42 +-1 +-19 +30 +-6 +-29 +30 +-7 +-17 +35 +-5 +-21 +29 +-10 +-29 +32 +-7 +-23 +38 +-4 +-27 +30 +-7 +-22 +28 +-9 +-22 +31 +-5 +-26 +44 +1 +-25 +27 +-8 +-30 +31 +-8 +-28 +17 +26 +24 +22 +16 +16 +19 +13 +14 +13 +25 +10 +4 +13 +1 +-2 +11 +5 +-3 +10 +2 +-3 +0 +14 +-2 +15 +0 +1 +-5 +-1 +-2 +-5 +-5 +0 +-2 +-7 +12 +3 +-3 +-2 +-2 +-1 +2 +-1 +-1 +-2 +-3 +1 +-3 +-2 +2 +1 +3 +-3 +0 +6 +8 +-2 +-2 +5 +3 +17 +-1 +-4 +-1 +7 +11 +1 +-2 +1 +-5 +4 +-3 +-2 +4 +-3 +2 +2 +-2 +6 +-3 +4 +-2 +-2 +1 +-3 +-5 +-3 +1 +-2 +4 +15 +2 +-2 +-4 +-3 +-2 +3 +-1 +-1 +16 +9 +-2 +-3 +-3 +-7 +-4 +6 +-3 +9 +13 +13 +-2 +-4 +10 +13 +5 +-6 +-3 +-1 +-4 +4 +-5 +9 +13 +-5 +-4 +14 +-25 +8 +-29 +-52 +9 +-26 +-44 +11 +-24 +-40 +16 +-19 +-30 +21 +-15 +-33 +34 +-4 +-27 +33 +-6 +-18 +30 +-9 +-27 +25 +-4 +-24 +32 +-7 +-23 +28 +-11 +-29 +34 +-3 +-23 +36 +-5 +-27 +26 +-9 +-28 +33 +-8 +-20 +27 +-10 +-29 +29 +-9 +-27 +28 +-6 +-23 +39 +-3 +-20 +31 +-8 +-22 +41 +3 +-17 +33 +-5 +-28 +28 +-11 +-29 +30 +-6 +-19 +51 +5 +-22 +31 +-7 +-16 +28 +-11 +-32 +35 +-6 +-22 +25 +-12 +-29 +23 +-1 +-26 +28 +-10 +-27 +34 +-6 +-21 +32 +-9 +-29 +26 +-8 +-14 +29 +-7 +-29 +33 +-6 +-24 +34 +-4 +-27 +29 +-8 +-25 +29 +-9 +-9 +32 +-3 +-28 +29 +-8 +-28 +34 +-5 +-28 +28 +-10 +-24 +27 +-8 +-19 +30 +-7 +-27 +30 +4 +-23 +33 +-7 +-27 +34 +1 +26 +25 +17 +21 +20 +13 +16 +11 +11 +7 +13 +6 +16 +6 +-1 +-2 +2 +-2 +5 +1 +-1 +0 +1 +0 +4 +6 +5 +6 +14 +8 +-4 +-4 +11 +9 +-5 +-4 +-6 +-5 +0 +-1 +7 +-3 +-3 +-3 +-1 +-3 +1 +-2 +-4 +1 +4 +5 +-2 +9 +-2 +3 +5 +8 +-4 +-4 +-5 +1 +9 +-4 +-3 +-2 +7 +-2 +6 +13 +-1 +-4 +1 +-2 +-6 +19 +1 +6 +-1 +-5 +-2 +3 +10 +1 +-2 +-4 +-4 +-2 +6 +9 +2 +0 +-4 +-3 +0 +-3 +5 +-3 +-4 +2 +-3 +15 +0 +0 +-5 +-1 +0 +3 +-4 +-2 +-4 +4 +-6 +1 +-2 +4 +2 +6 +-1 +-2 +-4 +-1 +14 +5 +-5 +0 +-3 +-3 +12 +-25 +-49 +11 +-23 +-41 +17 +-19 +-39 +20 +-17 +-34 +22 +-14 +-32 +25 +-10 +-30 +37 +-1 +-24 +42 +2 +-25 +39 +-2 +-28 +24 +-9 +-31 +30 +-7 +-29 +28 +-11 +-28 +32 +-8 +-27 +32 +-6 +-27 +37 +-4 +-17 +45 +3 +-25 +26 +-9 +-29 +27 +-6 +-29 +34 +-1 +-18 +37 +-6 +-26 +30 +-9 +-25 +33 +-6 +-26 +28 +-2 +-17 +29 +-10 +-24 +29 +-2 +-25 +26 +-9 +-30 +29 +-9 +-17 +50 +3 +-25 +26 +-5 +-30 +31 +-9 +-31 +44 +1 +-25 +30 +-8 +-30 +26 +-7 +-30 +26 +-4 +-15 +43 +3 +-27 +24 +-15 +-26 +25 +-10 +-25 +36 +-5 +-26 +29 +1 +-26 +31 +-8 +-25 +43 +0 +-28 +30 +-10 +-29 +43 +0 +-28 +27 +-11 +-27 +26 +-9 +-26 +30 +-10 +-28 +28 +-8 +-30 +28 +-7 +-21 +26 +29 +28 +22 +19 +15 +13 +14 +16 +9 +3 +3 +11 +7 +19 +9 +5 +4 +3 +-1 +1 +4 +-4 +-2 +2 +5 +10 +8 +8 +-3 +1 +-6 +-2 +0 +-5 +0 +-1 +-4 +13 +-1 +3 +8 +-4 +5 +0 +2 +3 +-3 +-5 +0 +11 +12 +-5 +-3 +-5 +-4 +-6 +-3 +1 +6 +2 +-3 +2 +5 +5 +8 +-1 +3 +1 +-5 +-2 +-4 +-6 +3 +4 +-1 +9 +-3 +2 +-2 +1 +-2 +-4 +4 +-3 +-3 +5 +0 +1 +7 +-5 +11 +-2 +-2 +-3 +-5 +-2 +12 +1 +2 +1 +-2 +-7 +-4 +-4 +-1 +-3 +-3 +16 +1 +0 +12 +1 +2 +-6 +3 +-1 +-2 +4 +-2 +-5 +0 +1 +-1 +-4 +4 +0 +0 +25 +-15 +-44 +4 +-29 +-46 +15 +-16 +-25 +19 +-17 +-26 +37 +-4 +-31 +20 +-10 +-31 +24 +-13 +-30 +28 +-11 +-26 +27 +-10 +-30 +31 +0 +-25 +30 +-7 +-28 +33 +-4 +-27 +27 +-10 +-27 +28 +-4 +-25 +47 +3 +-25 +33 +-7 +-29 +33 +-6 +-30 +28 +-8 +-20 +27 +-2 +-23 +45 +0 +-23 +26 +-10 +-31 +26 +-5 +-22 +30 +-5 +-25 +31 +0 +-23 +27 +-10 +-18 +34 +-7 +-29 +29 +-8 +-23 +31 +2 +-23 +29 +-7 +-26 +40 +-3 +-25 +27 +-10 +-13 +31 +-8 +-29 +33 +-5 +-15 +28 +-11 +-31 +26 +-11 +-30 +35 +-6 +-20 +46 +4 +-24 +28 +-2 +-23 +24 +-10 +-18 +29 +-10 +-30 +30 +-9 +-16 +45 +0 +-24 +40 +-2 +-30 +26 +-10 +-32 +30 +-9 +-23 +26 +-12 +-23 +26 +-5 +-21 +26 +-11 +-28 +32 +32 +22 +18 +18 +13 +12 +11 +17 +9 +5 +8 +18 +15 +1 +1 +0 +5 +2 +2 +12 +12 +-2 +-3 +1 +-1 +-1 +2 +16 +0 +2 +-3 +-5 +5 +-5 +0 +-3 +-2 +-1 +-3 +0 +-4 +-3 +-1 +1 +-1 +0 +-3 +0 +0 +8 +7 +-2 +15 +18 +-1 +-1 +-3 +-5 +-1 +-2 +4 +1 +-4 +1 +4 +6 +6 +1 +0 +-4 +4 +-6 +-5 +4 +0 +-5 +-4 +5 +9 +-5 +-5 +-4 +3 +4 +0 +-1 +2 +-4 +2 +0 +10 +0 +3 +-5 +-3 +12 +6 +-5 +-3 +16 +-1 +-1 +1 +0 +-3 +-6 +1 +-5 +3 +-4 +3 +-1 +-1 +2 +9 +3 +10 +0 +-2 +-6 +-1 +0 +-1 +-4 +2 +-6 +-1 +-33 +13 +-25 +-42 +9 +-25 +-43 +20 +-11 +-34 +24 +-14 +-34 +21 +-13 +-19 +27 +-11 +-24 +28 +-10 +-29 +26 +-11 +-29 +33 +-7 +-27 +31 +-5 +-26 +30 +-8 +-26 +30 +-6 +-25 +42 +-1 +-18 +30 +-7 +-26 +31 +0 +-21 +26 +-10 +-24 +31 +-9 +-28 +29 +-8 +-27 +34 +-6 +-24 +30 +-1 +-24 +34 +-6 +-22 +46 +3 +-26 +28 +-11 +-22 +30 +-7 +-30 +28 +-7 +-26 +29 +4 +-23 +30 +-9 +-27 +30 +-7 +-28 +37 +2 +-22 +36 +-2 +-23 +27 +-12 +-31 +27 +-9 +-27 +28 +-9 +-27 +32 +1 +-24 +33 +-5 +-20 +29 +-9 +-24 +40 +0 +-18 +29 +-10 +-29 +30 +-5 +-16 +29 +-9 +-30 +26 +-10 +-25 +42 +-1 +-23 +31 +-9 +-25 +31 +-2 +-26 +33 +-7 +-19 +29 +-6 +-29 +33 +-6 +-18 +32 +-7 +14 +22 +19 +32 +32 +15 +20 +9 +6 +5 +23 +5 +1 +4 +20 +3 +1 +-5 +-3 +1 +-3 +6 +-2 +0 +2 +0 +1 +-1 +-2 +3 +-2 +-2 +10 +6 +-4 +-2 +-1 +-2 +6 +0 +-1 +13 +2 +-4 +0 +-1 +0 +0 +8 +-1 +-4 +3 +-4 +-5 +1 +13 +9 +10 +10 +-4 +-2 +0 +7 +7 +-6 +-4 +-4 +-5 +-3 +-3 +-3 +-5 +16 +1 +0 +9 +1 +11 +5 +-6 +-1 +11 +-5 +-4 +5 +-6 +-7 +-3 +-1 +-5 +1 +-3 +0 +10 +6 +6 +-4 +-6 +-6 +1 +0 +-1 +-4 +-4 +0 +-3 +-2 +2 +2 +-3 +1 +-3 +3 +-2 +0 +-2 +13 +3 +1 +-4 +6 +3 +10 +4 +-6 +-5 +-6 +-2 +11 +-26 +-48 +21 +-16 +-41 +10 +-17 +-31 +32 +-9 +-33 +18 +-17 +-32 +22 +-14 +-30 +28 +-11 +-31 +29 +-9 +-30 +29 +-7 +-24 +32 +-8 +-19 +30 +-7 +-15 +50 +4 +-24 +23 +-13 +-32 +42 +1 +-27 +25 +-11 +-32 +27 +-11 +-28 +33 +-5 +-29 +39 +-3 +-23 +37 +-4 +-29 +31 +-6 +-25 +44 +1 +-21 +25 +-9 +-27 +30 +-5 +-30 +27 +-11 +-26 +34 +3 +-19 +37 +-4 +-24 +23 +-11 +-22 +39 +-3 +-22 +26 +-3 +-26 +25 +-12 +-25 +34 +-3 +-29 +41 +-2 +-27 +24 +-11 +-30 +29 +-6 +-28 +36 +-4 +-27 +30 +-8 +-21 +27 +-9 +-27 +41 +0 +-24 +29 +-6 +-28 +29 +-6 +-28 +30 +-8 +-19 +31 +-9 +-27 +30 +-5 +-26 +36 +-4 +-26 +31 +-4 +-13 +31 +-5 +-28 +39 +-2 +-24 +25 +-9 +-27 +21 +29 +24 +22 +19 +18 +19 +11 +27 +11 +7 +2 +2 +2 +2 +2 +1 +6 +-1 +9 +11 +1 +12 +9 +3 +3 +-2 +-2 +-3 +-4 +9 +-2 +-4 +-4 +15 +4 +-4 +11 +11 +-3 +-7 +-1 +-3 +1 +3 +12 +1 +0 +-4 +-4 +-5 +2 +-5 +-2 +-3 +17 +0 +5 +-2 +-5 +-4 +1 +4 +12 +-2 +-5 +-4 +-4 +6 +5 +11 +-2 +-3 +-8 +2 +-4 +-4 +0 +-3 +17 +1 +-3 +-2 +3 +1 +2 +-2 +-1 +-2 +3 +1 +11 +1 +-3 +0 +-3 +11 +-2 +-7 +1 +0 +-3 +-1 +14 +0 +-2 +-5 +-4 +-3 +2 +7 +3 +-2 +-1 +-4 +-2 +-3 +0 +3 +5 +-4 +-1 +-2 +-4 +8 +6 +3 +2 +16 +-22 +-45 +11 +-24 +-45 +14 +-22 +-39 +15 +-13 +-32 +28 +-11 +-33 +24 +-11 +-30 +28 +-8 +-28 +28 +-9 +-19 +27 +0 +-26 +29 +-1 +-11 +40 +-2 +-29 +32 +-9 +-21 +37 +-5 +-29 +26 +-12 +-28 +29 +-6 +-29 +31 +-7 +-24 +43 +4 +-26 +27 +-5 +-14 +27 +-10 +-32 +36 +0 +-25 +31 +-9 +-28 +39 +-2 +-26 +25 +-12 +-29 +26 +-11 +-24 +44 +2 +-22 +27 +-12 +-30 +29 +-9 +-29 +32 +-7 +-25 +28 +-9 +-29 +32 +-6 +-18 +34 +-3 +-27 +41 +2 +-24 +31 +-8 +-28 +27 +-10 +-29 +33 +-7 +-26 +34 +1 +-13 +33 +-7 +-26 +32 +-8 +-30 +26 +-9 +-29 +27 +-5 +-27 +34 +-3 +-23 +28 +-9 +-17 +33 +-5 +-18 +32 +-3 +-25 +27 +-12 +-30 +29 +-9 +-24 +31 +-7 +-20 +29 +-9 +-28 +24 +24 +25 +22 +17 +23 +21 +19 +7 +9 +6 +16 +4 +16 +11 +3 +1 +-1 +6 +8 +-2 +0 +5 +14 +0 +12 +12 +0 +0 +-5 +-5 +-5 +2 +-1 +3 +8 +-2 +-6 +-5 +-2 +-1 +-6 +-6 +-2 +0 +-2 +-2 +2 +6 +3 +5 +2 +5 +-2 +8 +4 +10 +15 +-1 +-6 +-5 +4 +-6 +1 +4 +6 +-3 +2 +-2 +4 +-2 +3 +-2 +4 +-5 +-7 +-1 +-1 +-1 +1 +3 +-5 +-1 +-3 +3 +-2 +-2 +4 +6 +1 +10 +-1 +15 +1 +-6 +6 +5 +-5 +0 +-5 +-5 +-1 +-7 +-3 +1 +1 +9 +0 +2 +12 +18 +-1 +-6 +0 +-7 +1 +-5 +-4 +-5 +11 +8 +2 +-5 +2 +9 +-2 +-2 +-6 +7 +-28 +-50 +12 +-24 +-44 +9 +-24 +-38 +22 +-16 +-31 +38 +-3 +-27 +23 +-13 +-33 +27 +-9 +-21 +29 +0 +-26 +22 +-11 +-32 +27 +-9 +-28 +30 +-6 +-12 +31 +-8 +-29 +26 +-7 +-24 +38 +-4 +-28 +32 +-6 +-15 +29 +-9 +-30 +31 +-3 +-26 +43 +1 +-24 +27 +-11 +-30 +29 +-11 +-29 +36 +-4 +-26 +29 +0 +-25 +36 +-5 +-24 +30 +-9 +-22 +36 +-3 +-23 +27 +-9 +-26 +29 +-9 +-30 +28 +-10 +-27 +37 +0 +-24 +32 +-7 +-19 +32 +-7 +-27 +32 +-5 +-24 +33 +-6 +-20 +38 +-4 +-28 +48 +3 +-23 +43 +-1 +-27 +34 +-7 +-27 +27 +-12 +-33 +27 +-10 +-32 +34 +-7 +-22 +26 +-12 +-27 +31 +-7 +-21 +29 +-5 +-29 +45 +1 +-26 +34 +-4 +-29 +29 +-10 +-25 +35 +-3 +-26 +26 +-11 +-29 +18 +33 +27 +25 +28 +14 +20 +15 +11 +9 +2 +3 +9 +14 +0 +12 +12 +-2 +-1 +1 +10 +5 +2 +-3 +-7 +-6 +16 +2 +1 +-2 +-4 +1 +-4 +-4 +-3 +4 +-2 +1 +-2 +-1 +4 +12 +17 +14 +12 +10 +-6 +2 +-3 +-8 +-3 +-8 +-5 +-4 +-3 +-3 +-3 +-4 +3 +5 +-4 +11 +2 +-2 +-3 +-1 +-1 +-5 +-4 +9 +-2 +-5 +13 +-1 +3 +0 +10 +4 +1 +-6 +-5 +-3 +-1 +-3 +-1 +0 +2 +1 +-3 +7 +-1 +2 +-1 +-3 +5 +-1 +6 +8 +0 +-4 +-5 +-1 +5 +9 +4 +5 +0 +13 +-2 +-3 +-3 +-3 +-1 +-6 +-2 +0 +-5 +8 +-5 +4 +-4 +-3 +13 +-3 +-4 +3 +-1 +0 +-34 +15 +-24 +-45 +7 +-27 +-33 +22 +-17 +-39 +16 +-14 +-35 +23 +-7 +-23 +36 +-3 +-27 +27 +-12 +-14 +28 +-11 +-32 +34 +-6 +-30 +27 +-9 +-29 +28 +-1 +-13 +28 +-9 +-19 +33 +-8 +-27 +24 +-7 +-28 +30 +-2 +-25 +28 +-7 +-24 +30 +-7 +-25 +45 +3 +-14 +37 +-3 +-26 +30 +-9 +-31 +43 +-1 +-28 +29 +-9 +-26 +32 +-9 +-27 +38 +-3 +-23 +28 +-9 +-28 +26 +-12 +-28 +42 +-2 +-24 +41 +-1 +-29 +29 +-7 +-16 +43 +-1 +-29 +38 +-3 +-30 +24 +-13 +-29 +33 +-7 +-30 +32 +-6 +-26 +30 +-2 +-13 +41 +-2 +-30 +26 +-10 +-29 +26 +-12 +-31 +29 +-9 +-25 +26 +-7 +-28 +28 +-10 +-23 +32 +-6 +-28 +30 +-8 +-25 +30 +-5 +-27 +31 +-4 +-20 +36 +-3 +-27 +46 +2 +-23 +32 +-5 +12 +25 +32 +21 +17 +13 +10 +15 +6 +4 +9 +11 +4 +8 +3 +3 +16 +2 +5 +8 +-4 +-2 +-2 +1 +-2 +-3 +0 +5 +3 +2 +6 +8 +0 +-4 +-4 +2 +13 +13 +-3 +-5 +-4 +10 +-3 +5 +-1 +1 +-4 +9 +5 +-3 +-7 +-6 +-7 +1 +-2 +-1 +4 +-2 +7 +-2 +-1 +0 +11 +6 +-1 +-4 +-3 +0 +-5 +-4 +1 +18 +0 +-3 +-4 +11 +9 +5 +1 +-4 +10 +0 +-7 +1 +4 +8 +-3 +-6 +8 +-4 +-9 +-7 +5 +-3 +0 +-2 +-5 +-3 +1 +-1 +0 +0 +-2 +3 +2 +15 +15 +-1 +-5 +13 +-3 +-2 +-5 +-6 +-5 +-5 +2 +-4 +-1 +-3 +-3 +14 +-1 +1 +-2 +3 +2 +-3 +21 +-18 +-39 +6 +-28 +-44 +11 +-21 +-39 +16 +-10 +-33 +25 +-3 +-30 +27 +-11 +-31 +42 +0 +-28 +26 +-1 +-27 +26 +-10 +-31 +27 +-11 +-30 +44 +6 +-13 +37 +-5 +-24 +30 +-8 +-26 +42 +-2 +-28 +28 +-10 +-33 +28 +-11 +-18 +26 +-12 +-32 +28 +-8 +-28 +26 +-8 +-27 +30 +1 +-22 +38 +-4 +-28 +30 +-9 +-26 +42 +6 +-22 +44 +0 +-23 +27 +-10 +-31 +31 +-9 +-27 +28 +-9 +-29 +42 +-1 +-25 +44 +1 +-25 +23 +-15 +-28 +44 +0 +-28 +26 +-12 +-27 +35 +0 +-16 +27 +-12 +-32 +36 +-3 +-26 +28 +-9 +-25 +28 +-9 +-24 +41 +0 +-25 +29 +-10 +-14 +33 +-9 +-27 +26 +-12 +-32 +37 +-4 +-23 +26 +-6 +-27 +34 +-6 +-19 +27 +-5 +-27 +28 +-9 +-26 +28 +-9 +-27 +30 +-9 +-24 +40 +-2 +-26 +31 +-6 +-16 +40 +-2 +-23 +37 +-5 +-29 +26 +-10 +-31 +30 +-10 +-24 +30 +-8 +-15 +46 +3 +-26 +27 +1 +-26 +25 +-9 +-29 +23 +-10 +-27 +35 +-2 +-24 +28 +-6 +-23 +32 +-4 +-23 +28 +-7 +-24 +42 +0 +-24 +29 +-8 +-23 +31 +-10 +-28 +27 +-8 +-22 +35 +-6 +-29 +39 +-3 +-24 +43 +-1 +-28 +28 +-9 +-32 +27 +-11 +-26 +27 +-8 +-27 +37 +-2 +-25 +34 +-6 +-28 +29 +-9 +-28 +30 +-6 +-19 +34 +-7 +-27 +34 +-6 +-27 +35 +-5 +-24 +30 +-9 +-23 +29 +-10 +-21 +27 +-8 +-28 +40 +-1 +-25 +30 +-6 +-25 +31 +-7 +-25 +36 +-2 +-25 +29 +-7 +-20 +30 +-4 +-28 +28 +-11 +-27 +33 +-6 +-26 +30 +-8 +-22 +35 +-6 +-26 +31 +-6 +-25 +30 +-9 +-24 +38 +-3 +-25 +19 +28 +26 +24 +17 +13 +19 +10 +9 +10 +13 +10 +4 +10 +16 +11 +1 +2 +6 +-3 +-4 +-1 +6 +5 +-2 +0 +3 +1 +4 +-1 +-1 +11 +1 +-2 +-1 +1 +-4 +8 +2 +-4 +-4 +0 +0 +-2 +0 +3 +-2 +1 +5 +6 +-2 +-1 +14 +4 +-5 +-4 +4 +6 +-1 +-1 +-3 +-2 +13 +3 +-5 +-5 +-4 +-2 +-2 +-4 +-4 +15 +0 +0 +5 +1 +-2 +7 +-3 +3 +-1 +2 +-2 +3 +-2 +0 +7 +3 +-4 +-4 +1 +-4 +0 +-4 +-3 +1 +-1 +3 +7 +17 +15 +-1 +-5 +-7 +-7 +-3 +10 +1 +0 +-3 +-2 +3 +1 +-3 +-4 +7 +4 +-3 +-3 +-1 +12 +1 +-4 +-1 +-2 +-3 +0 +5 +21 +-19 +-45 +5 +-30 +-46 +17 +-17 +-38 +21 +-15 +-33 +23 +-9 +-31 +38 +-5 +-27 +28 +-11 +-27 +26 +-11 +-30 +35 +-6 +-28 +29 +-10 +-25 +44 +1 +-27 +28 +-10 +-29 +28 +-9 +-23 +31 +-8 +-29 +36 +-1 +-24 +36 +-5 +-21 +28 +-11 +-27 +27 +-10 +-28 +45 +2 +-23 +28 +-2 +-26 +26 +-9 +-29 +30 +-8 +-26 +30 +-4 +-26 +33 +-7 +-17 +32 +-7 +-26 +32 +-6 +-27 +29 +-1 +-24 +29 +-9 +-25 +35 +-5 +-27 +32 +-3 +-21 +33 +-5 +-28 +36 +-4 +-24 +29 +-6 +-25 +33 +-6 +-27 +41 +-1 +-26 +32 +-7 +-27 +28 +-4 +-20 +37 +-5 +-25 +35 +-1 +-24 +26 +-12 +-23 +28 +-8 +-29 +32 +-7 +-27 +29 +-2 +-27 +33 +3 +-22 +29 +-8 +-21 +28 +-11 +-30 +28 +-9 +-19 +36 +2 +-24 +21 +22 +20 +27 +34 +24 +10 +13 +6 +9 +5 +5 +6 +5 +1 +14 +4 +0 +-1 +4 +7 +6 +2 +-2 +-2 +14 +8 +2 +-1 +-2 +-4 +-2 +11 +4 +-4 +-5 +-4 +2 +-3 +7 +-4 +-4 +2 +1 +-4 +-3 +2 +5 +-4 +-2 +11 +9 +-3 +3 +-5 +-2 +-5 +-1 +-4 +-1 +-1 +2 +0 +1 +0 +4 +-1 +-1 +-2 +2 +12 +15 +9 +7 +-3 +10 +-1 +5 +-3 +-3 +-10 +3 +-3 +5 +10 +1 +-6 +-5 +12 +2 +-1 +-8 +-6 +-2 +-5 +-1 +11 +8 +16 +-1 +-3 +-8 +-4 +12 +-4 +-3 +-5 +-2 +-2 +-3 +-6 +-1 +4 +12 +10 +-5 +-5 +-4 +-4 +0 +0 +1 +-6 +3 +14 +15 +0 +7 +-29 +8 +-27 +-49 +3 +-18 +-41 +19 +-15 +-37 +19 +-16 +-26 +30 +-10 +-31 +26 +-3 +-29 +32 +-9 +-31 +30 +-10 +-32 +22 +-14 +-30 +28 +-9 +-25 +37 +-4 +-26 +30 +-5 +-28 +34 +-6 +-28 +28 +-7 +-28 +30 +-3 +-26 +30 +-7 +-27 +30 +-8 +-25 +30 +-2 +-22 +31 +-6 +-17 +29 +-9 +-25 +32 +-4 +-26 +32 +-4 +-10 +32 +-8 +-28 +36 +-4 +-27 +37 +-5 +-27 +31 +-8 +-26 +32 +-5 +-27 +36 +-5 +-16 +42 +1 +-25 +41 +1 +-17 +36 +-6 +-18 +36 +-6 +-32 +23 +-8 +-27 +27 +-11 +-32 +35 +-7 +-27 +39 +-3 +-28 +31 +-9 +-32 +27 +-10 +-32 +28 +3 +-23 +29 +-5 +-29 +41 +4 +-20 +27 +-11 +-25 +26 +-11 +-26 +39 +-3 +-26 +29 +-6 +-26 +36 +-2 +-15 +38 +-4 +-25 +31 +-5 +8 +18 +16 +19 +13 +12 +9 +23 +19 +4 +15 +2 +5 +-2 +-2 +17 +9 +-2 +4 +-1 +-6 +2 +1 +0 +0 +-2 +1 +9 +1 +-3 +-2 +9 +1 +6 +-3 +-1 +-3 +-2 +12 +-1 +2 +0 +-4 +1 +2 +0 +5 +12 +7 +-4 +-4 +-4 +-1 +0 +-2 +3 +7 +-4 +-1 +-2 +13 +9 +4 +1 +-3 +-3 +-6 +-4 +1 +11 +-4 +-5 +-3 +-4 +-5 +15 +1 +1 +1 +-7 +-3 +3 +-3 +4 +1 +1 +-6 +10 +2 +2 +-1 +11 +3 +5 +18 +-1 +-2 +-4 +-1 +-6 +8 +-5 +-8 +-5 +6 +5 +-6 +-5 +-4 +11 +-3 +-5 +-3 +5 +-2 +3 +-6 +11 +-2 +-4 +-4 +0 +0 +14 +-2 +6 +2 +3 +-3 +5 +-2 +0 +1 +3 +4 +-4 +15 +-1 +-5 +-7 +-3 +4 +-4 +12 +9 +-5 +-7 +-5 +-6 +-3 +11 +-3 +-3 +-1 +10 +-2 +-3 +-4 +-3 +1 +9 +-4 +-3 +6 +-4 +4 +0 +-3 +0 +4 +-4 +3 +4 +-1 +1 +-3 +1 +2 +-3 +-1 +2 +-1 +2 +5 +-1 +1 +1 +11 +5 +-3 +0 +-1 +0 +-1 +0 +-3 +-4 +-2 +-2 +5 +0 +13 +3 +13 +-3 +-3 +-4 +-3 +-4 +-5 +-1 +-2 +5 +16 +-2 +-4 +-6 +-2 +-4 +2 +-1 +5 +-2 +-2 +2 +-3 +12 +2 +4 +1 +0 +-3 +3 +-3 +-2 +9 +-3 +0 +3 +1 +12 +12 +9 +-3 +-4 +-4 +-3 +-5 +-4 +0 +-5 +-4 +0 +-3 +0 +14 +12 +-25 +-48 +12 +-24 +-44 +24 +-12 +-38 +17 +-17 +-37 +22 +-14 +-31 +23 +-12 +-25 +33 +-7 +-27 +36 +-4 +-26 +29 +-6 +-30 +33 +-5 +-25 +27 +-11 +-29 +27 +-11 +-16 +36 +-1 +-21 +43 +-1 +-28 +35 +-6 +-21 +33 +-7 +-29 +24 +-4 +-29 +35 +-7 +-28 +29 +-8 +-23 +26 +-12 +-28 +37 +-3 +-26 +32 +-6 +-16 +46 +2 +-18 +29 +-7 +-31 +27 +-10 +-26 +32 +-8 +-29 +37 +-4 +-26 +26 +-10 +-30 +29 +-8 +-20 +35 +-5 +-27 +27 +-5 +-27 +33 +-6 +-27 +30 +-8 +-29 +28 +-8 +-25 +46 +4 +-16 +45 +2 +-24 +36 +-5 +-30 +26 +-11 +-21 +25 +-8 +-28 +29 +-8 +-28 +37 +-3 +-29 +30 +-7 +-17 +30 +-8 +-24 +27 +-10 +-30 +31 +-5 +-29 +30 +-7 +-28 +31 +-8 +-23 +27 +-7 +-27 +25 +27 +25 +21 +21 +13 +17 +26 +12 +11 +26 +8 +8 +5 +10 +4 +-3 +-2 +4 +3 +0 +-1 +-4 +17 +3 +2 +7 +14 +6 +-6 +-6 +4 +6 +3 +0 +-5 +9 +-4 +0 +-2 +-2 +2 +7 +-3 +-5 +1 +4 +10 +5 +-5 +-5 +-5 +-4 +-3 +9 +-3 +-4 +1 +-2 +-4 +-5 +-3 +5 +-3 +-1 +0 +11 +0 +-2 +4 +1 +16 +2 +-5 +-4 +-2 +6 +8 +1 +6 +-4 +-8 +-8 +12 +-1 +-6 +-8 +4 +9 +0 +-2 +1 +-6 +-2 +-4 +-3 +-4 +-2 +-4 +4 +11 +1 +2 +15 +2 +4 +-4 +1 +-5 +-5 +-5 +-2 +1 +10 +8 +6 +-1 +1 +11 +13 +1 +4 +2 +-4 +-4 +-2 +-6 +-8 +6 +-25 +-44 +20 +-20 +-43 +14 +-22 +-42 +19 +-13 +-35 +31 +-9 +-32 +22 +-5 +-29 +28 +-11 +-21 +35 +-7 +-31 +27 +-10 +-25 +27 +-11 +-30 +28 +-8 +-26 +27 +-11 +-28 +35 +-5 +-27 +30 +1 +-20 +27 +-9 +-22 +37 +-4 +-25 +32 +-7 +-16 +40 +-3 +-27 +38 +-2 +-29 +27 +-10 +-25 +25 +-4 +-19 +42 +0 +-22 +48 +3 +-25 +23 +-15 +-25 +28 +1 +-27 +30 +-8 +-23 +27 +-12 +-25 +25 +-13 +-32 +38 +-3 +-20 +26 +-10 +-31 +28 +-7 +-30 +34 +-4 +-22 +28 +-8 +-29 +37 +0 +-25 +29 +1 +-21 +28 +-10 +-28 +32 +-7 +-27 +31 +-2 +-24 +28 +-9 +-24 +35 +-5 +-26 +30 +-7 +-28 +33 +-7 +-27 +30 +-6 +-18 +43 +-1 +-23 +40 +0 +-25 +33 +-7 +-19 +29 +-5 +-27 +29 +-10 +-30 +34 +-2 +-27 +30 +-9 +-25 +25 +-7 +-29 +33 +-7 +-21 +31 +-8 +-29 +31 +-7 +-18 +32 +-8 +-29 +29 +-8 +-24 +34 +-4 +-27 +30 +-9 +-25 +46 +2 +-16 +28 +-8 +-26 +25 +-9 +-13 +34 +-7 +-27 +26 +-7 +-28 +40 +4 +-14 +37 +-3 +-17 +29 +-11 +-32 +26 +-11 +-26 +37 +-5 +-26 +29 +-5 +-29 +25 +-11 +-30 +28 +-5 +-21 +30 +-9 +-28 +39 +-1 +-27 +28 +-8 +-17 +48 +4 +-26 +30 +-8 +-30 +28 +-7 +-21 +31 +-9 +-27 +33 +-7 +-29 +29 +-8 +-23 +41 +5 +-23 +26 +-13 +-17 +28 +-11 +-30 +30 +-4 +-17 +27 +-10 +-29 +35 +1 +-18 +31 +-6 +-22 +27 +-8 +-27 +32 +-2 +-25 +42 +-1 +-27 +43 +-1 +-26 +29 +-11 +-26 +23 +-11 +-29 +35 +-5 +-28 +30 +-7 +-25 +26 +-10 +-30 +17 +24 +29 +23 +35 +16 +11 +9 +15 +8 +11 +9 +3 +11 +4 +15 +4 +2 +-2 +-1 +-2 +-2 +-4 +5 +-3 +9 +0 +-2 +-2 +0 +-2 +0 +0 +19 +3 +0 +-3 +-1 +0 +6 +-4 +1 +15 +2 +2 +-3 +-1 +-3 +10 +-3 +-2 +-3 +2 +0 +7 +6 +2 +6 +0 +-5 +-7 +-2 +-1 +17 +1 +0 +12 +9 +-5 +-5 +-6 +-2 +-6 +-3 +-4 +-3 +0 +-3 +8 +10 +-3 +3 +-2 +4 +-4 +-4 +-4 +6 +3 +0 +1 +-1 +-1 +1 +1 +-3 +1 +-2 +4 +-3 +1 +3 +-2 +16 +13 +-3 +-2 +-4 +-2 +0 +14 +0 +-4 +-3 +-2 +-8 +-1 +0 +-4 +4 +-4 +-2 +-4 +1 +2 +6 +0 +0 +1 +-2 +7 +5 +3 +10 +-2 +-4 +4 +-3 +0 +1 +5 +-2 +11 +4 +-3 +-1 +-7 +14 +1 +11 +4 +9 +2 +-7 +-2 +-5 +3 +-1 +-1 +-8 +-2 +-3 +-6 +0 +-4 +-3 +2 +-5 +6 +2 +-2 +1 +-2 +3 +-3 +-3 +0 +13 +2 +-2 +4 +-3 +10 +3 +9 +-3 +7 +14 +13 +14 +-5 +-10 +-6 +-8 +-6 +4 +-6 +-9 +-8 +-1 +7 +1 +2 +6 +6 +5 +10 +-3 +-2 +4 +-7 +-5 +0 +1 +-3 +2 +-1 +-1 +-1 +1 +6 +8 +0 +-4 +5 +8 +-1 +-4 +10 +-3 +0 +-4 +-6 +4 +-2 +-5 +-4 +11 +3 +9 +-3 +-3 +-1 +-5 +-6 +-4 +-1 +1 +10 +-3 +-4 +-2 +5 +-4 +0 +1 +-32 +14 +-23 +-42 +9 +-23 +-38 +14 +-21 +-30 +21 +-7 +-31 +30 +-7 +-31 +34 +-7 +-27 +31 +-7 +-29 +26 +-9 +-25 +27 +-10 +-29 +36 +1 +-26 +36 +-6 +-27 +34 +-5 +-30 +35 +-4 +-29 +32 +-5 +-27 +29 +-10 +-27 +26 +-11 +-28 +30 +-7 +-27 +29 +-8 +-23 +36 +-5 +-27 +32 +-6 +-16 +31 +-8 +-28 +29 +-8 +-25 +31 +-7 +-23 +28 +-7 +-25 +41 +4 +-22 +28 +-8 +-29 +30 +-6 +-19 +35 +4 +-23 +30 +-8 +-28 +33 +-6 +-24 +39 +-3 +-23 +32 +-7 +-25 +44 +1 +-17 +25 +-11 +-29 +33 +-6 +-29 +30 +-8 +-26 +27 +-8 +-22 +27 +-9 +-24 +40 +-1 +-24 +49 +4 +-24 +23 +-13 +-20 +49 +4 +-27 +27 +-11 +-20 +32 +-8 +-28 +22 +-15 +-20 +28 +-9 +-31 +27 +-11 +-30 +33 +-5 +20 +24 +19 +17 +20 +13 +11 +14 +6 +8 +4 +23 +8 +17 +2 +5 +-1 +8 +0 +13 +2 +-1 +14 +1 +3 +-1 +16 +0 +-4 +2 +-2 +3 +-5 +-2 +12 +3 +3 +13 +1 +9 +-3 +-7 +-11 +-4 +-7 +-6 +2 +0 +10 +-2 +-5 +-3 +6 +-5 +-1 +-1 +-2 +-4 +-2 +7 +5 +5 +-2 +-2 +-5 +2 +-5 +13 +1 +-2 +6 +-4 +9 +1 +-6 +-1 +-5 +1 +0 +-3 +0 +0 +7 +1 +5 +6 +-3 +2 +-4 +-4 +-1 +-2 +6 +1 +2 +-3 +-5 +4 +-1 +-4 +6 +-2 +-1 +-2 +-1 +-1 +2 +5 +0 +-2 +4 +3 +14 +4 +1 +2 +-5 +-4 +-5 +-1 +7 +-2 +-2 +4 +3 +-1 +0 +1 +-31 +14 +-23 +-33 +11 +-24 +-43 +24 +-16 +-37 +21 +-13 +-36 +25 +-11 +-29 +45 +1 +-27 +28 +-11 +-32 +23 +-13 +-22 +24 +-12 +-30 +37 +-1 +-26 +28 +-8 +-29 +26 +-5 +-27 +32 +-1 +-26 +29 +-8 +-26 +52 +6 +-18 +27 +-10 +-30 +33 +-8 +-17 +30 +-9 +-31 +26 +-9 +-29 +37 +-4 +-27 +41 +-2 +-19 +36 +-5 +-19 +26 +-12 +-32 +27 +-8 +-18 +32 +-9 +-21 +27 +-9 +-27 +27 +-5 +-19 +30 +-7 +-26 +37 +-5 +-28 +26 +-10 +-27 +27 +-8 +-23 +31 +-8 +-17 +43 +0 +-23 +40 +4 +-23 +35 +-7 +-29 +37 +-2 +-29 +29 +-10 +-23 +28 +-10 +-32 +27 +-10 +-30 +28 +-10 +-22 +31 +-8 +-26 +34 +-6 +-25 +45 +3 +-20 +30 +-5 +-23 +35 +-7 +-21 +29 +-7 +-29 +25 +-10 +-30 +29 +-8 +-27 +29 +-9 +-28 +29 +-7 +-26 +31 +-5 +-26 +32 +-6 +-26 +32 +-7 +-25 +30 +-5 +-22 +32 +-4 +-25 +34 +-5 +-25 +38 +-4 +-19 +44 +1 +-25 +33 +-8 +-26 +32 +-1 +-18 +41 +-3 +-25 +24 +-13 +-24 +30 +-6 +-29 +28 +-6 +-30 +29 +-1 +-27 +41 +-1 +-19 +30 +-10 +-30 +25 +-12 +-18 +43 +6 +-24 +35 +-4 +-30 +24 +-13 +-31 +26 +-7 +-28 +27 +-8 +-29 +30 +-6 +-25 +50 +4 +-23 +26 +-11 +-29 +27 +-10 +-23 +43 +0 +-27 +29 +-9 +-29 +32 +-5 +-23 +29 +-4 +-25 +35 +-5 +-19 +42 +-1 +-14 +28 +-10 +-23 +32 +-9 +-30 +26 +-10 +-19 +44 +-1 +-23 +25 +-11 +-17 +42 +-1 +-28 +22 +-13 +-27 +32 +-9 +-29 +25 +-8 +-30 +31 +-7 +-28 +27 +-10 +-24 +36 +-5 +-12 +33 +-5 +13 +22 +32 +17 +14 +13 +11 +12 +7 +11 +21 +6 +1 +1 +15 +11 +3 +1 +13 +6 +13 +5 +-6 +0 +3 +-8 +0 +9 +6 +8 +14 +-2 +-5 +7 +-4 +-7 +-8 +-7 +-3 +-5 +-1 +8 +7 +6 +14 +-3 +-1 +0 +-8 +-7 +2 +6 +1 +-6 +0 +-5 +-1 +-3 +2 +1 +-5 +3 +12 +-1 +7 +2 +5 +-6 +-2 +0 +-3 +9 +5 +-6 +-5 +0 +9 +6 +2 +-1 +-6 +-2 +-4 +-6 +-5 +0 +-5 +-4 +-4 +2 +1 +3 +12 +0 +-2 +-5 +10 +5 +-4 +-3 +2 +7 +0 +-3 +-1 +-3 +3 +10 +12 +15 +13 +1 +-8 +-10 +-10 +0 +-7 +-5 +-2 +-2 +-2 +-1 +11 +4 +-4 +-3 +0 +3 +-1 +4 +-3 +-3 +12 +3 +-3 +-3 +0 +-3 +-3 +8 +-4 +-1 +7 +1 +-1 +-4 +5 +9 +-3 +1 +10 +-2 +-2 +-2 +-4 +-3 +3 +-4 +-2 +2 +2 +3 +-2 +10 +8 +11 +-5 +-5 +-4 +-1 +1 +-4 +-6 +2 +1 +1 +-4 +2 +-3 +-3 +-4 +-2 +4 +-3 +2 +1 +0 +9 +-2 +-4 +-4 +2 +1 +16 +3 +-2 +-1 +1 +-3 +0 +-4 +-4 +15 +4 +-4 +0 +-3 +5 +-2 +0 +5 +-4 +5 +1 +3 +2 +2 +-4 +-2 +8 +-1 +-4 +-1 +-3 +-4 +3 +1 +2 +2 +4 +11 +5 +-4 +2 +0 +-3 +0 +1 +-2 +0 +4 +3 +4 +-5 +-4 +-3 +-3 +3 +10 +14 +1 +-1 +3 +-2 +-6 +-7 +15 +-22 +-47 +6 +-25 +-46 +10 +-21 +-40 +24 +-13 +-26 +22 +-14 +-28 +23 +-14 +-19 +47 +3 +-26 +29 +-7 +-26 +22 +-7 +-22 +25 +-12 +-28 +41 +-1 +-27 +31 +-4 +-29 +27 +-11 +-31 +37 +-5 +-28 +29 +0 +-25 +29 +-8 +-30 +25 +-11 +-27 +30 +-5 +-23 +37 +-1 +-23 +39 +-3 +-19 +30 +-4 +-11 +30 +-10 +-29 +28 +-6 +-27 +45 +0 +-9 +29 +-9 +-27 +22 +-10 +-28 +25 +-11 +-30 +40 +-2 +-27 +27 +-10 +-27 +45 +0 +-23 +29 +-5 +-30 +29 +-11 +-25 +35 +-6 +-26 +29 +-10 +-27 +29 +-5 +-25 +26 +-11 +-28 +30 +-5 +-23 +47 +2 +-25 +31 +-3 +-23 +27 +-9 +-23 +28 +-8 +-27 +30 +-7 +-29 +31 +-4 +-21 +42 +-1 +-25 +30 +3 +-22 +26 +-11 +-26 +31 +-8 +-28 +33 +-8 +-23 +36 +23 +24 +29 +22 +22 +11 +17 +8 +7 +0 +1 +7 +1 +4 +4 +18 +8 +11 +7 +-3 +-5 +-1 +2 +-2 +-1 +-3 +-1 +2 +1 +-2 +1 +-1 +14 +10 +-1 +-2 +10 +4 +-5 +-3 +1 +13 +10 +-4 +-3 +-6 +7 +-6 +-3 +2 +-5 +6 +0 +8 +-1 +-5 +-3 +0 +-2 +-4 +-3 +-3 +-3 +2 +1 +-1 +2 +0 +1 +-2 +-1 +3 +7 +-2 +3 +-1 +7 +1 +-2 +0 +1 +-1 +-5 +-2 +19 +2 +1 +-1 +3 +-3 +3 +5 +4 +-4 +-5 +-1 +-3 +-3 +0 +-2 +-4 +0 +-2 +1 +-1 +-2 +3 +-2 +9 +5 +1 +4 +-3 +-2 +7 +3 +4 +5 +3 +-1 +-2 +-4 +2 +2 +-1 +2 +-2 +8 +-27 +-48 +8 +-27 +-40 +29 +-12 +-34 +23 +-15 +-33 +19 +-16 +-32 +39 +-3 +-28 +24 +-12 +-30 +26 +-10 +-31 +34 +-2 +-18 +27 +-11 +-31 +25 +-11 +-29 +39 +-2 +-22 +32 +-6 +-28 +28 +-9 +-29 +45 +2 +-22 +34 +-5 +-21 +30 +-9 +-15 +28 +-6 +-21 +40 +-2 +-21 +23 +-10 +-31 +28 +-6 +-30 +28 +-9 +-27 +40 +-2 +-25 +30 +-8 +-25 +41 +0 +-25 +25 +-13 +-29 +31 +-7 +-24 +32 +-7 +-28 +28 +-9 +-19 +32 +-7 +-27 +27 +-9 +-24 +39 +2 +-24 +27 +-7 +-28 +31 +-4 +-13 +32 +-7 +-27 +28 +-5 +-27 +28 +-5 +-26 +29 +-9 +-24 +46 +2 +-24 +28 +-9 +-29 +36 +-4 +-27 +29 +-9 +-29 +32 +-6 +-25 +36 +0 +-17 +28 +-9 +-24 +33 +-7 +-15 +33 +-7 +-22 +26 +-1 +-26 +25 +19 +25 +19 +15 +14 +11 +17 +22 +24 +22 +5 +-1 +0 +6 +-1 +-2 +1 +1 +0 +1 +0 +3 +-1 +-1 +3 +-2 +6 +0 +-2 +-1 +0 +2 +2 +5 +0 +-2 +5 +-2 +-1 +-2 +-2 +1 +2 +-2 +6 +3 +0 +-2 +8 +1 +1 +7 +5 +-3 +1 +-1 +-3 +1 +-1 +-1 +-2 +-3 +-2 +-2 +3 +0 +8 +-1 +4 +11 +3 +-4 +-3 +3 +5 +0 +-3 +-1 +-3 +0 +5 +-3 +-2 +-2 +0 +-1 +0 +-3 +-1 +-3 +1 +1 +9 +3 +-1 +-1 +1 +3 +5 +-2 +9 +14 +12 +-2 +-2 +9 +1 +-5 +-6 +-4 +-5 +15 +0 +-5 +1 +-2 +-4 +-3 +4 +16 +1 +10 +8 +5 +-7 +-5 +-2 +-34 +6 +-22 +-45 +11 +-23 +-43 +18 +-18 +-23 +31 +-6 +-33 +17 +-18 +-36 +21 +-13 +-32 +29 +-10 +-29 +30 +-8 +-16 +29 +0 +-24 +37 +-4 +-28 +29 +-10 +-23 +30 +-9 +-28 +29 +-10 +-27 +30 +-7 +-28 +30 +-7 +-19 +32 +0 +-22 +28 +-10 +-24 +44 +5 +-19 +35 +-3 +-22 +34 +-7 +-19 +29 +-11 +-30 +27 +-8 +-30 +35 +-6 +-27 +27 +-9 +-29 +30 +-8 +-26 +37 +4 +-23 +28 +-10 +-20 +37 +-3 +-19 +34 +-7 +-24 +24 +-4 +-23 +38 +-4 +-28 +26 +-7 +-27 +26 +-2 +-17 +41 +-2 +-27 +29 +-9 +-23 +26 +-9 +-17 +42 +-2 +-26 +30 +-6 +-30 +25 +-13 +-30 +28 +-9 +-21 +35 +-6 +-21 +28 +-9 +-30 +27 +-10 +-10 +31 +-6 +-25 +28 +-7 +-23 +27 +-8 +-18 +30 +-8 +-28 +33 +2 +25 +26 +21 +14 +16 +21 +15 +10 +13 +7 +9 +9 +10 +2 +6 +16 +4 +0 +6 +1 +6 +2 +-2 +7 +-1 +-3 +-2 +-1 +3 +-6 +-1 +-1 +12 +15 +15 +-1 +-3 +-3 +-4 +-5 +9 +0 +-5 +-2 +-4 +-3 +-3 +-2 +-4 +13 +-2 +10 +7 +-2 +0 +-4 +-5 +-2 +13 +1 +-4 +-1 +-4 +0 +-1 +-3 +-5 +-2 +0 +5 +1 +15 +0 +-1 +-5 +-2 +2 +0 +-1 +-3 +0 +-1 +-2 +-1 +5 +8 +8 +-4 +-4 +5 +-2 +6 +-1 +-4 +-5 +6 +-3 +-3 +4 +11 +-4 +3 +-3 +2 +9 +2 +-4 +-3 +-2 +-2 +-4 +7 +-2 +-3 +-2 +11 +-2 +8 +2 +-1 +1 +-2 +-6 +-3 +0 +6 +2 +-3 +10 +-26 +-37 +15 +-23 +-41 +12 +-21 +-35 +17 +-18 +-31 +20 +-14 +-24 +23 +-12 +-29 +35 +3 +-25 +31 +-6 +-24 +33 +0 +-17 +26 +-13 +-29 +37 +-5 +-29 +29 +-2 +-26 +26 +-7 +-30 +31 +-8 +-28 +42 +0 +-14 +32 +-7 +-22 +27 +-10 +-17 +26 +-12 +-26 +43 +0 +-26 +37 +-5 +-26 +27 +-9 +-31 +31 +-9 +-29 +27 +-8 +-22 +32 +-7 +-19 +28 +-10 +-26 +27 +-9 +-22 +43 +1 +-25 +31 +-5 +-8 +30 +-6 +-31 +28 +-9 +-27 +25 +-12 +-24 +31 +-4 +-25 +32 +-4 +-24 +28 +-8 +-27 +44 +1 +-27 +31 +-8 +-25 +26 +-11 +-27 +25 +-11 +-29 +31 +-1 +-23 +34 +-7 +-25 +30 +-7 +-27 +46 +2 +-25 +33 +-4 +-27 +31 +-7 +-25 +37 +-2 +-26 +27 +-9 +-29 +30 +-8 +-28 +35 +-6 +-22 +21 +21 +24 +21 +17 +15 +13 +11 +11 +9 +7 +16 +5 +8 +5 +3 +6 +9 +3 +3 +-2 +0 +8 +0 +0 +5 +3 +20 +3 +-3 +3 +-2 +12 +3 +0 +1 +-4 +-4 +-5 +-1 +12 +-1 +1 +12 +-2 +8 +2 +1 +8 +1 +0 +-2 +-7 +-1 +-3 +-1 +3 +5 +7 +-3 +-4 +2 +0 +-1 +-2 +-5 +-6 +-5 +0 +4 +1 +-5 +-5 +7 +7 +-3 +4 +0 +11 +7 +-5 +0 +-5 +-4 +5 +-2 +-1 +-2 +-1 +0 +5 +3 +-2 +-1 +3 +4 +1 +-3 +-2 +-1 +-3 +12 +1 +5 +-4 +1 +2 +-1 +0 +17 +0 +-2 +5 +-1 +-5 +-6 +-1 +12 +15 +15 +-4 +-4 +-5 +9 +-3 +-6 +-7 +-2 +-35 +12 +-22 +-44 +7 +-26 +-41 +14 +-21 +-38 +35 +-4 +-31 +26 +-3 +-28 +23 +-14 +-32 +26 +-11 +-31 +37 +-4 +-16 +32 +-7 +-30 +37 +0 +-23 +41 +-2 +-27 +28 +-11 +-30 +25 +-8 +-23 +30 +-9 +-27 +29 +-11 +-29 +34 +-4 +-26 +29 +-3 +-15 +35 +0 +-23 +40 +-3 +-28 +27 +-8 +-31 +25 +-10 +-30 +27 +-8 +-28 +39 +-3 +-27 +42 +4 +-25 +30 +-7 +-21 +28 +-10 +-26 +30 +-9 +-22 +31 +-8 +-28 +48 +3 +-24 +35 +-6 +-30 +31 +-10 +-22 +27 +-9 +-29 +38 +-1 +-25 +35 +-6 +-28 +43 +-1 +-28 +27 +-9 +-31 +26 +-6 +-24 +29 +-8 +-24 +26 +-8 +-28 +33 +-6 +-27 +41 +-2 +-25 +37 +-3 +-28 +36 +0 +-26 +31 +3 +-25 +27 +-3 +-12 +37 +-3 +-28 +45 +0 +-28 +24 +-8 +-32 +23 +-11 +-30 +38 +1 +-25 +39 +-4 +-29 +40 +3 +-27 +25 +-13 +-19 +27 +-12 +-20 +25 +-11 +-27 +30 +-9 +-28 +37 +-6 +-27 +36 +5 +-25 +29 +-10 +-31 +31 +-7 +-25 +41 +0 +-28 +39 +-3 +-30 +33 +-9 +-24 +25 +-11 +-13 +29 +-10 +-30 +40 +-1 +-29 +25 +-11 +-22 +25 +-11 +-30 +41 +-1 +-26 +32 +1 +-26 +32 +-9 +-24 +30 +-9 +-31 +30 +-8 +-28 +30 +-7 +-28 +32 +-8 +-27 +28 +-9 +-28 +29 +-6 +-25 +41 +1 +-11 +33 +-8 +-24 +31 +-7 +-27 +28 +-7 +-28 +28 +-8 +-28 +31 +-7 +-20 +42 +1 +-24 +36 +-6 +-27 +28 +-9 +-29 +32 +-7 +-23 +30 +-8 +-19 +46 +1 +-25 +27 +-10 +-30 +35 +-6 +-22 +30 +-8 +-28 +27 +-9 +-24 +28 +-7 +-27 +31 +-5 +-27 +32 +-6 +13 +23 +22 +38 +19 +18 +11 +8 +24 +26 +6 +5 +1 +5 +5 +7 +-1 +3 +2 +11 +14 +6 +-1 +-3 +5 +8 +-3 +-5 +-4 +-3 +1 +-2 +4 +-3 +4 +8 +0 +-3 +-3 +-3 +-5 +8 +17 +-1 +-5 +-1 +-1 +3 +-4 +-7 +11 +7 +-6 +-4 +0 +5 +4 +-3 +0 +13 +-1 +2 +15 +13 +7 +6 +-9 +-4 +-8 +-8 +0 +-4 +-2 +-7 +-1 +7 +-3 +7 +-4 +-6 +1 +-3 +-1 +-3 +-3 +0 +-1 +-2 +13 +5 +4 +-2 +3 +7 +-5 +11 +-1 +2 +2 +-1 +-8 +-2 +-5 +-2 +-4 +6 +8 +-3 +-1 +4 +5 +-5 +3 +5 +-5 +-1 +10 +-4 +1 +5 +-1 +-2 +11 +-3 +1 +-1 +-2 +2 +-22 +6 +-28 +-41 +9 +-25 +-42 +19 +-15 +-27 +22 +-15 +-36 +37 +-4 +-29 +30 +-8 +-32 +27 +-12 +-32 +31 +-6 +-28 +26 +-12 +-30 +44 +1 +-22 +30 +-9 +-19 +27 +-5 +-28 +28 +-8 +-21 +41 +-1 +-27 +31 +-9 +-29 +31 +-6 +-29 +30 +-9 +-28 +29 +-9 +-20 +28 +-7 +-27 +31 +-7 +-28 +35 +-6 +-24 +29 +-9 +-29 +30 +-4 +-26 +30 +-7 +-27 +42 +-1 +-23 +34 +4 +-15 +28 +-8 +-27 +28 +-9 +-28 +27 +-9 +-28 +31 +-4 +-26 +32 +-2 +-24 +46 +4 +-23 +31 +-8 +-29 +29 +-8 +-29 +28 +-9 +-29 +29 +-5 +-26 +30 +-6 +-22 +36 +5 +-22 +41 +-1 +-27 +27 +-10 +-29 +35 +0 +-23 +27 +-9 +-29 +32 +-1 +-24 +35 +-5 +-25 +32 +-2 +-14 +49 +4 +-24 +29 +-11 +-28 +34 +-5 +16 +18 +16 +14 +10 +11 +9 +9 +12 +13 +3 +11 +2 +3 +6 +9 +2 +0 +9 +4 +1 +0 +-1 +8 +9 +2 +-3 +1 +10 +2 +-4 +5 +0 +3 +-4 +-3 +10 +9 +-3 +-3 +-4 +-2 +-4 +1 +-4 +-2 +17 +0 +-4 +-4 +-6 +14 +1 +-3 +2 +0 +9 +10 +-4 +0 +3 +11 +-2 +-6 +-6 +-2 +10 +2 +-4 +-4 +-1 +0 +-5 +-1 +-1 +-2 +9 +11 +5 +-3 +6 +-2 +0 +1 +0 +-8 +8 +7 +-2 +-2 +13 +-1 +-4 +-7 +-6 +-5 +0 +-4 +-1 +-1 +4 +-1 +-4 +-4 +-3 +-3 +-2 +1 +14 +12 +2 +-3 +7 +-2 +4 +-5 +-4 +3 +3 +0 +-2 +-2 +-4 +-2 +6 +12 +9 +3 +-2 +-3 +6 +6 +2 +8 +-4 +4 +-6 +-7 +-7 +-5 +-4 +0 +-3 +3 +0 +3 +1 +-1 +-1 +-2 +7 +2 +6 +0 +3 +10 +-4 +2 +1 +-1 +5 +-3 +-4 +0 +-2 +-4 +-5 +-2 +-1 +-3 +0 +3 +6 +11 +8 +16 +-1 +-3 +-4 +-3 +0 +1 +-7 +6 +-3 +-4 +6 +-3 +0 +-4 +3 +1 +0 +-4 +5 +-3 +1 +0 +4 +1 +-1 +5 +8 +6 +12 +2 +-7 +-1 +0 +9 +11 +7 +-4 +-8 +-4 +-2 +-7 +-4 +13 +0 +-4 +0 +1 +3 +-6 +0 +2 +0 +3 +-3 +1 +-1 +-4 +-1 +-4 +-2 +2 +1 +-3 +8 +-3 +-3 +-1 +-5 +0 +17 +5 +15 +-1 +-1 +-3 +-2 +1 +-3 +-5 +2 +-34 +-50 +12 +-24 +-42 +21 +-17 +-39 +18 +-17 +-28 +20 +-15 +-33 +32 +-8 +-27 +32 +-8 +-28 +33 +-3 +-26 +31 +-9 +-22 +44 +1 +-27 +38 +-3 +-25 +26 +-9 +-25 +37 +-6 +-27 +28 +-10 +-24 +28 +-10 +-27 +27 +-3 +-19 +32 +-6 +-25 +26 +-11 +-27 +35 +-6 +-26 +31 +-5 +-21 +42 +-2 +-21 +39 +-3 +-27 +42 +5 +-25 +30 +-9 +-29 +25 +-10 +-18 +25 +-9 +-28 +24 +-12 +-31 +27 +-9 +-28 +29 +-5 +-19 +29 +-4 +-27 +31 +-6 +-28 +30 +-6 +-25 +39 +1 +-21 +42 +1 +-26 +44 +1 +-26 +39 +1 +-28 +25 +-11 +-31 +24 +-11 +-32 +27 +-9 +-25 +29 +-8 +-27 +42 +-1 +-26 +28 +-6 +-29 +28 +-9 +-27 +45 +2 +-23 +40 +-1 +-27 +28 +-5 +-25 +30 +-7 +-29 +29 +-5 +-18 +29 +-9 +-25 +32 +-4 +-23 +33 +-7 +-28 +32 +-7 +-28 +32 +-3 +-22 +27 +-9 +-29 +35 +0 +-25 +28 +-8 +-29 +44 +1 +-16 +34 +-4 +-28 +30 +-9 +-29 +42 +2 +-27 +30 +-10 +-17 +30 +0 +-27 +26 +-11 +-13 +29 +-10 +-30 +25 +-13 +-21 +27 +-7 +-30 +27 +-10 +-26 +29 +-8 +-25 +29 +-10 +-24 +31 +-1 +-11 +33 +-7 +-24 +32 +-5 +-18 +39 +-3 +-28 +28 +-5 +-21 +26 +-9 +-27 +38 +-2 +-19 +47 +1 +-26 +26 +-5 +-26 +36 +-6 +-29 +27 +-1 +-28 +25 +-12 +-30 +30 +3 +-25 +31 +-5 +-26 +36 +-5 +-29 +32 +-6 +-28 +34 +-5 +-29 +30 +-6 +-27 +27 +-10 +-27 +33 +-3 +-27 +38 +-3 +-27 +37 +-3 +-23 +25 +-10 +-30 +28 +-9 +-27 +38 +0 +-24 +28 +-10 +-25 +39 +-1 +-25 +34 +29 +27 +20 +13 +10 +13 +18 +20 +5 +7 +11 +2 +2 +5 +2 +-2 +2 +-2 +-2 +-2 +9 +0 +0 +0 +8 +5 +6 +-2 +0 +2 +-2 +4 +-2 +0 +-3 +1 +1 +6 +-2 +8 +-1 +4 +2 +1 +4 +-2 +1 +11 +-2 +-3 +-4 +-3 +-3 +-1 +-1 +10 +-2 +8 +-2 +-1 +-2 +5 +12 +16 +3 +-5 +-1 +-5 +3 +-1 +8 +15 +-4 +0 +2 +-5 +-5 +-4 +-4 +-4 +2 +4 +-3 +-5 +0 +-3 +-6 +0 +6 +-2 +7 +2 +11 +2 +0 +8 +4 +1 +0 +-9 +-6 +0 +-5 +-5 +-3 +-5 +-3 +15 +18 +0 +-3 +3 +-5 +9 +12 +0 +-6 +-6 +14 +-3 +-7 +-4 +-5 +-6 +-4 +-4 +-2 +1 +-4 +-2 +-1 +5 +0 +8 +9 +0 +-6 +3 +-3 +-3 +-3 +12 +0 +5 +-2 +-2 +0 +2 +-1 +3 +6 +-1 +-5 +1 +0 +-1 +1 +4 +2 +-1 +5 +-3 +-5 +18 +2 +3 +-5 +-1 +-2 +9 +-4 +1 +-5 +10 +-2 +11 +-3 +5 +-3 +-3 +-4 +13 +16 +1 +-5 +-5 +-4 +-1 +-5 +-2 +6 +0 +0 +3 +7 +0 +-5 +-1 +-5 +-3 +3 +-1 +1 +12 +-2 +-6 +-4 +1 +9 +6 +14 +2 +0 +-1 +-7 +-6 +-4 +-7 +4 +-2 +3 +-1 +-5 +-3 +0 +3 +-5 +-5 +-3 +1 +2 +5 +3 +-2 +3 +1 +5 +-1 +-1 +1 +6 +-2 +-1 +13 +8 +1 +-1 +5 +2 +-4 +2 +0 +-7 +2 +-5 +3 +-33 +-33 +12 +-24 +-38 +14 +-13 +-23 +18 +-15 +-37 +18 +-9 +-27 +28 +-5 +-24 +23 +-10 +-27 +26 +-12 +-30 +39 +-2 +-18 +30 +-5 +-29 +33 +-7 +-29 +27 +-8 +-28 +35 +0 +-22 +32 +-7 +-23 +26 +-12 +-26 +25 +-9 +-26 +28 +-3 +-15 +38 +-2 +-18 +30 +-10 +-21 +30 +-9 +-23 +30 +-8 +-16 +32 +-8 +-29 +26 +-10 +-25 +24 +-4 +-9 +31 +-8 +-30 +29 +-9 +-27 +30 +-9 +-16 +35 +2 +-15 +37 +-5 +-22 +25 +-12 +-32 +26 +-7 +-14 +31 +-5 +-26 +32 +-9 +-26 +31 +-8 +-29 +31 +1 +-24 +33 +-7 +-26 +29 +-8 +-18 +27 +-9 +-27 +31 +-5 +-25 +32 +-5 +-25 +34 +-7 +-23 +31 +0 +-24 +36 +6 +-22 +25 +-3 +-27 +30 +-10 +-27 +23 +-11 +-22 +27 +-10 +-22 +33 +-6 +-27 +30 +26 +18 +19 +30 +30 +20 +23 +11 +4 +5 +24 +6 +0 +-1 +1 +3 +-1 +-1 +-2 +4 +0 +4 +-4 +17 +1 +2 +-3 +3 +5 +7 +0 +-2 +1 +1 +-4 +2 +-2 +-4 +1 +-4 +1 +-3 +-3 +0 +4 +1 +0 +-3 +-1 +-1 +4 +0 +-3 +-1 +-1 +-1 +-1 +9 +4 +-3 +6 +5 +3 +5 +-3 +8 +10 +1 +-5 +-3 +-6 +1 +-5 +-1 +0 +10 +10 +-3 +-1 +4 +-3 +1 +5 +-3 +-4 +4 +-4 +-3 +-1 +7 +-4 +1 +-4 +9 +0 +-4 +-3 +-2 +2 +0 +9 +-2 +7 +2 +-4 +-5 +12 +1 +-2 +-4 +11 +2 +-5 +-5 +-6 +16 +0 +-1 +3 +4 +-5 +-1 +6 +-5 +4 +5 +-1 +-1 +-36 +-50 +12 +-24 +-41 +21 +-18 +-34 +20 +-16 +-21 +26 +-11 +-33 +25 +-9 +-30 +42 +-1 +-28 +30 +-5 +-28 +29 +-10 +-17 +28 +-11 +-30 +33 +-7 +-18 +34 +-4 +-15 +37 +-6 +-27 +25 +-12 +-32 +34 +-7 +-22 +27 +-10 +-28 +28 +-10 +-30 +30 +-8 +-21 +50 +4 +-22 +36 +-3 +-28 +24 +-14 +-30 +25 +-11 +-31 +35 +0 +-24 +29 +-3 +-26 +29 +-7 +-21 +27 +-9 +-30 +28 +-7 +-25 +30 +-8 +-25 +30 +-1 +-16 +28 +-8 +-25 +47 +3 +-23 +29 +-9 +-25 +34 +-7 +-16 +34 +-4 +-25 +29 +-11 +-29 +37 +-4 +-28 +25 +-12 +-27 +32 +-7 +-23 +31 +-8 +-23 +27 +-7 +-29 +36 +2 +-21 +26 +-10 +-30 +31 +-8 +-27 +30 +-7 +-28 +36 +7 +-20 +40 +0 +-26 +47 +2 +-25 +27 +-6 +-29 +26 +20 +16 +18 +30 +16 +8 +10 +6 +6 +6 +13 +5 +5 +8 +9 +17 +1 +-1 +-3 +-2 +-1 +7 +1 +-3 +2 +2 +5 +8 +2 +-2 +0 +-3 +-1 +-2 +0 +9 +-3 +-3 +6 +4 +-2 +-4 +12 +11 +10 +17 +-1 +-2 +-1 +-7 +-7 +-4 +2 +-4 +1 +-3 +1 +7 +1 +9 +-4 +5 +0 +-2 +-3 +6 +4 +14 +12 +1 +-7 +0 +-6 +-4 +0 +-8 +2 +-2 +10 +3 +-2 +-3 +5 +-4 +-2 +9 +-1 +-1 +-1 +-8 +-5 +2 +5 +6 +-5 +-1 +-1 +12 +6 +-6 +0 +-1 +-4 +0 +-5 +-4 +-5 +4 +1 +7 +-3 +-5 +-5 +-3 +-3 +2 +16 +-1 +0 +-2 +-4 +0 +3 +3 +-1 +3 +6 +1 +-32 +-49 +5 +-25 +-42 +16 +-19 +-25 +20 +-13 +-19 +33 +-7 +-30 +27 +-8 +-22 +24 +-14 +-21 +43 +0 +-17 +29 +-11 +-31 +24 +-3 +-27 +29 +-11 +-25 +25 +-12 +-30 +30 +-10 +-28 +26 +-9 +-12 +32 +-7 +-24 +34 +-6 +-23 +35 +-6 +-19 +32 +-7 +-26 +29 +-3 +-20 +25 +-8 +-30 +37 +1 +-24 +27 +-9 +-26 +29 +-9 +-28 +26 +-5 +-27 +34 +-3 +-20 +31 +-8 +-28 +38 +3 +-17 +26 +-11 +-29 +38 +-2 +-16 +30 +-6 +-29 +30 +-1 +-17 +28 +-7 +-27 +32 +-8 +-29 +36 +-2 +-26 +30 +-10 +-28 +42 +0 +-18 +31 +-8 +-30 +30 +-7 +-27 +27 +-10 +-29 +30 +-8 +-27 +36 +-6 +-27 +29 +-8 +-25 +37 +5 +-22 +30 +-7 +-23 +40 +4 +-23 +31 +-8 +-31 +43 +-1 +-25 +40 +2 +-27 +25 +29 +24 +16 +11 +16 +23 +8 +3 +22 +6 +8 +-2 +8 +10 +13 +-3 +-6 +2 +0 +-1 +-4 +1 +2 +-2 +6 +1 +-1 +-2 +6 +10 +-3 +-4 +-3 +4 +0 +1 +-5 +1 +-1 +-2 +2 +16 +1 +1 +0 +16 +1 +-1 +-3 +-7 +-3 +6 +-3 +1 +-4 +-4 +-6 +1 +-2 +-3 +-3 +-2 +-4 +4 +-3 +3 +-4 +4 +-1 +7 +2 +14 +1 +-3 +-3 +2 +7 +0 +-4 +-3 +-1 +6 +5 +-3 +-3 +6 +-4 +-3 +-2 +2 +6 +-2 +-4 +7 +4 +5 +0 +-4 +10 +16 +1 +-5 +-7 +-5 +14 +0 +-4 +-4 +-5 +-4 +1 +5 +1 +0 +2 +-5 +-4 +-1 +-5 +-2 +-1 +0 +3 +-2 +3 +4 +17 +7 +-28 +-46 +10 +-25 +-42 +20 +-18 +-35 +18 +-17 +-33 +23 +-10 +-23 +35 +-6 +-20 +37 +-5 +-25 +30 +0 +-27 +22 +-10 +-32 +27 +-10 +-30 +32 +-8 +-27 +25 +-9 +-21 +28 +-10 +-25 +30 +-8 +-29 +32 +-8 +-27 +46 +3 +-18 +28 +-11 +-31 +30 +0 +-25 +27 +-8 +-28 +41 +0 +-21 +35 +-6 +-29 +27 +-3 +-28 +35 +-6 +-28 +26 +-2 +-27 +31 +-8 +-27 +30 +-7 +-27 +38 +-4 +-26 +36 +2 +-13 +28 +-10 +-28 +28 +0 +-21 +32 +-5 +-27 +29 +-9 +-24 +50 +4 +-22 +31 +-5 +-28 +30 +-10 +-30 +38 +3 +-26 +24 +-14 +-32 +31 +-8 +-26 +31 +-9 +-24 +25 +-11 +-27 +41 +1 +-17 +29 +-2 +-10 +29 +-10 +-27 +23 +-11 +-24 +30 +-9 +-20 +44 +0 +-26 +27 +-9 +-22 +30 +-9 +-28 +26 +28 +21 +17 +27 +17 +12 +20 +9 +7 +8 +10 +20 +3 +0 +0 +16 +14 +0 +-3 +-2 +6 +-4 +8 +-3 +4 +-3 +-2 +15 +-2 +8 +-2 +-3 +6 +4 +-5 +11 +-4 +-3 +-5 +-4 +3 +6 +2 +10 +13 +4 +2 +-9 +-5 +-4 +-4 +-8 +-7 +-1 +-5 +-4 +-6 +11 +2 +5 +8 +9 +-4 +1 +-4 +3 +-5 +-5 +-8 +-3 +4 +1 +3 +-2 +-2 +-2 +-3 +6 +14 +-1 +-4 +10 +1 +5 +4 +7 +-3 +-3 +-3 +14 +-2 +-1 +6 +2 +-2 +11 +-4 +-3 +12 +-4 +-7 +3 +4 +4 +-6 +-5 +-3 +-3 +-6 +-7 +-6 +16 +1 +11 +-2 +-7 +-3 +0 +-1 +-2 +3 +5 +2 +-4 +0 +-4 +-3 +-2 +-36 +5 +-23 +-43 +10 +-15 +-33 +27 +-7 +-33 +19 +-13 +-35 +27 +-10 +-29 +38 +-2 +-25 +27 +-7 +-25 +24 +-7 +-25 +31 +-9 +-20 +25 +-12 +-25 +25 +-6 +-19 +32 +-6 +-29 +35 +-1 +-17 +26 +-11 +-23 +32 +-7 +-23 +49 +5 +-17 +43 +-1 +-29 +21 +-9 +-32 +23 +-13 +-33 +25 +-6 +-30 +31 +-9 +-25 +25 +-11 +-29 +34 +-3 +-25 +30 +-3 +-27 +39 +-2 +-23 +28 +-9 +-28 +30 +-2 +-26 +29 +-6 +-26 +49 +4 +-24 +31 +-3 +-27 +40 +-2 +-16 +32 +-8 +-30 +26 +-12 +-21 +30 +-9 +-31 +28 +-9 +-21 +29 +2 +-24 +35 +-6 +-17 +37 +-5 +-25 +35 +-4 +-27 +24 +-12 +-31 +24 +-11 +-11 +31 +-8 +-25 +26 +-3 +-21 +30 +-5 +-29 +34 +-2 +-24 +27 +3 +-24 +27 +-10 +-28 +23 +-6 +-28 +48 +3 +-20 +37 +-4 +-28 +29 +-9 +-30 +24 +-11 +-14 +34 +0 +-17 +43 +1 +-24 +36 +-5 +-28 +37 +-4 +-29 +29 +-8 +-24 +33 +-7 +-31 +23 +-14 +-27 +26 +-11 +-14 +29 +0 +-26 +28 +-7 +-30 +27 +-7 +-16 +29 +-9 +-30 +26 +-11 +-25 +27 +-2 +-24 +42 +0 +-9 +30 +-8 +-27 +25 +-12 +-25 +28 +-6 +-12 +32 +-7 +-24 +37 +0 +-27 +30 +-4 +-10 +29 +-9 +-32 +27 +-9 +-31 +25 +-5 +-27 +27 +-11 +-25 +36 +-1 +-22 +41 +-2 +-13 +29 +-10 +-28 +25 +-12 +-30 +35 +2 +-25 +30 +-9 +-26 +32 +-5 +-23 +35 +-1 +-23 +41 +0 +-27 +36 +-5 +-29 +35 +-2 +-27 +29 +-11 +-23 +28 +-7 +-13 +28 +-11 +-15 +29 +-10 +-31 +42 +-1 +-27 +23 +-13 +-31 +29 +-10 +-28 +27 +-2 +14 +19 +19 +28 +15 +28 +20 +7 +8 +4 +4 +7 +10 +6 +6 +-1 +1 +-1 +14 +8 +0 +13 +-1 +-1 +13 +8 +-5 +-4 +-6 +-3 +-4 +2 +-1 +-3 +-5 +2 +9 +1 +-3 +13 +0 +-3 +-3 +-1 +-4 +1 +14 +6 +4 +-6 +17 +0 +-3 +12 +-4 +-5 +5 +-2 +-5 +-6 +10 +-1 +-6 +-3 +-4 +-6 +10 +-2 +-6 +-1 +-2 +-2 +-3 +-1 +5 +0 +1 +0 +8 +3 +7 +7 +-3 +-4 +-4 +-1 +-2 +16 +0 +-5 +-2 +7 +-4 +8 +4 +14 +-1 +-4 +-8 +-8 +-6 +-5 +9 +-1 +0 +6 +8 +-5 +-3 +-2 +0 +-1 +17 +1 +-2 +-3 +0 +-6 +1 +4 +12 +9 +-4 +11 +-2 +-4 +-7 +-3 +2 +10 +1 +7 +-5 +-3 +-3 +0 +10 +13 +-1 +-5 +-2 +0 +1 +-4 +6 +-5 +-4 +-6 +-1 +3 +2 +0 +-2 +-1 +4 +13 +11 +0 +-6 +-1 +0 +-5 +-4 +-2 +0 +0 +13 +9 +-4 +-6 +-1 +-5 +-3 +-2 +3 +-1 +-2 +0 +5 +0 +-3 +1 +-1 +-5 +-3 +3 +-2 +3 +0 +-2 +4 +-1 +-1 +-2 +8 +7 +-2 +-1 +2 +-2 +-2 +-1 +-2 +5 +0 +1 +-1 +1 +3 +-2 +4 +10 +9 +-2 +3 +0 +-3 +13 +14 +0 +-7 +-5 +-5 +-6 +4 +9 +0 +-3 +-5 +-4 +-4 +-3 +-3 +4 +6 +-2 +-1 +-2 +-3 +-1 +-1 +-1 +2 +2 +3 +-3 +-1 +0 +0 +6 +10 +-2 +5 +12 +16 +1 +-31 +3 +-31 +-42 +14 +-22 +-39 +18 +-18 +-37 +17 +-16 +-36 +24 +-13 +-29 +25 +-11 +-30 +32 +-8 +-23 +27 +-5 +-25 +39 +-2 +-19 +27 +-10 +-30 +41 +-2 +-26 +28 +-10 +-30 +26 +-10 +-24 +34 +-5 +-27 +41 +5 +-21 +26 +-9 +-26 +27 +-11 +-27 +32 +-5 +-22 +40 +-2 +-19 +29 +0 +-26 +31 +-9 +-27 +28 +-9 +-27 +28 +-4 +-13 +43 +1 +-12 +30 +-10 +-21 +25 +-12 +-32 +26 +-6 +-25 +30 +-1 +-26 +30 +-5 +-28 +28 +-9 +-16 +35 +-5 +-22 +28 +-9 +-21 +27 +-6 +-27 +37 +-4 +-27 +32 +-8 +-22 +32 +-7 +-29 +28 +-7 +-28 +28 +-2 +-20 +28 +-6 +-25 +32 +-7 +-19 +37 +-5 +-28 +29 +-9 +-13 +33 +-5 +-26 +27 +-10 +-29 +37 +-4 +-25 +45 +3 +-13 +33 +-8 +-23 +33 +-7 +10 +22 +13 +13 +20 +22 +13 +8 +12 +12 +7 +0 +15 +6 +-1 +-2 +8 +1 +-2 +5 +-1 +1 +1 +0 +1 +-1 +3 +-2 +-3 +9 +-2 +1 +-4 +6 +-2 +4 +6 +3 +-3 +-3 +3 +-1 +1 +-3 +5 +-3 +4 +-3 +4 +3 +-4 +4 +-2 +10 +3 +-3 +6 +1 +-6 +-4 +-4 +13 +20 +2 +-7 +-7 +-4 +4 +5 +-1 +11 +-2 +-6 +11 +0 +14 +-3 +-6 +3 +-1 +-4 +4 +-4 +2 +7 +-4 +4 +-5 +-5 +-6 +-3 +2 +-3 +-3 +-4 +-5 +17 +2 +8 +4 +-6 +0 +1 +-4 +-3 +4 +-2 +-4 +-3 +-2 +4 +10 +3 +2 +3 +0 +11 +1 +5 +-6 +12 +-2 +9 +9 +-2 +-4 +-6 +-4 +13 +-22 +-40 +4 +-31 +-48 +10 +-25 +-43 +15 +-21 +-32 +26 +-11 +-27 +26 +-12 +-29 +28 +-8 +-23 +27 +-11 +-31 +31 +-6 +-26 +33 +-3 +-25 +28 +-7 +-28 +34 +-5 +-26 +27 +-4 +-16 +31 +-9 +-26 +36 +-3 +-23 +37 +-4 +-22 +44 +0 +-26 +27 +-9 +-24 +38 +-3 +-29 +36 +-6 +-25 +25 +-12 +-13 +30 +-9 +-30 +27 +-10 +-29 +31 +-5 +-27 +30 +-1 +-25 +46 +2 +-25 +30 +-8 +-23 +32 +-8 +-14 +31 +-8 +-23 +30 +-10 +-28 +28 +-10 +-30 +32 +-7 +-28 +31 +-5 +-25 +34 +-6 +-26 +31 +-7 +-19 +30 +-10 +-29 +43 +3 +-21 +38 +2 +-15 +28 +-1 +-27 +28 +-11 +-32 +42 +0 +-27 +23 +-15 +-27 +24 +-3 +-22 +26 +-11 +-20 +27 +-8 +-25 +44 +0 +-22 +26 +-9 +-30 +31 +-1 +-12 +21 +20 +21 +16 +15 +11 +25 +12 +9 +10 +10 +5 +6 +20 +19 +14 +-2 +-1 +-5 +-3 +4 +14 +0 +-4 +7 +1 +-2 +-3 +-1 +0 +-2 +-2 +-1 +5 +2 +-2 +3 +-1 +0 +-2 +4 +9 +3 +-4 +10 +14 +8 +-4 +9 +-1 +3 +-6 +0 +13 +-3 +-5 +-5 +1 +5 +-1 +-5 +-4 +-4 +-2 +-1 +0 +20 +1 +4 +3 +-6 +-6 +5 +-2 +-4 +8 +2 +13 +-3 +2 +-3 +-3 +-4 +-4 +-5 +-2 +6 +-3 +-1 +-5 +1 +2 +5 +4 +-2 +1 +-3 +-4 +-1 +-5 +-2 +0 +2 +5 +1 +1 +-3 +7 +3 +7 +17 +1 +-5 +6 +-1 +-2 +-1 +9 +-3 +-4 +-6 +-4 +-5 +2 +-2 +-2 +11 +1 +24 +-17 +-45 +6 +-23 +-42 +11 +-17 +-40 +15 +-21 +-38 +19 +-16 +-33 +23 +-13 +-30 +26 +-8 +-28 +27 +-10 +-27 +28 +-8 +-27 +39 +-3 +-25 +31 +-3 +-25 +31 +-4 +-25 +47 +3 +-22 +29 +-10 +-29 +33 +-7 +-26 +32 +-8 +-27 +36 +-5 +-25 +40 +-3 +-29 +38 +-2 +-28 +27 +-10 +-28 +29 +-10 +-28 +29 +-8 +-22 +29 +-4 +-13 +41 +-2 +-25 +27 +-9 +-12 +31 +-5 +-29 +34 +-2 +-28 +24 +-8 +-19 +29 +-10 +-15 +36 +-3 +-25 +24 +-10 +-31 +27 +-6 +-28 +30 +-3 +-27 +27 +-11 +-24 +29 +-7 +-26 +34 +-6 +-19 +34 +-5 +-19 +41 +-2 +-26 +26 +-11 +-25 +32 +-6 +-28 +29 +-8 +-20 +36 +-6 +-29 +36 +-4 +-15 +36 +-7 +-29 +27 +-10 +-27 +27 +-8 +-28 +28 +-7 +-26 +29 +-8 +-18 +23 +37 +23 +24 +16 +13 +29 +14 +9 +8 +13 +4 +8 +8 +11 +2 +14 +8 +13 +3 +2 +1 +0 +-4 +12 +4 +-7 +-2 +-1 +-4 +0 +1 +12 +3 +0 +5 +-4 +-4 +-4 +2 +-1 +11 +10 +12 +-5 +-2 +9 +12 +6 +-6 +-10 +-2 +-8 +-9 +-9 +7 +-1 +-4 +0 +2 +-4 +-2 +5 +7 +-4 +-2 +12 +3 +-5 +-4 +11 +1 +-4 +2 +-4 +0 +-2 +0 +4 +-3 +-4 +14 +13 +13 +-3 +13 +-4 +-5 +1 +-7 +-5 +-2 +-4 +-6 +-3 +-2 +10 +9 +-4 +-4 +3 +5 +16 +1 +5 +-5 +-3 +9 +-1 +-2 +-4 +-4 +-5 +-1 +-2 +0 +-2 +-5 +-3 +2 +-3 +0 +-2 +-2 +-2 +6 +-3 +-2 +9 +-25 +-44 +7 +-27 +-43 +16 +-14 +-29 +30 +-11 +-24 +21 +-14 +-29 +26 +-13 +-30 +35 +-3 +-29 +27 +-11 +-28 +34 +-1 +-27 +30 +-7 +-22 +32 +-5 +-27 +42 +3 +-21 +25 +-12 +-32 +28 +-9 +-22 +30 +-8 +-24 +29 +-10 +-26 +31 +-7 +-10 +33 +-8 +-26 +38 +-3 +-27 +34 +-5 +-28 +25 +-10 +-30 +28 +-7 +-27 +27 +-8 +-27 +29 +-9 +-26 +32 +-6 +-23 +34 +-4 +-21 +29 +-7 +-24 +31 +-6 +-25 +31 +5 +-22 +32 +-7 +-24 +30 +-7 +-28 +30 +-4 +-25 +31 +-6 +-18 +31 +-6 +-24 +27 +-7 +-11 +34 +-7 +-28 +27 +2 +-23 +33 +1 +-23 +42 +-1 +-25 +29 +-10 +-29 +23 +-10 +-19 +31 +-8 +-22 +27 +-10 +-29 +33 +-7 +-24 +35 +-5 +-18 +32 +-8 +-28 +36 +-4 +-22 +30 +-8 +-28 +21 +30 +22 +27 +16 +14 +21 +15 +12 +9 +4 +6 +5 +9 +16 +5 +3 +1 +3 +4 +-1 +2 +1 +7 +-1 +2 +4 +1 +-3 +0 +-1 +-1 +0 +6 +2 +1 +-2 +-1 +8 +1 +7 +3 +1 +-2 +12 +7 +15 +-3 +-4 +-6 +1 +5 +7 +11 +-2 +4 +13 +-3 +-8 +-5 +-8 +9 +3 +0 +7 +-4 +-5 +-2 +0 +-5 +-8 +-1 +-5 +3 +12 +4 +3 +-5 +0 +-3 +-5 +8 +11 +-3 +6 +-5 +-5 +-1 +-7 +15 +-1 +2 +-5 +-2 +-6 +-5 +-1 +3 +-4 +-4 +-4 +4 +1 +2 +1 +3 +-4 +-2 +8 +-2 +-3 +0 +2 +-1 +16 +1 +0 +-5 +1 +-1 +5 +1 +1 +-3 +4 +-2 +-2 +8 +20 +-19 +-47 +17 +-22 +-45 +24 +-15 +-41 +17 +-17 +-37 +17 +-18 +-37 +31 +-10 +-27 +24 +-11 +-30 +25 +-11 +-24 +25 +-2 +-25 +29 +-9 +-28 +34 +-1 +-24 +29 +-5 +-25 +37 +0 +-23 +32 +-8 +-15 +38 +-4 +-29 +41 +-2 +-12 +28 +-11 +-32 +25 +-8 +-23 +29 +-6 +-14 +30 +-9 +-30 +28 +-10 +-28 +28 +-10 +-29 +29 +-7 +-27 +35 +-5 +-21 +35 +-5 +-26 +28 +-6 +-27 +35 +-3 +-24 +29 +-2 +-26 +35 +-1 +-24 +27 +-11 +-23 +26 +-10 +-16 +52 +6 +-22 +31 +-9 +-30 +26 +-7 +-20 +26 +-11 +-26 +27 +-11 +-26 +28 +-8 +-10 +33 +-7 +-25 +37 +0 +-25 +27 +-11 +-29 +38 +0 +-25 +30 +-10 +-23 +35 +-4 +-25 +29 +-11 +-20 +41 +-1 +-25 +27 +-7 +-27 +25 +-8 +-29 +37 +-5 +-27 +18 +20 +21 +25 +16 +15 +13 +9 +16 +13 +8 +6 +8 +5 +2 +3 +0 +14 +10 +8 +13 +24 +2 +-4 +-4 +-3 +-4 +-5 +0 +5 +4 +-2 +-2 +3 +-3 +0 +12 +3 +-5 +-4 +8 +-3 +-5 +2 +-3 +-5 +5 +4 +2 +-5 +12 +-2 +-4 +-2 +2 +-2 +-2 +13 +-2 +0 +-5 +-4 +5 +-4 +-4 +2 +-3 +1 +-4 +-2 +0 +1 +1 +-1 +0 +1 +0 +10 +-1 +7 +2 +13 +9 +1 +1 +-5 +6 +-1 +-3 +5 +-4 +1 +-1 +0 +-3 +-4 +-3 +-2 +6 +2 +-4 +-3 +-1 +18 +1 +0 +-1 +3 +-6 +-4 +-4 +-2 +2 +4 +3 +-5 +2 +3 +-3 +-1 +-1 +-1 +-3 +0 +1 +9 +4 +14 +13 +-24 +-41 +5 +-30 +-34 +23 +-16 +-39 +14 +-21 +-36 +21 +-5 +-30 +32 +-9 +-31 +30 +-2 +-29 +25 +-12 +-30 +26 +-11 +-27 +35 +-6 +-28 +29 +-8 +-17 +32 +-6 +-19 +37 +-4 +-27 +26 +-12 +-19 +31 +-8 +-27 +30 +-9 +-14 +42 +-1 +-25 +44 +0 +-16 +30 +-7 +-28 +30 +-11 +-31 +28 +-11 +-28 +23 +-13 +-26 +27 +0 +-14 +32 +-9 +-29 +28 +-5 +-26 +36 +-2 +-27 +25 +-12 +-29 +37 +-4 +-25 +29 +1 +-25 +31 +-7 +-25 +49 +4 +-25 +30 +-5 +-27 +33 +-1 +-16 +45 +0 +-28 +28 +-10 +-29 +23 +-13 +-27 +36 +-4 +-24 +24 +-12 +-30 +36 +-5 +-26 +30 +-5 +-20 +27 +-11 +-20 +33 +-6 +-22 +36 +-5 +-28 +31 +-9 +-29 +31 +-2 +-27 +30 +1 +-24 +30 +-9 +-27 +31 +-8 +-28 +23 +20 +39 +21 +18 +16 +11 +7 +10 +8 +5 +6 +3 +7 +19 +15 +-1 +5 +7 +-1 +7 +-2 +-3 +-3 +-1 +7 +1 +0 +-6 +2 +-2 +-1 +2 +1 +-2 +0 +0 +9 +-1 +-1 +-3 +-1 +7 +7 +13 +4 +6 +2 +9 +-2 +-5 +-4 +-6 +7 +17 +1 +4 +-4 +-7 +-8 +-6 +-2 +-6 +8 +0 +-2 +3 +-2 +-4 +-1 +9 +11 +-2 +-1 +10 +1 +-3 +-5 +2 +-4 +4 +6 +-1 +3 +-6 +-4 +-2 +2 +5 +-2 +0 +5 +-4 +-2 +-1 +9 +1 +0 +-1 +3 +7 +6 +-4 +-3 +1 +-1 +-2 +-3 +-2 +3 +-2 +0 +1 +-1 +5 +2 +4 +-1 +3 +-4 +-3 +-3 +-2 +5 +15 +4 +-3 +-3 +12 +-25 +-47 +18 +-15 +-40 +20 +-18 +-28 +27 +-13 +-34 +33 +-8 +-35 +26 +-13 +-32 +22 +-12 +-31 +23 +-14 +-30 +26 +-11 +-17 +29 +-11 +-29 +38 +-3 +-27 +27 +-10 +-19 +44 +1 +-26 +29 +-9 +-17 +39 +-3 +-24 +30 +-10 +-22 +25 +-12 +-32 +25 +-11 +-14 +28 +-10 +-29 +46 +1 +-25 +30 +-3 +-28 +47 +2 +-15 +40 +-3 +-31 +25 +-14 +-31 +24 +-12 +-20 +28 +-3 +-27 +29 +-7 +-29 +31 +-4 +-25 +26 +-11 +-29 +29 +-4 +-17 +26 +-7 +-25 +36 +-5 +-27 +28 +-10 +-17 +29 +-4 +-15 +32 +-5 +-29 +33 +-3 +-24 +27 +-5 +-25 +27 +-6 +-28 +39 +-2 +-23 +28 +-3 +-25 +29 +-8 +-25 +27 +-11 +-29 +38 +-3 +-25 +40 +-1 +-15 +36 +-5 +-29 +25 +-13 +-27 +28 +-9 +-29 +29 +-9 +-19 +23 +28 +19 +19 +21 +18 +14 +30 +13 +7 +14 +4 +2 +2 +3 +19 +5 +10 +-2 +11 +2 +6 +-3 +-3 +1 +1 +-2 +13 +2 +-3 +-3 +-4 +4 +7 +-4 +0 +5 +0 +-6 +-4 +2 +0 +-6 +8 +2 +0 +-2 +-2 +6 +-2 +13 +1 +8 +12 +2 +-1 +-6 +-4 +3 +-4 +-5 +2 +3 +15 +0 +-5 +-1 +-5 +4 +6 +-5 +4 +-3 +6 +-1 +4 +0 +1 +-4 +-5 +-5 +-5 +0 +-2 +0 +6 +-3 +15 +-1 +0 +-5 +-5 +-4 +13 +-1 +1 +13 +14 +5 +-6 +-3 +-6 +-5 +15 +-1 +-4 +-4 +-5 +11 +-1 +11 +-3 +-5 +-1 +-2 +-1 +-4 +0 +-5 +-1 +-4 +-6 +-2 +0 +11 +12 +-2 +13 +-22 +5 +-30 +-49 +17 +-20 +-30 +18 +-16 +-38 +16 +-19 +-34 +22 +-11 +-26 +36 +-2 +-26 +27 +-11 +-18 +25 +-13 +-28 +28 +-3 +-22 +27 +-10 +-23 +27 +-11 +-29 +41 +-1 +-26 +30 +-9 +-26 +27 +-9 +-18 +30 +-7 +-27 +34 +-4 +-27 +35 +-6 +-27 +28 +-8 +-26 +33 +-6 +-26 +27 +-5 +-24 +35 +-2 +-23 +35 +-2 +-25 +33 +-8 +-28 +38 +0 +-19 +32 +-8 +-14 +36 +-1 +-14 +29 +-12 +-32 +23 +-13 +-27 +32 +-7 +-28 +31 +-8 +-29 +28 +-9 +-24 +28 +-4 +-12 +30 +-8 +-15 +35 +-5 +-24 +25 +-9 +-23 +32 +-7 +-27 +46 +4 +-21 +28 +-9 +-31 +45 +1 +-27 +29 +-8 +-22 +26 +-13 +-31 +28 +-10 +-23 +37 +-5 +-26 +31 +-8 +-29 +28 +-7 +-26 +27 +-2 +-24 +37 +-4 +-27 +44 +2 +29 +22 +21 +18 +12 +23 +15 +20 +14 +2 +0 +3 +2 +-1 +5 +6 +5 +-2 +0 +6 +4 +14 +13 +-2 +-4 +5 +4 +-3 +13 +-1 +-7 +-4 +-7 +-2 +5 +4 +3 +8 +-2 +2 +-5 +-1 +-4 +1 +13 +-1 +3 +-4 +-3 +-4 +-4 +-4 +-3 +-2 +0 +-1 +-2 +-2 +13 +14 +6 +-4 +-4 +12 +-2 +3 +-1 +2 +-2 +-6 +7 +-4 +10 +16 +10 +0 +2 +-9 +-7 +-5 +4 +12 +-3 +-6 +3 +5 +12 +-2 +-6 +2 +14 +-3 +-1 +-3 +-6 +-4 +0 +-3 +-2 +0 +-7 +-5 +11 +4 +-2 +-5 +-5 +-7 +11 +0 +-1 +-4 +-3 +4 +10 +-3 +-4 +1 +-4 +10 +1 +-2 +7 +4 +13 +13 +0 +8 +10 +-23 +-39 +3 +-32 +-49 +12 +-22 +-41 +23 +-16 +-28 +22 +-15 +-36 +25 +-6 +-24 +22 +-5 +-30 +25 +-10 +-29 +26 +-11 +-21 +28 +-10 +-29 +34 +-4 +-15 +47 +2 +-24 +26 +-1 +-27 +25 +-13 +-31 +30 +-8 +-20 +34 +-7 +-28 +31 +-5 +-27 +29 +-9 +-29 +43 +1 +-20 +26 +-3 +-24 +34 +-6 +-30 +37 +4 +-24 +27 +-5 +-16 +44 +0 +-26 +25 +-9 +-31 +32 +-3 +-22 +35 +-3 +-21 +24 +-15 +-27 +26 +-11 +-28 +30 +-9 +-29 +25 +-10 +-29 +29 +-9 +-26 +31 +-7 +-16 +38 +1 +-18 +27 +-10 +-28 +37 +-3 +-19 +31 +-8 +-30 +27 +-11 +-27 +29 +-6 +-27 +30 +-9 +-25 +39 +1 +-23 +32 +-6 +-19 +26 +-10 +-29 +32 +-6 +-20 +34 +-5 +-24 +30 +-9 +-27 +38 +-1 +-17 +33 +-6 +-25 +18 +23 +19 +23 +16 +17 +11 +10 +21 +20 +12 +10 +2 +3 +7 +19 +4 +13 +12 +3 +8 +12 +-4 +-7 +-6 +1 +-3 +-2 +-2 +-2 +1 +-5 +-4 +3 +-2 +-1 +-3 +3 +5 +6 +2 +-1 +-2 +0 +9 +0 +12 +-2 +0 +-6 +-5 +4 +-4 +-4 +3 +7 +9 +8 +-5 +-6 +-3 +-2 +13 +1 +-4 +-6 +-4 +-2 +4 +-2 +2 +0 +6 +-1 +8 +0 +-5 +14 +-1 +1 +-8 +17 +0 +-1 +-7 +-2 +2 +2 +-3 +5 +-1 +-3 +-4 +-3 +0 +-2 +-1 +7 +-4 +2 +6 +-6 +-2 +-3 +2 +-6 +-2 +4 +0 +5 +-4 +-3 +5 +-2 +-4 +11 +8 +12 +7 +-6 +-7 +-5 +-5 +-4 +4 +-4 +7 +9 +9 +-28 +-50 +7 +-23 +-42 +10 +-23 +-26 +22 +-16 +-18 +24 +-14 +-33 +25 +-12 +-30 +21 +-13 +-33 +37 +0 +-26 +24 +-9 +-28 +34 +-1 +-26 +25 +-11 +-17 +50 +4 +-21 +33 +-7 +-31 +26 +-6 +-29 +25 +-11 +-30 +39 +-4 +-22 +30 +-8 +-18 +32 +-7 +-26 +26 +-11 +-27 +29 +-7 +-14 +44 +1 +-20 +30 +-11 +-30 +27 +-10 +-27 +27 +-8 +-24 +28 +-6 +-23 +28 +-9 +-26 +30 +-6 +-19 +34 +-4 +-27 +29 +-5 +-27 +33 +-5 +-25 +31 +-7 +-21 +39 +-4 +-24 +35 +-4 +-24 +28 +-8 +-29 +29 +-4 +-24 +29 +-6 +-18 +28 +-3 +-28 +32 +-7 +-16 +31 +-2 +-26 +28 +-9 +-25 +27 +-10 +-25 +35 +-6 +-25 +31 +-5 +-15 +49 +4 +-25 +35 +-6 +-30 +27 +-11 +-27 +39 +-2 +-16 +36 +-2 +-29 +19 +25 +21 +15 +12 +17 +8 +8 +8 +10 +5 +5 +5 +7 +2 +7 +5 +6 +2 +3 +7 +2 +8 +-1 +2 +15 +8 +11 +-2 +-8 +1 +-2 +-5 +-5 +-4 +4 +-3 +5 +-3 +-3 +0 +6 +-4 +0 +-2 +0 +9 +-1 +-2 +-5 +16 +3 +-4 +-3 +2 +1 +-2 +2 +0 +-2 +11 +19 +0 +6 +-6 +3 +13 +17 +-3 +-7 +1 +6 +8 +-3 +-10 +-4 +-7 +-8 +5 +-5 +0 +-4 +-8 +-3 +-6 +-1 +-2 +1 +1 +2 +-3 +-3 +2 +10 +-2 +-1 +1 +6 +-4 +14 +0 +10 +8 +-4 +-5 +5 +-4 +4 +11 +12 +-4 +5 +-3 +-2 +-4 +-7 +9 +-4 +-7 +-7 +-4 +-4 +-1 +-2 +-1 +9 +-3 +10 +-26 +16 +-22 +-46 +11 +-23 +-30 +17 +-18 +-39 +16 +-11 +-22 +21 +-16 +-34 +19 +-14 +-33 +26 +-9 +-21 +26 +-6 +-17 +38 +-4 +-25 +32 +-4 +-27 +26 +-8 +-24 +25 +-10 +-23 +27 +-11 +-25 +35 +-6 +-26 +36 +-4 +-27 +41 +0 +-22 +27 +-3 +-23 +27 +-10 +-22 +31 +-1 +-26 +45 +1 +-22 +32 +-7 +-31 +23 +-9 +-25 +39 +-3 +-28 +32 +2 +-26 +29 +-3 +-22 +30 +-7 +-31 +27 +-6 +-27 +26 +-11 +-25 +32 +-8 +-28 +30 +-6 +-28 +28 +-8 +-28 +30 +-5 +-20 +44 +0 +-24 +29 +-4 +-28 +33 +-4 +-26 +29 +-7 +-24 +30 +-4 +-27 +32 +-6 +-24 +27 +-10 +-25 +30 +-6 +-21 +33 +-4 +-26 +31 +-6 +-26 +40 +-2 +-24 +31 +-2 +-23 +41 +-2 +-24 +28 +-8 +-26 +25 +-13 +-30 +30 +-8 +13 +25 +27 +32 +16 +12 +23 +21 +9 +5 +2 +19 +12 +5 +-1 +0 +8 +-1 +6 +24 +2 +0 +-7 +1 +1 +-4 +5 +2 +1 +-5 +3 +12 +-2 +11 +-2 +-3 +5 +3 +0 +-3 +3 +-2 +-8 +3 +-2 +0 +7 +-3 +-4 +11 +7 +-5 +-5 +-6 +-5 +-1 +-4 +2 +-2 +-1 +0 +-3 +-2 +-2 +1 +1 +1 +4 +-4 +14 +-1 +-2 +-2 +-2 +-2 +-2 +-2 +-1 +-1 +8 +1 +2 +1 +0 +14 +4 +2 +3 +-7 +-6 +2 +3 +-2 +-2 +2 +-2 +6 +-3 +-3 +6 +-2 +4 +1 +-3 +-2 +2 +-4 +8 +-1 +-3 +0 +1 +0 +4 +-1 +-1 +-2 +19 +2 +3 +3 +5 +3 +1 +4 +3 +-6 +-3 +-35 +9 +-25 +-47 +9 +-25 +-33 +16 +-19 +-33 +19 +-15 +-28 +38 +-5 +-29 +31 +-7 +-29 +27 +-6 +-24 +36 +-3 +-28 +30 +-10 +-32 +26 +-11 +-30 +39 +-4 +-21 +28 +-10 +-31 +43 +3 +-25 +25 +-7 +-30 +25 +-12 +-21 +28 +-8 +-28 +34 +-6 +-27 +37 +-4 +-24 +28 +-11 +-19 +32 +-7 +-20 +33 +-4 +-21 +45 +2 +-27 +34 +-6 +-27 +42 +1 +-28 +26 +-12 +-28 +30 +-6 +-27 +27 +-12 +-26 +25 +-11 +-30 +33 +-7 +-28 +33 +-4 +-27 +31 +-3 +-26 +29 +-8 +-19 +36 +-3 +-18 +43 +2 +-26 +29 +-10 +-30 +36 +-3 +-28 +31 +2 +-24 +32 +-8 +-31 +26 +-11 +-29 +30 +-1 +-21 +38 +-4 +-24 +49 +4 +-20 +29 +-10 +-28 +29 +-10 +-31 +25 +-13 +-24 +28 +-6 +-26 +32 +-4 +-18 +44 +2 +10 +20 +25 +15 +10 +10 +27 +10 +3 +6 +2 +9 +2 +5 +6 +1 +5 +1 +2 +8 +1 +13 +-1 +-2 +2 +-2 +1 +-1 +-4 +2 +10 +0 +16 +1 +-1 +5 +-4 +-2 +-4 +-7 +-4 +-5 +-3 +1 +3 +1 +-1 +4 +4 +3 +4 +6 +11 +0 +-4 +1 +-1 +-2 +0 +-2 +0 +7 +-5 +2 +-4 +-3 +2 +-3 +0 +-2 +-2 +-1 +2 +0 +5 +17 +9 +-3 +-6 +4 +0 +5 +0 +-5 +-7 +6 +0 +12 +-3 +-6 +9 +-1 +-6 +-1 +-4 +1 +-2 +1 +-2 +3 +-4 +-4 +8 +-1 +-3 +3 +5 +3 +-5 +2 +0 +0 +-1 +3 +3 +8 +12 +-3 +-2 +-4 +2 +1 +-8 +-5 +-1 +-3 +-1 +7 +-28 +23 +-14 +-39 +10 +-25 +-46 +17 +-20 +-36 +24 +-15 +-36 +22 +-14 +-30 +29 +-9 +-27 +27 +-11 +-19 +27 +-8 +-26 +29 +-3 +-27 +28 +-4 +-29 +47 +2 +-23 +43 +0 +-27 +31 +-9 +-23 +38 +-3 +-27 +24 +-9 +-30 +27 +-10 +-29 +35 +-4 +-27 +26 +-9 +-30 +33 +-6 +-27 +28 +-7 +-26 +35 +-1 +-26 +29 +-9 +-23 +29 +-9 +-27 +32 +-7 +-19 +33 +-5 +-28 +33 +-6 +-25 +28 +-8 +-12 +40 +-2 +-25 +32 +-8 +-29 +30 +-8 +-23 +28 +-9 +-28 +42 +6 +-23 +29 +-8 +-28 +28 +2 +-25 +38 +-4 +-23 +47 +3 +-26 +24 +-14 +-26 +31 +-7 +-29 +28 +-9 +-12 +30 +-9 +-30 +37 +-4 +-29 +41 +1 +-27 +35 +-6 +-28 +37 +3 +-25 +24 +-6 +-29 +23 +-4 +-26 +26 +-11 +-29 +40 +1 +18 +23 +13 +13 +13 +33 +13 +7 +9 +5 +11 +3 +0 +12 +7 +0 +8 +26 +4 +-2 +-5 +6 +-1 +0 +4 +-3 +-2 +2 +-3 +-3 +4 +3 +-4 +7 +-1 +-3 +-1 +-3 +-3 +-1 +-2 +7 +9 +-3 +6 +-2 +-2 +-3 +-2 +4 +13 +5 +2 +5 +2 +-4 +-5 +-1 +-1 +-4 +8 +9 +4 +1 +-6 +0 +-2 +-1 +10 +15 +-2 +-2 +10 +5 +-1 +-2 +-9 +-4 +1 +-6 +-5 +-3 +-4 +13 +11 +-1 +-1 +3 +10 +2 +-4 +-3 +-1 +-4 +-3 +8 +-5 +-1 +11 +10 +12 +-5 +-4 +-7 +-7 +12 +13 +2 +-4 +-4 +3 +-5 +5 +-3 +2 +5 +-6 +-8 +4 +-5 +-6 +1 +2 +1 +2 +0 +11 +-3 +6 +-26 +-49 +5 +-27 +-37 +32 +-10 +-36 +31 +-11 +-27 +16 +-19 +-39 +23 +-13 +-20 +29 +-11 +-20 +42 +2 +-23 +20 +-16 +-34 +32 +2 +-25 +28 +-10 +-29 +26 +-13 +-16 +27 +-10 +-31 +42 +0 +-27 +27 +-10 +-29 +27 +-11 +-30 +32 +-7 +-29 +31 +-8 +-28 +34 +-5 +-28 +30 +-8 +-25 +29 +-7 +-27 +42 +-1 +-17 +28 +-7 +-22 +29 +-2 +-17 +32 +-8 +-25 +28 +-10 +-26 +29 +-7 +-28 +30 +-1 +-23 +28 +-9 +-12 +36 +-5 +-26 +28 +-6 +-27 +33 +-5 +-9 +34 +-4 +-27 +31 +-9 +-21 +33 +-7 +-29 +33 +-5 +-29 +30 +-9 +-29 +32 +-3 +-28 +33 +-7 +-27 +35 +-4 +-27 +29 +-7 +-11 +33 +-5 +-26 +32 +-7 +-26 +38 +-1 +-27 +25 +-12 +-16 +32 +-8 +-28 +44 +0 +-25 +26 +-11 +-20 +18 +19 +19 +32 +21 +18 +11 +5 +20 +18 +4 +7 +3 +2 +4 +0 +1 +7 +4 +10 +2 +-1 +0 +4 +-2 +3 +2 +-3 +2 +-1 +-1 +0 +1 +17 +12 +-1 +4 +-2 +-5 +11 +6 +-5 +2 +19 +-1 +-1 +-2 +5 +-2 +-5 +-3 +7 +8 +-5 +-4 +2 +-4 +-1 +-4 +9 +7 +-5 +3 +3 +1 +6 +8 +2 +-4 +-5 +-10 +-5 +-2 +-6 +2 +-2 +5 +17 +0 +0 +0 +-3 +-3 +-4 +-6 +1 +-5 +-4 +-2 +-4 +-1 +3 +-2 +0 +0 +4 +0 +12 +0 +-2 +-2 +3 +-1 +-1 +-3 +9 +-3 +12 +14 +11 +-4 +-5 +-1 +-3 +15 +0 +0 +-6 +10 +-3 +-4 +6 +-3 +-3 +-3 +0 +-1 +0 +-34 +9 +-26 +-45 +7 +-25 +-43 +33 +-9 +-34 +21 +-13 +-36 +22 +-14 +-29 +30 +-7 +-29 +37 +3 +-13 +26 +-9 +-26 +24 +-13 +-28 +28 +-7 +-24 +32 +-8 +-17 +34 +-6 +-29 +28 +-6 +-26 +27 +-8 +-28 +27 +-8 +-11 +31 +-5 +-22 +26 +-11 +-26 +32 +-5 +-22 +32 +-7 +-23 +28 +-10 +-23 +31 +-7 +-25 +30 +-7 +-27 +35 +-5 +-17 +46 +2 +-25 +28 +-11 +-21 +31 +-8 +-28 +36 +-5 +-14 +31 +-4 +-28 +26 +-11 +-27 +32 +-8 +-24 +27 +-11 +-29 +28 +-7 +-21 +30 +-9 +-25 +32 +-1 +-18 +30 +-7 +-24 +28 +-9 +-28 +51 +5 +-22 +28 +-9 +-29 +30 +1 +-23 +27 +-10 +-30 +31 +-9 +-26 +30 +-5 +-23 +34 +-5 +-26 +33 +2 +-25 +27 +-11 +-28 +28 +-9 +-14 +35 +-4 +-26 +28 +1 +25 +23 +20 +17 +15 +14 +11 +10 +30 +10 +12 +4 +1 +21 +4 +2 +3 +-2 +2 +8 +2 +1 +-4 +-5 +-3 +-1 +-4 +0 +-3 +8 +0 +1 +12 +0 +-2 +-3 +6 +1 +3 +-5 +3 +1 +-2 +13 +3 +-2 +2 +14 +0 +-6 +-4 +1 +-4 +-3 +-1 +-3 +2 +0 +5 +-4 +-4 +2 +-4 +3 +5 +6 +0 +-1 +-4 +-4 +-3 +0 +8 +0 +7 +-2 +-4 +-1 +-1 +-1 +0 +-3 +11 +1 +15 +3 +-1 +-1 +-4 +-5 +6 +1 +-3 +0 +0 +-3 +-2 +7 +1 +1 +-3 +-1 +1 +-6 +-2 +15 +11 +-2 +-2 +-3 +-3 +0 +-3 +2 +6 +-2 +2 +0 +-6 +-3 +-1 +-1 +15 +10 +-3 +3 +14 +10 +8 +-28 +-41 +8 +-28 +-32 +14 +-20 +-40 +16 +-17 +-36 +20 +-6 +-31 +33 +-8 +-30 +24 +-13 +-30 +26 +-8 +-20 +39 +-3 +-26 +31 +-7 +-30 +30 +-6 +-29 +26 +-10 +-25 +39 +-3 +-26 +27 +-9 +-25 +26 +-9 +-28 +28 +-9 +-19 +32 +-7 +-19 +39 +-4 +-26 +41 +-1 +-21 +28 +-8 +-29 +32 +0 +-25 +26 +-11 +-27 +26 +-10 +-19 +38 +-1 +-10 +44 +0 +-27 +33 +-4 +-26 +26 +-10 +-32 +25 +-2 +-26 +30 +-9 +-31 +32 +-8 +-22 +26 +-11 +-26 +30 +-10 +-22 +32 +-5 +-23 +31 +-1 +-10 +32 +0 +-17 +45 +0 +-26 +25 +-12 +-19 +28 +-12 +-30 +22 +-13 +-32 +33 +-6 +-29 +29 +-9 +-29 +30 +5 +-22 +28 +-3 +-25 +29 +-9 +-22 +27 +-9 +-23 +29 +-6 +-24 +31 +-5 +-26 +36 +-5 +-26 +27 +30 +25 +20 +15 +14 +11 +8 +14 +26 +9 +22 +5 +1 +14 +9 +0 +0 +4 +-3 +-4 +-1 +2 +6 +-4 +5 +6 +-2 +13 +1 +3 +-4 +-4 +-1 +-6 +2 +2 +-1 +-2 +17 +1 +3 +-1 +-2 +6 +-5 +-1 +-4 +0 +-3 +10 +9 +-2 +15 +-2 +13 +-4 +-9 +12 +-2 +-5 +3 +6 +-6 +-3 +-5 +-4 +-1 +7 +1 +-7 +-3 +1 +-3 +-4 +-2 +-1 +-2 +7 +0 +5 +-2 +1 +6 +-4 +13 +11 +7 +-3 +-7 +-1 +-4 +4 +-4 +-4 +2 +-7 +-2 +-1 +3 +-1 +5 +8 +11 +-4 +-2 +1 +15 +0 +1 +0 +2 +13 +0 +-5 +15 +-2 +-2 +3 +-8 +9 +7 +-1 +-9 +-7 +-3 +-4 +-6 +8 +-28 +-41 +17 +-22 +-44 +11 +-23 +-41 +18 +-15 +-27 +39 +-4 +-32 +26 +-12 +-22 +36 +-5 +-32 +34 +-6 +-31 +22 +-13 +-32 +40 +0 +-22 +37 +-5 +-28 +27 +-12 +-26 +22 +-14 +-30 +24 +-13 +-30 +38 +-3 +-27 +36 +-3 +-25 +30 +-8 +-26 +27 +-2 +-12 +36 +-4 +-29 +33 +-6 +-26 +31 +-7 +-24 +45 +5 +-13 +36 +-5 +-28 +26 +-12 +-18 +32 +-8 +-32 +25 +-13 +-29 +27 +-9 +-29 +43 +1 +-18 +31 +-7 +-29 +28 +-10 +-25 +27 +-1 +-27 +36 +-6 +-27 +33 +-6 +-21 +29 +-10 +-30 +32 +-6 +-24 +31 +-2 +-23 +34 +-2 +-26 +32 +-8 +-26 +26 +-10 +-24 +38 +-1 +-19 +31 +-3 +-25 +32 +-5 +-24 +29 +-8 +-31 +27 +-7 +-17 +38 +-1 +-28 +26 +-12 +-28 +29 +-4 +-27 +40 +2 +-22 +21 +23 +20 +25 +19 +24 +10 +9 +10 +7 +6 +9 +2 +4 +3 +5 +0 +2 +1 +3 +6 +3 +-1 +7 +17 +16 +4 +-2 +-3 +-1 +4 +12 +15 +6 +-7 +5 +-4 +3 +-2 +-4 +-8 +-6 +-6 +-4 +5 +3 +2 +-1 +-2 +4 +-4 +-5 +5 +2 +-7 +-4 +-4 +10 +-1 +4 +-2 +-3 +2 +0 +0 +1 +0 +1 +10 +6 +4 +-5 +-6 +-4 +1 +11 +4 +-3 +-3 +-2 +0 +14 +1 +-3 +-2 +2 +3 +3 +-2 +-4 +0 +-4 +-4 +-2 +6 +-2 +10 +0 +-3 +-6 +-4 +-1 +5 +-2 +-3 +-3 +5 +1 +-2 +5 +8 +2 +-3 +0 +8 +-3 +-4 +1 +10 +1 +-4 +-1 +-2 +0 +5 +-2 +-4 +-3 +10 +-26 +-48 +13 +-23 +-40 +14 +-21 +-39 +26 +-13 +-34 +26 +-12 +-31 +32 +-8 +-28 +27 +-11 +-28 +27 +-9 +-27 +29 +1 +-17 +38 +0 +-23 +28 +-10 +-29 +26 +-10 +-24 +42 +4 +-21 +35 +-4 +-26 +44 +0 +-26 +35 +-4 +-14 +26 +-12 +-20 +34 +-8 +-32 +23 +-13 +-21 +34 +-7 +-30 +32 +-8 +-31 +28 +-8 +-29 +30 +-8 +-30 +28 +-2 +-20 +26 +-9 +-29 +33 +-7 +-27 +29 +-6 +-23 +31 +-4 +-17 +30 +-8 +-28 +37 +-3 +-13 +42 +-1 +-26 +24 +-11 +-25 +29 +-3 +-20 +27 +-11 +-28 +34 +-5 +-29 +27 +-10 +-29 +44 +1 +-23 +30 +-10 +-25 +30 +-3 +-19 +28 +-10 +-23 +27 +-10 +-27 +46 +2 +-18 +37 +-1 +-28 +26 +-13 +-31 +31 +-8 +-30 +27 +-10 +-24 +26 +2 +-24 +36 +-3 +-19 +35 +30 +37 +27 +19 +27 +18 +5 +8 +0 +-3 +14 +13 +-1 +-3 +-3 +9 +-2 +2 +7 +4 +-3 +-3 +0 +-3 +5 +-3 +-4 +5 +2 +4 +1 +9 +3 +-4 +11 +8 +-4 +-3 +-6 +-5 +4 +8 +-3 +-4 +2 +16 +1 +-4 +-2 +-2 +-8 +-4 +4 +-4 +-2 +-1 +-1 +3 +-2 +5 +-2 +1 +-3 +4 +-1 +-2 +1 +-3 +7 +2 +6 +-3 +5 +4 +2 +12 +5 +-5 +-6 +8 +17 +-2 +-1 +-4 +2 +-5 +-7 +-6 +-3 +-4 +-2 +1 +8 +0 +-1 +5 +-5 +-1 +14 +1 +-2 +-5 +-5 +-3 +-2 +6 +-1 +5 +1 +-3 +7 +-4 +-3 +-1 +5 +6 +-2 +13 +4 +0 +6 +10 +5 +-6 +1 +9 +5 +-31 +10 +-27 +-43 +6 +-28 +-33 +33 +-8 +-35 +12 +-18 +-26 +23 +-16 +-23 +22 +-15 +-34 +34 +-6 +-27 +26 +-9 +-32 +25 +-9 +-22 +31 +-6 +-28 +26 +-3 +-23 +29 +-9 +-22 +31 +-10 +-29 +33 +-1 +-21 +32 +-8 +-29 +26 +-8 +-29 +39 +4 +-23 +30 +-3 +-29 +29 +-8 +-22 +29 +-10 +-27 +42 +1 +-8 +29 +-9 +-23 +27 +-11 +-27 +36 +-3 +-26 +27 +-11 +-24 +32 +-6 +-29 +31 +-7 +-18 +30 +-8 +-24 +30 +-9 +-26 +28 +-9 +-25 +31 +-9 +-24 +31 +-6 +-21 +29 +-5 +-14 +37 +6 +-23 +28 +-8 +-25 +29 +-9 +-31 +26 +0 +-23 +34 +-5 +-18 +32 +-6 +-28 +35 +-4 +-29 +33 +4 +-23 +27 +-9 +-31 +28 +-4 +-23 +41 +0 +-27 +28 +-7 +-30 +35 +-5 +-25 +30 +-10 +-14 +34 +-5 +9 +20 +20 +23 +21 +19 +24 +24 +12 +7 +0 +8 +3 +0 +-3 +0 +4 +6 +-1 +3 +-1 +-1 +-1 +15 +9 +2 +6 +-3 +-7 +10 +5 +-4 +3 +-4 +-4 +6 +6 +-1 +-4 +0 +-4 +-4 +-4 +-2 +-1 +0 +0 +15 +-2 +4 +8 +8 +-2 +-8 +2 +-6 +-7 +13 +-1 +-4 +-2 +-3 +-2 +9 +-3 +4 +-2 +12 +5 +7 +8 +5 +-6 +8 +0 +10 +12 +10 +-7 +-8 +-8 +-4 +-6 +-3 +-7 +-8 +-1 +-4 +11 +15 +4 +11 +11 +4 +-5 +-9 +-7 +-6 +-4 +-3 +-6 +-1 +3 +1 +3 +9 +13 +-2 +-6 +1 +-7 +-6 +-1 +-3 +1 +3 +-2 +1 +3 +3 +2 +-3 +-2 +-1 +1 +11 +2 +0 +11 +-26 +-41 +11 +-21 +-42 +12 +-17 +-39 +19 +-18 +-34 +31 +-9 +-33 +38 +-4 +-24 +30 +-4 +-26 +31 +-10 +-31 +26 +-8 +-28 +27 +-9 +-29 +24 +-9 +-25 +27 +-11 +-28 +33 +-6 +-28 +31 +-4 +-12 +32 +-5 +-28 +26 +-11 +-28 +29 +-8 +-27 +31 +0 +-22 +34 +-5 +-27 +48 +3 +-21 +27 +-11 +-22 +45 +0 +-26 +27 +-11 +-22 +45 +0 +-24 +43 +2 +-27 +27 +-11 +-28 +32 +-7 +-31 +24 +-9 +-30 +41 +-2 +-25 +28 +-11 +-22 +47 +3 +-25 +35 +-7 +-23 +26 +-10 +-32 +26 +-7 +-30 +23 +-13 +-24 +34 +-7 +-26 +31 +-1 +-20 +28 +-11 +-22 +36 +-1 +-23 +30 +-5 +-21 +32 +-7 +-22 +25 +-13 +-19 +30 +-3 +-26 +29 +-10 +-29 +29 +-6 +-29 +35 +-5 +-17 +50 +5 +-22 +23 +-13 +-28 +28 +21 +32 +34 +14 +8 +8 +9 +5 +21 +5 +9 +-1 +8 +1 +11 +-1 +3 +1 +9 +-2 +-2 +3 +-3 +-3 +-1 +12 +2 +-3 +-3 +-5 +1 +13 +6 +1 +9 +1 +7 +-4 +12 +8 +13 +-1 +8 +-2 +-2 +-7 +5 +-2 +5 +-5 +-6 +-5 +-3 +-5 +-6 +-5 +-4 +-2 +-1 +-5 +-1 +2 +3 +6 +1 +0 +-4 +-4 +9 +1 +5 +-1 +5 +-6 +-1 +-3 +9 +2 +-5 +-1 +9 +8 +17 +0 +2 +-3 +10 +11 +7 +9 +-6 +-7 +-10 +-5 +-6 +-1 +-6 +10 +0 +7 +-5 +-4 +-2 +9 +-5 +-5 +-2 +3 +-1 +1 +16 +-2 +-1 +-2 +1 +-7 +-2 +11 +7 +-3 +0 +0 +-3 +-7 +0 +0 +-2 +13 +-25 +-48 +7 +-28 +-46 +12 +-19 +-34 +32 +-10 +-34 +19 +-16 +-34 +23 +-13 +-29 +28 +-11 +-30 +38 +-4 +-26 +31 +-8 +-29 +26 +-9 +-26 +35 +-6 +-24 +30 +-9 +-25 +31 +-6 +-27 +46 +2 +-24 +42 +-1 +-27 +41 +2 +-19 +22 +-14 +-34 +35 +-4 +-28 +24 +-11 +-24 +25 +-12 +-28 +34 +-2 +-25 +29 +-4 +-21 +32 +-7 +-27 +27 +-9 +-29 +34 +-3 +-27 +30 +-7 +-22 +44 +6 +-18 +27 +-10 +-30 +47 +3 +-22 +43 +-1 +-29 +25 +-12 +-26 +28 +-7 +-31 +25 +-11 +-27 +27 +-9 +-19 +30 +-6 +-27 +28 +3 +-23 +30 +-8 +-21 +43 +-1 +-27 +26 +-6 +-26 +31 +-9 +-26 +26 +-9 +-27 +25 +-12 +-29 +30 +-4 +-27 +41 +0 +-24 +39 +0 +-12 +38 +-2 +-25 +37 +0 +-29 +25 +-11 +-31 +21 +21 +18 +19 +19 +13 +15 +8 +16 +14 +10 +5 +3 +17 +4 +2 +3 +4 +8 +10 +-1 +3 +-4 +7 +2 +8 +1 +-3 +1 +-4 +11 +15 +14 +5 +-8 +-8 +-3 +-5 +-4 +-5 +2 +5 +-2 +-3 +-3 +-4 +-6 +-3 +-1 +4 +5 +1 +16 +1 +-3 +-3 +-3 +3 +-5 +8 +3 +-5 +-4 +-2 +-2 +12 +7 +-1 +2 +5 +-1 +6 +2 +-4 +-1 +-4 +-2 +-1 +1 +-4 +3 +1 +3 +2 +7 +8 +-5 +-3 +0 +-4 +2 +-5 +-4 +-1 +-3 +-3 +-1 +6 +6 +-1 +2 +8 +16 +5 +-6 +5 +-3 +-4 +-6 +-4 +3 +3 +9 +-1 +-4 +-2 +-3 +9 +-1 +-4 +11 +1 +3 +-4 +-6 +-2 +0 +-4 +13 +-23 +-46 +21 +-18 +-42 +17 +-19 +-41 +21 +-17 +-37 +35 +-6 +-32 +21 +-16 +-30 +20 +-14 +-28 +24 +-13 +-27 +29 +-5 +-26 +38 +-3 +-8 +32 +-8 +-26 +32 +-8 +-26 +26 +-10 +-22 +32 +-8 +-27 +37 +-4 +-27 +30 +-8 +-28 +32 +-7 +-26 +28 +-10 +-23 +38 +4 +-23 +30 +-8 +-30 +36 +-4 +-27 +27 +-4 +-25 +38 +-3 +-27 +32 +-7 +-28 +33 +-6 +-27 +29 +-8 +-27 +38 +-2 +-22 +33 +-6 +-19 +43 +0 +-25 +25 +-12 +-31 +30 +-6 +-29 +40 +-3 +-24 +35 +-3 +-28 +28 +-2 +-19 +25 +-11 +-28 +35 +0 +-25 +28 +-9 +-30 +27 +-11 +-29 +33 +-6 +-27 +28 +-10 +-14 +35 +-3 +-15 +30 +-9 +-27 +25 +-9 +-29 +27 +-7 +-25 +34 +-2 +-25 +37 +-3 +-26 +33 +-5 +-25 +35 +-6 +-18 +28 +22 +21 +31 +17 +16 +14 +14 +6 +7 +12 +4 +14 +4 +14 +2 +0 +4 +-1 +8 +-2 +7 +7 +-1 +3 +-2 +-2 +-2 +-3 +1 +4 +2 +4 +2 +8 +-2 +9 +6 +19 +1 +-6 +-7 +2 +-2 +-5 +-1 +-4 +0 +-2 +-2 +15 +2 +-2 +-4 +6 +0 +-2 +0 +6 +-1 +6 +-2 +-2 +-3 +-1 +1 +-1 +-3 +0 +8 +12 +2 +-4 +-2 +-6 +-3 +3 +-2 +2 +0 +14 +2 +-4 +2 +13 +-1 +-6 +-5 +-6 +1 +-4 +2 +3 +2 +-6 +1 +15 +7 +-4 +1 +-2 +-5 +-1 +-4 +6 +-3 +-4 +-4 +-4 +-2 +-1 +1 +3 +14 +2 +-2 +-3 +-3 +3 +3 +-3 +-2 +0 +16 +0 +-4 +1 +9 +12 +-25 +-49 +6 +-29 +-45 +20 +-15 +-37 +26 +-12 +-35 +22 +-13 +-32 +29 +-8 +-27 +32 +-5 +-27 +33 +-7 +-23 +25 +-12 +-32 +27 +-9 +-16 +29 +-9 +-30 +29 +-8 +-27 +30 +-7 +-28 +29 +-1 +-25 +34 +-2 +-20 +40 +-3 +-27 +27 +-7 +-30 +38 +-4 +-18 +32 +-7 +-25 +30 +-9 +-29 +47 +3 +-24 +29 +-9 +-23 +29 +-9 +-31 +32 +-7 +-26 +29 +-9 +-28 +29 +-7 +-23 +30 +-5 +-28 +29 +-9 +-27 +31 +-1 +-21 +30 +-4 +-26 +48 +4 +-16 +28 +-11 +-26 +27 +-8 +-29 +31 +-8 +-23 +45 +1 +-23 +29 +-5 +-27 +25 +-2 +-13 +35 +-7 +-22 +27 +-2 +-27 +29 +-9 +-31 +32 +-7 +-22 +38 +3 +-25 +24 +-11 +-25 +32 +-8 +-23 +29 +-8 +-29 +27 +-10 +-15 +32 +-7 +-13 +29 +-10 +-21 +19 +33 +27 +22 +29 +13 +9 +12 +15 +2 +7 +2 +6 +5 +3 +1 +3 +2 +3 +14 +6 +1 +2 +0 +2 +7 +16 +12 +0 +2 +-5 +-3 +-1 +-3 +1 +4 +-2 +1 +3 +-6 +-1 +-5 +5 +1 +-1 +1 +1 +1 +10 +-3 +-4 +-1 +-8 +0 +-1 +-5 +2 +1 +-3 +0 +1 +0 +1 +4 +9 +-2 +1 +-2 +10 +2 +-4 +-2 +-4 +-4 +6 +14 +1 +-1 +1 +4 +0 +-5 +-4 +-2 +3 +-1 +-3 +2 +-4 +10 +-3 +-3 +5 +-1 +-3 +-1 +0 +0 +-3 +-2 +6 +-3 +4 +4 +-1 +4 +5 +4 +-4 +-3 +0 +0 +5 +-3 +-4 +-3 +-2 +7 +9 +9 +-4 +8 +18 +2 +7 +1 +11 +-4 +4 +-31 +-49 +7 +-29 +-45 +7 +-25 +-42 +19 +-17 +-26 +24 +-11 +-27 +25 +-6 +-28 +26 +-10 +-18 +34 +-6 +-28 +36 +-3 +-19 +26 +-10 +-23 +29 +-9 +-26 +35 +-7 +-26 +28 +-9 +-30 +30 +-3 +-18 +30 +-8 +-22 +28 +-11 +-26 +26 +-2 +-23 +28 +-7 +-28 +34 +-3 +-28 +41 +1 +-26 +30 +-7 +-29 +32 +-4 +-24 +30 +-5 +-20 +29 +-8 +-24 +35 +-5 +-29 +29 +-6 +-15 +29 +0 +-24 +38 +-4 +-22 +25 +-12 +-32 +43 +3 +-25 +28 +-7 +-19 +32 +-8 +-22 +38 +-3 +-28 +30 +-6 +-27 +25 +-1 +-27 +31 +-9 +-26 +30 +-4 +-14 +29 +-8 +-29 +40 +-1 +-25 +38 +-4 +-18 +39 +-2 +-30 +22 +-13 +-31 +41 +2 +-27 +25 +-12 +-27 +42 +3 +-24 +24 +-9 +-22 +24 +-13 +-29 +25 +-8 +-19 +32 +34 +19 +16 +24 +16 +11 +8 +16 +6 +4 +5 +4 +5 +7 +7 +2 +1 +3 +5 +5 +7 +3 +-1 +10 +7 +-3 +-4 +-1 +-2 +-4 +-3 +5 +3 +8 +2 +-3 +-2 +1 +-3 +4 +-3 +-3 +-2 +-1 +2 +3 +4 +3 +8 +11 +-2 +0 +-4 +11 +7 +11 +1 +-5 +-2 +-3 +5 +-5 +-1 +-6 +-4 +0 +6 +-3 +-4 +0 +3 +-3 +2 +-1 +-2 +1 +1 +-4 +1 +2 +0 +3 +8 +-1 +-2 +-4 +14 +-1 +3 +3 +-2 +7 +8 +-2 +-6 +-5 +3 +-2 +-5 +7 +16 +7 +5 +-5 +-5 +-1 +-2 +-6 +10 +8 +1 +11 +1 +-5 +-5 +-6 +3 +-7 +-5 +-4 +3 +-6 +-5 +3 +0 +2 +-2 +24 +-16 +-45 +7 +-29 +-44 +11 +-22 +-36 +15 +-19 +-18 +25 +-14 +-35 +22 +-14 +-27 +47 +3 +-27 +38 +-4 +-30 +30 +-7 +-30 +36 +-6 +-25 +23 +-13 +-32 +46 +1 +-27 +24 +-12 +-25 +26 +-4 +-20 +29 +-3 +-14 +35 +-7 +-22 +27 +-9 +-30 +26 +-7 +-29 +36 +-3 +-26 +32 +-9 +-30 +25 +-11 +-30 +29 +-8 +-23 +31 +-5 +-25 +42 +-1 +-21 +32 +-8 +-28 +33 +-8 +-29 +28 +-9 +-29 +34 +0 +-25 +42 +0 +-17 +35 +-5 +-29 +26 +-11 +-18 +36 +2 +-22 +24 +-11 +-31 +27 +-10 +-28 +30 +-8 +-28 +30 +-9 +-28 +34 +4 +-14 +38 +-4 +-25 +26 +-7 +-23 +29 +-10 +-29 +28 +-5 +-26 +29 +-7 +-14 +36 +-5 +-19 +33 +-8 +-25 +45 +2 +-26 +29 +-10 +-27 +25 +-6 +-21 +34 +-6 +-26 +22 +25 +33 +21 +18 +13 +26 +11 +20 +23 +15 +0 +-3 +7 +1 +-4 +-1 +1 +10 +18 +0 +4 +-5 +11 +15 +-2 +0 +-8 +-7 +-5 +-2 +-6 +5 +-1 +6 +-2 +-6 +-3 +10 +-1 +-2 +-2 +-2 +10 +-2 +0 +0 +-1 +6 +-1 +-3 +-3 +-3 +2 +-2 +0 +9 +1 +-1 +10 +1 +-3 +-2 +-5 +-4 +-1 +-3 +5 +1 +5 +-1 +1 +-1 +-1 +13 +22 +1 +-4 +-9 +-3 +-4 +1 +-1 +3 +0 +2 +4 +16 +9 +0 +-1 +-5 +-4 +-3 +-3 +3 +5 +-1 +-2 +1 +4 +-3 +5 +-1 +-5 +1 +2 +0 +2 +2 +-4 +-1 +-3 +11 +14 +2 +-5 +-5 +-4 +-3 +-4 +2 +2 +11 +10 +0 +-8 +-5 +7 +-29 +-48 +18 +-20 +-29 +14 +-22 +-41 +14 +-18 +-37 +28 +-11 +-31 +31 +-9 +-23 +26 +-12 +-31 +37 +-5 +-29 +29 +-10 +-29 +38 +1 +-13 +27 +-7 +-30 +25 +-12 +-30 +30 +-7 +-28 +42 +1 +-24 +33 +-6 +-30 +47 +2 +-21 +42 +-1 +-13 +27 +-13 +-31 +23 +-12 +-33 +37 +-3 +-16 +42 +0 +-29 +23 +-11 +-32 +30 +-7 +-30 +25 +-9 +-26 +33 +-2 +-27 +38 +-4 +-27 +30 +-7 +-30 +28 +-10 +-27 +29 +-9 +-28 +39 +-1 +-18 +31 +-6 +-29 +28 +-2 +-21 +35 +-5 +-26 +26 +-7 +-28 +26 +-3 +-18 +32 +-6 +-18 +28 +-5 +-16 +30 +-10 +-27 +29 +-1 +-27 +33 +-7 +-29 +28 +-9 +-21 +32 +-8 +-28 +30 +-7 +-26 +46 +2 +-23 +34 +-6 +-21 +39 +0 +-27 +27 +-9 +-29 +30 +-10 +-29 +22 +40 +32 +17 +11 +8 +20 +10 +7 +7 +5 +5 +13 +11 +2 +2 +5 +1 +-1 +0 +15 +8 +14 +5 +-4 +-2 +-4 +-1 +2 +-3 +-3 +6 +10 +-2 +-4 +-1 +-2 +4 +-1 +0 +9 +-2 +-1 +1 +5 +-1 +-2 +2 +0 +-6 +-6 +-1 +5 +17 +2 +-2 +5 +5 +-1 +-2 +-3 +-4 +-3 +-1 +0 +-1 +8 +15 +8 +-5 +2 +-5 +-3 +-4 +9 +11 +0 +-4 +-4 +-6 +1 +1 +-5 +-3 +4 +16 +0 +0 +3 +-6 +-1 +9 +-4 +-5 +-4 +-4 +-1 +3 +9 +-2 +1 +-4 +-2 +16 +0 +-2 +-1 +-6 +-5 +-3 +-2 +2 +4 +5 +19 +1 +-3 +2 +-2 +-2 +-5 +9 +2 +4 +-4 +13 +0 +-4 +12 +-25 +-48 +5 +-28 +-46 +11 +-23 +-40 +23 +-13 +-33 +25 +-13 +-26 +33 +-6 +-30 +23 +-13 +-31 +29 +-8 +-29 +28 +-9 +-29 +31 +-6 +-20 +39 +-2 +-17 +28 +-8 +-14 +33 +-6 +-30 +33 +-7 +-29 +32 +-7 +-24 +28 +-8 +-25 +27 +-9 +-29 +34 +-4 +-27 +30 +-7 +-28 +47 +3 +-24 +28 +-9 +-31 +28 +-10 +-25 +32 +-6 +-22 +30 +-9 +-28 +28 +-9 +-28 +37 +-2 +-19 +32 +3 +-23 +31 +-7 +-23 +30 +-2 +-26 +28 +-9 +-22 +30 +-4 +-28 +32 +-5 +-26 +40 +-1 +-25 +29 +-2 +-24 +29 +-7 +-26 +41 +-3 +-22 +33 +-7 +-21 +31 +-9 +-20 +27 +-9 +-30 +28 +-8 +-18 +30 +-1 +-26 +28 +-7 +-26 +32 +-7 +-28 +34 +-6 +-23 +37 +-2 +-8 +34 +-7 +-15 +37 +-4 +-30 +32 +-9 +-25 +20 +17 +17 +31 +18 +11 +11 +9 +6 +11 +7 +7 +4 +7 +3 +10 +8 +3 +5 +11 +8 +-1 +5 +2 +-7 +-1 +-4 +4 +13 +0 +9 +15 +15 +-4 +-4 +-7 +-6 +-5 +-5 +7 +-4 +2 +1 +-1 +14 +1 +-4 +11 +-5 +-3 +-4 +-6 +-5 +2 +11 +9 +-2 +-5 +-1 +-4 +4 +-4 +0 +11 +9 +0 +-4 +3 +9 +5 +-1 +-6 +4 +-3 +-7 +-4 +0 +-7 +10 +2 +-4 +-4 +-1 +15 +-1 +-4 +5 +1 +0 +3 +-4 +-6 +-7 +0 +3 +-2 +6 +11 +0 +-5 +-2 +1 +-3 +7 +-4 +-2 +-1 +0 +-3 +-1 +11 +-1 +-3 +4 +-1 +-1 +-1 +1 +0 +4 +-3 +4 +-5 +-5 +-3 +1 +-5 +-3 +11 +-25 +-36 +19 +-18 +-37 +15 +-17 +-38 +29 +-9 +-30 +37 +-5 +-33 +23 +-15 +-32 +28 +-11 +-33 +25 +-13 +-29 +29 +-10 +-21 +27 +-11 +-28 +35 +-5 +-29 +30 +-8 +-27 +32 +-1 +-19 +29 +-1 +-12 +29 +-10 +-30 +31 +-6 +-14 +30 +-9 +-30 +36 +-6 +-25 +29 +-8 +-29 +28 +-10 +-25 +38 +-1 +-25 +35 +-1 +-24 +34 +-6 +-29 +30 +-4 +-23 +25 +-11 +-28 +35 +0 +-16 +46 +2 +-23 +29 +-11 +-32 +24 +-9 +-28 +45 +2 +-24 +28 +-8 +-26 +29 +-10 +-21 +24 +-11 +-27 +31 +-4 +-24 +27 +-8 +-17 +30 +-4 +-12 +30 +-9 +-30 +29 +-7 +-28 +30 +-8 +-15 +43 +-1 +-26 +33 +-6 +-30 +37 +-5 +-19 +34 +-6 +-28 +25 +-13 +-29 +29 +-9 +-27 +32 +-8 +-27 +44 +4 +-21 +29 +-10 +-29 +19 +19 +25 +35 +25 +15 +16 +13 +7 +10 +5 +3 +2 +2 +5 +4 +-2 +-2 +5 +4 +5 +1 +-1 +1 +10 +2 +-3 +-1 +-1 +1 +1 +5 +2 +1 +1 +-1 +-2 +9 +-2 +2 +-1 +1 +3 +6 +4 +1 +20 +1 +-6 +1 +-5 +-4 +4 +5 +-1 +2 +0 +-3 +-3 +8 +8 +10 +-3 +-6 +-1 +1 +-4 +-2 +-2 +-5 +2 +-2 +0 +-2 +-2 +9 +-3 +1 +-2 +1 +-2 +-2 +-1 +-1 +13 +11 +1 +4 +-4 +5 +0 +-5 +-6 +1 +-1 +-3 +12 +2 +-3 +1 +-4 +-1 +-2 +-4 +3 +13 +1 +0 +-2 +4 +6 +-4 +-4 +1 +0 +-4 +1 +2 +-4 +-3 +2 +-2 +15 +1 +0 +-2 +0 +19 +-21 +14 +-23 +-40 +22 +-13 +-32 +23 +-17 +-40 +16 +-20 +-32 +27 +-10 +-34 +18 +-17 +-28 +25 +-9 +-18 +24 +-13 +-29 +25 +-7 +-29 +31 +-8 +-27 +25 +-11 +-25 +36 +1 +-24 +42 +0 +-26 +26 +-10 +-28 +32 +-8 +-29 +43 +8 +-22 +30 +-10 +-23 +26 +-2 +-21 +43 +-1 +-28 +29 +-9 +-33 +30 +-3 +-22 +25 +-9 +-25 +31 +-9 +-30 +28 +-9 +-29 +29 +-8 +-13 +35 +-5 +-26 +46 +5 +-24 +24 +-11 +-16 +30 +-8 +-27 +41 +1 +-27 +28 +-6 +-28 +25 +-11 +-30 +31 +-8 +-29 +47 +3 +-25 +29 +-10 +-30 +29 +-8 +-30 +29 +-9 +-19 +33 +-6 +-15 +33 +-7 +-24 +28 +-10 +-23 +29 +-10 +-27 +28 +-6 +-27 +31 +-5 +-26 +46 +3 +-24 +38 +-5 +-27 +29 +-9 +-29 +41 +-2 +-25 +30 +1 +13 +21 +18 +22 +28 +14 +16 +6 +9 +9 +8 +13 +3 +0 +0 +10 +-1 +9 +3 +4 +-3 +1 +-2 +-3 +11 +10 +-1 +0 +3 +11 +-4 +-3 +6 +-2 +4 +-5 +-5 +-2 +-5 +1 +-2 +-2 +-1 +0 +-4 +-1 +-2 +0 +5 +7 +0 +5 +-3 +1 +-3 +1 +-1 +2 +-2 +-3 +11 +21 +1 +12 +7 +-6 +-4 +-2 +-6 +-5 +-3 +2 +-6 +-5 +-4 +-3 +1 +6 +2 +14 +11 +11 +7 +-1 +-8 +-2 +-1 +-4 +3 +-2 +-3 +-5 +1 +-3 +0 +-1 +5 +-3 +0 +-2 +0 +3 +-2 +-2 +-2 +2 +5 +1 +-2 +1 +3 +8 +-2 +12 +2 +-2 +4 +-3 +-6 +2 +8 +10 +-4 +-1 +0 +-5 +-3 +0 +13 +-23 +-48 +6 +-18 +-41 +17 +-19 +-37 +18 +-18 +-32 +37 +-5 +-31 +24 +-13 +-32 +24 +-13 +-32 +32 +-9 +-15 +33 +0 +-26 +28 +-10 +-29 +24 +-12 +-29 +32 +-6 +-27 +38 +-1 +-25 +32 +-8 +-26 +31 +-5 +-23 +30 +-8 +-27 +32 +-6 +-13 +33 +-7 +-26 +26 +-9 +-28 +29 +-3 +-24 +35 +-3 +-27 +31 +-3 +-25 +30 +-5 +-17 +40 +-2 +-23 +31 +-6 +-23 +26 +-10 +-23 +25 +-9 +-25 +40 +-3 +-27 +41 +-1 +-29 +33 +-7 +-27 +27 +-10 +-21 +39 +-3 +-22 +26 +-7 +-30 +25 +-10 +-19 +37 +-4 +-26 +34 +-3 +-23 +43 +9 +-23 +32 +-7 +-17 +28 +-6 +-23 +31 +-10 +-28 +23 +-13 +-30 +26 +-10 +-30 +26 +-10 +-28 +36 +-3 +-27 +26 +-10 +-25 +32 +-7 +-8 +32 +-6 +-28 +31 +-9 +-11 +24 +31 +28 +17 +23 +14 +23 +17 +10 +13 +4 +17 +7 +-1 +2 +4 +-3 +6 +-1 +5 +4 +-3 +-2 +3 +-4 +-2 +4 +5 +8 +-1 +-3 +0 +13 +0 +0 +6 +9 +-4 +-4 +5 +-5 +-3 +-1 +-2 +1 +6 +-1 +-1 +-5 +-3 +-5 +-5 +-4 +-1 +3 +10 +3 +2 +5 +-4 +3 +2 +1 +-1 +11 +13 +7 +-5 +-8 +-1 +-3 +-6 +-4 +0 +7 +-4 +0 +0 +-4 +15 +3 +0 +5 +17 +-1 +2 +-3 +-6 +-4 +-5 +-6 +-5 +-5 +0 +2 +-1 +-1 +-2 +0 +6 +-1 +13 +0 +12 +4 +10 +0 +-1 +-1 +-5 +-3 +0 +-5 +-7 +-1 +1 +1 +-3 +0 +1 +0 +1 +-2 +1 +-1 +-1 +1 +-4 +11 +-20 +-45 +18 +-20 +-43 +12 +-20 +-41 +17 +-14 +-33 +22 +-12 +-32 +31 +-9 +-27 +37 +-2 +-19 +26 +-13 +-32 +29 +-9 +-27 +26 +-8 +-25 +29 +-6 +-25 +26 +-9 +-17 +33 +-6 +-17 +28 +-8 +-18 +35 +3 +-15 +43 +-1 +-27 +25 +-12 +-28 +28 +-11 +-30 +32 +-5 +-29 +32 +-7 +-28 +46 +2 +-26 +37 +-4 +-29 +25 +-11 +-26 +37 +-5 +-28 +27 +1 +-25 +29 +-8 +-28 +35 +-4 +-26 +28 +-1 +-25 +28 +-6 +-25 +45 +1 +-25 +32 +-8 +-27 +34 +-6 +-28 +26 +-11 +-31 +26 +-7 +-18 +32 +0 +-18 +27 +-11 +-27 +38 +-3 +-28 +26 +-12 +-23 +28 +-2 +-26 +31 +-7 +-27 +42 +3 +-24 +29 +-4 +-24 +28 +-10 +-29 +31 +-4 +-26 +26 +-5 +-27 +40 +-3 +-17 +35 +-4 +-17 +30 +-7 +-22 +16 +20 +23 +16 +24 +13 +17 +8 +9 +25 +8 +4 +6 +6 +6 +1 +0 +-4 +11 +4 +-1 +0 +-2 +-1 +0 +8 +5 +6 +9 +-2 +15 +5 +-4 +1 +3 +-1 +-2 +13 +-2 +-3 +-6 +1 +13 +1 +11 +9 +5 +-4 +-8 +-6 +0 +-6 +5 +-4 +-7 +-5 +0 +-3 +2 +4 +-4 +-4 +-3 +-2 +1 +4 +0 +1 +0 +0 +-1 +-2 +-5 +8 +0 +3 +4 +15 +-2 +-3 +-4 +-4 +-4 +0 +-2 +1 +4 +0 +7 +-1 +5 +3 +-3 +-2 +2 +5 +0 +-2 +-5 +-3 +-3 +-2 +1 +-1 +2 +7 +-5 +12 +19 +1 +0 +-7 +-4 +2 +0 +2 +12 +-2 +-4 +6 +-1 +5 +0 +-5 +-6 +-5 +12 +7 +-29 +14 +-25 +-46 +6 +-22 +-41 +13 +-16 +-37 +33 +-7 +-33 +36 +-6 +-26 +33 +-8 +-33 +26 +-12 +-29 +24 +-13 +-26 +46 +1 +-27 +37 +-4 +-30 +32 +-6 +-21 +22 +-12 +-27 +27 +-9 +-16 +30 +-10 +-32 +27 +-11 +-30 +34 +-6 +-26 +27 +-9 +-24 +32 +-6 +-24 +30 +-8 +-28 +38 +-2 +-27 +31 +-7 +-28 +37 +-3 +-28 +27 +-10 +-26 +30 +-7 +-28 +29 +-6 +-25 +28 +-6 +-27 +33 +-5 +-27 +32 +-6 +-15 +35 +-6 +-27 +30 +5 +-23 +39 +-3 +-19 +27 +-9 +-26 +30 +-9 +-28 +27 +-9 +-26 +32 +-7 +-27 +29 +-7 +-27 +34 +-6 +-12 +40 +-1 +-22 +32 +-7 +-28 +28 +-9 +-24 +28 +-9 +-23 +31 +-5 +-10 +33 +-7 +-27 +33 +1 +-20 +31 +-8 +-29 +32 +-7 +-25 +29 +-5 +-27 +30 +-8 +16 +40 +23 +15 +13 +24 +18 +6 +13 +14 +5 +15 +22 +6 +7 +-4 +-3 +1 +-1 +-2 +2 +4 +7 +-5 +-3 +-1 +0 +-1 +8 +1 +-5 +-2 +11 +15 +1 +5 +-5 +-2 +3 +-3 +-6 +0 +-6 +13 +4 +3 +-2 +-2 +-4 +7 +-1 +6 +-4 +-2 +-7 +-2 +3 +-3 +-4 +17 +1 +-5 +11 +1 +2 +-1 +4 +-4 +-3 +8 +12 +1 +1 +-1 +-5 +5 +-2 +-4 +-3 +0 +-4 +-1 +6 +-2 +-1 +-5 +-4 +-2 +5 +10 +11 +10 +-6 +-5 +8 +-2 +-6 +-6 +3 +-4 +2 +-2 +-1 +6 +6 +-3 +-6 +7 +6 +0 +3 +0 +4 +0 +-7 +1 +-6 +1 +2 +-5 +-2 +8 +5 +15 +13 +0 +-4 +-5 +8 +-28 +-50 +8 +-23 +-41 +14 +-22 +-42 +19 +-4 +-30 +20 +-8 +-22 +29 +-9 +-31 +31 +-7 +-32 +25 +-12 +-32 +25 +-9 +-29 +34 +-5 +-14 +29 +-7 +-27 +49 +3 +-24 +41 +-2 +-26 +33 +-8 +-29 +25 +-3 +-29 +23 +-12 +-31 +29 +-7 +-29 +45 +0 +-26 +30 +-9 +-29 +34 +-2 +-22 +26 +-12 +-26 +29 +-9 +-20 +30 +-7 +-26 +28 +-10 +-23 +42 +-1 +-26 +34 +-6 +-11 +28 +-10 +-26 +30 +-10 +-29 +44 +1 +-23 +45 +0 +-27 +40 +-2 +-30 +25 +-5 +-29 +21 +-15 +-31 +25 +-7 +-21 +33 +-5 +-27 +42 +1 +-19 +29 +-6 +-30 +37 +-6 +-29 +23 +-13 +-29 +32 +-7 +-21 +28 +-9 +-26 +27 +-2 +-12 +44 +0 +-25 +32 +-6 +-12 +30 +-7 +-30 +37 +-3 +-26 +25 +-10 +-29 +26 +-9 +-30 +20 +25 +20 +18 +15 +18 +26 +20 +7 +13 +9 +0 +3 +7 +10 +2 +16 +5 +-1 +-2 +14 +3 +6 +-3 +2 +-4 +-5 +-1 +0 +-4 +0 +-3 +3 +14 +7 +-3 +12 +4 +-7 +-1 +-5 +5 +1 +12 +1 +-5 +-6 +3 +-2 +0 +6 +1 +-1 +-3 +-3 +13 +0 +-5 +2 +-3 +-5 +-3 +0 +-5 +-2 +15 +3 +-3 +-5 +-2 +4 +0 +10 +-2 +-4 +12 +12 +1 +0 +-3 +-4 +1 +-4 +-3 +11 +1 +6 +-1 +-3 +-1 +-3 +16 +-1 +-4 +-1 +1 +1 +3 +0 +-2 +-6 +-1 +1 +-1 +-3 +4 +-3 +-3 +-4 +4 +-2 +1 +2 +-3 +-1 +-2 +-1 +4 +0 +0 +20 +3 +5 +-4 +11 +0 +-3 +-4 +10 +-23 +-41 +15 +-24 +-45 +11 +-23 +-42 +23 +-16 +-31 +26 +-10 +-32 +22 +-15 +-25 +23 +-12 +-28 +40 +-2 +-20 +26 +-5 +-23 +25 +-13 +-28 +25 +-11 +-18 +48 +3 +-23 +27 +-11 +-29 +27 +-9 +-29 +26 +-9 +-29 +44 +2 +-16 +27 +-8 +-30 +29 +-8 +-28 +31 +-8 +-27 +34 +-7 +-23 +28 +-8 +-28 +33 +-5 +-18 +32 +-7 +-27 +30 +2 +-25 +40 +-2 +-27 +28 +-10 +-29 +27 +-9 +-28 +30 +-6 +-26 +32 +1 +-12 +30 +-10 +-27 +36 +-4 +-23 +33 +-7 +-24 +29 +-9 +-29 +36 +-4 +-13 +33 +-5 +-26 +41 +0 +-25 +27 +-11 +-30 +29 +-4 +-26 +28 +-6 +-16 +35 +-6 +-29 +33 +-6 +-19 +40 +-3 +-26 +33 +-6 +-28 +32 +-5 +-29 +30 +-9 +-27 +34 +-7 +-27 +30 +-9 +-22 +32 +-9 +-26 +29 +25 +30 +18 +14 +13 +14 +17 +11 +5 +5 +6 +4 +4 +7 +4 +3 +4 +4 +9 +0 +1 +0 +4 +11 +14 +0 +0 +4 +4 +-4 +-4 +10 +11 +1 +7 +-3 +7 +-4 +14 +-2 +1 +-1 +1 +-6 +-4 +0 +-3 +-5 +0 +7 +-5 +-7 +7 +2 +-3 +10 +0 +11 +-1 +-3 +-4 +0 +0 +5 +6 +-6 +-2 +-7 +-3 +-4 +-3 +-4 +9 +11 +-3 +-5 +-4 +-4 +-4 +-2 +1 +0 +-2 +-1 +16 +0 +-2 +4 +14 +5 +-5 +-2 +1 +-4 +-3 +-2 +-2 +-4 +6 +-1 +2 +2 +-2 +-4 +-2 +5 +-1 +12 +1 +-3 +2 +0 +-1 +0 +11 +-3 +-3 +-5 +0 +3 +4 +-5 +4 +-2 +9 +0 +12 +25 +-16 +-37 +6 +-29 +-43 +11 +-24 +-43 +18 +-17 +-37 +35 +-2 +-31 +23 +-12 +-30 +21 +-15 +-29 +29 +-10 +-22 +29 +-9 +-15 +40 +-3 +-27 +32 +-4 +-29 +26 +-10 +-30 +23 +-12 +-24 +37 +-5 +-15 +32 +-8 +-28 +30 +-2 +-26 +32 +-6 +-27 +45 +0 +-15 +33 +1 +-26 +39 +-4 +-29 +32 +-7 +-26 +34 +-7 +-23 +24 +-12 +-31 +30 +-7 +-24 +39 +-3 +-16 +30 +-10 +-23 +26 +-10 +-30 +27 +-10 +-24 +38 +-3 +-28 +41 +-2 +-14 +26 +-11 +-29 +30 +-9 +-22 +30 +-8 +-27 +26 +-1 +-24 +30 +-2 +-19 +35 +-7 +-27 +40 +-2 +-29 +26 +-11 +-30 +25 +-11 +-30 +41 +-2 +-27 +26 +-9 +-25 +35 +-6 +-27 +34 +3 +-11 +29 +-7 +-26 +27 +-1 +-15 +32 +-8 +-28 +26 +-4 +-19 +30 +-8 +-21 +19 +19 +26 +19 +17 +12 +10 +18 +18 +26 +8 +13 +9 +-1 +3 +-2 +-2 +-1 +19 +2 +1 +9 +-1 +7 +-1 +-2 +-7 +0 +3 +-3 +-5 +2 +1 +-2 +2 +-1 +-4 +10 +-3 +-3 +-2 +-2 +-5 +6 +15 +7 +-3 +1 +13 +3 +2 +3 +-3 +9 +9 +-4 +2 +-1 +-5 +1 +12 +-2 +-5 +1 +-7 +-2 +-1 +-5 +-3 +2 +-7 +-1 +1 +-4 +-2 +-3 +1 +15 +3 +1 +-5 +-1 +-5 +-2 +0 +2 +-3 +5 +9 +2 +-3 +-4 +-3 +-1 +-4 +-1 +5 +17 +1 +-3 +5 +15 +2 +-1 +4 +-3 +-1 +-3 +-6 +14 +4 +14 +-1 +-6 +2 +-5 +1 +-2 +-7 +-1 +-1 +1 +-5 +-2 +-5 +-2 +-2 +10 +-24 +20 +-19 +-44 +9 +-25 +-40 +23 +-16 +-32 +24 +-14 +-36 +24 +-13 +-33 +26 +-5 +-22 +33 +-5 +-25 +23 +-11 +-32 +26 +-7 +-19 +38 +-3 +-24 +27 +-10 +-31 +34 +-2 +-25 +27 +-10 +-24 +25 +-10 +-28 +31 +-2 +-20 +34 +-5 +-28 +43 +1 +-26 +25 +-11 +-17 +39 +-4 +-20 +25 +-10 +-29 +27 +-10 +-16 +41 +-1 +-28 +43 +-1 +-27 +24 +-4 +-13 +27 +-12 +-27 +24 +-10 +-23 +26 +-10 +-30 +32 +-7 +-24 +32 +-4 +-27 +44 +1 +-19 +33 +-8 +-28 +35 +-2 +-28 +29 +-10 +-17 +30 +-8 +-28 +35 +-6 +-29 +27 +-7 +-30 +27 +-11 +-27 +29 +-9 +-28 +32 +-5 +-26 +26 +-5 +-12 +42 +5 +-15 +31 +-7 +-31 +29 +-7 +-29 +37 +-3 +-14 +31 +-9 +-26 +29 +-8 +-10 +30 +-9 +-30 +29 +1 +15 +30 +17 +22 +13 +13 +6 +19 +14 +13 +11 +10 +4 +1 +14 +3 +-2 +6 +12 +6 +-1 +-4 +-2 +-3 +-4 +-2 +0 +-3 +5 +18 +4 +0 +6 +5 +5 +-5 +1 +-6 +-5 +1 +-2 +5 +9 +13 +6 +-3 +2 +9 +-3 +-7 +-6 +7 +-2 +-6 +-5 +-5 +-3 +-4 +4 +-3 +-2 +5 +1 +18 +-1 +-1 +-8 +-5 +-5 +8 +1 +-1 +10 +1 +-1 +-3 +13 +5 +-6 +-5 +-7 +0 +-4 +6 +4 +13 +2 +-6 +-4 +-1 +-5 +4 +-4 +10 +-2 +-4 +0 +-3 +-5 +2 +-3 +3 +-3 +2 +-2 +0 +-4 +-2 +-3 +0 +0 +1 +-2 +6 +-2 +-1 +0 +-2 +13 +5 +-2 +1 +1 +5 +-1 +6 +12 +5 +-30 +12 +-24 +-47 +18 +-18 +-36 +16 +-20 +-26 +28 +-12 +-34 +24 +-11 +-25 +26 +-12 +-34 +27 +-12 +-32 +33 +-6 +-25 +30 +-9 +-28 +29 +-9 +-26 +32 +-7 +-29 +27 +-9 +-29 +35 +-5 +-27 +29 +-8 +-25 +36 +-4 +-25 +31 +-8 +-27 +42 +4 +-21 +32 +-3 +-23 +28 +-9 +-28 +28 +-9 +-27 +46 +5 +-24 +29 +-1 +-23 +30 +-1 +-27 +36 +3 +-26 +27 +-11 +-22 +40 +-2 +-30 +25 +-13 +-27 +47 +2 +-23 +24 +-14 +-31 +40 +-3 +-28 +24 +-11 +-30 +35 +-5 +-29 +31 +-7 +-28 +28 +-8 +-21 +36 +-5 +-27 +28 +-7 +-29 +32 +-6 +-26 +34 +-6 +-26 +30 +-7 +-19 +39 +-2 +-26 +27 +-10 +-29 +28 +-1 +-21 +25 +-8 +-26 +33 +-6 +-14 +37 +-5 +-26 +24 +-10 +-25 +36 +0 +-24 +28 +-9 +17 +41 +27 +15 +12 +11 +10 +7 +7 +7 +7 +5 +13 +6 +14 +6 +14 +2 +-2 +-2 +3 +-1 +7 +-3 +-3 +-3 +-3 +14 +13 +17 +5 +1 +-6 +-7 +-6 +-2 +-3 +1 +1 +1 +12 +2 +-6 +1 +15 +1 +2 +-8 +0 +5 +10 +10 +-5 +3 +-6 +-8 +-4 +-3 +-3 +-8 +-5 +12 +3 +-5 +-5 +-5 +6 +0 +1 +5 +-5 +5 +14 +4 +0 +5 +-3 +-1 +-5 +-4 +5 +-3 +-2 +-4 +7 +2 +-4 +-1 +6 +-2 +-5 +-3 +-4 +-2 +-1 +7 +-2 +15 +13 +2 +-1 +-3 +-4 +-3 +-5 +5 +-3 +-2 +1 +-4 +-4 +2 +5 +9 +-3 +4 +-4 +3 +-4 +4 +6 +7 +1 +-4 +-2 +1 +1 +0 +9 +-27 +-48 +8 +-26 +-44 +15 +-10 +-33 +23 +-13 +-31 +22 +-15 +-29 +29 +-10 +-19 +41 +1 +-19 +26 +-13 +-28 +27 +-10 +-31 +30 +-10 +-30 +28 +-3 +-16 +27 +-12 +-30 +32 +-7 +-18 +28 +-10 +-26 +38 +-2 +-27 +27 +-9 +-25 +43 +5 +-22 +29 +-9 +-27 +25 +-12 +-31 +40 +0 +-19 +32 +-5 +-30 +24 +-12 +-23 +42 +3 +-23 +29 +-9 +-28 +23 +-11 +-30 +33 +-4 +-27 +26 +-10 +-26 +31 +-5 +-27 +33 +-5 +-26 +30 +-8 +-25 +32 +-6 +-27 +32 +-7 +-26 +31 +-7 +-18 +32 +-7 +-20 +34 +-2 +-15 +52 +6 +-23 +30 +-10 +-31 +33 +-8 +-20 +29 +-7 +-27 +25 +-8 +-28 +25 +-10 +-29 +32 +-4 +-25 +28 +-3 +-16 +36 +-1 +-26 +28 +0 +-24 +29 +-7 +-28 +31 +-7 +-28 +30 +-7 +-14 +31 +22 +20 +20 +17 +15 +12 +17 +12 +11 +5 +5 +11 +13 +17 +15 +9 +6 +-2 +-4 +0 +4 +-2 +3 +-3 +-2 +3 +8 +6 +-1 +8 +4 +-3 +0 +-5 +9 +9 +-1 +-5 +-3 +-4 +4 +-4 +1 +-1 +-2 +-1 +-1 +-3 +5 +-3 +15 +3 +-3 +9 +12 +11 +0 +-11 +-9 +-4 +-5 +2 +-4 +-3 +7 +14 +3 +5 +1 +-7 +-5 +0 +-4 +-1 +-1 +-7 +-5 +0 +2 +-2 +-1 +10 +-2 +4 +-1 +3 +-5 +11 +7 +-2 +-2 +-4 +3 +5 +11 +-2 +16 +-1 +-4 +-5 +-6 +-6 +-2 +-3 +0 +-2 +-4 +8 +1 +10 +-2 +-2 +1 +3 +-4 +-4 +13 +2 +-3 +2 +3 +3 +4 +2 +2 +5 +14 +-25 +12 +-25 +-47 +5 +-29 +-39 +18 +-19 +-35 +20 +-17 +-36 +24 +-14 +-28 +23 +-12 +-31 +33 +-7 +-23 +30 +-8 +-30 +44 +0 +-27 +37 +-2 +-26 +27 +-11 +-29 +28 +-8 +-28 +29 +-9 +-29 +36 +-3 +-22 +42 +1 +-26 +31 +3 +-26 +25 +-11 +-30 +27 +-10 +-25 +30 +-10 +-27 +32 +-1 +-26 +33 +-7 +-25 +28 +-9 +-29 +38 +-3 +-19 +34 +-5 +-27 +29 +-10 +-28 +30 +-6 +-26 +44 +0 +-23 +25 +-11 +-31 +37 +-4 +-27 +28 +-9 +-16 +29 +-10 +-27 +31 +-8 +-24 +44 +3 +-23 +24 +-1 +-27 +32 +-7 +-27 +31 +-7 +-25 +32 +-2 +-26 +29 +-9 +-29 +45 +1 +-24 +32 +-4 +-27 +32 +-6 +-29 +31 +-2 +-27 +26 +-10 +-28 +40 +4 +-25 +33 +-8 +-31 +29 +-9 +-29 +30 +-10 +-27 +31 +-5 +23 +27 +38 +20 +19 +19 +12 +11 +7 +5 +19 +7 +2 +1 +1 +4 +1 +0 +-1 +-2 +5 +18 +2 +5 +-3 +15 +12 +1 +0 +-3 +-7 +-2 +-1 +0 +-4 +1 +0 +7 +5 +0 +-4 +-1 +1 +-2 +2 +-1 +15 +1 +10 +-3 +4 +-4 +1 +-5 +-3 +-5 +-6 +-4 +-1 +2 +-1 +1 +-2 +2 +3 +-2 +-3 +4 +-5 +1 +1 +4 +0 +-5 +11 +8 +0 +-1 +1 +-3 +-6 +-4 +-4 +7 +7 +-1 +0 +-2 +8 +-1 +-1 +-1 +-2 +9 +2 +1 +-3 +16 +-1 +1 +-2 +8 +12 +17 +-3 +-6 +-7 +-6 +0 +-7 +-4 +-5 +-4 +5 +-2 +-1 +2 +-1 +-6 +13 +-1 +-3 +-4 +8 +12 +2 +-3 +2 +10 +-26 +-46 +10 +-26 +-42 +13 +-20 +-40 +31 +-9 +-18 +25 +-13 +-26 +30 +-9 +-29 +29 +-5 +-31 +38 +-4 +-28 +24 +-12 +-33 +29 +-8 +-27 +26 +-9 +-24 +39 +-2 +-24 +34 +-6 +-29 +34 +-7 +-21 +26 +-11 +-24 +26 +-12 +-11 +30 +-6 +-20 +28 +-11 +-28 +28 +0 +-18 +39 +-3 +-23 +29 +-10 +-20 +30 +-9 +-31 +36 +-4 +-30 +30 +-8 +-27 +39 +-3 +-28 +36 +-6 +-29 +23 +-7 +-29 +33 +-4 +-14 +31 +-7 +-15 +28 +-6 +-14 +32 +-3 +-28 +29 +-10 +-29 +37 +-4 +-22 +27 +-12 +-17 +30 +-8 +-31 +29 +-10 +-30 +25 +-11 +-16 +33 +-5 +-28 +30 +5 +-24 +31 +-8 +-25 +30 +-7 +-28 +30 +-3 +-26 +35 +-5 +-22 +39 +-3 +-24 +26 +-7 +-18 +39 +-3 +-26 +31 +-9 +-29 +40 +0 +-27 +18 +26 +27 +39 +17 +13 +6 +7 +21 +17 +7 +1 +3 +1 +10 +-1 +-3 +1 +-2 +0 +-4 +1 +-1 +-1 +0 +3 +12 +-1 +-4 +3 +-4 +1 +4 +1 +-1 +0 +-3 +14 +15 +2 +-5 +8 +1 +-4 +2 +1 +2 +12 +6 +11 +7 +0 +-8 +-4 +10 +4 +-3 +-7 +2 +8 +-6 +-5 +0 +-7 +4 +4 +-3 +1 +-3 +-5 +-4 +1 +7 +-5 +-1 +-4 +3 +-1 +18 +1 +-3 +11 +0 +-3 +11 +-1 +-5 +-1 +4 +-4 +-2 +-1 +-1 +7 +7 +9 +-2 +-7 +-7 +-9 +0 +-4 +-4 +0 +-3 +0 +-2 +-4 +-2 +15 +1 +-2 +-2 +13 +1 +1 +-1 +0 +-4 +-2 +-2 +-4 +6 +5 +7 +5 +-3 +-1 +8 +-27 +-45 +17 +-21 +-42 +14 +-20 +-39 +21 +-18 +-32 +26 +-12 +-20 +37 +-6 +-23 +24 +-13 +-29 +25 +-12 +-31 +26 +-10 +-18 +38 +-5 +-20 +24 +-13 +-31 +28 +-11 +-28 +30 +-7 +-29 +27 +1 +-23 +31 +-1 +-22 +38 +1 +-19 +26 +-9 +-28 +31 +-9 +-20 +30 +-8 +-20 +27 +-9 +-26 +26 +-11 +-27 +43 +1 +-25 +37 +-5 +-28 +26 +-12 +-30 +25 +-9 +-15 +37 +-5 +-27 +40 +1 +-25 +28 +-8 +-27 +32 +-6 +-29 +33 +-3 +-26 +31 +-3 +-24 +31 +-8 +-29 +27 +5 +-23 +28 +-1 +-9 +30 +-9 +-28 +35 +-4 +-28 +25 +-8 +-27 +31 +-6 +-28 +30 +-7 +-24 +42 +-1 +-26 +28 +-5 +-26 +26 +-11 +-28 +30 +-7 +-15 +43 +0 +-22 +29 +-9 +-30 +36 +-6 +-28 +47 +3 +-24 +33 +-9 +-30 +15 +18 +19 +19 +15 +20 +26 +30 +12 +15 +1 +14 +9 +1 +0 +1 +3 +-3 +-2 +16 +1 +-2 +-5 +4 +3 +5 +-4 +-3 +-4 +-4 +3 +-3 +14 +2 +-4 +-3 +0 +-2 +-4 +4 +-3 +-2 +4 +11 +7 +-3 +-4 +2 +-2 +1 +6 +0 +-1 +-3 +4 +10 +-3 +-1 +-2 +2 +-4 +-2 +4 +-3 +1 +-1 +-3 +-3 +4 +13 +18 +2 +0 +-2 +3 +-4 +6 +-4 +0 +0 +6 +-4 +-1 +0 +1 +3 +-1 +1 +11 +-3 +-2 +2 +9 +1 +2 +6 +9 +2 +-3 +-6 +-8 +9 +15 +-3 +0 +-4 +-5 +0 +-9 +-6 +1 +-7 +-1 +-2 +0 +-2 +-5 +11 +0 +-4 +-2 +-2 +-2 +-2 +5 +13 +0 +-3 +7 +-28 +-43 +12 +-25 +-43 +18 +-19 +-38 +18 +-16 +-34 +21 +-12 +-32 +27 +-6 +-27 +28 +-10 +-25 +37 +-5 +-26 +28 +-7 +-30 +27 +-10 +-29 +32 +-6 +-16 +30 +-7 +-28 +26 +-10 +-29 +35 +0 +-9 +44 +0 +-26 +30 +-6 +-27 +28 +-10 +-30 +26 +-2 +-19 +32 +-6 +-21 +29 +-9 +-21 +30 +-9 +-16 +43 +-1 +-26 +28 +-10 +-25 +30 +-10 +-27 +27 +-8 +-27 +30 +-9 +-25 +26 +-3 +-22 +48 +3 +-24 +31 +-7 +-31 +31 +-8 +-25 +40 +-2 +-27 +31 +-9 +-28 +25 +-11 +-30 +29 +-10 +-26 +32 +-1 +-24 +39 +0 +-22 +33 +-6 +-28 +34 +-7 +-25 +31 +-8 +-28 +30 +2 +-23 +32 +0 +-20 +33 +-2 +-27 +27 +-8 +-29 +29 +-10 +-29 +33 +-5 +-24 +31 +2 +-23 +38 +-3 +-23 +31 +-6 +-29 +18 +31 +26 +19 +15 +18 +20 +9 +8 +8 +7 +19 +10 +2 +8 +13 +3 +-2 +7 +-3 +0 +4 +0 +1 +-4 +-2 +-1 +6 +3 +-2 +-2 +-2 +9 +-1 +9 +2 +0 +-3 +-4 +-2 +11 +4 +10 +-4 +3 +-3 +-3 +3 +-1 +-4 +-2 +2 +-3 +-1 +0 +0 +-2 +4 +1 +1 +0 +-2 +4 +-1 +-2 +4 +-2 +2 +13 +17 +8 +6 +-3 +10 +-6 +2 +-4 +-7 +-6 +-2 +-1 +-3 +2 +5 +-3 +-5 +16 +1 +1 +12 +0 +-5 +1 +12 +-5 +7 +4 +-7 +-9 +-6 +-6 +2 +-3 +-1 +3 +-4 +-7 +-5 +1 +1 +-2 +-1 +-2 +2 +-2 +-3 +-1 +10 +-1 +0 +-2 +1 +-3 +2 +-2 +-1 +9 +0 +15 +-23 +-44 +11 +-26 +-41 +14 +-19 +-30 +17 +-18 +-33 +34 +-6 +-25 +24 +-8 +-29 +25 +-12 +-30 +32 +-8 +-25 +43 +0 +-24 +26 +-13 +-18 +30 +-6 +-26 +30 +-1 +-26 +26 +-10 +-28 +28 +-2 +-26 +39 +-1 +-25 +32 +-6 +-13 +27 +-7 +-28 +27 +-10 +-30 +30 +-4 +-23 +32 +-7 +-28 +30 +-7 +-27 +33 +-8 +-28 +43 +5 +-13 +39 +-4 +-29 +31 +-8 +-24 +25 +-13 +-30 +24 +-8 +-30 +29 +-5 +-27 +34 +-3 +-27 +31 +-6 +-27 +27 +-6 +-28 +29 +-8 +-25 +30 +-8 +-23 +31 +-7 +-18 +32 +1 +-10 +44 +-1 +-24 +29 +-8 +-29 +33 +-7 +-28 +41 +4 +-18 +25 +-6 +-23 +35 +-1 +-16 +36 +-7 +-29 +23 +-11 +-32 +28 +-10 +-27 +33 +0 +-26 +28 +-7 +-27 +26 +-9 +-28 +27 +-8 +-27 +21 +25 +24 +17 +17 +16 +23 +17 +16 +13 +10 +13 +8 +1 +1 +8 +3 +3 +9 +9 +3 +3 +16 +1 +-2 +1 +-3 +-3 +0 +-1 +-5 +3 +15 +-1 +-1 +-3 +6 +-3 +-1 +4 +-1 +5 +5 +-5 +-6 +-6 +-4 +-6 +0 +-5 +-1 +1 +0 +3 +6 +0 +-3 +0 +11 +10 +17 +1 +-1 +-2 +-6 +-7 +-5 +2 +-3 +-1 +-2 +-2 +-1 +0 +-1 +5 +-4 +1 +1 +0 +0 +-2 +1 +5 +-1 +-2 +-1 +2 +5 +-2 +2 +2 +-3 +-3 +3 +-3 +-2 +4 +6 +0 +-1 +1 +-1 +-2 +5 +3 +-2 +1 +8 +2 +7 +-1 +-5 +-1 +6 +-1 +-5 +-1 +15 +2 +-3 +1 +-3 +-5 +-4 +4 +0 +-2 +-33 +6 +-28 +-39 +19 +-19 +-40 +17 +-20 +-38 +35 +-6 +-32 +27 +-12 +-23 +26 +-10 +-28 +31 +-9 +-20 +27 +-11 +-30 +27 +-12 +-29 +29 +-7 +-29 +31 +-8 +-23 +41 +-1 +-21 +36 +-6 +-9 +31 +-7 +-19 +40 +-4 +-21 +34 +-5 +-29 +26 +-12 +-30 +35 +-5 +-28 +29 +-8 +-28 +29 +-8 +-27 +29 +-8 +-16 +30 +-10 +-29 +31 +-8 +-28 +28 +-1 +-25 +31 +-7 +-14 +41 +-1 +-20 +34 +-7 +-29 +26 +-11 +-25 +26 +-9 +-16 +38 +-4 +-28 +29 +-10 +-19 +32 +-7 +-26 +31 +-9 +-28 +30 +-5 +-27 +27 +-11 +-22 +38 +-3 +-27 +29 +-10 +-24 +41 +-1 +-27 +49 +3 +-25 +26 +-10 +-23 +32 +-8 +-31 +36 +-4 +-26 +27 +-10 +-28 +24 +-12 +-26 +41 +-2 +-25 +34 +-6 +-26 +33 +-6 +-23 +29 +-4 +14 +20 +29 +20 +10 +12 +11 +21 +15 +17 +12 +7 +1 +5 +2 +4 +-3 +7 +-2 +3 +6 +-2 +-3 +1 +2 +14 +18 +1 +-3 +4 +-2 +-4 +12 +14 +11 +0 +-5 +-8 +-3 +0 +0 +-4 +-7 +-1 +9 +0 +-3 +-5 +-4 +-1 +-5 +0 +18 +2 +5 +1 +7 +-4 +11 +-3 +-3 +-6 +-7 +-2 +-1 +-4 +-4 +14 +-2 +0 +1 +10 +3 +-2 +-4 +0 +2 +15 +-1 +-3 +-1 +1 +-4 +9 +3 +3 +6 +6 +5 +-6 +4 +-7 +1 +-7 +-7 +-3 +-3 +2 +0 +-3 +6 +2 +1 +-5 +1 +-4 +-3 +13 +15 +12 +-5 +-1 +-4 +0 +-6 +-6 +-1 +-4 +3 +-5 +-1 +-1 +2 +-4 +-3 +-2 +-1 +-2 +15 +-22 +-44 +9 +-21 +-37 +12 +-22 +-40 +19 +-17 +-34 +21 +-11 +-31 +45 +0 +-15 +28 +-10 +-31 +25 +-13 +-31 +31 +-6 +-29 +27 +-11 +-27 +29 +-7 +-29 +35 +-5 +-25 +31 +-1 +-22 +34 +-6 +-27 +41 +-1 +-14 +32 +-8 +-18 +43 +4 +-17 +24 +-11 +-28 +26 +-11 +-32 +28 +-9 +-22 +41 +-1 +-18 +35 +-7 +-28 +26 +-11 +-23 +40 +-3 +-19 +30 +-9 +-27 +28 +-12 +-29 +37 +-3 +-29 +26 +-11 +-30 +34 +-6 +-16 +28 +-10 +-28 +27 +-11 +-29 +31 +-8 +-22 +34 +-4 +-27 +32 +-7 +-27 +33 +-5 +-26 +39 +-2 +-24 +42 +2 +-26 +28 +-10 +-29 +30 +2 +-20 +41 +-2 +-28 +25 +-12 +-28 +26 +-6 +-23 +35 +-5 +-25 +35 +-4 +-22 +33 +-5 +-27 +33 +-7 +-15 +43 +0 +-24 +34 +-7 +-29 +15 +27 +21 +17 +22 +11 +18 +7 +10 +9 +7 +2 +11 +15 +11 +11 +11 +7 +-3 +-4 +-4 +-5 +0 +-3 +-3 +-1 +8 +1 +16 +1 +-1 +-4 +0 +-3 +-2 +-2 +1 +-3 +9 +2 +-2 +-3 +-5 +-2 +0 +8 +1 +-2 +1 +5 +-4 +12 +1 +0 +6 +-3 +-4 +-3 +-1 +-1 +2 +2 +6 +-2 +-3 +4 +0 +-1 +8 +-1 +3 +-2 +3 +17 +-1 +-1 +2 +-7 +1 +-3 +0 +-1 +1 +-2 +13 +-1 +-2 +8 +10 +-3 +-6 +-3 +-6 +1 +-1 +-1 +-1 +-5 +-7 +0 +5 +0 +-5 +1 +-4 +-2 +2 +5 +-2 +1 +2 +-2 +-1 +5 +-2 +-1 +-1 +1 +-1 +2 +-2 +18 +4 +13 +6 +9 +11 +-2 +-35 +1 +-32 +-42 +24 +-12 +-39 +17 +-17 +-38 +16 +-19 +-24 +28 +-12 +-32 +35 +-6 +-29 +27 +-13 +-30 +26 +-11 +-30 +29 +-10 +-17 +44 +3 +-26 +22 +-10 +-30 +26 +-11 +-28 +36 +-6 +-23 +28 +-5 +-22 +47 +2 +-25 +27 +-8 +-23 +25 +-11 +-29 +33 +0 +-24 +25 +-4 +-27 +43 +0 +-27 +26 +-8 +-28 +25 +-5 +-19 +39 +1 +-12 +29 +-8 +-29 +30 +-9 +-31 +26 +0 +-26 +26 +-8 +-27 +38 +0 +-25 +35 +-7 +-29 +36 +-3 +-15 +30 +-9 +-29 +28 +-10 +-29 +34 +-7 +-29 +32 +-7 +-28 +30 +-9 +-25 +29 +-7 +-22 +32 +-6 +-25 +29 +-6 +-28 +29 +-7 +-17 +38 +-1 +-26 +38 +-2 +-23 +24 +-12 +-27 +29 +-9 +-27 +35 +-6 +-26 +45 +1 +-25 +35 +-4 +-29 +29 +-11 +-29 +33 +-6 +10 +38 +23 +17 +16 +15 +10 +21 +16 +23 +11 +9 +-1 +4 +5 +2 +-2 +9 +0 +-4 +5 +3 +-3 +-5 +-4 +-2 +9 +-2 +3 +-1 +-1 +-2 +4 +7 +-1 +-3 +-3 +3 +12 +-2 +9 +-1 +4 +-3 +-3 +5 +-4 +-1 +5 +0 +-4 +13 +-2 +-5 +-5 +-3 +-1 +7 +0 +-1 +12 +3 +13 +1 +9 +5 +-4 +-10 +2 +-2 +-3 +-5 +11 +0 +-5 +-6 +4 +-5 +-2 +8 +-3 +15 +0 +2 +-6 +-3 +-5 +-3 +-4 +-4 +3 +2 +-6 +10 +2 +5 +6 +2 +-5 +-3 +2 +-5 +-4 +-3 +5 +8 +-5 +6 +-3 +-1 +5 +0 +-2 +-6 +4 +0 +1 +0 +8 +-2 +-3 +15 +1 +-3 +-3 +-3 +14 +0 +10 +-27 +-50 +6 +-26 +-38 +14 +-21 +-39 +28 +-6 +-30 +28 +-10 +-34 +28 +-10 +-31 +36 +1 +-25 +22 +-16 +-29 +22 +-9 +-30 +27 +-9 +-29 +28 +-4 +-27 +35 +-5 +-20 +30 +-7 +-25 +28 +-9 +-24 +29 +-8 +-25 +47 +2 +-23 +29 +1 +-17 +35 +-5 +-24 +42 +-1 +-27 +26 +-13 +-30 +26 +-10 +-24 +40 +-3 +-27 +33 +-6 +-26 +30 +-2 +-28 +27 +-6 +-22 +33 +0 +-25 +33 +-4 +-28 +24 +-11 +-26 +30 +-5 +-24 +31 +-6 +-20 +28 +-10 +-27 +43 +1 +-24 +44 +1 +-25 +42 +-2 +-26 +29 +-10 +-29 +24 +-14 +-27 +32 +-8 +-28 +29 +-9 +-28 +28 +-9 +-26 +34 +-7 +-24 +37 +-4 +-27 +34 +-3 +-14 +30 +-8 +-22 +39 +-4 +-27 +26 +-9 +-22 +30 +-10 +-29 +34 +0 +-19 +27 +-11 +-29 +17 +40 +23 +23 +15 +30 +14 +10 +22 +17 +7 +3 +3 +3 +0 +7 +16 +1 +-2 +6 +-4 +8 +-3 +-1 +-2 +-3 +2 +6 +7 +3 +5 +-3 +8 +-3 +-3 +0 +-4 +-2 +0 +5 +-3 +-3 +-4 +13 +0 +0 +-2 +-3 +7 +17 +-1 +15 +-2 +0 +-8 +-7 +-6 +-1 +9 +-3 +-4 +7 +-3 +-2 +-5 +6 +6 +1 +4 +-5 +-3 +-3 +-1 +13 +-1 +1 +-3 +3 +-2 +-5 +-3 +0 +-3 +1 +-4 +-1 +1 +-2 +4 +14 +8 +-4 +-5 +-2 +1 +1 +3 +11 +11 +3 +2 +-6 +-4 +-4 +-2 +2 +-5 +-3 +-2 +-1 +-2 +0 +-1 +3 +9 +2 +-3 +-5 +11 +1 +-3 +1 +-2 +7 +7 +4 +0 +-4 +9 +-27 +-47 +18 +-20 +-43 +19 +-18 +-35 +23 +-16 +-28 +20 +-14 +-34 +30 +-9 +-31 +28 +-9 +-31 +29 +-10 +-19 +37 +-4 +-27 +26 +-11 +-25 +26 +-7 +-29 +43 +5 +-19 +27 +-10 +-28 +26 +-12 +-27 +28 +1 +-20 +27 +-11 +-24 +26 +-7 +-25 +38 +-4 +-27 +30 +-1 +-26 +31 +-7 +-27 +32 +-6 +-27 +38 +-2 +-22 +49 +4 +-17 +26 +-11 +-19 +27 +-11 +-28 +32 +-6 +-27 +24 +-10 +-16 +39 +-3 +-28 +47 +3 +-25 +29 +-6 +-27 +22 +-10 +-31 +36 +-6 +-26 +23 +-12 +-31 +26 +-4 +-11 +35 +-5 +-29 +28 +-5 +-25 +42 +5 +-24 +25 +-9 +-23 +25 +-10 +-28 +28 +-9 +-25 +30 +-7 +-27 +28 +1 +-23 +37 +-4 +-23 +27 +-8 +-29 +30 +-8 +-13 +31 +-8 +-27 +28 +-9 +-27 +42 +0 +-14 +36 +29 +21 +18 +17 +13 +21 +10 +8 +8 +5 +7 +7 +13 +2 +6 +-1 +0 +3 +18 +14 +3 +-5 +-3 +-3 +-4 +7 +-2 +7 +0 +-5 +-3 +-2 +-1 +1 +4 +2 +-2 +-6 +0 +0 +3 +-3 +1 +17 +2 +7 +1 +-3 +-5 +3 +-4 +16 +1 +2 +-6 +-5 +-5 +10 +13 +-2 +-6 +-2 +2 +-4 +-1 +1 +0 +-1 +-2 +13 +-1 +-3 +-7 +-7 +7 +1 +-5 +14 +11 +2 +-2 +-6 +-4 +2 +-1 +-3 +-1 +0 +11 +-2 +-1 +-5 +-3 +-2 +-4 +-1 +1 +-3 +1 +16 +1 +11 +11 +8 +-5 +-3 +5 +-1 +-2 +-6 +-8 +-5 +0 +-4 +12 +0 +-3 +-1 +-2 +-5 +-2 +0 +14 +8 +0 +-5 +-2 +9 +-27 +-50 +12 +-24 +-41 +12 +-23 +-38 +21 +-11 +-17 +24 +-13 +-33 +29 +-8 +-28 +40 +-1 +-29 +26 +-11 +-32 +27 +-7 +-27 +36 +-6 +-29 +27 +-6 +-25 +26 +-9 +-28 +30 +-2 +-26 +29 +-7 +-19 +34 +-6 +-26 +32 +-8 +-27 +30 +-8 +-27 +45 +3 +-20 +49 +4 +-21 +23 +-7 +-29 +28 +-11 +-27 +38 +-4 +-16 +30 +-9 +-25 +40 +-3 +-25 +25 +-12 +-32 +26 +-11 +-22 +32 +-8 +-17 +42 +-2 +-13 +27 +-11 +-32 +25 +-13 +-30 +26 +-7 +-22 +30 +-3 +-24 +34 +-1 +-27 +43 +7 +-22 +34 +-6 +-22 +32 +-10 +-18 +32 +-8 +-29 +37 +2 +-24 +27 +-11 +-33 +26 +-9 +-28 +26 +-10 +-28 +32 +-7 +-23 +42 +0 +-27 +26 +-12 +-31 +35 +1 +-24 +27 +-9 +-29 +27 +-9 +-28 +27 +-8 +-26 +23 +44 +27 +22 +16 +13 +12 +16 +26 +12 +11 +1 +15 +12 +18 +0 +-2 +4 +2 +5 +-4 +-2 +-2 +-1 +-4 +0 +9 +-2 +3 +1 +-3 +8 +-1 +-5 +-1 +-2 +1 +-5 +1 +7 +-3 +10 +-2 +-3 +-2 +-1 +9 +8 +-2 +-4 +5 +2 +-4 +-2 +-2 +-4 +-4 +13 +8 +-2 +-3 +16 +1 +-4 +-3 +-3 +2 +-5 +13 +-1 +-3 +1 +-4 +-5 +-1 +2 +6 +11 +-2 +-1 +-3 +7 +1 +1 +2 +-5 +-4 +7 +0 +0 +6 +-1 +-1 +5 +-2 +1 +0 +-1 +-7 +13 +0 +5 +-3 +-7 +-5 +-2 +16 +1 +-4 +12 +4 +-1 +-6 +4 +6 +-4 +8 +3 +-7 +-6 +4 +-2 +-6 +-4 +0 +8 +9 +-5 +13 +-24 +-47 +7 +-29 +-47 +14 +-17 +-38 +22 +-9 +-31 +26 +-7 +-32 +23 +-13 +-30 +36 +-4 +-28 +33 +4 +-25 +32 +-8 +-24 +25 +-11 +-29 +26 +-11 +-30 +26 +-12 +-25 +29 +-6 +-26 +32 +-7 +-27 +34 +-6 +-26 +34 +-4 +-14 +44 +0 +-25 +26 +-8 +-31 +29 +-9 +-28 +29 +-5 +-27 +30 +-7 +-29 +31 +-5 +-27 +30 +-4 +-17 +38 +-4 +-23 +29 +-9 +-22 +31 +-4 +-27 +46 +2 +-26 +28 +-11 +-29 +28 +-10 +-25 +34 +-7 +-26 +36 +-5 +-25 +28 +-2 +-26 +32 +-6 +-18 +28 +-11 +-25 +33 +-5 +-28 +33 +-3 +-23 +27 +-9 +-24 +27 +2 +-25 +34 +-3 +-26 +27 +-11 +-23 +32 +-5 +-28 +29 +-10 +-28 +29 +-7 +-25 +32 +3 +-23 +31 +-6 +-24 +34 +-7 +-26 +31 +-2 +-26 +33 +-5 +-25 +20 +31 +41 +23 +16 +12 +17 +14 +23 +8 +14 +7 +12 +11 +-2 +8 +8 +-3 +2 +0 +0 +6 +-2 +-7 +-4 +4 +-2 +-1 +14 +-1 +1 +-4 +3 +-3 +10 +4 +-2 +0 +-4 +-4 +4 +12 +-1 +5 +-4 +-3 +5 +7 +5 +3 +-6 +4 +-6 +-4 +-5 +-5 +-3 +-2 +-1 +2 +-2 +-3 +-3 +-5 +7 +8 +5 +2 +-2 +4 +-3 +-2 +-4 +9 +-1 +0 +2 +2 +-2 +1 +2 +-2 +18 +2 +9 +5 +-4 +1 +-2 +4 +-2 +-5 +-7 +-6 +2 +2 +-5 +2 +2 +10 +-2 +1 +-2 +2 +-4 +-5 +1 +0 +5 +0 +8 +4 +1 +-4 +6 +2 +0 +-4 +-3 +0 +5 +-2 +-5 +-3 +-3 +7 +-2 +-3 +7 +-28 +-41 +7 +-28 +-46 +25 +-13 +-38 +19 +-12 +-33 +21 +-9 +-25 +35 +-8 +-31 +32 +-7 +-30 +29 +-11 +-30 +26 +-12 +-31 +33 +-6 +-16 +29 +-1 +-20 +36 +-6 +-28 +26 +-10 +-23 +37 +-5 +-21 +31 +-7 +-29 +30 +-9 +-28 +36 +-1 +-24 +46 +2 +-26 +26 +-7 +-16 +27 +-11 +-30 +24 +-12 +-29 +30 +-8 +-24 +29 +-8 +-27 +46 +2 +-18 +32 +-7 +-21 +27 +-4 +-20 +28 +-8 +-22 +41 +-1 +-18 +32 +-8 +-31 +30 +-10 +-27 +29 +-10 +-30 +36 +-6 +-27 +40 +0 +-21 +27 +-10 +-29 +23 +-4 +-26 +38 +-1 +-26 +35 +-5 +-28 +30 +-9 +-21 +27 +-11 +-29 +37 +-5 +-15 +28 +-9 +-24 +26 +-9 +-19 +33 +-1 +-27 +36 +-6 +-27 +31 +-8 +-29 +26 +-9 +-25 +31 +-2 +-25 +36 +-5 +-20 +19 +24 +22 +20 +24 +25 +11 +19 +8 +20 +8 +7 +3 +6 +4 +4 +1 +0 +-1 +0 +6 +5 +-1 +15 +4 +-2 +2 +1 +-3 +11 +11 +-3 +-1 +2 +9 +-1 +-6 +-3 +-4 +-2 +2 +-4 +2 +11 +0 +-2 +2 +-3 +-5 +-5 +-4 +-2 +5 +1 +10 +-2 +5 +6 +2 +5 +0 +0 +-5 +-5 +-6 +1 +-1 +3 +-4 +4 +-1 +12 +5 +-5 +-4 +-5 +-2 +14 +4 +12 +7 +2 +7 +3 +-8 +-6 +-2 +-1 +-4 +-2 +7 +-5 +-3 +-5 +-5 +-2 +13 +1 +4 +-1 +-5 +11 +6 +8 +6 +-6 +2 +-3 +6 +-2 +3 +1 +2 +0 +-3 +-6 +-5 +7 +-3 +-5 +12 +0 +2 +-4 +-9 +7 +-4 +-6 +8 +-27 +-50 +8 +-24 +-43 +22 +-11 +-36 +23 +-16 +-34 +21 +-13 +-35 +27 +-5 +-28 +29 +-8 +-28 +29 +-10 +-29 +33 +-6 +-26 +32 +-8 +-24 +26 +-11 +-27 +33 +-3 +-24 +27 +-7 +-26 +29 +-9 +-24 +29 +-8 +-10 +35 +-6 +-22 +36 +-4 +-28 +29 +-9 +-28 +44 +7 +-21 +28 +-11 +-27 +46 +3 +-19 +29 +-11 +-26 +28 +-8 +-17 +27 +-10 +-29 +30 +-9 +-24 +40 +-3 +-23 +29 +-10 +-29 +30 +-8 +-28 +40 +0 +-15 +29 +-11 +-31 +35 +-2 +-29 +38 +-4 +-25 +23 +-11 +-29 +27 +-10 +-28 +33 +-6 +-15 +38 +-4 +-27 +28 +-9 +-30 +30 +-7 +-29 +27 +-9 +-23 +40 +-1 +-21 +40 +5 +-24 +26 +-9 +-27 +38 +-4 +-26 +25 +-12 +-28 +27 +-10 +-24 +31 +-4 +-24 +29 +-8 +-26 +31 +1 +-24 +36 +24 +24 +19 +18 +16 +12 +14 +15 +12 +12 +11 +24 +5 +6 +-1 +-1 +15 +2 +-2 +8 +-1 +-6 +4 +0 +-3 +0 +-1 +0 +6 +-4 +-3 +1 +6 +1 +-1 +1 +3 +-3 +-4 +3 +5 +5 +1 +6 +6 +-5 +-3 +3 +5 +-4 +6 +6 +-1 +10 +-3 +-1 +-6 +-2 +-2 +-5 +0 +5 +-4 +-1 +5 +10 +7 +-1 +2 +-4 +-3 +13 +-1 +1 +-2 +-3 +-3 +-6 +-3 +1 +7 +-2 +3 +-4 +-4 +-5 +-2 +-4 +4 +-3 +-3 +-4 +0 +-2 +3 +9 +1 +10 +3 +1 +4 +14 +1 +-3 +0 +-4 +-3 +1 +0 +17 +0 +-5 +-4 +-2 +-3 +3 +-1 +-4 +3 +-4 +4 +-4 +9 +2 +-2 +-4 +17 +13 +-23 +-47 +5 +-29 +-43 +12 +-22 +-40 +21 +-11 +-20 +22 +-8 +-29 +23 +-10 +-30 +24 +-12 +-19 +28 +-11 +-18 +29 +-9 +-28 +29 +-6 +-27 +30 +-8 +-24 +32 +-7 +-27 +33 +-5 +-27 +31 +-8 +-27 +34 +-4 +-27 +46 +2 +-21 +42 +-1 +-27 +26 +-7 +-23 +26 +-11 +-25 +38 +-1 +-27 +27 +-10 +-29 +30 +-9 +-24 +29 +-8 +-17 +38 +-1 +-23 +26 +-10 +-18 +45 +1 +-27 +42 +-1 +-14 +28 +-7 +-23 +33 +-5 +-27 +32 +-6 +-25 +32 +-6 +-18 +41 +0 +-29 +22 +-14 +-29 +30 +-10 +-32 +26 +-9 +-25 +28 +-11 +-31 +29 +-6 +-23 +33 +-6 +-28 +27 +-11 +-29 +33 +-3 +-24 +33 +-6 +-26 +31 +-5 +-13 +37 +-4 +-28 +28 +-10 +-27 +27 +-5 +-23 +31 +1 +-24 +29 +-5 +-14 +39 +-4 +-29 +17 +21 +18 +29 +22 +15 +10 +12 +11 +7 +3 +11 +15 +6 +9 +3 +1 +3 +3 +3 +3 +5 +2 +-1 +0 +0 +5 +1 +0 +6 +5 +-1 +1 +3 +3 +5 +4 +2 +-1 +-3 +11 +-2 +-3 +1 +7 +-3 +6 +0 +-4 +-1 +-6 +3 +2 +-2 +-3 +5 +14 +9 +2 +-4 +6 +12 +-1 +-9 +-1 +2 +-4 +-1 +-2 +8 +-1 +-5 +5 +-5 +-4 +-2 +-5 +-4 +5 +4 +-4 +-4 +2 +-3 +-4 +-2 +-4 +1 +-1 +6 +-4 +-4 +-4 +15 +0 +2 +-3 +-2 +-3 +8 +1 +-2 +0 +15 +2 +-3 +-1 +1 +2 +12 +-3 +-6 +-5 +-3 +7 +0 +4 +16 +14 +0 +-3 +-7 +-4 +1 +-4 +-2 +-4 +1 +16 +-22 +-46 +22 +-16 +-31 +24 +-16 +-41 +15 +-21 +-40 +16 +-18 +-36 +39 +-4 +-28 +26 +-12 +-31 +23 +-13 +-31 +44 +1 +-26 +37 +-1 +-23 +27 +-10 +-28 +26 +-12 +-27 +26 +-4 +-24 +45 +2 +-25 +29 +-4 +-27 +26 +-11 +-12 +29 +-10 +-29 +26 +-10 +-30 +38 +4 +-14 +38 +-5 +-27 +26 +-10 +-27 +29 +-10 +-31 +33 +-4 +-23 +26 +-11 +-27 +32 +2 +-15 +31 +-9 +-20 +28 +-9 +-29 +32 +-4 +-27 +37 +-4 +-28 +26 +-10 +-25 +31 +-6 +-24 +27 +-4 +-27 +29 +-7 +-20 +33 +-7 +-25 +35 +-4 +-26 +27 +-6 +-21 +36 +-2 +-26 +27 +-10 +-19 +31 +-7 +-26 +44 +0 +-26 +28 +-10 +-27 +28 +-3 +-26 +31 +-8 +-25 +30 +-6 +-22 +31 +-7 +-28 +33 +-7 +-22 +27 +-6 +-26 +34 +-6 +-25 +22 +28 +28 +21 +26 +37 +16 +11 +5 +6 +16 +3 +3 +2 +8 +11 +1 +12 +-1 +-2 +2 +3 +2 +7 +3 +0 +4 +1 +1 +-4 +-3 +14 +3 +-3 +9 +14 +-3 +-1 +0 +6 +-7 +3 +-5 +2 +-5 +-5 +-6 +-5 +-4 +4 +2 +-2 +-2 +-3 +1 +5 +-2 +-1 +-2 +-3 +4 +1 +4 +4 +5 +-3 +7 +3 +-4 +1 +-2 +11 +10 +-1 +-3 +-1 +-1 +0 +-4 +-1 +-5 +-1 +-2 +3 +-1 +-1 +-2 +-1 +-2 +10 +3 +-1 +11 +1 +6 +-4 +-3 +-3 +-3 +-3 +0 +-2 +-3 +-1 +6 +3 +-3 +-3 +4 +-1 +6 +-1 +-4 +-4 +0 +3 +10 +1 +0 +11 +2 +-2 +-2 +-2 +1 +1 +2 +-5 +10 +-26 +-46 +16 +-20 +-43 +11 +-20 +-38 +19 +-18 +-28 +28 +-10 +-33 +28 +-10 +-27 +30 +-5 +-16 +35 +-7 +-29 +30 +-8 +-30 +29 +0 +-24 +42 +0 +-24 +29 +-6 +-30 +28 +-9 +-29 +34 +-7 +-25 +29 +-10 +-29 +34 +-4 +-26 +34 +-6 +-29 +38 +-2 +-27 +36 +-4 +-29 +40 +-3 +-14 +32 +-5 +-27 +26 +-10 +-31 +26 +-9 +-29 +29 +-9 +-27 +31 +-6 +-27 +28 +-6 +-27 +30 +-7 +-18 +49 +4 +-24 +26 +-8 +-29 +26 +-10 +-20 +28 +0 +-22 +36 +-6 +-28 +32 +-5 +-28 +35 +1 +-19 +26 +-10 +-29 +27 +-6 +-26 +29 +-7 +-21 +41 +-2 +-26 +35 +-4 +-25 +27 +-11 +-17 +39 +-1 +-28 +27 +-12 +-16 +33 +-7 +-24 +36 +-2 +-26 +40 +6 +-25 +24 +-14 +-18 +27 +-11 +-27 +30 +-10 +-30 +23 +20 +21 +21 +18 +11 +21 +13 +7 +7 +14 +5 +19 +24 +4 +8 +-3 +-2 +-2 +-4 +-2 +2 +-2 +0 +0 +12 +12 +-1 +-2 +-3 +1 +-5 +0 +-1 +2 +5 +-5 +-5 +-4 +0 +-2 +1 +1 +8 +16 +6 +-2 +-4 +1 +7 +14 +-2 +-4 +-2 +2 +-2 +2 +14 +1 +-4 +-6 +-4 +-1 +-3 +3 +1 +-2 +3 +-3 +1 +-4 +-4 +-3 +4 +-1 +0 +-3 +0 +5 +1 +-2 +12 +9 +7 +-4 +0 +1 +1 +1 +4 +6 +18 +0 +4 +-3 +-6 +0 +-2 +-1 +13 +-3 +-2 +-7 +-5 +2 +7 +-6 +-2 +-3 +-5 +1 +-4 +-4 +0 +-4 +1 +-2 +-3 +-2 +2 +5 +-1 +4 +10 +-3 +1 +1 +15 +-24 +15 +-22 +-46 +10 +-25 +-45 +13 +-9 +-34 +19 +-10 +-32 +22 +-14 +-32 +27 +-6 +-29 +31 +-7 +-27 +27 +-10 +-29 +34 +1 +-25 +30 +-9 +-30 +33 +-4 +-27 +31 +-8 +-29 +32 +-8 +-24 +32 +-7 +-27 +46 +2 +-24 +29 +-9 +-31 +32 +-2 +-11 +34 +-2 +-20 +26 +-12 +-31 +25 +-10 +-30 +28 +-9 +-25 +28 +-6 +-21 +39 +-3 +-24 +32 +-7 +-25 +37 +-5 +-27 +27 +-8 +-29 +30 +-4 +-13 +40 +2 +-23 +31 +-10 +-30 +29 +-5 +-28 +27 +-6 +-28 +27 +-5 +-16 +31 +-9 +-25 +32 +-7 +-20 +37 +-4 +-21 +28 +-10 +-30 +30 +-6 +-28 +27 +-10 +-16 +41 +-3 +-26 +28 +-8 +-26 +39 +-4 +-20 +27 +-8 +-29 +31 +-9 +-28 +30 +-9 +-29 +32 +-5 +-24 +40 +-2 +-25 +28 +-7 +-28 +28 +-7 +18 +24 +22 +26 +21 +34 +14 +10 +4 +2 +3 +5 +5 +13 +10 +0 +0 +3 +0 +1 +-1 +3 +17 +1 +0 +9 +-3 +2 +3 +-4 +0 +0 +-1 +5 +1 +1 +0 +-3 +1 +-3 +-1 +-1 +2 +7 +-3 +-1 +-1 +6 +13 +8 +-3 +-2 +14 +11 +4 +3 +-2 +-3 +-4 +0 +4 +0 +-7 +-1 +-3 +9 +-5 +2 +5 +16 +-3 +-8 +-8 +-2 +-3 +0 +3 +-1 +-3 +-3 +8 +9 +7 +8 +5 +-2 +-4 +-6 +4 +8 +2 +-2 +-7 +5 +0 +-6 +-7 +-4 +-5 +-3 +-3 +-1 +7 +4 +-1 +3 +-3 +16 +1 +-3 +9 +4 +-3 +-4 +-4 +10 +4 +-4 +-3 +-2 +-5 +0 +-5 +-2 +2 +-2 +-4 +-3 +11 +-26 +-47 +9 +-22 +-41 +15 +-20 +-37 +20 +-16 +-33 +29 +-10 +-32 +25 +-7 +-28 +30 +-7 +-19 +33 +0 +-19 +28 +-11 +-14 +30 +-10 +-29 +25 +-11 +-21 +28 +-10 +-23 +37 +-3 +-27 +37 +0 +-13 +36 +-2 +-29 +29 +-10 +-28 +26 +-7 +-26 +26 +-12 +-25 +27 +-10 +-26 +30 +-1 +-26 +34 +-6 +-27 +32 +-5 +-24 +30 +-5 +-27 +39 +-2 +-26 +28 +-9 +-26 +44 +0 +-26 +34 +-3 +-23 +29 +-9 +-27 +37 +-3 +-24 +38 +-4 +-28 +37 +-3 +-29 +46 +1 +-25 +22 +-12 +-32 +34 +-8 +-28 +29 +-9 +-28 +32 +-6 +-29 +29 +-3 +-19 +30 +-8 +-26 +42 +7 +-23 +28 +-11 +-31 +29 +-3 +-26 +34 +-7 +-29 +35 +-2 +-23 +27 +-10 +-28 +33 +-6 +-30 +30 +-2 +-25 +30 +-6 +-28 +30 +-6 +-26 +32 +-7 +-17 +33 +-6 +-27 +27 +-9 +-27 +34 +-6 +-23 +31 +-7 +-25 +30 +-8 +-27 +31 +-3 +-15 +30 +-8 +-27 +37 +1 +-25 +26 +-2 +-23 +28 +-7 +-24 +34 +3 +-23 +29 +-8 +-29 +30 +-9 +-27 +30 +-4 +-26 +31 +3 +-14 +29 +-8 +-28 +29 +-6 +-23 +42 +0 +-22 +28 +-9 +-29 +32 +0 +-26 +36 +-6 +-27 +37 +-4 +-26 +35 +-7 +-26 +31 +-5 +-24 +30 +-9 +-27 +36 +-5 +-27 +31 +-6 +-27 +32 +-7 +-25 +33 +-7 +-17 +31 +-7 +-18 +29 +-1 +-26 +33 +-7 +-14 +30 +-5 +-18 +25 +-7 +-21 +25 +-13 +-28 +26 +-10 +-28 +31 +-7 +-27 +32 +-1 +-25 +28 +-9 +-27 +34 +-4 +-12 +30 +-2 +-25 +31 +-7 +-29 +29 +-9 +-26 +50 +4 +-24 +28 +-10 +-25 +35 +-5 +-23 +37 +-1 +-19 +19 +18 +20 +15 +19 +14 +9 +19 +7 +13 +4 +2 +3 +9 +4 +5 +0 +2 +0 +-1 +2 +1 +3 +3 +14 +7 +10 +9 +3 +-2 +6 +-5 +-3 +-1 +-2 +11 +-3 +-2 +-3 +-3 +5 +-2 +0 +-2 +-2 +6 +-2 +-2 +-1 +2 +0 +2 +0 +1 +3 +0 +18 +3 +-3 +-4 +-1 +-1 +-5 +-1 +12 +2 +-4 +1 +2 +-3 +-4 +-3 +1 +6 +8 +9 +1 +-5 +-6 +-4 +0 +-1 +-1 +-4 +-1 +-1 +13 +10 +1 +12 +-1 +-5 +-8 +12 +5 +-4 +-7 +-8 +5 +3 +-5 +-4 +3 +-2 +13 +20 +0 +-5 +-6 +0 +0 +-3 +-1 +-3 +5 +-2 +2 +0 +1 +0 +15 +0 +-5 +0 +-6 +-5 +7 +-5 +-2 +7 +-4 +15 +0 +-3 +-1 +-6 +-6 +-3 +-1 +-1 +-1 +10 +11 +-2 +-5 +1 +-5 +2 +0 +-2 +9 +17 +8 +-4 +-5 +-2 +-2 +1 +-5 +-3 +-4 +-3 +-2 +3 +14 +13 +3 +-5 +-1 +11 +4 +-5 +-1 +-3 +-6 +-5 +-3 +-2 +-6 +-2 +-2 +-1 +-1 +10 +2 +-2 +-4 +2 +3 +-2 +-5 +2 +2 +-1 +-1 +0 +12 +0 +2 +13 +7 +-2 +5 +2 +-4 +-5 +-3 +1 +-5 +-3 +2 +2 +7 +-1 +-3 +13 +0 +0 +-4 +-3 +-2 +-4 +2 +0 +-3 +1 +-2 +7 +13 +1 +-5 +-6 +3 +5 +-2 +-5 +1 +2 +0 +-3 +13 +-1 +-1 +0 +-5 +-2 +0 +0 +-4 +-4 +16 +5 +12 +1 +-4 +4 +11 +-26 +-49 +21 +-14 +-41 +8 +-22 +-42 +15 +-21 +-37 +18 +-14 +-34 +32 +-8 +-29 +34 +-4 +-12 +29 +-5 +-29 +24 +-10 +-26 +36 +1 +-25 +28 +-7 +-26 +33 +-3 +-11 +28 +-10 +-32 +29 +-10 +-30 +29 +-4 +-27 +27 +-5 +-28 +29 +-9 +-24 +42 +5 +-15 +27 +0 +-26 +27 +-10 +-29 +28 +-3 +-28 +30 +-9 +-29 +32 +-6 +-13 +29 +-10 +-26 +30 +-7 +-30 +27 +-10 +-22 +33 +-5 +-27 +33 +-7 +-26 +29 +-9 +-27 +31 +-5 +-22 +42 +0 +-26 +29 +-8 +-25 +44 +3 +-26 +31 +-9 +-20 +26 +-5 +-25 +28 +-9 +-13 +36 +-5 +-28 +31 +-7 +-13 +30 +-6 +-27 +29 +-10 +-27 +27 +-6 +-24 +33 +-7 +-28 +36 +-5 +-23 +40 +-3 +-22 +32 +-7 +-18 +27 +-9 +-29 +33 +0 +-27 +32 +-8 +-23 +33 +-8 +-30 +29 +-7 +-27 +34 +1 +-21 +29 +-10 +-24 +33 +-4 +-29 +33 +-5 +-18 +45 +1 +-26 +38 +-1 +-28 +37 +-4 +-24 +23 +-15 +-20 +28 +-10 +-27 +31 +-9 +-18 +28 +-4 +-21 +25 +-13 +-32 +23 +-12 +-28 +28 +-8 +-27 +42 +0 +-23 +30 +-5 +-15 +35 +-6 +-29 +27 +-11 +-27 +28 +-10 +-23 +35 +-5 +-27 +38 +1 +-20 +25 +-11 +-27 +27 +-3 +-27 +26 +-10 +-29 +29 +-2 +-24 +29 +-9 +-27 +36 +-3 +-22 +31 +-7 +-22 +28 +-6 +-24 +35 +-4 +-14 +47 +3 +-26 +41 +-2 +-27 +33 +-6 +-29 +27 +-11 +-23 +25 +-11 +-29 +28 +-7 +-14 +31 +-8 +-26 +35 +3 +-12 +44 +1 +-29 +25 +-6 +-26 +25 +-9 +-32 +26 +-11 +-29 +27 +-3 +-25 +27 +-9 +-24 +27 +-4 +-25 +30 +-6 +-17 +17 +27 +23 +31 +29 +13 +11 +8 +20 +9 +5 +3 +11 +8 +12 +14 +13 +-2 +4 +5 +0 +-4 +-4 +-2 +-4 +17 +2 +8 +-1 +-5 +-4 +-2 +-3 +0 +4 +0 +-4 +-1 +-1 +0 +2 +-3 +-4 +7 +8 +-1 +4 +6 +10 +16 +-1 +1 +4 +-5 +-3 +-6 +-6 +2 +-2 +-2 +-1 +12 +10 +-3 +-1 +-3 +-5 +11 +13 +1 +-9 +-2 +-3 +-5 +-4 +-2 +11 +7 +-4 +-5 +-1 +-1 +-2 +1 +-4 +4 +-5 +-2 +4 +0 +-5 +-1 +-1 +6 +-3 +1 +-4 +-1 +2 +-1 +-1 +2 +5 +-2 +-2 +9 +0 +1 +5 +6 +-3 +-1 +2 +5 +4 +-2 +7 +-3 +5 +-1 +3 +-1 +5 +-4 +-1 +-5 +8 +3 +-29 +5 +-30 +-48 +12 +-23 +-36 +21 +-14 +-36 +23 +-14 +-36 +29 +-4 +-29 +25 +-12 +-32 +28 +-7 +-29 +26 +-10 +-21 +32 +-7 +-27 +30 +-8 +-25 +32 +-6 +-27 +32 +-3 +-27 +31 +-5 +-18 +29 +-8 +-23 +31 +-8 +-28 +38 +-3 +-26 +30 +-6 +-27 +32 +-6 +-26 +31 +-8 +-21 +34 +-3 +-9 +32 +-5 +-29 +38 +-1 +-26 +27 +-11 +-27 +24 +-12 +-18 +29 +-9 +-23 +29 +-9 +-26 +35 +-5 +-22 +28 +-9 +-27 +32 +-7 +-27 +30 +-8 +-22 +32 +-7 +-23 +42 +0 +-11 +31 +-8 +-25 +28 +-3 +-18 +41 +3 +-22 +30 +-8 +-31 +26 +-10 +-22 +34 +-5 +-28 +25 +-12 +-26 +33 +-5 +-26 +33 +-8 +-27 +42 +0 +-21 +38 +-5 +-25 +23 +-13 +-32 +26 +-12 +-20 +28 +-4 +-28 +35 +-5 +-18 +29 +-6 +11 +22 +31 +17 +15 +12 +9 +14 +14 +10 +5 +6 +3 +10 +4 +1 +6 +11 +1 +2 +19 +3 +-2 +2 +-2 +-6 +5 +14 +2 +-6 +-4 +-2 +7 +15 +13 +-3 +-5 +-7 +-8 +-6 +4 +3 +2 +0 +-3 +-3 +1 +5 +-3 +-3 +4 +0 +0 +1 +3 +1 +-4 +0 +9 +-2 +15 +0 +-4 +-4 +-3 +0 +0 +1 +-5 +-2 +1 +20 +2 +-1 +-6 +0 +8 +-1 +-3 +3 +6 +-2 +-3 +2 +-4 +-7 +6 +-3 +1 +-1 +-6 +-1 +1 +1 +0 +-2 +-2 +0 +3 +1 +6 +2 +12 +5 +-1 +-2 +0 +-7 +13 +9 +5 +-2 +-5 +-1 +-1 +0 +-4 +2 +6 +1 +13 +5 +-8 +3 +-5 +-2 +-3 +3 +-32 +5 +-30 +-43 +12 +-24 +-43 +17 +-17 +-37 +36 +-4 +-32 +26 +-12 +-27 +28 +-9 +-24 +25 +-12 +-31 +28 +-3 +-24 +43 +0 +-27 +41 +-1 +-23 +25 +-13 +-21 +25 +-13 +-32 +29 +-11 +-24 +35 +-5 +-25 +36 +-4 +-27 +27 +-7 +-30 +33 +-8 +-26 +30 +-8 +-27 +44 +0 +-25 +31 +-8 +-27 +27 +-11 +-28 +36 +-5 +-28 +32 +-5 +-26 +33 +-4 +-28 +31 +-7 +-28 +37 +0 +-21 +32 +-1 +-18 +27 +-11 +-21 +31 +-7 +-29 +26 +-10 +-30 +34 +-5 +-20 +32 +-1 +-21 +29 +-10 +-24 +32 +-7 +-29 +27 +-7 +-26 +33 +-1 +-26 +36 +-6 +-26 +32 +-8 +-27 +33 +-5 +-27 +35 +0 +-26 +30 +-8 +-28 +34 +-4 +-15 +36 +-4 +-27 +29 +-8 +-14 +31 +-9 +-16 +38 +-3 +-23 +34 +-7 +-27 +25 +-12 +9 +20 +22 +16 +17 +14 +10 +12 +21 +13 +11 +9 +4 +-2 +14 +5 +-1 +5 +1 +-2 +0 +-1 +0 +-3 +13 +1 +1 +18 +1 +1 +-4 +-3 +5 +-1 +-5 +6 +1 +-2 +8 +-3 +-7 +0 +12 +9 +-2 +7 +-3 +-3 +0 +3 +-4 +-4 +3 +-4 +1 +-2 +-2 +4 +1 +5 +2 +-1 +-2 +12 +16 +5 +-7 +-6 +-5 +-2 +9 +13 +6 +-7 +-6 +-6 +-5 +-4 +-1 +7 +12 +1 +3 +1 +-4 +-4 +-6 +8 +0 +-3 +-5 +-3 +-6 +-3 +-2 +0 +14 +1 +10 +8 +-4 +9 +-3 +4 +6 +-4 +-3 +12 +-4 +-4 +-4 +-6 +-5 +12 +-2 +-1 +-6 +-5 +3 +-2 +7 +4 +9 +2 +12 +17 +-1 +-6 +-4 +-7 +-2 +-6 +-6 +1 +-3 +0 +10 +12 +7 +-5 +3 +2 +-7 +9 +4 +-5 +-1 +-8 +0 +-1 +2 +-2 +1 +-3 +0 +7 +13 +1 +-6 +-3 +-4 +2 +2 +1 +0 +1 +7 +-1 +2 +-5 +-7 +-1 +-6 +-5 +1 +2 +-4 +9 +13 +9 +-4 +-4 +-2 +-1 +6 +0 +-4 +13 +-3 +-1 +-7 +-2 +-7 +-5 +-2 +8 +6 +0 +-3 +-3 +5 +-1 +-4 +-2 +-4 +-2 +-4 +4 +-1 +1 +20 +3 +-2 +-3 +12 +4 +1 +1 +2 +-3 +2 +9 +7 +0 +9 +14 +-4 +-9 +-9 +-6 +2 +-2 +7 +-3 +-6 +11 +1 +-8 +-1 +6 +-5 +-1 +-6 +-5 +-3 +-7 +2 +2 +3 +-2 +11 +-1 +5 +-3 +-6 +2 +10 +-26 +-37 +17 +-20 +-42 +11 +-19 +-38 +27 +-13 +-28 +19 +-13 +-35 +23 +-14 +-30 +27 +-10 +-26 +27 +-11 +-27 +35 +-2 +-14 +33 +-8 +-26 +41 +-2 +-27 +30 +-7 +-26 +30 +-8 +-30 +42 +-1 +-25 +41 +1 +-28 +26 +-13 +-31 +31 +-7 +-26 +34 +0 +-24 +30 +-9 +-31 +26 +-7 +-22 +27 +-9 +-18 +32 +-7 +-14 +44 +2 +-24 +35 +-7 +-17 +25 +-9 +-32 +34 +-5 +-31 +32 +0 +-28 +26 +-11 +-22 +31 +-4 +-17 +30 +-6 +-19 +25 +-12 +-32 +36 +-5 +-28 +27 +-7 +-28 +28 +-8 +-26 +26 +-11 +-30 +31 +-8 +-27 +33 +-1 +-17 +33 +-8 +-26 +29 +-8 +-24 +33 +-8 +-27 +38 +-3 +-26 +33 +-6 +-20 +36 +-1 +-27 +26 +-10 +-25 +40 +-2 +-28 +29 +-10 +-25 +28 +-7 +-28 +30 +-4 +-24 +37 +-4 +-23 +40 +-3 +-25 +28 +-9 +-23 +30 +-3 +-27 +26 +-8 +-23 +37 +-2 +-23 +26 +-8 +-28 +30 +-6 +-21 +26 +-10 +-29 +28 +-5 +-25 +26 +-8 +-22 +29 +-9 +-16 +31 +-7 +-22 +37 +-4 +-19 +29 +-9 +-28 +29 +0 +-25 +29 +-9 +-23 +36 +-5 +-17 +29 +-4 +-27 +36 +-5 +-28 +35 +-5 +-27 +35 +-6 +-26 +45 +3 +-23 +32 +-7 +-30 +36 +-4 +-29 +30 +-9 +-25 +41 +3 +-22 +24 +-14 +-32 +26 +-10 +-28 +27 +-10 +-28 +30 +-7 +-27 +36 +0 +-25 +28 +-9 +-20 +49 +3 +-22 +42 +0 +-27 +30 +-8 +-31 +27 +-9 +-29 +30 +0 +-22 +29 +-6 +-12 +30 +-10 +-31 +27 +-6 +-11 +31 +-2 +-21 +38 +-3 +-22 +26 +-13 +-28 +33 +-6 +-30 +31 +-9 +-26 +30 +-9 +-27 +39 +-4 +-27 +31 +30 +19 +26 +20 +27 +22 +8 +8 +11 +2 +2 +7 +5 +15 +8 +-1 +-5 +-3 +1 +2 +2 +-3 +-2 +2 +0 +0 +-5 +6 +7 +3 +3 +-4 +-2 +0 +-1 +0 +11 +8 +-2 +7 +0 +-4 +9 +12 +-4 +-4 +-7 +-5 +0 +4 +1 +-6 +-6 +3 +3 +-2 +1 +-2 +-3 +2 +-2 +-2 +10 +2 +-2 +0 +0 +-4 +13 +16 +0 +-4 +1 +-5 +-4 +10 +-2 +-5 +0 +-4 +1 +3 +-4 +2 +-2 +-5 +4 +0 +1 +-1 +2 +-1 +1 +-2 +-1 +1 +5 +3 +11 +1 +-2 +2 +-1 +-4 +-3 +-5 +-4 +9 +5 +1 +-2 +9 +-1 +1 +-1 +-2 +-3 +-3 +1 +6 +0 +-2 +-2 +-1 +0 +-1 +-5 +8 +-27 +-48 +10 +-18 +-40 +31 +-10 +-35 +22 +-17 +-37 +20 +-16 +-31 +28 +-11 +-29 +45 +2 +-24 +28 +-8 +-31 +29 +-4 +-28 +36 +0 +-26 +24 +-8 +-20 +29 +-10 +-21 +31 +-2 +-28 +37 +-4 +-27 +25 +-10 +-31 +33 +-7 +-18 +31 +-5 +-29 +42 +1 +-26 +29 +-10 +-28 +34 +-5 +-29 +27 +-9 +-27 +27 +-9 +-29 +34 +-2 +-21 +42 +-1 +-25 +32 +-4 +-30 +25 +-12 +-30 +40 +-1 +-25 +28 +-6 +-25 +28 +-7 +-30 +30 +-7 +-28 +29 +-2 +-19 +39 +-3 +-27 +27 +-10 +-30 +32 +-4 +-21 +40 +-2 +-23 +39 +-3 +-12 +29 +-9 +-30 +27 +-8 +-29 +37 +0 +-20 +29 +-7 +-27 +25 +-12 +-28 +40 +-3 +-27 +30 +-9 +-30 +30 +-9 +-28 +30 +1 +-20 +31 +-8 +-28 +48 +4 +-25 +48 +3 +-26 +14 +19 +17 +22 +14 +8 +9 +8 +8 +15 +10 +4 +11 +21 +3 +9 +18 +9 +3 +14 +-1 +-1 +-6 +5 +11 +13 +1 +2 +-1 +-9 +-6 +-7 +-2 +-5 +0 +-3 +-5 +16 +0 +-5 +-5 +-5 +-5 +0 +5 +-2 +-4 +-3 +12 +1 +-4 +7 +-3 +-1 +0 +8 +-4 +-3 +0 +0 +-2 +1 +-6 +0 +0 +0 +11 +0 +-1 +-2 +-1 +4 +3 +-1 +4 +6 +-3 +-3 +-3 +3 +5 +-4 +-3 +-1 +-3 +7 +5 +-2 +-4 +-3 +0 +-1 +1 +5 +10 +-2 +-3 +-1 +1 +-1 +10 +5 +-1 +-2 +2 +2 +2 +-5 +-5 +-4 +3 +1 +-2 +-4 +9 +4 +-2 +9 +8 +-3 +9 +9 +-1 +-2 +3 +16 +-1 +-7 +6 +-28 +-50 +5 +-29 +-33 +20 +-15 +-28 +22 +-15 +-37 +20 +-13 +-32 +25 +-14 +-33 +24 +-12 +-32 +33 +-7 +-24 +27 +-10 +-23 +27 +-8 +-28 +31 +-7 +-28 +33 +-7 +-25 +34 +-4 +-19 +32 +-8 +-27 +40 +-2 +-26 +28 +-9 +-21 +32 +-8 +-27 +32 +-2 +-26 +36 +-4 +-11 +31 +-8 +-23 +29 +-9 +-28 +25 +-12 +-29 +28 +-6 +-27 +33 +-6 +-25 +29 +-5 +-27 +40 +-1 +-22 +29 +-7 +-27 +30 +-9 +-23 +29 +-9 +-26 +41 +-2 +-21 +32 +-5 +-28 +42 +3 +-24 +28 +-8 +-30 +28 +-9 +-26 +43 +1 +-14 +47 +2 +-27 +22 +-12 +-25 +32 +-9 +-27 +29 +-10 +-30 +30 +-6 +-27 +29 +-7 +-29 +45 +2 +-24 +30 +-7 +-25 +31 +-3 +-27 +31 +-8 +-30 +36 +-5 +-20 +32 +-8 +-16 +29 +-11 +-23 +14 +29 +31 +28 +23 +18 +9 +10 +4 +6 +2 +6 +1 +8 +1 +7 +10 +4 +1 +12 +0 +6 +1 +-4 +-3 +6 +-1 +11 +3 +3 +1 +-4 +1 +-4 +10 +9 +-3 +-7 +0 +-1 +1 +10 +3 +0 +-5 +-4 +-2 +14 +0 +0 +-7 +-1 +-4 +-4 +2 +-2 +-1 +-3 +-3 +13 +16 +11 +-4 +-6 +-5 +-3 +-6 +-3 +11 +20 +-1 +-4 +3 +-2 +-5 +-4 +-6 +-3 +-4 +-3 +2 +-1 +-4 +4 +-1 +3 +5 +14 +3 +-4 +-3 +-3 +-4 +-5 +-2 +0 +7 +15 +0 +0 +4 +-3 +-3 +1 +4 +-5 +-1 +-3 +-6 +1 +-3 +7 +4 +0 +-4 +2 +-1 +6 +-1 +-3 +4 +10 +0 +-2 +-2 +-2 +11 +4 +-31 +9 +-25 +-45 +14 +-18 +-40 +20 +-19 +-31 +18 +-12 +-31 +21 +-15 +-34 +25 +-2 +-21 +25 +-13 +-32 +31 +-2 +-15 +31 +-9 +-21 +34 +-5 +-28 +30 +-9 +-17 +41 +4 +-25 +26 +-11 +-28 +46 +2 +-21 +40 +-3 +-26 +28 +-12 +-34 +24 +-13 +-27 +23 +-13 +-31 +26 +-2 +-22 +24 +-10 +-23 +32 +-7 +-14 +47 +3 +-26 +27 +-10 +-20 +35 +-6 +-29 +41 +-1 +-28 +30 +-8 +-31 +42 +-1 +-12 +28 +-11 +-32 +24 +-11 +-28 +31 +-9 +-31 +27 +-10 +-19 +26 +-10 +-9 +33 +-6 +-22 +25 +-12 +-31 +44 +3 +-24 +29 +-2 +-28 +36 +-6 +-28 +38 +3 +-24 +26 +-8 +-30 +26 +0 +-28 +37 +-5 +-29 +28 +-10 +-29 +29 +-9 +-27 +25 +-11 +-28 +32 +-6 +-20 +38 +-3 +-27 +33 +-2 +-26 +33 +-5 +17 +21 +19 +24 +26 +18 +25 +11 +4 +6 +4 +7 +2 +6 +2 +2 +6 +5 +8 +0 +0 +2 +0 +4 +-1 +2 +-2 +5 +4 +0 +-2 +13 +2 +-4 +17 +1 +6 +-5 +-6 +-4 +9 +6 +-3 +4 +2 +-5 +-2 +-5 +-4 +-3 +-1 +14 +7 +-4 +-4 +0 +12 +10 +-5 +-2 +-6 +5 +11 +0 +-6 +-5 +10 +-1 +-5 +3 +-3 +1 +-4 +-1 +-5 +2 +-5 +-6 +2 +6 +4 +-4 +-5 +0 +-3 +-2 +-1 +1 +-2 +-2 +5 +13 +6 +-2 +-3 +0 +0 +-2 +-2 +7 +-2 +-3 +0 +16 +0 +-1 +10 +-1 +-5 +-3 +-4 +3 +-1 +6 +-2 +3 +1 +-2 +-3 +-3 +6 +12 +-2 +4 +-1 +5 +2 +-2 +9 +-22 +-47 +6 +-24 +-45 +11 +-22 +-34 +28 +-12 +-31 +20 +-16 +-31 +34 +-7 +-31 +41 +4 +-26 +23 +-14 +-27 +27 +-11 +-31 +28 +-8 +-22 +27 +-5 +-21 +33 +-7 +-28 +29 +-2 +-18 +27 +-11 +-30 +29 +-7 +-22 +30 +-9 +-27 +30 +-4 +-11 +48 +4 +-23 +34 +-5 +-31 +24 +-10 +-27 +45 +6 +-24 +29 +-10 +-17 +37 +-4 +-27 +30 +-10 +-31 +25 +-11 +-30 +38 +1 +-25 +32 +-7 +-30 +27 +-11 +-30 +34 +-5 +-26 +34 +-6 +-25 +35 +-5 +-29 +34 +-2 +-25 +27 +-10 +-19 +28 +-9 +-29 +35 +-6 +-25 +44 +1 +-18 +33 +-7 +-30 +29 +-9 +-30 +26 +-11 +-29 +26 +-10 +-18 +45 +4 +-23 +31 +-8 +-16 +43 +2 +-27 +29 +-9 +-22 +41 +-2 +-19 +29 +-9 +-31 +23 +-14 +-31 +30 +-4 +-18 +20 +34 +23 +15 +22 +15 +10 +15 +21 +23 +5 +2 +4 +1 +2 +0 +9 +-2 +3 +-1 +-2 +6 +0 +-1 +2 +-2 +-1 +-3 +-3 +-1 +2 +-4 +1 +4 +0 +-1 +10 +4 +6 +6 +-3 +-3 +13 +15 +-2 +7 +-5 +-1 +-5 +10 +-1 +-5 +-5 +-2 +-4 +4 +-2 +0 +-4 +-5 +-2 +2 +3 +-2 +8 +-2 +4 +-3 +4 +1 +1 +-3 +-3 +8 +-2 +1 +-3 +8 +0 +9 +5 +-4 +4 +-4 +1 +4 +-7 +-6 +-5 +1 +7 +-2 +-4 +-2 +3 +-1 +3 +-1 +-2 +-2 +7 +8 +6 +13 +2 +1 +-4 +2 +-3 +2 +-5 +5 +3 +-1 +-2 +-1 +-1 +9 +-3 +5 +6 +-4 +0 +-3 +-3 +11 +-4 +-4 +-1 +-3 +-4 +9 +-2 +0 +-5 +-5 +-4 +2 +-2 +-2 +-4 +-1 +4 +20 +1 +-4 +7 +-2 +5 +2 +3 +1 +-2 +9 +-3 +1 +9 +0 +-3 +-2 +2 +-4 +-2 +6 +2 +-5 +-3 +-2 +-2 +-2 +1 +12 +6 +14 +3 +7 +5 +1 +-6 +-5 +-5 +6 +8 +12 +5 +-3 +-5 +-3 +11 +-2 +-5 +10 +-1 +-8 +-2 +-1 +2 +-2 +-7 +-5 +2 +13 +8 +-5 +-3 +-6 +-5 +3 +-3 +-2 +-5 +-3 +-4 +1 +14 +3 +3 +-4 +2 +1 +1 +-4 +-3 +0 +-2 +4 +-3 +-1 +5 +20 +0 +1 +2 +4 +5 +1 +-6 +-6 +7 +-1 +14 +-2 +-9 +-3 +5 +0 +-4 +-6 +13 +-1 +-3 +2 +-2 +-4 +4 +10 +-26 +6 +-26 +-46 +6 +-25 +-44 +19 +-18 +-38 +19 +-15 +-19 +27 +-13 +-27 +29 +-10 +-21 +30 +-10 +-19 +41 +1 +-15 +32 +-5 +-17 +33 +-5 +-24 +21 +-16 +-32 +26 +-8 +-30 +25 +-9 +-26 +43 +0 +-23 +28 +-2 +-20 +28 +-8 +-18 +30 +-10 +-31 +24 +-4 +-26 +30 +1 +-23 +39 +-1 +-24 +30 +-8 +-27 +35 +-6 +-29 +33 +-8 +-31 +32 +0 +-27 +32 +-6 +-28 +26 +-1 +-25 +34 +-7 +-25 +35 +-6 +-25 +33 +-8 +-26 +38 +-4 +-27 +31 +1 +-25 +34 +-6 +-29 +25 +-11 +-17 +28 +-10 +-17 +27 +-11 +-21 +33 +-7 +-30 +29 +-5 +-25 +37 +-4 +-29 +30 +-9 +-30 +40 +-2 +-26 +27 +-12 +-28 +40 +-2 +-28 +28 +-11 +-27 +28 +-8 +-28 +31 +-6 +-26 +33 +5 +-21 +40 +-3 +-18 +31 +-6 +-23 +26 +-12 +-31 +43 +1 +-20 +30 +-5 +-29 +27 +-10 +-26 +32 +-6 +-22 +29 +-8 +-29 +26 +1 +-23 +30 +-6 +-27 +28 +-10 +-27 +34 +-3 +-20 +30 +-8 +-25 +28 +-6 +-27 +30 +-8 +-26 +47 +3 +-23 +42 +1 +-25 +26 +-7 +-28 +35 +-5 +-14 +45 +1 +-27 +33 +-8 +-31 +34 +-5 +-25 +27 +-9 +-28 +37 +2 +-24 +26 +-12 +-16 +27 +-11 +-18 +37 +-4 +-26 +34 +-6 +-29 +23 +-11 +-25 +27 +-8 +-28 +27 +-10 +-27 +28 +-9 +-26 +28 +2 +-23 +48 +3 +-22 +27 +-10 +-25 +38 +1 +-27 +30 +-7 +-30 +26 +-3 +-18 +26 +-9 +-25 +41 +-2 +-12 +29 +-11 +-18 +44 +0 +-25 +22 +-14 +-24 +27 +-12 +-30 +25 +-9 +-26 +29 +-10 +-30 +35 +-6 +-24 +30 +-7 +-30 +28 +-4 +-27 +28 +-10 +30 +26 +32 +26 +16 +10 +6 +17 +14 +15 +3 +4 +5 +6 +1 +0 +0 +1 +-1 +3 +4 +0 +4 +0 +3 +2 +5 +13 +18 +1 +5 +-2 +-6 +-3 +2 +18 +-1 +-3 +-7 +-8 +1 +3 +-2 +-1 +1 +-3 +-3 +-3 +-3 +7 +-2 +7 +-2 +-4 +-2 +2 +-5 +2 +2 +1 +-1 +18 +2 +10 +-3 +10 +6 +-5 +3 +-4 +1 +11 +5 +2 +-7 +-7 +-5 +-2 +-4 +2 +-3 +-3 +2 +0 +8 +-1 +2 +-4 +-3 +8 +7 +2 +9 +-1 +2 +5 +-3 +1 +-7 +4 +-3 +-6 +-6 +3 +-3 +1 +14 +-1 +-5 +-2 +1 +-6 +-3 +-1 +-2 +1 +3 +10 +12 +-2 +0 +-5 +-2 +-5 +-6 +0 +13 +11 +11 +-25 +-49 +14 +-23 +-32 +24 +-15 +-37 +18 +-19 +-35 +17 +-16 +-32 +32 +-6 +-29 +21 +-7 +-22 +26 +-13 +-29 +28 +-8 +-30 +28 +-9 +-11 +31 +-7 +-12 +29 +-10 +-30 +28 +-10 +-29 +40 +-3 +-25 +28 +-9 +-29 +29 +-6 +-25 +40 +1 +-25 +30 +-10 +-26 +27 +-10 +-29 +29 +-8 +-26 +28 +-8 +-27 +36 +-5 +-20 +35 +-5 +-26 +39 +-2 +-23 +35 +-1 +-15 +34 +-5 +-24 +34 +-7 +-30 +31 +-1 +-15 +28 +-11 +-26 +29 +-10 +-30 +34 +-5 +-26 +30 +-7 +-25 +32 +-5 +-25 +40 +5 +-24 +28 +-9 +-30 +27 +-9 +-28 +48 +3 +-24 +29 +-9 +-27 +31 +-7 +-30 +26 +-11 +-30 +28 +-8 +-25 +27 +-5 +-27 +39 +-2 +-25 +27 +-11 +-24 +40 +5 +-21 +37 +-3 +-25 +26 +-6 +-29 +26 +-8 +-24 +20 +30 +27 +27 +32 +16 +9 +15 +9 +6 +4 +5 +5 +15 +7 +6 +10 +-1 +-1 +-2 +5 +4 +10 +0 +10 +2 +2 +-3 +-6 +-4 +-2 +1 +2 +-1 +3 +1 +-1 +-1 +-3 +16 +2 +2 +0 +3 +3 +-4 +-2 +12 +-1 +0 +-4 +12 +-2 +-2 +-7 +0 +-1 +-6 +0 +14 +6 +3 +-3 +4 +2 +8 +-5 +-2 +-6 +-4 +-2 +1 +-4 +-2 +-2 +4 +-4 +0 +-3 +-3 +1 +2 +2 +-1 +6 +2 +-2 +0 +2 +0 +-2 +-2 +-1 +6 +9 +1 +1 +-1 +6 +15 +0 +-3 +-3 +-5 +-5 +-2 +1 +4 +-2 +14 +12 +7 +-4 +7 +5 +-4 +-5 +2 +0 +15 +-2 +-5 +1 +-1 +-2 +-6 +3 +0 +9 +-28 +-47 +12 +-24 +-46 +15 +-21 +-42 +18 +-19 +-35 +37 +-5 +-31 +25 +-7 +-26 +23 +-11 +-16 +29 +-9 +-30 +29 +-3 +-23 +31 +-9 +-29 +37 +-5 +-29 +29 +-10 +-29 +28 +-7 +-15 +33 +-7 +-22 +30 +-6 +-16 +37 +-5 +-26 +26 +-12 +-28 +36 +-3 +-10 +29 +-9 +-32 +42 +1 +-17 +32 +-7 +-32 +25 +-5 +-30 +39 +-3 +-26 +31 +-9 +-17 +37 +-5 +-30 +27 +-6 +-30 +28 +-10 +-26 +32 +-3 +-27 +26 +-9 +-21 +33 +-6 +-18 +32 +-7 +-30 +32 +-3 +-11 +29 +-10 +-27 +25 +-12 +-25 +24 +-10 +-26 +33 +-7 +-11 +34 +-6 +-27 +38 +3 +-23 +28 +-8 +-28 +27 +-11 +-27 +33 +-6 +-26 +37 +-3 +-27 +36 +-4 +-28 +29 +-10 +-27 +29 +-9 +-26 +33 +-2 +-25 +27 +-8 +-22 +31 +-2 +-15 +30 +22 +20 +33 +22 +13 +18 +7 +6 +19 +10 +5 +7 +12 +14 +10 +3 +-1 +-2 +-4 +9 +0 +-5 +-3 +3 +1 +1 +15 +-1 +2 +-2 +15 +-1 +0 +-4 +1 +5 +-1 +1 +-6 +1 +-5 +-6 +0 +0 +-2 +-5 +6 +13 +1 +0 +3 +-4 +-3 +-3 +-4 +0 +-3 +-3 +-4 +-2 +3 +15 +13 +-2 +-4 +-3 +-3 +-4 +12 +-1 +0 +1 +0 +-2 +-4 +-5 +4 +-4 +-2 +2 +9 +-1 +5 +1 +-3 +-2 +-2 +11 +5 +-4 +5 +5 +7 +2 +0 +-2 +3 +-2 +-2 +-1 +-5 +-3 +2 +9 +-3 +-1 +-1 +-3 +-2 +1 +13 +10 +-4 +-4 +-2 +6 +0 +9 +1 +-1 +2 +-6 +9 +-5 +-4 +0 +14 +-24 +9 +-27 +-42 +11 +-24 +-42 +13 +-22 +-37 +26 +-13 +-32 +34 +-8 +-31 +27 +-12 +-24 +34 +-8 +-28 +24 +-11 +-26 +24 +-11 +-30 +39 +1 +-26 +27 +-8 +-15 +27 +-11 +-27 +28 +-11 +-24 +42 +0 +-27 +30 +-8 +-26 +27 +-10 +-21 +30 +-10 +-15 +41 +-1 +-23 +30 +-8 +-31 +37 +1 +-27 +28 +-11 +-26 +30 +-7 +-28 +28 +-3 +-12 +45 +2 +-25 +27 +-9 +-32 +31 +-9 +-28 +30 +2 +-25 +29 +-10 +-31 +31 +-6 +-13 +28 +-10 +-28 +48 +3 +-26 +25 +-12 +-31 +40 +-1 +-15 +26 +-9 +-27 +37 +-2 +-22 +23 +-7 +-23 +27 +-11 +-29 +29 +-9 +-30 +29 +-10 +-25 +28 +-10 +-16 +44 +0 +-18 +30 +-5 +-17 +28 +-9 +-31 +26 +-10 +-24 +33 +-8 +-27 +29 +-9 +-23 +33 +-8 +-26 +34 +-6 +11 +21 +23 +17 +16 +20 +22 +10 +7 +7 +11 +6 +10 +7 +6 +2 +11 +0 +3 +3 +5 +-1 +8 +1 +-1 +4 +0 +12 +5 +5 +1 +-5 +-3 +5 +0 +-1 +7 +10 +13 +-4 +-8 +-6 +-5 +-5 +-3 +1 +1 +2 +-4 +-1 +-4 +-2 +-4 +-2 +0 +-3 +5 +3 +0 +-3 +-4 +0 +4 +-2 +5 +8 +1 +-2 +-4 +7 +-2 +-3 +5 +1 +-3 +1 +10 +9 +0 +-2 +-4 +8 +-1 +2 +-2 +-3 +-5 +8 +5 +4 +5 +-5 +9 +7 +-4 +14 +-2 +-1 +-5 +2 +-4 +-3 +-7 +2 +-1 +16 +-1 +-1 +-5 +-4 +-2 +-7 +-3 +3 +0 +11 +14 +11 +-5 +-4 +-5 +1 +-7 +-3 +-4 +-3 +-3 +2 +-1 +-2 +-3 +-1 +-4 +0 +7 +-2 +9 +0 +-1 +-1 +10 +2 +-2 +-1 +-4 +1 +13 +3 +-3 +-4 +-6 +-2 +8 +-1 +2 +-3 +-3 +1 +14 +-1 +-4 +3 +13 +4 +4 +14 +8 +-3 +6 +10 +-3 +-6 +-3 +0 +-5 +-3 +-1 +-3 +9 +7 +-6 +4 +-1 +-1 +-3 +-6 +-4 +-5 +3 +0 +-4 +-1 +-1 +-2 +-5 +6 +-2 +15 +-1 +-3 +2 +0 +8 +9 +-2 +6 +0 +-4 +-6 +-3 +-3 +3 +-4 +-1 +-4 +5 +9 +8 +17 +-1 +1 +-3 +-6 +1 +-4 +-5 +0 +-4 +-2 +-2 +-3 +3 +0 +0 +5 +1 +-2 +0 +12 +-2 +-3 +-1 +11 +10 +4 +0 +-5 +-7 +-4 +-7 +-1 +3 +14 +5 +-2 +-1 +20 +-19 +-46 +16 +-23 +-43 +10 +-23 +-30 +24 +-12 +-26 +18 +-18 +-34 +21 +-7 +-29 +27 +-9 +-32 +27 +-10 +-28 +32 +-7 +-27 +27 +-7 +-27 +32 +1 +-26 +31 +-3 +-28 +34 +-6 +-30 +26 +-6 +-28 +30 +-7 +-23 +32 +-7 +-22 +35 +-4 +-26 +31 +-8 +-28 +28 +-10 +-26 +30 +-8 +-24 +36 +2 +-25 +30 +-8 +-16 +42 +2 +-25 +28 +-9 +-19 +33 +-5 +-27 +35 +-6 +-28 +26 +-11 +-30 +37 +-5 +-18 +29 +-8 +-30 +29 +-3 +-21 +28 +-10 +-27 +35 +-4 +-26 +32 +-2 +-12 +38 +-3 +-24 +43 +0 +-28 +30 +-10 +-30 +27 +-11 +-29 +43 +-1 +-13 +32 +-8 +-22 +25 +-12 +-29 +31 +-7 +-28 +30 +-9 +-29 +31 +6 +-23 +30 +-10 +-30 +30 +-6 +-15 +34 +-4 +-26 +29 +-7 +-30 +32 +-6 +-28 +19 +28 +27 +33 +19 +13 +16 +11 +24 +10 +6 +5 +6 +14 +21 +3 +16 +0 +4 +-4 +-3 +-2 +-2 +-2 +6 +-3 +-6 +2 +-1 +1 +-2 +-2 +-3 +1 +2 +-1 +-3 +2 +0 +-1 +4 +0 +-1 +15 +0 +-1 +2 +-5 +-4 +16 +1 +-2 +-4 +12 +-1 +-4 +-2 +-5 +5 +5 +-3 +-2 +-1 +-3 +-4 +-1 +0 +12 +16 +-2 +4 +-1 +3 +0 +0 +6 +-5 +-4 +-5 +-4 +-3 +-4 +4 +-1 +-2 +-2 +-1 +0 +-2 +3 +12 +0 +0 +1 +13 +9 +-3 +-4 +-6 +-2 +0 +-5 +-1 +4 +6 +-3 +-3 +7 +0 +-4 +-3 +-2 +-2 +2 +-5 +-3 +1 +0 +4 +0 +0 +1 +-2 +0 +2 +-2 +4 +1 +16 +-21 +-40 +14 +-23 +-43 +23 +-9 +-26 +32 +-9 +-30 +17 +-18 +-38 +20 +-15 +-31 +26 +-4 +-22 +25 +-8 +-30 +46 +2 +-25 +38 +-4 +-28 +24 +-12 +-22 +38 +-3 +-30 +27 +-9 +-30 +37 +-2 +-18 +26 +-12 +-31 +26 +-10 +-31 +27 +-6 +-29 +47 +2 +-25 +39 +-3 +-28 +26 +-8 +-20 +41 +-2 +-27 +29 +-10 +-24 +31 +-7 +-29 +36 +-6 +-29 +26 +-11 +-22 +27 +-11 +-30 +28 +-6 +-28 +33 +4 +-23 +29 +-9 +-29 +30 +-5 +-18 +41 +-1 +-19 +35 +-5 +-29 +27 +-10 +-29 +28 +-10 +-27 +36 +-4 +-16 +41 +-2 +-24 +28 +-9 +-29 +41 +-2 +-24 +28 +-10 +-32 +28 +-10 +-26 +30 +-2 +-19 +34 +-6 +-29 +32 +-7 +-27 +42 +2 +-24 +27 +-10 +-12 +30 +-8 +-29 +37 +-4 +-28 +30 +-10 +-30 +14 +19 +28 +23 +22 +18 +16 +9 +12 +19 +6 +3 +2 +16 +7 +-2 +1 +2 +1 +2 +2 +14 +12 +-1 +-2 +2 +3 +2 +4 +6 +-4 +-3 +-6 +5 +6 +2 +-5 +6 +-4 +-2 +-3 +3 +6 +-2 +-2 +-1 +6 +-3 +-4 +6 +-2 +8 +3 +-4 +0 +5 +-4 +2 +2 +-3 +-4 +-4 +1 +-3 +2 +-5 +0 +-1 +-4 +6 +-1 +9 +13 +8 +1 +1 +-6 +-4 +10 +16 +8 +-5 +2 +-2 +0 +8 +-2 +-6 +-5 +-4 +-2 +5 +-1 +-2 +-4 +-3 +2 +-3 +3 +0 +-3 +6 +-3 +-2 +-2 +2 +9 +5 +3 +-3 +0 +-1 +-3 +-1 +-1 +-3 +-4 +-2 +3 +11 +11 +-2 +4 +7 +2 +-4 +-9 +-6 +30 +-12 +-42 +4 +-31 +-48 +10 +-21 +-36 +25 +-13 +-32 +25 +-10 +-29 +23 +-15 +-34 +26 +-5 +-30 +26 +-11 +-26 +28 +-10 +-28 +39 +-3 +-25 +26 +-11 +-23 +29 +-7 +-27 +39 +2 +-13 +34 +-7 +-29 +25 +-2 +-19 +29 +-8 +-27 +24 +-11 +-23 +33 +-7 +-27 +29 +-4 +-18 +47 +4 +-25 +30 +-5 +-18 +25 +-12 +-30 +30 +-5 +-30 +29 +-5 +-27 +35 +-5 +-24 +29 +-8 +-15 +28 +-1 +-27 +34 +2 +-24 +35 +-6 +-27 +26 +-12 +-30 +34 +-4 +-23 +32 +-9 +-27 +33 +-6 +-28 +32 +-5 +-25 +32 +2 +-25 +29 +-10 +-26 +35 +-6 +-21 +32 +-8 +-29 +31 +-7 +-30 +34 +-6 +-14 +41 +-1 +-27 +32 +-9 +-23 +35 +-5 +-15 +28 +-9 +-28 +24 +-11 +-32 +28 +-4 +-26 +27 +-9 +-26 +28 +-10 +-15 +48 +4 +-21 +46 +2 +-27 +28 +-11 +-28 +29 +-9 +-28 +25 +-8 +-26 +40 +-3 +-25 +25 +-2 +-27 +27 +-11 +-31 +29 +-7 +-26 +26 +-11 +-29 +30 +-7 +-20 +29 +-9 +-11 +34 +-6 +-25 +30 +-7 +-14 +35 +-5 +-28 +29 +-9 +-20 +28 +-9 +-19 +28 +-9 +-28 +27 +-8 +-20 +45 +0 +-21 +36 +-5 +-23 +32 +-6 +-29 +26 +-11 +-29 +33 +-8 +-25 +36 +-3 +-21 +40 +-2 +-27 +42 +0 +-28 +26 +-12 +-25 +34 +-6 +-28 +41 +-2 +-20 +26 +-11 +-32 +36 +-6 +-29 +30 +-9 +-29 +29 +-10 +-10 +31 +-9 +-29 +28 +-9 +-27 +37 +5 +-24 +30 +-10 +-30 +39 +-3 +-24 +41 +-2 +-29 +25 +-10 +-30 +27 +-10 +-23 +35 +-3 +-27 +27 +-5 +-28 +31 +-8 +-28 +27 +-10 +-26 +29 +-8 +-28 +33 +-6 +-22 +21 +24 +38 +26 +21 +19 +16 +14 +21 +8 +2 +3 +5 +6 +5 +3 +6 +6 +3 +-1 +1 +11 +0 +2 +-3 +3 +13 +1 +-3 +-1 +7 +4 +-2 +12 +7 +-1 +-5 +0 +-4 +-1 +-4 +6 +15 +11 +-4 +7 +-1 +-6 +-6 +-6 +-7 +-5 +-3 +5 +0 +-3 +4 +2 +-3 +-2 +-4 +-2 +1 +-2 +3 +1 +4 +-3 +0 +4 +2 +3 +2 +-2 +-1 +-2 +0 +2 +-1 +-1 +7 +3 +3 +4 +-1 +13 +9 +2 +-8 +-7 +2 +0 +-5 +-2 +1 +7 +6 +-2 +1 +-3 +0 +-5 +1 +2 +-3 +-1 +1 +-3 +-1 +7 +-4 +4 +14 +11 +-1 +-6 +-6 +-1 +11 +0 +-1 +-1 +3 +10 +9 +3 +-3 +-4 +3 +-1 +-4 +-4 +-7 +3 +10 +-1 +13 +13 +0 +-7 +-5 +-4 +-6 +-2 +-6 +-4 +-3 +-3 +2 +13 +2 +-2 +1 +-4 +5 +0 +-6 +-1 +-1 +-1 +-3 +-2 +-2 +1 +0 +0 +0 +0 +1 +-1 +-2 +5 +1 +17 +1 +0 +7 +-2 +4 +-2 +-6 +-6 +-4 +-3 +1 +-2 +0 +16 +11 +1 +-4 +6 +-2 +-4 +6 +0 +-4 +1 +-1 +0 +4 +7 +-2 +0 +-4 +18 +1 +14 +-2 +2 +-1 +-7 +-5 +-4 +16 +0 +-5 +-5 +-7 +-2 +-1 +4 +3 +3 +-1 +12 +9 +6 +8 +17 +-2 +-8 +6 +5 +-5 +-2 +-8 +-5 +8 +0 +-6 +-7 +-3 +0 +-4 +11 +19 +0 +-5 +1 +6 +5 +-2 +-4 +-3 +-7 +11 +-26 +-51 +3 +-29 +-46 +11 +-21 +-34 +19 +-17 +-23 +32 +-3 +-29 +26 +-12 +-30 +23 +-10 +-28 +32 +-8 +-23 +32 +-4 +-28 +41 +-3 +-28 +26 +-12 +-32 +26 +-10 +-28 +26 +-11 +-19 +35 +-7 +-24 +30 +-7 +-28 +35 +-4 +-24 +30 +-7 +-28 +32 +-6 +-19 +28 +-8 +-26 +29 +-9 +-26 +29 +-6 +-28 +32 +-4 +-13 +35 +5 +-23 +30 +-7 +-22 +27 +-10 +-29 +44 +7 +-22 +32 +-7 +-29 +29 +-4 +-27 +30 +-9 +-25 +39 +-4 +-28 +41 +-2 +-27 +35 +-6 +-27 +36 +-5 +-27 +26 +-11 +-30 +35 +-5 +-21 +35 +-2 +-26 +33 +-4 +-27 +43 +5 +-24 +27 +-7 +-33 +30 +-2 +-28 +29 +-7 +-31 +27 +-4 +-26 +46 +2 +-15 +27 +-13 +-32 +24 +-13 +-29 +26 +-8 +-28 +29 +-9 +-27 +32 +-7 +-26 +22 +25 +24 +26 +22 +14 +13 +10 +23 +16 +6 +15 +8 +5 +0 +2 +2 +1 +0 +1 +2 +1 +-1 +4 +15 +22 +4 +1 +6 +-3 +-1 +5 +-1 +4 +-2 +-7 +-5 +-3 +0 +9 +7 +-1 +16 +0 +1 +2 +-1 +-5 +-1 +-1 +-1 +-1 +2 +2 +-4 +-2 +-1 +13 +8 +-5 +9 +16 +-3 +-6 +-6 +13 +12 +0 +-7 +0 +-8 +-3 +-6 +0 +-6 +-4 +2 +8 +-1 +-2 +-7 +3 +1 +-4 +-4 +-2 +-3 +-3 +11 +2 +-1 +14 +9 +13 +-4 +-5 +-6 +0 +-5 +-3 +-3 +0 +8 +11 +-3 +-4 +14 +-2 +-6 +-6 +-3 +11 +7 +5 +1 +7 +-6 +-8 +11 +-1 +0 +-1 +-6 +1 +-3 +0 +11 +1 +8 +-26 +-50 +5 +-29 +-36 +12 +-23 +-41 +39 +-5 +-32 +17 +-11 +-33 +21 +-15 +-33 +39 +-3 +-21 +24 +-14 +-32 +29 +-9 +-22 +28 +-10 +-26 +30 +-8 +-29 +32 +-2 +-26 +31 +-8 +-23 +32 +-8 +-26 +34 +-4 +-28 +27 +-7 +-28 +33 +-3 +-26 +32 +-7 +-18 +39 +-2 +-19 +28 +-10 +-27 +40 +-1 +-28 +45 +1 +-26 +40 +-1 +-18 +31 +-8 +-21 +36 +-5 +-30 +25 +-13 +-31 +25 +-9 +-22 +42 +-1 +-28 +35 +0 +-28 +29 +-7 +-16 +44 +0 +-25 +30 +-5 +-25 +20 +-16 +-26 +24 +-14 +-30 +41 +2 +-15 +29 +-11 +-32 +25 +-12 +-31 +40 +1 +-25 +26 +-11 +-28 +26 +-11 +-30 +37 +-2 +-18 +36 +-4 +-29 +33 +-7 +-28 +29 +-9 +-27 +44 +2 +-26 +40 +-3 +-25 +26 +-11 +-14 +30 +-9 +-30 +19 +34 +19 +23 +14 +27 +22 +9 +18 +6 +2 +13 +8 +0 +13 +14 +1 +12 +1 +-5 +-6 +4 +-3 +1 +-4 +-5 +-4 +3 +-2 +-2 +0 +-2 +17 +2 +-3 +-7 +-2 +0 +5 +12 +1 +-2 +-1 +-5 +-4 +-3 +-1 +-1 +-1 +0 +13 +-1 +2 +-1 +15 +8 +-5 +6 +1 +-3 +-2 +12 +1 +-4 +-1 +-2 +2 +-3 +11 +8 +-5 +-3 +-5 +1 +-6 +-4 +-4 +-4 +-3 +7 +13 +-1 +4 +10 +-4 +1 +-4 +3 +7 +0 +11 +4 +-6 +-6 +-2 +-4 +-3 +9 +-4 +0 +10 +11 +-3 +-2 +-8 +-2 +0 +1 +6 +1 +-2 +6 +5 +0 +-8 +-8 +-7 +1 +-5 +-3 +13 +3 +-3 +-3 +-4 +-3 +5 +8 +16 +-23 +-46 +5 +-30 +-38 +26 +-14 +-39 +16 +-19 +-38 +20 +-13 +-32 +23 +-12 +-31 +26 +-1 +-23 +28 +-9 +-27 +41 +-2 +-19 +29 +-7 +-28 +36 +0 +-26 +30 +-9 +-22 +38 +-3 +-23 +42 +-1 +-28 +34 +-6 +-30 +24 +-12 +-22 +43 +-1 +-26 +25 +-11 +26 +-5 +-30 +33 +-1 +-25 +26 +-12 +-32 +25 +-12 +-24 +25 +-12 +-24 +38 +-3 +-26 +33 +-6 +-27 +33 +-5 +-29 +27 +-11 +-25 +37 +-3 +-26 +28 +-10 +-27 +35 +-1 +-26 +28 +-8 +-25 +35 +-4 +-12 +31 +-9 +-27 +27 +-9 +-18 +45 +0 +-23 +27 +-11 +-28 +28 +-2 +-25 +30 +-4 +-28 +37 +-5 +-14 +28 +-11 +-31 +33 +-7 +-18 +36 +-5 +-21 +29 +-10 +-29 +37 +-4 +-25 +30 +-2 +-22 +25 +-10 +-19 +28 +-11 +-23 +25 +-12 +-29 +23 +26 +21 +34 +33 +23 +18 +9 +13 +3 +6 +3 +6 +2 +4 +0 +5 +12 +2 +-2 +0 +-1 +5 +2 +-1 +7 +3 +3 +1 +7 +2 +-4 +-3 +-4 +-3 +2 +7 +0 +7 +13 +9 +2 +12 +-4 +-2 +12 +-3 +-4 +-5 +-5 +-4 +-3 +11 +-1 +-6 +-5 +9 +6 +4 +0 +-7 +-6 +-4 +-3 +4 +-5 +11 +15 +-1 +0 +-1 +-1 +7 +-4 +-5 +-3 +-6 +-1 +12 +3 +-6 +-4 +6 +-5 +-4 +-4 +2 +-3 +-2 +12 +-3 +-6 +0 +-5 +-2 +-4 +-2 +-1 +11 +-1 +6 +1 +-1 +-4 +3 +17 +2 +2 +-4 +12 +1 +7 +7 +-5 +-2 +-3 +-4 +4 +-1 +-7 +-2 +-2 +13 +1 +2 +0 +-1 +0 +7 +-30 +-46 +7 +-26 +-42 +14 +-21 +-25 +23 +-16 +-37 +22 +-14 +-33 +33 +-5 +-29 +32 +-8 +-22 +23 +-10 +-24 +29 +1 +-25 +26 +-10 +-19 +35 +-4 +-29 +31 +-8 +-30 +28 +-10 +-16 +45 +6 +-23 +23 +-12 +-29 +27 +-10 +-30 +36 +-6 +-23 +28 +-9 +-12 +31 +-8 +-29 +30 +4 +-24 +31 +-7 +-16 +38 +-3 +-28 +25 +-9 +-17 +31 +-8 +-29 +28 +-11 +-30 +28 +-9 +-21 +34 +-5 +-19 +29 +-5 +-27 +27 +-10 +-24 +31 +0 +-26 +34 +-6 +-28 +30 +-9 +-21 +32 +-1 +-24 +34 +-5 +-28 +31 +-8 +-29 +43 +1 +-26 +28 +-10 +-23 +39 +-3 +-22 +25 +-10 +-29 +37 +-4 +-29 +41 +1 +-27 +25 +-8 +-23 +30 +-8 +-29 +28 +-9 +-24 +34 +-6 +-27 +39 +-2 +-27 +31 +-9 +-28 +31 +-7 +-18 +33 +33 +20 +19 +24 +33 +13 +5 +20 +17 +1 +7 +10 +-1 +-3 +-3 +-2 +-2 +3 +0 +4 +-1 +-2 +0 +-1 +-1 +16 +11 +-1 +-4 +-3 +4 +8 +6 +-4 +-4 +1 +-7 +7 +-1 +-4 +0 +-5 +-2 +1 +3 +15 +6 +7 +-2 +0 +-2 +-5 +-2 +-3 +1 +-3 +-4 +-3 +2 +13 +9 +2 +0 +-3 +-1 +3 +15 +0 +-1 +-4 +10 +-3 +-5 +-4 +9 +12 +-1 +-7 +-4 +-5 +-4 +-5 +8 +10 +0 +6 +-1 +-4 +-5 +-2 +12 +0 +-4 +0 +-3 +13 +10 +3 +-4 +-1 +7 +6 +-7 +-7 +-4 +1 +-2 +-4 +-7 +0 +3 +6 +-3 +9 +6 +1 +-2 +-3 +-2 +-4 +-6 +1 +-3 +13 +0 +-4 +3 +-2 +-36 +6 +-29 +-44 +13 +-15 +-26 +33 +-9 +-34 +18 +-17 +-37 +26 +-13 +-25 +25 +-11 +-21 +47 +2 +-23 +30 +-9 +-20 +27 +-13 +-25 +28 +-11 +-30 +24 +-8 +-28 +32 +-7 +-30 +37 +-5 +-28 +29 +-5 +-29 +28 +-8 +-23 +28 +-8 +-18 +35 +-6 +-23 +32 +-6 +-24 +27 +-11 +-29 +45 +1 +-24 +28 +-10 +-29 +33 +-7 +-29 +34 +-3 +-23 +25 +-8 +-23 +27 +-11 +-20 +34 +-1 +-17 +29 +-6 +-29 +32 +-6 +-30 +28 +-8 +-29 +43 +1 +-12 +33 +-7 +-16 +44 +1 +-27 +28 +-7 +-31 +28 +-10 +-32 +26 +-5 +-28 +25 +-10 +-29 +35 +2 +-21 +27 +-9 +-27 +28 +-10 +-28 +45 +2 +-18 +45 +0 +-27 +25 +-12 +-19 +28 +-11 +-25 +27 +-11 +-23 +42 +-2 +-27 +26 +-10 +-28 +27 +-7 +-10 +30 +25 +11 +20 +18 +12 +10 +10 +15 +9 +9 +21 +24 +5 +5 +7 +1 +-1 +1 +0 +1 +7 +-1 +-1 +16 +2 +7 +-4 +-3 +0 +2 +1 +-5 +-5 +-5 +1 +3 +1 +4 +2 +-1 +-3 +1 +-1 +-2 +1 +-3 +-1 +1 +9 +-2 +-2 +-1 +6 +5 +8 +9 +9 +5 +2 +-6 +-5 +1 +8 +0 +-2 +-7 +8 +9 +-3 +1 +-1 +-5 +1 +-2 +-4 +-5 +-2 +1 +1 +4 +-3 +-1 +-1 +8 +0 +4 +13 +2 +-4 +-6 +4 +4 +-2 +-4 +-3 +-3 +0 diff --git a/traces/mifare/ntag216-empty.json b/traces/mifare/ntag216-empty.json new file mode 100644 index 000000000..5b113c409 --- /dev/null +++ b/traces/mifare/ntag216-empty.json @@ -0,0 +1,250 @@ +{ + "Created": "proxmark3", + "FileType": "mfu", + "Card": { + "UID": "045869D29C3980", + "Version": "0004040201001303", + "TBO_0": "0000", + "TBO_1": "00", + "Signature": "1FA9FE479435E4B60280F7A2B44293DF9127471B3251BC8942F0941AD71A1755", + "Counter0": "000000", + "Tearing0": "00", + "Counter1": "000000", + "Tearing1": "00", + "Counter2": "000000", + "Tearing2": "BD" + }, + "blocks": { + "0": "045869BD", + "1": "D29C3980", + "2": "F7480000", + "3": "E1106D00", + "4": "0300FE00", + "5": "00000000", + "6": "00000000", + "7": "00000000", + "8": "00000000", + "9": "00000000", + "10": "00000000", + "11": "00000000", + "12": "00000000", + "13": "00000000", + "14": "00000000", + "15": "00000000", + "16": "00000000", + "17": "00000000", + "18": "00000000", + "19": "00000000", + "20": "00000000", + "21": "00000000", + "22": "00000000", + "23": "00000000", + "24": "00000000", + "25": "00000000", + "26": "00000000", + "27": "00000000", + "28": "00000000", + "29": "00000000", + "30": "00000000", + "31": "00000000", + "32": "00000000", + "33": "00000000", + "34": "00000000", + "35": "00000000", + "36": "00000000", + "37": "00000000", + "38": "00000000", + "39": "00000000", + "40": "00000000", + "41": "00000000", + "42": "00000000", + "43": "00000000", + "44": "00000000", + "45": "00000000", + "46": "00000000", + "47": "00000000", + "48": "00000000", + "49": "00000000", + "50": "00000000", + "51": "00000000", + "52": "00000000", + "53": "00000000", + "54": "00000000", + "55": "00000000", + "56": "00000000", + "57": "00000000", + "58": "00000000", + "59": "00000000", + "60": "00000000", + "61": "00000000", + "62": "00000000", + "63": "00000000", + "64": "00000000", + "65": "00000000", + "66": "00000000", + "67": "00000000", + "68": "00000000", + "69": "00000000", + "70": "00000000", + "71": "00000000", + "72": "00000000", + "73": "00000000", + "74": "00000000", + "75": "00000000", + "76": "00000000", + "77": "00000000", + "78": "00000000", + "79": "00000000", + "80": "00000000", + "81": "00000000", + "82": "00000000", + "83": "00000000", + "84": "00000000", + "85": "00000000", + "86": "00000000", + "87": "00000000", + "88": "00000000", + "89": "00000000", + "90": "00000000", + "91": "00000000", + "92": "00000000", + "93": "00000000", + "94": "00000000", + "95": "00000000", + "96": "00000000", + "97": "00000000", + "98": "00000000", + "99": "00000000", + "100": "00000000", + "101": "00000000", + "102": "00000000", + "103": "00000000", + "104": "00000000", + "105": "00000000", + "106": "00000000", + "107": "00000000", + "108": "00000000", + "109": "00000000", + "110": "00000000", + "111": "00000000", + "112": "00000000", + "113": "00000000", + "114": "00000000", + "115": "00000000", + "116": "00000000", + "117": "00000000", + "118": "00000000", + "119": "00000000", + "120": "00000000", + "121": "00000000", + "122": "00000000", + "123": "00000000", + "124": "00000000", + "125": "00000000", + "126": "00000000", + "127": "00000000", + "128": "00000000", + "129": "00000000", + "130": "00000000", + "131": "00000000", + "132": "00000000", + "133": "00000000", + "134": "00000000", + "135": "00000000", + "136": "00000000", + "137": "00000000", + "138": "00000000", + "139": "00000000", + "140": "00000000", + "141": "00000000", + "142": "00000000", + "143": "00000000", + "144": "00000000", + "145": "00000000", + "146": "00000000", + "147": "00000000", + "148": "00000000", + "149": "00000000", + "150": "00000000", + "151": "00000000", + "152": "00000000", + "153": "00000000", + "154": "00000000", + "155": "00000000", + "156": "00000000", + "157": "00000000", + "158": "00000000", + "159": "00000000", + "160": "00000000", + "161": "00000000", + "162": "00000000", + "163": "00000000", + "164": "00000000", + "165": "00000000", + "166": "00000000", + "167": "00000000", + "168": "00000000", + "169": "00000000", + "170": "00000000", + "171": "00000000", + "172": "00000000", + "173": "00000000", + "174": "00000000", + "175": "00000000", + "176": "00000000", + "177": "00000000", + "178": "00000000", + "179": "00000000", + "180": "00000000", + "181": "00000000", + "182": "00000000", + "183": "00000000", + "184": "00000000", + "185": "00000000", + "186": "00000000", + "187": "00000000", + "188": "00000000", + "189": "00000000", + "190": "00000000", + "191": "00000000", + "192": "00000000", + "193": "00000000", + "194": "00000000", + "195": "00000000", + "196": "00000000", + "197": "00000000", + "198": "00000000", + "199": "00000000", + "200": "00000000", + "201": "00000000", + "202": "00000000", + "203": "00000000", + "204": "00000000", + "205": "00000000", + "206": "00000000", + "207": "00000000", + "208": "00000000", + "209": "00000000", + "210": "00000000", + "211": "00000000", + "212": "00000000", + "213": "00000000", + "214": "00000000", + "215": "00000000", + "216": "00000000", + "217": "00000000", + "218": "00000000", + "219": "00000000", + "220": "00000000", + "221": "00000000", + "222": "00000000", + "223": "00000000", + "224": "00000000", + "225": "00000000", + "226": "000000BD", + "227": "040000FF", + "228": "00050000", + "229": "FFFFFFFF", + "230": "00000000" + } +} \ No newline at end of file diff --git a/traces/mifare/s20-empty-key.bin b/traces/mifare/s20-empty-key.bin new file mode 100644 index 000000000..91a45f9b9 --- /dev/null +++ b/traces/mifare/s20-empty-key.bin @@ -0,0 +1,2 @@ +\ \  + diff --git a/traces/mifare/s20-empty.json b/traces/mifare/s20-empty.json new file mode 100644 index 000000000..2ff64185c --- /dev/null +++ b/traces/mifare/s20-empty.json @@ -0,0 +1,93 @@ +{ + "Created": "proxmark3", + "FileType": "mfcard", + "Card": { + "UID": "1D357AE9", + "ATQA": "0400", + "SAK": "09" + }, + "blocks": { + "0": "1D357AE9BB890400C846002000000017", + "1": "00000000000000000000000000000000", + "2": "00000000000000000000000000000000", + "3": "FFFFFFFFFFFFFF078069FFFFFFFFFFFF", + "4": "00000000000000000000000000000000", + "5": "00000000000000000000000000000000", + "6": "00000000000000000000000000000000", + "7": "FFFFFFFFFFFFFF078069FFFFFFFFFFFF", + "8": "00000000000000000000000000000000", + "9": "00000000000000000000000000000000", + "10": "00000000000000000000000000000000", + "11": "FFFFFFFFFFFFFF078069FFFFFFFFFFFF", + "12": "00000000000000000000000000000000", + "13": "00000000000000000000000000000000", + "14": "00000000000000000000000000000000", + "15": "FFFFFFFFFFFFFF078069FFFFFFFFFFFF", + "16": "00000000000000000000000000000000", + "17": "00000000000000000000000000000000", + "18": "00000000000000000000000000000000", + "19": "FFFFFFFFFFFFFF078069FFFFFFFFFFFF" + }, + "SectorKeys": { + "0": { + "KeyA": "FFFFFFFFFFFF", + "KeyB": "FFFFFFFFFFFF", + "AccessConditions": "FF078069", + "AccessConditionsText": { + "block0": "read AB; write AB; increment AB; decrement transfer restore AB", + "block1": "read AB; write AB; increment AB; decrement transfer restore AB", + "block2": "read AB; write AB; increment AB; decrement transfer restore AB", + "block3": "write A by A; read/write ACCESS by A; read/write B by A", + "UserData": "69" + } + }, + "1": { + "KeyA": "FFFFFFFFFFFF", + "KeyB": "FFFFFFFFFFFF", + "AccessConditions": "FF078069", + "AccessConditionsText": { + "block4": "read AB; write AB; increment AB; decrement transfer restore AB", + "block5": "read AB; write AB; increment AB; decrement transfer restore AB", + "block6": "read AB; write AB; increment AB; decrement transfer restore AB", + "block7": "write A by A; read/write ACCESS by A; read/write B by A", + "UserData": "69" + } + }, + "2": { + "KeyA": "FFFFFFFFFFFF", + "KeyB": "FFFFFFFFFFFF", + "AccessConditions": "FF078069", + "AccessConditionsText": { + "block8": "read AB; write AB; increment AB; decrement transfer restore AB", + "block9": "read AB; write AB; increment AB; decrement transfer restore AB", + "block10": "read AB; write AB; increment AB; decrement transfer restore AB", + "block11": "write A by A; read/write ACCESS by A; read/write B by A", + "UserData": "69" + } + }, + "3": { + "KeyA": "FFFFFFFFFFFF", + "KeyB": "FFFFFFFFFFFF", + "AccessConditions": "FF078069", + "AccessConditionsText": { + "block12": "read AB; write AB; increment AB; decrement transfer restore AB", + "block13": "read AB; write AB; increment AB; decrement transfer restore AB", + "block14": "read AB; write AB; increment AB; decrement transfer restore AB", + "block15": "write A by A; read/write ACCESS by A; read/write B by A", + "UserData": "69" + } + }, + "4": { + "KeyA": "FFFFFFFFFFFF", + "KeyB": "FFFFFFFFFFFF", + "AccessConditions": "FF078069", + "AccessConditionsText": { + "block16": "read AB; write AB; increment AB; decrement transfer restore AB", + "block17": "read AB; write AB; increment AB; decrement transfer restore AB", + "block18": "read AB; write AB; increment AB; decrement transfer restore AB", + "block19": "write A by A; read/write ACCESS by A; read/write B by A", + "UserData": "69" + } + } + } +} \ No newline at end of file diff --git a/traces/mifare/s50-empty-key.bin b/traces/mifare/s50-empty-key.bin new file mode 100644 index 000000000..1855302bb --- /dev/null +++ b/traces/mifare/s50-empty-key.bin @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/traces/mifare/s50-empty.bin b/traces/mifare/s50-empty.bin new file mode 100644 index 000000000..283aa229d Binary files /dev/null and b/traces/mifare/s50-empty.bin differ