Merge pull request #1197 from tcprst/cliparser/mfc

hf mf - cliparser
This commit is contained in:
Iceman 2021-02-13 22:09:36 +01:00 committed by GitHub
commit 108ae51146
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 593 additions and 518 deletions

View file

@ -32,4 +32,4 @@ rm $2
echo "hf mf eclr" >> $2
echo "hf mf eload" $1 >> $2
echo "hf mf ekeyprn" >> $2
echo "hf mf sim u" `cat $1.eml | (read -n 8 uid; echo $uid)` >> $2
echo "hf mf sim -u" `cat $1.eml | (read -n 8 uid; echo $uid)` >> $2

View file

@ -99,7 +99,7 @@ local function nested(key,sak)
else
print("I don't know how many sectors there are on this type of card, defaulting to 16")
end
local cmd = string.format('hf mf nested %d 0 A %s d', typ, key)
local cmd = string.format('hf mf nested -t %d -b 0 --keya -k %s --dumpkeys', typ, key)
core.console(cmd)
end
@ -123,7 +123,7 @@ local function dump_tag(uid, numsectors)
local dumpfile = 'hf-mf-'..uid..'-dump'
local dmp = ('hf mf dump %s f %s'):format(typ, dumpfile)
local dmp = ('hf mf dump -t %s -f %s'):format(typ, dumpfile)
core.console(dmp)
-- Save the global args, those are *our* arguments

View file

@ -147,7 +147,7 @@ local function main(args)
--Trying to find the other keys
if useNested then
core.console( ('hf mf nested 1 0 A %s d'):format(keyA) )
core.console( ('hf mf nested -t 1 -b 0 --keya -k %s --dumpkeys'):format(keyA) )
end
core.clearCommandBuffer()

View file

@ -496,7 +496,7 @@ local function main(args)
err = LoadEmulator(uid, blocks)
if err then return oops(err) end
core.clearCommandBuffer()
print('The simulation is now prepared.\n --> run \"hf mf sim u '..uid..'\" <--')
print('The simulation is now prepared.\n --> run \"hf mf sim -u '..uid..'\" <--')
end
end
main(args)

File diff suppressed because it is too large Load diff

View file

@ -586,7 +586,7 @@ static void show_help(bool showFullHelp, char *exec_name) {
PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -w -- wait for serial port", exec_name);
PrintAndLogEx(NORMAL, " %s -- runs the pm3 client in OFFLINE mode", exec_name);
PrintAndLogEx(NORMAL, "\n to execute different commands from terminal:\n");
PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -c \"hf mf chk 1* ?\" -- execute cmd and quit client", exec_name);
PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -c \"hf mf chk --1k -* --all\" -- execute cmd and quit client", exec_name);
PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -l hf_read -- execute lua script " _YELLOW_("`hf_read`")" and quit client", exec_name);
PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -s mycmds.txt -- execute each pm3 cmd in file and quit client", exec_name);
PrintAndLogEx(NORMAL, "\n to flash fullimage and bootloader:\n");

View file

@ -224,12 +224,22 @@ Check for default keys
```
Options
---
<*card memory> <key type (A/B/?)> [t|d|s|ss] <dic (*.dic)>
* : all sectors
card memory : 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K
d : write keys to binary file
-h, --help This help
-k, --key <hex> Key specified as 12 hex symbols
--blk <dec> Input block number
-* Target all blocks
-a Input key specified is A key (default)
-b Input key specified is B key
--all Target all keys
--mini MIFARE Classic Mini / S20
--1k MIFARE Classic 1k / S50
--2k MIFARE Classic/Plus 2k
--4k MIFARE Classic 4k / S70
--emu Fill simulator keys from found keys
--dump Dump found keys to file
-f, --file <filename> filename of dictionary
pm3 --> hf mf chk *1 ? d mfc_default_keys
pm3 --> hf mf chk -* --1k --all -f mfc_default_keys
```
Check for default keys from local memory
@ -244,14 +254,19 @@ pm3 --> hf mf fchk 1 m
Dump MIFARE card contents
```
Options
---
<card memory> : 0 = 320 bytes (MIFARE Mini), 1 = 1K (default), 2 = 2K, 4 = 4K
k <name> : key filename, if no <name> given, UID will be used as filename"
f <name> : data filename, if no <name> given, UID will be used as filename
options:
-t, --type <0-4> MIFARE Classic type
-f, --file <filename> filename of dump
-k, --keys <filename> filename of keys
pm3 --> hf mf dump 1
pm3 --> hf mf dump 1 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-dump.bin
examples/notes:
hf mf dump -t 0 -> MIFARE Mini
hf mf dump -t 1 -> MIFARE Classic 1k (default)
hf mf dump -t 2 -> MIFARE 2k
hf mf dump -t 4 -> MIFARE 4k
pm3 --> hf mf dump -t 1
pm3 --> hf mf dump -t 1 -k hf-mf-A29558E4-key.bin -f hf-mf-A29558E4-dump.bin
```
Convert .bin to .eml
@ -305,21 +320,21 @@ Simulate MIFARE
```
u : (Optional) UID 4,7 or 10 bytes. If not specified, the UID 4B from emulator memory will be used
pm3 --> hf mf sim u 353c2aa6
pm3 --> hf mf sim -u 353c2aa6
```
Simulate MIFARE Sequence
```
pm3 --> hf mf chk *1 ? d mfc_default_keys
pm3 --> hf mf chk -* --1k --all -f mfc_default_keys
pm3 --> hf mf dump 1
pm3 --> script run data_mf_bin2eml -i dumpdata.bin
pm3 --> hf mf eload 353C2AA6
pm3 --> hf mf sim u 353c2aa6
pm3 --> hf mf sim -u 353c2aa6
```
Clone MIFARE 1K Sequence
```
pm3 --> hf mf chk *1 ? d mfc_default_keys
pm3 --> hf mf chk -* --1k --all -f mfc_default_keys
pm3 --> hf mf dump
pm3 --> hf mf restore 1 u 4A6CE843 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-dump.bin
```

View file

@ -57,22 +57,16 @@ hf felica rqspecver
hf felica resetmode
hf felica litesim
hf felica litedump
hf mf darkside
hf mf nested
hf mf hardnested
hf mf staticnested
hf mf autopwn
hf mf nack
hf mf chk
hf mf fchk
hf mf decrypt
hf mf dump
hf mf rdbl
hf mf rdsc
hf mf restore
hf mf setmod
hf mf wrbl
hf mf sim
hf mf ecfill
hf mf eclr
hf mf egetblk
@ -92,7 +86,6 @@ hf mf cview
hf mf gen3uid
hf mf gen3blk
hf mf gen3freeze
hf mf ice
lf em 410x
lf em 4x05
lf em 4x50