RfidResearchGroup / ChameleonUltra

The new generation chameleon based on NRF52840 makes the performance of card emulation more stable. And gave the chameleon the ability to read, write, and decrypt cards.
https://chameleonultra.com
GNU General Public License v3.0
783 stars 137 forks source link

CLI: use one process to test many keys for mfkey32v2 #191

Open p-l- opened 6 months ago

p-l- commented 6 months ago

It is done by adding a "server" mode (on STDIN/STDOUT) to mfkey32v2 using --server.

This improves the speed of the decrypt process, as it prevents a lot of Python calls to subprocess.Popen() (and of course, a lot of fork/execve syscalls).

On my laptop, with the same logs (37 records for one block and 37 records for another block), here are the performances, as measured using a simple command:

time echo -e "hw connect\nhf mf elog --decrypt\nhw disconnect" | ./chameleon_cli_main.py
real user sys
Before parallelisation https://github.com/RfidResearchGroup/ChameleonUltra/commit/05ea03d31c223875895b21ee42522043235a811d 14m59,277s 14m47,995s 0m8,490s
With parallelisation https://github.com/RfidResearchGroup/ChameleonUltra/pull/187 6m13,513s 35m2,926s 0m22,038s
With item skipping https://github.com/RfidResearchGroup/ChameleonUltra/pull/189 2m42,491s 15m43,425s 0m9,881s
With mfkey32v2 --server this PR 1m55,160s 0m1,315s 0m0,250s

Also, the Python code has been cleaned a bit, mostly to improve readability.

github-actions[bot] commented 6 months ago

Built artifacts for commit 04ee2f4beb8300039493f2220d117026a0125465

Firmware

Client