Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI commands to dump and clone tag #201

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

rickNmorty2
Copy link

@rickNmorty2 rickNmorty2 commented Jan 28, 2024

Note: based on PR #199

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

  • hf mf dump to dump the content of a tag from a dictionary of keys:
[USB] chameleon --> hf mf dump -h
--------------------------------------------------------------------------------
hf mf dump

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.

Copy link

Built artifacts for commit 8a02d6f

Firmware

Client

@GameTec-live
Copy link
Contributor

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
Copy link
Contributor

taichunmin commented Jan 29, 2024

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
Copy link
Contributor

taichunmin commented Jan 29, 2024

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
Copy link
Contributor

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...

# check ACL option
if not args.clone_access:
# if option is not specified, use generic ACL to be able to write again
data = data[:6] + bytes.fromhex("08778F") + data[9:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the acl ff0780 is better then the acl 08778F

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I've changed it to ff0780.

@xianglin1998
Copy link
Contributor

So this PR is finished?

@xianglin1998
Copy link
Contributor

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

Copy link

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

@rickNmorty2
Copy link
Author

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
Copy link
Contributor

taichunmin commented Apr 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants