Merge branch 'master' of github.com:merlokk/proxmark3i into desf_update

This commit is contained in:
merlokk 2021-07-04 22:40:27 +03:00
commit b53c8bc0c9
8 changed files with 583 additions and 14 deletions

View file

@ -3,8 +3,11 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Added experimental support for macOS users utilizing MacPorts instead of Homebrew (@linuxgemini)
- Added `pm3_online_check.py` - a script to verify and initialize a Proxmark3 RDV4 device (@iceman1001)
## [midsummer.4.13441][2021-06-25]
- Fix `hf iclass` - a crash when AA1 limit was larger than AA2 (@pcunning)
- Added bruteforce function for the magic byte in `cmdlfnexwatch.c` and ability to clone with psk2 modulation (@Guilhem7, @MaximeBosca)
- Changed `hw setmux` - improve user feedback for special case (@iceman1001)
- Changed 'filename' - unified file name param across client (@iceman1001)

View file

@ -59,7 +59,10 @@ else
endif
ifeq ($(USE_BREW),1)
BREW_PREFIX = $(shell brew --prefix)
BREW_PREFIX = $(shell brew --prefix 2>/dev/null)
ifeq ($(strip $(BREW_PREFIX)),)
MACPORTS_PREFIX ?= /opt/local
endif
endif
ifeq ($(DEBUG),1)

View file

@ -25,6 +25,7 @@
||[Advanced compilation parameters](/doc/md/Use_of_Proxmark/4_Advanced-compilation-parameters.md)|[More cheat sheets](https://github.com/RfidResearchGroup/proxmark3/wiki/More-cheat-sheets)|
||**[Troubleshooting](/doc/md/Installation_Instructions/Troubleshooting.md)**|[Complete client command set](/doc/commands.md)|
||**[JTAG](/doc/jtag_notes.md)**|[T5577 Introduction Guide](/doc/T5577_Guide.md)|
||**[MacPorts (Mac OS X, experimental)](/doc/md/Installation_Instructions/Mac-OS-X-MacPorts-Installation-Instructions.md)** |
## Notes / helpful documents
@ -135,7 +136,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 / Apple Silicon M1
- Mac OS X / Homebrew (or MacPorts, experimental) / Apple Silicon M1
- Docker container
- [ RRG / Iceman repo based ubuntu 18.04 container ](https://hub.docker.com/r/secopsconsult/proxmark3)
- [ Iceman fork based container v1.7 ](https://hub.docker.com/r/iceman1001/proxmark3/)

View file

@ -14,10 +14,18 @@ vpath %.dic dictionaries
OBJDIR = obj
ifeq ($(USE_BREW),1)
INCLUDES += -I$(BREW_PREFIX)/include
LDLIBS += -L$(BREW_PREFIX)/lib
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(BREW_PREFIX)/opt/qt/lib/pkgconfig
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(BREW_PREFIX)/opt/qt5/lib/pkgconfig
ifdef MACPORTS_PREFIX
INCLUDES += -I$(MACPORTS_PREFIX)/include
LDLIBS += -L$(MACPORTS_PREFIX)/lib
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(MACPORTS_PREFIX)/lib/pkgconfig
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(MACPORTS_PREFIX)/libexec/qt/lib/pkgconfig
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(MACPORTS_PREFIX)/libexec/qt5/lib/pkgconfig
else
INCLUDES += -I$(BREW_PREFIX)/include
LDLIBS += -L$(BREW_PREFIX)/lib
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(BREW_PREFIX)/opt/qt/lib/pkgconfig
PKG_CONFIG_ENV := PKG_CONFIG_PATH=$(BREW_PREFIX)/opt/qt5/lib/pkgconfig
endif
endif
###################
@ -117,8 +125,13 @@ INCLUDES += $(HARDNESTEDLIBINC)
## Lua
ifneq ($(SKIPLUASYSTEM),1)
LUAINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags lua5.2 2>/dev/null)
LUALDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs lua5.2 2>/dev/null)
ifdef MACPORTS_PREFIX
LUAINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags lua-5.2 2>/dev/null)
LUALDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs lua-5.2 2>/dev/null)
else
LUAINCLUDES = $(shell $(PKG_CONFIG_ENV) pkg-config --cflags lua5.2 2>/dev/null)
LUALDLIBS = $(shell $(PKG_CONFIG_ENV) pkg-config --libs lua5.2 2>/dev/null)
endif
ifneq ($(LUALDLIBS),)
LUALIB =
LUALIBLD = $(LUALDLIBS)
@ -279,8 +292,12 @@ CXXINCLUDES += $(QTINCLUDES)
## Readline
ifneq ($(SKIPREADLINE),1)
ifeq ($(USE_BREW),1)
LDLIBS += -L$(BREW_PREFIX)/opt/readline/lib
INCLUDES += -I$(BREW_PREFIX)/opt/readline/include
ifdef MACPORTS_PREFIX
INCLUDES += -I$(MACPORTS_PREFIX)/include/readline
else
LDLIBS += -L$(BREW_PREFIX)/opt/readline/lib
INCLUDES += -I$(BREW_PREFIX)/opt/readline/include
endif
endif
LDLIBS += -lreadline
READLINE_FOUND = 1

