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
838 stars 144 forks source link

Reworking CLI commands #164

Closed doegox closed 10 months ago

doegox commented 10 months ago

Historically, 99% of CLI commands reflect directly the firmware protocol, but it does not have to. It has to be user-friendly.

Note that with the current dev CLI, we can already provide -h to any command (as in the Proxmark3 client).

And command groups can be spotted with {...} (as in the Proxmark3 client)

Proposals, to be discussed:

Implementation in development here: https://github.com/RfidResearchGroup/ChameleonUltra/tree/rework_cli

- hw chipid get
+ hw chipid

- hw address get
+ hw address

- hw mode set                -m {reader,r,emulator,e}
- hw mode get
+ hw mode                    [-r | -e]

- hw slot nick set           -s number -st number -n NAME
- hw slot nick get           -s number -st number
- hw slot nick delete        -s number -st number
+ hw slot nick               [-s <1-8>] (--hf | --lf) [-n NAME | -d]

- hw slot list               [-e {0,1:default}]
+ hw slot list               [--short]

- hw slot change             -s number
+ hw slot change             -s <1-8>

- hw slot type               -s number -t number
+ hw slot type               [-s <1-8>] -t TAG_TYPE

- hw slot delete             -s number -st number
+ hw slot delete             [-s <1-8>] (--hf | --lf)

- hw slot init               -s number -t number
+ hw slot init               [-s <1-8>] -t TAG_TYPE
- hw slot enable             -s number -st number -e {0,1}
+ hw slot enable             [-s <1-8>] (--hf | --lf)
+ hw slot disable            [-s <1-8>] (--hf | --lf)

- hw slot update
+ hw slot store

  hw slot openall

- hw factory_reset           [--i-know-what-im-doing]
+ hw factory_reset           [--force]

- hw ble bonds clear
+ hw settings bleclearbonds  [--force]

- hw settings reset
+ hw settings reset          [--force]

- hw settings animation get
- hw settings animation set  -m {0,1,2}
+ hw settings animation      [-m MODE]

  hw settings store

  hw settings blekey         [-k KEY]

- hw settings blepair        [-e ENABLE]
+ hw settings blepair        [-e | -d]

- hw settings btnpress get
- hw settings btnpress set   [-l] -b {A,B,a,b} -f {0,1,2,3,4}
+ hw settings btnpress       [-a | -b] [-s | -l] [-f FUNCTION]

  hw connect                 [-p PORT]

  hw version

  hw dfu

  hw battery

- hw raw                     -c COMMAND [-d DATA] [-t TIMEOUT]
+ hw raw                     (-c COMMAND | -n <dec>) [-d <hex>] [-t <dec>]

  hf 14a scan

  hf 14a info

- hf 14a raw                 [-a] [-s] [-d DATA] [-b BITS] [-c] [-r] [-cc] [-k] [-t TIMEOUT]
+ hf 14a raw                 [-a] [-s] [-d <hex>] [-b <dec>] [-c] [-r] [-cc] [-k] [-t <dec>]

- hf mf nested               [-o] --block-known decimal --type-known {A,B,a,b} --key-known hex [--block-target decimal] [--type-target {A,B,a,b}]
+ hf mf nested               --blk <dec> [-a | -b] -k <hex> --tblk <dec> [--ta | --tb]

  hf mf darkside

- hf mf rdbl                 -b decimal -t {A,B,a,b} -k hex
+ hf mf rdbl                 --blk <dec> [-a | -b] -k <hex>

- hf mf wrbl                 -b decimal -t {A,B,a,b} -k hex -d Your block data
+ hf mf wrbl                 --blk <dec> [-a | -b] -k <hex> -d <hex>

- hf mf eload                -f FILE [-t {bin,hex}]
+ hf mf eload                [-s <1-8>] -f FILE [-t {bin,hex}]

- hf mf eread                -f FILE [-t {bin,hex}]
+ hf mf esave                [-s <1-8>] -f FILE [-t {bin,hex}]

- hf detection count
- hf detection decrypt
+ hf mf elog                 [--decrypt]

- hf mfu rdpg                -p decimal
+ hf mfu rdpg                -p <dec>

- hf mfu dump                [-p decimal] [-q decimal] [-f FILE]
+ hf mfu dump                [-p <dec>] [-q <dec>] [-f FILE]

- lf em read
+ lf em 410x read

- lf em write                --id hex
+ lf em 410x write           --id <hex>

- hf mf settings             [--gen1a {1,0}] [--gen2 {1,0}] [--coll {1,0}] [--write {0,1,2,3,4}]
- hf mf sim                  --uid hex --atqa hex --sak hex [--ats hex]
- hf mf info
- hf detection enable        -e {1,0}
+ hf mf econfig              [-s <1-8>] [--uid <hex>] [--atqa <hex>] [--sak <hex>]
+                            [--ats <hex> | --delete-ats] [--enable-gen1a | --disable-gen1a]
+                            [--enable-gen2 | --disable-gen2] [--enable-block0 | --disable-block0]
+                            [--write MODE] [--enable-log | --disable-log]
+ hf mfu econfig             [-s <1-8>] [--uid <hex>] [--atqa <hex>] [--sak <hex>]
+                            [--ats <hex> | --delete-ats]

- lf em sim get
- lf em sim set              --id hex
+ lf em 410x econfig         [-s <1-8>] [--id <hex>]
GameTec-live commented 10 months ago

adapting the PM3 syntax is a good idea IMO

iceman1001 commented 10 months ago

the pm3 command structure and params isn't unified so don't fall in that pit.

Make sure you lock down so same parameters is the same across the CLI. And reserve some.
Find a nomenclature that fits. PM3 struggle with it.

Make a guiding document and adapt, like: https://github.com/RfidResearchGroup/proxmark3/blob/master/doc/cliparser.md

Same thing when it comes to color management, like https://github.com/RfidResearchGroup/proxmark3/blob/master/doc/colors_notes.md

Learn from the mistakes PM3 CLI did and become even better.

doegox commented 10 months ago

thanks for the tips @iceman1001 !