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
897 stars 148 forks source link

Add CLI commands to dump and clone tag #201

Open rickNmorty2 opened 8 months ago

rickNmorty2 commented 8 months ago

Note: based on PR #199

Thanks to @taichunmin implementation of fchk, this PR adds the following commands:

Mifare Classic dump tag

usage: hf mf dump [-h] [-t {bin,hex}] -f DUMP_FILE -d DIC

options: -h, --help show this help message and exit -t {bin,hex}, --dump-file-type {bin,hex} Dump file content type -f DUMP_FILE, --dump-file DUMP_FILE Dump file to write data from tag -d DIC, --dic DIC Read keys (to communicate with tag to dump) from .dic format file


Example:

[USB] chameleon --> hf mf dump --dic keys.dic -f dump.bin


* `hf mf clone` to clone the content of a dump to a tag:

[USB] chameleon --> hf mf clone -h

hf mf clone

Mifare Classic clone tag from dump

usage: hf mf clone [-h] [-t {bin,hex}] [-a CLONE_ACCESS] -f DUMP_FILE -d DIC

options: -h, --help show this help message and exit -t {bin,hex}, --dump-file-type {bin,hex} Dump file content type -a CLONE_ACCESS, --clone-access CLONE_ACCESS Write ACL from original dump too (/!\ could brick your tag) -f DUMP_FILE, --dump-file DUMP_FILE Dump file containing data to write on new tag -d DIC, --dic DIC Read keys (to communicate with tag to write) from .dic format file


Example:

[USB] chameleon --> hf mf clone -f dump.bin --dic keys.dic



Note that by default, the `clone` command does not copy the ACL to avoid bricking the tag, but it could be enforced with `--clone-access`.
github-actions[bot] commented 8 months ago

Built artifacts for commit 8a02d6f4f84b84ebc4a4605503b5c843045339e5

Firmware

Client

GameTec-live commented 8 months ago

may i suggest the addition of another option, something like --plain, which then just exports in the good ol one key per line format?

taichunmin commented 8 months ago

I can add the export option to my PR. But I think the .key and .dic format is better then custom format. because proxmark3 doesn't support custom format.

taichunmin commented 8 months ago

I already add the export option in PR #199

I also change the option from -f, -b and --hex to --key and --dic.

GameTec-live commented 8 months ago

I can add the export option to my PR. But I think the .key and .dic format is better then custom format. because proxmark3 doesn't support custom format.

ah, oki... With that one key per line i did mean .dic btw...

xianglin1998 commented 7 months ago

So this PR is finished?

xianglin1998 commented 7 months ago

You are the author of the export feature idea, so you can add a item to CHANGELOG.md after this PR is closed.

github-actions[bot] commented 5 months ago

You are welcome to add an entry to the CHANGELOG.md as well

rickNmorty2 commented 5 months ago

I merged main into this and fixed/changed a few things to comply with PR #199 by @taichunmin.

From my point of view, ready to [be more tested and] merge.

taichunmin commented 5 months ago

The dic file usually has comment lines. https://github.com/RfidResearchGroup/proxmark3/blob/master/client/dictionaries/mfc_default_keys.dic

Maybe you can use the code: https://github.com/RfidResearchGroup/ChameleonUltra/blob/main/software/script/chameleon_cli_unit.py#L922