View file

@ -191,11 +191,27 @@ local function read_config()
elseif cardtype == '02' then typestr = 'NTAG 216'
end
local versionstr = 'unknown'
if version == '0004030101000B03' then versionstr = 'UL EV1 48b'
elseif version == '0004030101000E03' then versionstr = 'UL EV1 128b'
elseif version == '0004040101000B03' then versionstr = 'NTAG 210'
elseif version == '0004040101000E03' then versionstr = 'NTAG 212'
elseif version == '0004040201000F03' then versionstr = 'NTAG 213'
elseif version == '0004040201001103' then versionstr = 'NTAG 215'
elseif version == '0004040201001303' then versionstr = 'NTAG 216'
elseif version == '0004040502011303' then versionstr = 'NTAG I2C 1K'
elseif version == '0004040502011503' then versionstr = 'NTAG I2C 2K'
elseif version == '0004040502021303' then versionstr = 'NTAG I2C 1K PLUS'
elseif version == '0004040502021503' then versionstr = 'NTAG I2C 2K PLUS'
elseif version == '0004040401000F03' then versionstr = 'NTAG 213F'
elseif version == '0004040401001303' then versionstr = 'NTAG 216F'
end
print('Magic NTAG 21* Configuration')
print(' - Type ', typestr, '(genuine cardtype)')
print(' - Password', pwd)
print(' - Pack ', pack)
print(' - Version ', version)
print(' - Version ', version, '(' .. versionstr .. ')')
print(' - Signature', signature1..signature2)
lib14a.disconnect()

View file

@ -1653,6 +1653,9 @@ static int CmdHFiClassDump(const char *Cmd) {
app_limit1 = card_app2_limit[type];
app_limit2 = 0;
} else if (hdr->conf.app_limit >= hdr->conf.mem_config) {
PrintAndLogEx(WARNING, "AA1 config is >= card size, using card size as AA1 limit");
app_limit1 = card_app2_limit[type];
} else {
app_limit1 = hdr->conf.app_limit;
app_limit2 = card_app2_limit[type];
@ -1674,7 +1677,12 @@ static int CmdHFiClassDump(const char *Cmd) {
PrintAndLogEx(FAILED, "Run command with keys");
return PM3_ESOFT;
}
PrintAndLogEx(INFO, "Card has atleast 2 application areas. AA1 limit %u (0x%02X) AA2 limit %u (0x%02X)", app_limit1, app_limit1, app_limit2, app_limit2);
if (app_limit2 != 0) {
PrintAndLogEx(INFO, "Card has at least 2 application areas. AA1 limit %u (0x%02X) AA2 limit %u (0x%02X)", app_limit1, app_limit1, app_limit2, app_limit2);
} else {
PrintAndLogEx(INFO, "Card has 1 application area. AA1 limit %u (0x%02X)", app_limit1, app_limit1);
}
}
iclass_dump_req_t payload = {
@ -1750,7 +1758,7 @@ static int CmdHFiClassDump(const char *Cmd) {
// AIA data
memcpy(tag_data + (8 * 5), tempbuf + (8 * 5), 8);
// AA1 data
memcpy(tag_data + (8 * 6), tempbuf + (8 * 6), (blocks_read * 8));
memcpy(tag_data + (8 * 6), tempbuf + (8 * 6), ((blocks_read - 6) * 8));
}
uint16_t bytes_got = (app_limit1 + 1) * 8;
@ -1758,7 +1766,7 @@ static int CmdHFiClassDump(const char *Cmd) {
// try AA2 Kc, Credit
bool aa2_success = false;
if (have_credit_key && pagemap != 0x01) {
if (have_credit_key && pagemap != PICOPASS_NON_SECURE_PAGEMODE && app_limit2 != 0) {
// AA2 authenticate credit key
memcpy(payload.req.key, credit_key, 8);

View file

@ -0,0 +1,72 @@
# MacPorts (Mac OS X), developer installation, ***experimental***
<b><h3>These insturctions are not tested on Apple Silicon!</h3></b>
## Prerequisites
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.
1. Have MacPorts installed. Visit https://www.macports.org/ for more information.
* MacPorts may require a bit more setup. You first need to set up your PATH variable:
```bash
export "/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
```
Although it is optional for proxmark3 repository, you can also set include variables:
```bash
export C_INCLUDE_PATH="/opt/local/include"
export CPLUS_INCLUDE_PATH="/opt/local/include"
export LIBRARY_PATH="/opt/local/lib"
export LDFLAGS="-L/opt/local/lib"
export CFLAGS="-I/opt/local/include"
export CPPFLAGS="-isystem/opt/local/include -I/opt/local/include"
```
2. Install dependencies:
```
sudo port install readline qt5 qt5-qtbase pkgconfig arm-none-eabi-gcc arm-none-eabi-binutils lua52
```
3. Clamp Python version for pkg-config
MacPorts doesn't handle Python version defaults when it comes to pkg-config. So even if you have done:
```
sudo port install python39 cython39
sudo port select --set python python39 # this also makes calls to "python" operate on python3.9
sudo port select --set python3 python39
sudo port select --set cython cython39
```
This won't set a default python3.pc (and python3-embed.pc) under the MacPorts pkgconfig includes folder.
To fix that, follow these steps:
```
cd /opt/local/lib/pkgconfig
sudo ln -svf python3.pc python-3.9.pc
sudo ln -svf python3-embed.pc python-3.9-embed.pc
```
4. (optional) Install makefile dependencies:
```
sudo port install recode
sudo port install astyle
```
## Compile and use the project
To use the compiled client, you can use `pm3` script, it is a wrapper of the proxmark3 client that handles automatic detection of your proxmark.
Now you're ready to follow the [compilation instructions](/doc/md/Use_of_Proxmark/0_Compilation-Instructions.md).
To flash on OS X, better to enter the bootloader mode manually, else you may experience errors.
With your Proxmark3 unplugged from your machine, press and hold the button on your Proxmark3 as you plug it into a USB port. You can release the button, two of the four LEDs should stay on. You're in bootloader mode, ready for the next step. In case the two LEDs don't stay on when you're releasing the button, you've an old bootloader, start over and keep the button pressed during the whole flashing procedure.
From there, you can follow the original compilation instructions.

449
tools/pm3_online_check.py Executable file
View file

@ -0,0 +1,449 @@
#!/usr/bin/env python3
'''
# pm3_online_check.py
# Christian Herrmann, Iceman, <iceman@icesql.se> 2020
# version = 'v1.0.5'
#
# This code is copyright (c) Christian Herrmann, 2020, All rights reserved.
# For non-commercial use only, the following terms apply - for all other
# uses, please contact the author:
#
# This code 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 2 of the License, or
# (at your option) any later version.
#
# This code 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.
#
#
# Dependecies:
#
# pip3 install pexpect ansicolors
#
'''
import pexpect
from colors import color
import requests
import string
import re
import time
import argparse
def pm3_flashbootrom():
flbootrom = pexpect.spawnu('./pm3-flash-bootrom')
flbootrom.expect(pexpect.EOF)
msg = escape_ansi(str(flbootrom.before))
if 'Have a nice day!'.lower() in msg:
print("Flashing bootrom ", color('[OK]', fg='green'))
else:
print("Flashing bootrom ", color('[FAIL]', fg='red'))
time.sleep(20)
def pm3_flashfullimage():
flimage = pexpect.spawnu('./pm3-flash-fullimage')
flimage.expect(pexpect.EOF)
msg = escape_ansi(str(flimage.before))
if 'Have a nice day!'.lower() in msg:
print("Flashing fullimage ", color('[OK]', fg='green'))
else:
print("Flashing fullimage ", color('[FAIL]', fg='red'))
time.sleep(20)
def escape_ansi(line):
ansi_escape = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]')
return ansi_escape.sub('', str(line)).lower()
def pm3_initrdv4(child):
child.sendline('script run init_rdv4')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if 'finished init_rdv4'.lower() in msg:
print("Init RDV4 ", color('[OK]', fg='green'))
else:
print("Init RDV4 ", color('[FAIL]', fg='red'))
# LF T55x7 wipe/clone/read/wipe test
def pm3_lf_t55xx(child):
try:
print("[=] starting lf t55xx tests...")
# wipe t55xx
child.sendline('lf t55xx wipe')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if 'Writing page 0 block: 07 data: 0x00000000'.lower() in msg:
print("[+] LF T55XX WIPE ", color('[OK]', fg='green'))
else:
print("[-] LF T55XX WIPE ", color('[FAIL]', fg='red'))
# clone HID
child.sendline('lf hid clone -r 2006ec0c86')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if 'Done'.lower() in msg:
print("[+] LF HID CLONE ", color('[OK]', fg='green'))
else:
print("[-] LF HID CLONE ", color('[FAIL]', fg='red'))
# read HID
child.sendline('lf hid read')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if "HID H10301 26-bit; FC: 118 CN: 1603 parity: valid".lower() in msg:
print("[+] LF HID READ ", color('[OK]', fg='green'))
else:
print("[-] LF HID READ ", color('[FAIL]', fg='red'))
# wipe t55xx
child.sendline('lf t55xx wipe')
i = child.expect('pm3 --> ')
return True
except:
print(color("[!] exception for LF T55XX", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return False
def pm3_flash_sm(child):
try:
print("[+] Updating smart card fw")
child.sendline('smart upgrade -f sim011.bin')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
print("================")
print(" smart card upgrade")
print("==== msg ========")
print(msg)
if "successful" in msg:
print("[+] Smart card firmware upgrade ", color('[OK]', fg='green'))
return True
else:
print("[-] Smart card firmware upgrade ", color('[FAIL]', fg='red'))
return False
except:
print(color("[!] exception for SMART UPGRADE", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return False
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--flash", help="flash bootrom & fullimage", action="store_true")
parser.add_argument("--init", help="run init rdv4 script", action="store_true")
parser.add_argument("-y", help="automatic yes to prompts", action="store_true")
args = parser.parse_args()
print("-----------", color('Proxmark3 online test script v1.0.3', fg='cyan'), "------------")
print("This script will run some series of test against a connected Proxmark3 device")
print("Steps:");
print(" 1. flash bootrom, fullimage");
print(" 2. init_rdv4 / flash smartcard");
print(" 3. check device mismatch message");
print(" 4. check smart card fw, flash memory");
print(" if needed, flash flash smartcard reader firmware");
print(" 5. check antenna tuning");
print(" 6. check LF T55x7 functionality");
print(" 7. check HF search");
print(" 8. check SPIFFS");
print(" 9. check HF iCLASS functionality");
print("\n");
# result
res = 0
total_tests = 12
must_update_fw = 0
msg = ''
if args.flash:
print("-----------------------", color('Flashing phase', fg='cyan'), "---------------------")
print("flashing bootrom - don't touch the device or cables")
pm3_flashbootrom()
print("flashing fullimage - don't touch the device or cables")
pm3_flashfullimage()
print("\n")
# start pm3
child = pexpect.spawnu('./pm3')
i = child.expect('pm3 --> ')
print("[+] Proxmark3 client open")
if args.init:
print("------------------------", color('Init phase', fg='cyan'), "------------------------")
print("Running init rdv4 script - don't touch the device or cables")
pm3_initrdv4(child)
print("flashing smartcard - don't touch the device or cables")
pm3_flash_sm(child)
print("\n")
print("------------------------", color('Test phase', fg='cyan'), "------------------------")
# check device mismatch
signature_msg = "device.................... RDV4".lower()
# check flashmemory
flash_mem = "baudrate................24 mhz".lower()
# check smartcard fw version
sm_version = "version.................v3.11".lower()
# check LF
lf_search = "valid hid prox id found!".lower()
# check HF
hf_search = "Valid iCLASS tag / PicoPass tag found".lower()
# mem spiffs info
mem_spiffs = "max path length............32 chars".lower()
# lf antenna tuning
lf_tune = "LF antenna is OK".lower()
# hf antenna tuning
hf_tune = "HF antenna is OK".lower()
try:
# HW VERSION checks
child.sendline('hw version')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if signature_msg in msg:
print("[+] RDV4 signature ", color('[OK]', fg='green'))
res += 1
else:
print("[-] RDV4 signature ", color('[FAIL]', fg='red'))
# HW STATUS checks
child.sendline('hw status')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if sm_version in msg:
print("[+] Smart card firmware version ", color('[OK]', fg='green'))
res += 1
else:
print("[-] Smart card firmware version ", color('[FAIL]', fg='red'), " will upgrade fw in the next step")
must_update_fw = 1
if flash_mem in msg:
print("[+] Flash memory accessable ", color('[OK]', fg='green'))
res += 1
else:
print("[-] Flash memory accessable ", color('[FAIL]', fg='red'))
# extract slow clock and verify its OK...
# slow clock check:
# Slow clock..............30057 Hz
for line in msg.splitlines():
match_slow = line.find('slow clock..............')
if match_slow > -1:
match = re.search(r'\d+', line)
if match:
clock = int(match[0])
if clock < 29000:
print("[-] Warning, Slow clock too slow (%d Hz)" % (clock), color('[FAIL]', fg='red'))
elif clock > 33000:
print("[-] Warning, Slow clock too fast (%d Hz)" % (clock), color('[FAIL]', fg='red'))
else:
print("[+] Slow clock within acceptable range (%d Hz)" % (clock), color('[OK]', fg='green'))
res += 1
except:
print(color("[!] exception for HW STATUS", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return
if must_update_fw == 1:
if pm3_flash_sm(child):
res += 1
try:
print("[=] starting antenna tune tests, this takes some time and plot window will flash up...")
# HW TUNE checks
child.sendline('hw tune')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if lf_tune in msg:
print("[+] LF antenna tuning ", color('[OK]', fg='green'))
res += 1
else:
print("[-] LF antenna tuning ", color('[FAIL]', fg='red'))
if hf_tune in msg:
print("[+] HF antenna tuning ", color('[OK]', fg='green'))
res += 1
else:
print("[-] HF antenna tuning ", color('[FAIL]', fg='red'))
except:
print(color("[!] exception for hw tune", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return
# hide plot window again
child.sendline('data hide')
i = child.expect('pm3 --> ')
ans = ''
while ans != 'y' and args.y == False:
ans = (input(color('>>> Put LF card and HF card on Proxmark3 antenna', fg='yellow') + ' [Y/n/q] ') or "y")
if ans == 'q':
child.sendline('quit')
child.expect(pexpect.EOF)
print('[!] Aborted all tests ', color('[USER ABORTED]', fg='red'))
return
# LF T55X7 WIPE/CLONE/READ TESTS
if pm3_lf_t55xx(child):
res += 1
# HF SEARCH TESTS
try:
print("[=] starting HF SEARCH tests...")
# HF SEARCH Test
child.sendline('hf search')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
if hf_search in msg:
print("[+] HF SEARCH ", color('[OK]', fg='green'))
res += 1
else:
print("[-] HF SEARCH ", color('[FAIL]', fg='red'))
except:
print(color("[!] exception for HF SEARCH", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return
# MEM Tree test
child.sendline('mem spiffs info')
i = child.expect('/', timeout=10)
msg = escape_ansi(str(child.before))
if mem_spiffs in msg:
print("[+] MEM SPIFFS INFO ", color('[OK]', fg='green'))
res += 1
else:
print("[-] MEM SPIFFS INFO ", color('[FAIL]', fg='red'))
ans = ''
while ans != 'y' and args.y == False:
ans = (input(color('>>> Put iCLASS legacy card on Proxmark3 antenna', fg='yellow') + ' [Y/n/q] ') or "y")
if ans == 'q':
child.sendline('quit')
child.expect(pexpect.EOF)
print('[!] Aborted all tests ', color('[USER ABORTED]', fg='red'))
return
# iCLASS read/write test
try:
print("[=] starting iCLASS info/read/write tests...")
child.sendline('hf iclass info')
i = child.expect('pm3 --> ')
# iclass info / read / write checks
iclass_info = 'Credential... iCLASS legacy'.lower()
iclass_ok = False
msg = escape_ansi(str(child.before))
if iclass_info in msg:
print("[+] HF ICLASS INFO ", color('[OK]', fg='green'))
res += 1
iclass_ok = True
else:
print("[-] HF ICLASS INFO ", color('[FAIL]', fg='red'))
if iclass_ok:
child.sendline('hf iclass rdbl -b 10 --ki 0')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
for line in msg.splitlines():
iclass_read = 'block 10'.lower()
if iclass_read in line:
res += 1
print("[+] HF ICLASS RDBL ", color('[OK]', fg='green'))
old_b10 = line[16:].replace(" ","")
child.sendline('hf iclass wrbl -b 10 --ki 0 -d 0102030405060708')
i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before))
iclass_write = 'wrote block 10 successful'.lower()
if iclass_write in msg:
res += 1
print("[+] HF ICLASS WRBL ", color('[OK]', fg='green'))
child.sendline('hf iclass wrbl -b 10 --ki 0 -d %s' % (old_b10))
i = child.expect('pm3 --> ')
else:
print("[-] HF ICLASS WRBL ", color('[FAIL]', fg='red'))
break;
else:
print("[-] skipping iclass read/write")
except:
print(color("[!] exception iCLASS read/write", fg='red'))
msg = escape_ansi(str(child.before))
print(msg)
child.sendline('quit')
child.expect(pexpect.EOF)
return
# exit Proxmark3 client
child.sendline('quit')
i = child.expect(pexpect.EOF)
print("[+] PM3 client closed\n")
# validate test results
print("-------------------------", color('Results', fg='cyan'), "-------------------------")
if res == total_tests:
print('[+] Passed ', color('[OK]', fg='green'))
else:
print('[-] failed test ', color('[FAIL]', fg='red'), '(%d / %d tests)' % (res, total_tests))
print("")
if __name__ == "__main__":
main()