Merge pull request #164 from brianpow/master

CHG: 'hf mf dump' now use hf-mf-UID-key.bin and hf-mf-UID-data.bin in…
This commit is contained in:
Iceman 2018-02-11 17:42:40 +01:00 committed by GitHub
commit 9af8d0e7ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 694 additions and 394 deletions

View file

@ -20,7 +20,7 @@ int usage_analyse_lcr(void) {
PrintAndLog(" h This help"); PrintAndLog(" h This help");
PrintAndLog(" <bytes> bytes to calc missing XOR in a LCR"); PrintAndLog(" <bytes> bytes to calc missing XOR in a LCR");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" analyse lcr 04008064BA"); PrintAndLog(" analyse lcr 04008064BA");
PrintAndLog("expected output: Target (BA) requires final LRC XOR byte value: 5A"); PrintAndLog("expected output: Target (BA) requires final LRC XOR byte value: 5A");
return 0; return 0;
@ -36,7 +36,7 @@ int usage_analyse_checksum(void) {
PrintAndLog(" b <bytes> bytes to calc missing XOR in a LCR"); PrintAndLog(" b <bytes> bytes to calc missing XOR in a LCR");
PrintAndLog(" m <mask> bit mask to limit the outpuyt"); PrintAndLog(" m <mask> bit mask to limit the outpuyt");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" analyse chksum b 137AF00A0A0D m FF"); PrintAndLog(" analyse chksum b 137AF00A0A0D m FF");
PrintAndLog("expected output: 0x61"); PrintAndLog("expected output: 0x61");
return 0; return 0;
@ -49,7 +49,7 @@ int usage_analyse_crc(void){
PrintAndLog(" h This help"); PrintAndLog(" h This help");
PrintAndLog(" <bytes> bytes to calc crc"); PrintAndLog(" <bytes> bytes to calc crc");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" analyse crc 137AF00A0A0D"); PrintAndLog(" analyse crc 137AF00A0A0D");
return 0; return 0;
} }
@ -62,7 +62,7 @@ int usage_analyse_nuid(void){
PrintAndLog(" h This help"); PrintAndLog(" h This help");
PrintAndLog(" <bytes> input bytes (14 hexsymbols)"); PrintAndLog(" <bytes> input bytes (14 hexsymbols)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" analyse nuid 11223344556677"); PrintAndLog(" analyse nuid 11223344556677");
return 0; return 0;
} }

View file

@ -33,7 +33,7 @@ int usage_data_manrawdecode(void){
PrintAndLog(" [invert] invert output"); PrintAndLog(" [invert] invert output");
PrintAndLog(" [maxErr] set number of errors allowed (default = 20)"); PrintAndLog(" [maxErr] set number of errors allowed (default = 20)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data manrawdecode = decode manchester bitstream from the demodbuffer"); PrintAndLog(" Example: data manrawdecode = decode manchester bitstream from the demodbuffer");
return 0; return 0;
} }
int usage_data_biphaserawdecode(void){ int usage_data_biphaserawdecode(void){
@ -46,8 +46,8 @@ int usage_data_biphaserawdecode(void){
PrintAndLog(" [invert <0|1>], set to 1 to invert output"); PrintAndLog(" [invert <0|1>], set to 1 to invert output");
PrintAndLog(" [maxErr int], set max errors tolerated - default=20"); PrintAndLog(" [maxErr int], set max errors tolerated - default=20");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data biphaserawdecode = decode biphase bitstream from the demodbuffer"); PrintAndLog(" Example: data biphaserawdecode = decode biphase bitstream from the demodbuffer");
PrintAndLog(" sample: data biphaserawdecode 1 1 = decode biphase bitstream from the demodbuffer, set offset, and invert output"); PrintAndLog(" Example: data biphaserawdecode 1 1 = decode biphase bitstream from the demodbuffer, set offset, and invert output");
return 0; return 0;
} }
int usage_data_rawdemod(void){ int usage_data_rawdemod(void){
@ -57,7 +57,7 @@ int usage_data_rawdemod(void){
PrintAndLog(" <help> as 'h', prints the help for the specific modulation"); PrintAndLog(" <help> as 'h', prints the help for the specific modulation");
PrintAndLog(" <options> see specific modulation help for optional parameters"); PrintAndLog(" <options> see specific modulation help for optional parameters");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod fs h = print help specific to fsk demod"); PrintAndLog(" Example: data rawdemod fs h = print help specific to fsk demod");
PrintAndLog(" : data rawdemod fs = demod GraphBuffer using: fsk - autodetect"); PrintAndLog(" : data rawdemod fs = demod GraphBuffer using: fsk - autodetect");
PrintAndLog(" : data rawdemod ab = demod GraphBuffer using: ask/biphase - autodetect"); PrintAndLog(" : data rawdemod ab = demod GraphBuffer using: ask/biphase - autodetect");
PrintAndLog(" : data rawdemod am = demod GraphBuffer using: ask/manchester - autodetect"); PrintAndLog(" : data rawdemod am = demod GraphBuffer using: ask/manchester - autodetect");
@ -76,7 +76,7 @@ int usage_data_rawdemod_am(void){
PrintAndLog(" [set maximum Samples to read], default = 32768 (512 bits at rf/64)"); PrintAndLog(" [set maximum Samples to read], default = 32768 (512 bits at rf/64)");
PrintAndLog(" <amplify>, 'a' to attempt demod with ask amplification, default = no amp"); PrintAndLog(" <amplify>, 'a' to attempt demod with ask amplification, default = no amp");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod am = demod an ask/manchester tag from GraphBuffer"); PrintAndLog(" Example: data rawdemod am = demod an ask/manchester tag from GraphBuffer");
PrintAndLog(" : data rawdemod am 32 = demod an ask/manchester tag from GraphBuffer using a clock of RF/32"); PrintAndLog(" : data rawdemod am 32 = demod an ask/manchester tag from GraphBuffer using a clock of RF/32");
PrintAndLog(" : data rawdemod am 32 1 = demod an ask/manchester tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" : data rawdemod am 32 1 = demod an ask/manchester tag from GraphBuffer using a clock of RF/32 and inverting data");
PrintAndLog(" : data rawdemod am 1 = demod an ask/manchester tag from GraphBuffer while inverting data"); PrintAndLog(" : data rawdemod am 1 = demod an ask/manchester tag from GraphBuffer while inverting data");
@ -97,7 +97,7 @@ int usage_data_rawdemod_ab(void){
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" NOTE: --invert for Conditional Dephase Encoding (CDP) AKA Differential Manchester"); PrintAndLog(" NOTE: --invert for Conditional Dephase Encoding (CDP) AKA Differential Manchester");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod ab = demod an ask/biph tag from GraphBuffer"); PrintAndLog(" Example: data rawdemod ab = demod an ask/biph tag from GraphBuffer");
PrintAndLog(" : data rawdemod ab 0 a = demod an ask/biph tag from GraphBuffer, amplified"); PrintAndLog(" : data rawdemod ab 0 a = demod an ask/biph tag from GraphBuffer, amplified");
PrintAndLog(" : data rawdemod ab 1 32 = demod an ask/biph tag from GraphBuffer using an offset of 1 and a clock of RF/32"); PrintAndLog(" : data rawdemod ab 1 32 = demod an ask/biph tag from GraphBuffer using an offset of 1 and a clock of RF/32");
PrintAndLog(" : data rawdemod ab 0 32 1 = demod an ask/biph tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" : data rawdemod ab 0 32 1 = demod an ask/biph tag from GraphBuffer using a clock of RF/32 and inverting data");
@ -114,7 +114,7 @@ int usage_data_rawdemod_ar(void){
PrintAndLog(" [set maximum Samples to read], default = 32768 (1024 bits at rf/64)"); PrintAndLog(" [set maximum Samples to read], default = 32768 (1024 bits at rf/64)");
PrintAndLog(" <amplify>, 'a' to attempt demod with ask amplification, default = no amp"); PrintAndLog(" <amplify>, 'a' to attempt demod with ask amplification, default = no amp");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod ar = demod an ask tag from GraphBuffer"); PrintAndLog(" Example: data rawdemod ar = demod an ask tag from GraphBuffer");
PrintAndLog(" : data rawdemod ar a = demod an ask tag from GraphBuffer, amplified"); PrintAndLog(" : data rawdemod ar a = demod an ask tag from GraphBuffer, amplified");
PrintAndLog(" : data rawdemod ar 32 = demod an ask tag from GraphBuffer using a clock of RF/32"); PrintAndLog(" : data rawdemod ar 32 = demod an ask tag from GraphBuffer using a clock of RF/32");
PrintAndLog(" : data rawdemod ar 32 1 = demod an ask tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" : data rawdemod ar 32 1 = demod an ask tag from GraphBuffer using a clock of RF/32 and inverting data");
@ -130,7 +130,7 @@ int usage_data_rawdemod_fs(void){
PrintAndLog(" [fchigh], larger field clock length, omit for autodetect"); PrintAndLog(" [fchigh], larger field clock length, omit for autodetect");
PrintAndLog(" [fclow], small field clock length, omit for autodetect"); PrintAndLog(" [fclow], small field clock length, omit for autodetect");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod fs = demod an fsk tag from GraphBuffer using autodetect"); PrintAndLog(" Example: data rawdemod fs = demod an fsk tag from GraphBuffer using autodetect");
PrintAndLog(" : data rawdemod fs 32 = demod an fsk tag from GraphBuffer using a clock of RF/32, autodetect fc"); PrintAndLog(" : data rawdemod fs 32 = demod an fsk tag from GraphBuffer using a clock of RF/32, autodetect fc");
PrintAndLog(" : data rawdemod fs 1 = demod an fsk tag from GraphBuffer using autodetect, invert output"); PrintAndLog(" : data rawdemod fs 1 = demod an fsk tag from GraphBuffer using autodetect, invert output");
PrintAndLog(" : data rawdemod fs 32 1 = demod an fsk tag from GraphBuffer using a clock of RF/32, invert output, autodetect fc"); PrintAndLog(" : data rawdemod fs 32 1 = demod an fsk tag from GraphBuffer using a clock of RF/32, invert output, autodetect fc");
@ -145,7 +145,7 @@ int usage_data_rawdemod_nr(void){
PrintAndLog(" <invert>, 1 for invert output"); PrintAndLog(" <invert>, 1 for invert output");
PrintAndLog(" [set maximum allowed errors], default = 100."); PrintAndLog(" [set maximum allowed errors], default = 100.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod nr = demod a nrz/direct tag from GraphBuffer"); PrintAndLog(" Example: data rawdemod nr = demod a nrz/direct tag from GraphBuffer");
PrintAndLog(" : data rawdemod nr 32 = demod a nrz/direct tag from GraphBuffer using a clock of RF/32"); PrintAndLog(" : data rawdemod nr 32 = demod a nrz/direct tag from GraphBuffer using a clock of RF/32");
PrintAndLog(" : data rawdemod nr 32 1 = demod a nrz/direct tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" : data rawdemod nr 32 1 = demod a nrz/direct tag from GraphBuffer using a clock of RF/32 and inverting data");
PrintAndLog(" : data rawdemod nr 1 = demod a nrz/direct tag from GraphBuffer while inverting data"); PrintAndLog(" : data rawdemod nr 1 = demod a nrz/direct tag from GraphBuffer while inverting data");
@ -158,7 +158,7 @@ int usage_data_rawdemod_p1(void){
PrintAndLog(" <invert>, 1 for invert output"); PrintAndLog(" <invert>, 1 for invert output");
PrintAndLog(" [set maximum allowed errors], default = 100."); PrintAndLog(" [set maximum allowed errors], default = 100.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod p1 = demod a psk1 tag from GraphBuffer"); PrintAndLog(" Example: data rawdemod p1 = demod a psk1 tag from GraphBuffer");
PrintAndLog(" : data rawdemod p1 32 = demod a psk1 tag from GraphBuffer using a clock of RF/32"); PrintAndLog(" : data rawdemod p1 32 = demod a psk1 tag from GraphBuffer using a clock of RF/32");
PrintAndLog(" : data rawdemod p1 32 1 = demod a psk1 tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" : data rawdemod p1 32 1 = demod a psk1 tag from GraphBuffer using a clock of RF/32 and inverting data");
PrintAndLog(" : data rawdemod p1 1 = demod a psk1 tag from GraphBuffer while inverting data"); PrintAndLog(" : data rawdemod p1 1 = demod a psk1 tag from GraphBuffer while inverting data");
@ -171,7 +171,7 @@ int usage_data_rawdemod_p2(void){
PrintAndLog(" <invert>, 1 for invert output"); PrintAndLog(" <invert>, 1 for invert output");
PrintAndLog(" [set maximum allowed errors], default = 100."); PrintAndLog(" [set maximum allowed errors], default = 100.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data rawdemod p2 = demod a psk2 tag from GraphBuffer, autodetect clock"); PrintAndLog(" Example: data rawdemod p2 = demod a psk2 tag from GraphBuffer, autodetect clock");
PrintAndLog(" : data rawdemod p2 32 = demod a psk2 tag from GraphBuffer using a clock of RF/32"); PrintAndLog(" : data rawdemod p2 32 = demod a psk2 tag from GraphBuffer using a clock of RF/32");
PrintAndLog(" : data rawdemod p2 32 1 = demod a psk2 tag from GraphBuffer using a clock of RF/32 and inverting output"); PrintAndLog(" : data rawdemod p2 32 1 = demod a psk2 tag from GraphBuffer using a clock of RF/32 and inverting output");
PrintAndLog(" : data rawdemod p2 1 = demod a psk2 tag from GraphBuffer, autodetect clock and invert output"); PrintAndLog(" : data rawdemod p2 1 = demod a psk2 tag from GraphBuffer, autodetect clock and invert output");
@ -189,7 +189,7 @@ int usage_data_autocorr(void) {
int usage_data_undecimate(void){ int usage_data_undecimate(void){
PrintAndLog("Usage: data undec [factor]"); PrintAndLog("Usage: data undec [factor]");
PrintAndLog("This function performs un-decimation, by repeating each sample N times"); PrintAndLog("This function performs un-decimation, by repeating each sample N times");
PrintAndLog("Options: "); PrintAndLog("Options:");
PrintAndLog(" h This help"); PrintAndLog(" h This help");
PrintAndLog(" factor The number of times to repeat each sample.[default:2]"); PrintAndLog(" factor The number of times to repeat each sample.[default:2]");
PrintAndLog("Example: 'data undec 3'"); PrintAndLog("Example: 'data undec 3'");
@ -201,7 +201,7 @@ int usage_data_detectclock(void){
PrintAndLog(" <clock> , specify the clock (optional - to get best start position only)"); PrintAndLog(" <clock> , specify the clock (optional - to get best start position only)");
PrintAndLog(" 'a' = ask, 'f' = fsk, 'n' = nrz/direct, 'p' = psk"); PrintAndLog(" 'a' = ask, 'f' = fsk, 'n' = nrz/direct, 'p' = psk");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: data detectclock a = detect the clock of an ask modulated wave in the GraphBuffer"); PrintAndLog(" Example: data detectclock a = detect the clock of an ask modulated wave in the GraphBuffer");
PrintAndLog(" data detectclock f = detect the clock of an fsk modulated wave in the GraphBuffer"); PrintAndLog(" data detectclock f = detect the clock of an fsk modulated wave in the GraphBuffer");
PrintAndLog(" data detectclock p = detect the clock of an psk modulated wave in the GraphBuffer"); PrintAndLog(" data detectclock p = detect the clock of an psk modulated wave in the GraphBuffer");
PrintAndLog(" data detectclock n = detect the clock of an nrz/direct modulated wave in the GraphBuffer"); PrintAndLog(" data detectclock n = detect the clock of an nrz/direct modulated wave in the GraphBuffer");
@ -226,7 +226,7 @@ int usage_data_buffclear(void){
} }
int usage_data_fsktonrz() { int usage_data_fsktonrz() {
PrintAndLog("Usage: data fsktonrz c <clock> l <fc_low> f <fc_high>"); PrintAndLog("Usage: data fsktonrz c <clock> l <fc_low> f <fc_high>");
PrintAndLog("Options: "); PrintAndLog("Options:");
PrintAndLog(" h This help"); PrintAndLog(" h This help");
PrintAndLog(" c <clock> enter the a clock (omit to autodetect)"); PrintAndLog(" c <clock> enter the a clock (omit to autodetect)");
PrintAndLog(" l <fc_low> enter a field clock (omit to autodetect)"); PrintAndLog(" l <fc_low> enter a field clock (omit to autodetect)");

View file

@ -844,7 +844,8 @@ int usage_hf_list(){
PrintAndLog(" legic - interpret data as LEGIC communications"); PrintAndLog(" legic - interpret data as LEGIC communications");
PrintAndLog(" felica - interpret data as ISO18092 / FeliCa communications"); PrintAndLog(" felica - interpret data as ISO18092 / FeliCa communications");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("example: hf list 14a f"); PrintAndLog("Examples:");
PrintAndLog(" hf list 14a f");
PrintAndLog(" hf list iclass"); PrintAndLog(" hf list iclass");
return 0; return 0;
} }
@ -866,7 +867,8 @@ int usage_hf_snoop(){
PrintAndLog(" <skip pairs> - skip sample pairs"); PrintAndLog(" <skip pairs> - skip sample pairs");
PrintAndLog(" <skip triggers> - skip number of triggers"); PrintAndLog(" <skip triggers> - skip number of triggers");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("example: hf snoop"); PrintAndLog("Examples:");
PrintAndLog(" hf snoop");
PrintAndLog(" hf snoop 1000 0"); PrintAndLog(" hf snoop 1000 0");
return 0; return 0;
} }

View file

@ -108,8 +108,8 @@ char* getTagInfo(uint8_t uid) {
int usage_hf_14a_sim(void) { int usage_hf_14a_sim(void) {
// PrintAndLog("\n Emulating ISO/IEC 14443 type A tag with 4,7 or 10 byte UID\n"); // PrintAndLog("\n Emulating ISO/IEC 14443 type A tag with 4,7 or 10 byte UID\n");
PrintAndLog("\n Emulating ISO/IEC 14443 type A tag with 4,7 byte UID\n"); PrintAndLog("\n Emulating ISO/IEC 14443 type A tag with 4,7 byte UID\n");
PrintAndLog("usage: hf 14a sim [h] t <type> u <uid> [x] [e] [v]"); PrintAndLog("Usage: hf 14a sim [h] t <type> u <uid> [x] [e] [v]");
PrintAndLog("options: "); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" t : 1 = MIFARE Classic 1k"); PrintAndLog(" t : 1 = MIFARE Classic 1k");
PrintAndLog(" 2 = MIFARE Ultralight"); PrintAndLog(" 2 = MIFARE Ultralight");
@ -124,7 +124,7 @@ int usage_hf_14a_sim(void) {
PrintAndLog(" x : (Optional) Performs the 'reader attack', nr/ar attack against a reader"); PrintAndLog(" x : (Optional) Performs the 'reader attack', nr/ar attack against a reader");
PrintAndLog(" e : (Optional) Fill simulator keys from found keys"); PrintAndLog(" e : (Optional) Fill simulator keys from found keys");
PrintAndLog(" v : (Optional) Verbose"); PrintAndLog(" v : (Optional) Verbose");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf 14a sim t 1 u 11223344 x"); PrintAndLog(" hf 14a sim t 1 u 11223344 x");
PrintAndLog(" hf 14a sim t 1 u 11223344"); PrintAndLog(" hf 14a sim t 1 u 11223344");
PrintAndLog(" hf 14a sim t 1 u 11223344556677"); PrintAndLog(" hf 14a sim t 1 u 11223344556677");
@ -137,7 +137,8 @@ int usage_hf_14a_sniff(void) {
PrintAndLog("Usage: hf 14a sniff [c][r]"); PrintAndLog("Usage: hf 14a sniff [c][r]");
PrintAndLog("c - triggered by first data from card"); PrintAndLog("c - triggered by first data from card");
PrintAndLog("r - triggered by first 7-bit request from reader (REQ,WUP,...)"); PrintAndLog("r - triggered by first 7-bit request from reader (REQ,WUP,...)");
PrintAndLog("sample: hf 14a sniff c r"); PrintAndLog("Examples:");
PrintAndLog(" hf 14a sniff c r");
return 0; return 0;
} }
int usage_hf_14a_raw(void) { int usage_hf_14a_raw(void) {

View file

@ -18,7 +18,7 @@ int usage_hf_14b_info(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" s silently"); PrintAndLog(" s silently");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b info"); PrintAndLog(" hf 14b info");
return 0; return 0;
} }
@ -27,7 +27,7 @@ int usage_hf_14b_reader(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" s silently"); PrintAndLog(" s silently");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b reader"); PrintAndLog(" hf 14b reader");
return 0; return 0;
} }
@ -40,7 +40,7 @@ int usage_hf_14b_raw(void){
PrintAndLog(" -p leave the field on after receive"); PrintAndLog(" -p leave the field on after receive");
PrintAndLog(" -s active signal field ON with select"); PrintAndLog(" -s active signal field ON with select");
PrintAndLog(" -ss active signal field ON with select for SRx ST Microelectronics tags"); PrintAndLog(" -ss active signal field ON with select for SRx ST Microelectronics tags");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b raw -s -c -p 0200a40400"); PrintAndLog(" hf 14b raw -s -c -p 0200a40400");
return 0; return 0;
} }
@ -50,7 +50,7 @@ int usage_hf_14b_sniff(void){
PrintAndLog("Usage: hf 14b sniff [h]"); PrintAndLog("Usage: hf 14b sniff [h]");
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b sniff"); PrintAndLog(" hf 14b sniff");
return 0; return 0;
} }
@ -60,7 +60,7 @@ int usage_hf_14b_sim(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" u 4byte UID/PUPI"); PrintAndLog(" u 4byte UID/PUPI");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b sim"); PrintAndLog(" hf 14b sim");
PrintAndLog(" hf 14b sim u 11223344"); PrintAndLog(" hf 14b sim u 11223344");
return 0; return 0;
@ -70,7 +70,7 @@ int usage_hf_14b_read_srx(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <1|2> 1 = SRIX4K , 2 = SRI512"); PrintAndLog(" <1|2> 1 = SRIX4K , 2 = SRI512");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b sriread 1"); PrintAndLog(" hf 14b sriread 1");
PrintAndLog(" hf 14b sriread 2"); PrintAndLog(" hf 14b sriread 2");
return 0; return 0;
@ -82,7 +82,7 @@ int usage_hf_14b_write_srx(void){
PrintAndLog(" <1|2> 1 = SRIX4K , 2 = SRI512"); PrintAndLog(" <1|2> 1 = SRIX4K , 2 = SRI512");
PrintAndLog(" <block> BLOCK number depends on tag, special block == FF"); PrintAndLog(" <block> BLOCK number depends on tag, special block == FF");
PrintAndLog(" <data> hex bytes of data to be written"); PrintAndLog(" <data> hex bytes of data to be written");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 14b sriwrite 1 7F 11223344"); PrintAndLog(" hf 14b sriwrite 1 7F 11223344");
PrintAndLog(" hf 14b sriwrite 1 FF 11223344"); PrintAndLog(" hf 14b sriwrite 1 FF 11223344");
PrintAndLog(" hf 14b sriwrite 2 15 11223344"); PrintAndLog(" hf 14b sriwrite 2 15 11223344");

View file

@ -283,14 +283,14 @@ int usage_15_info(void){
PrintAndLog("defaults to '1 out of 4' mode"); PrintAndLog("defaults to '1 out of 4' mode");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: hf 15 info [options] <uid|s|u|*>"); PrintAndLog("Usage: hf 15 info [options] <uid|s|u|*>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" -2 use slower '1 out of 256' mode"); PrintAndLog(" -2 use slower '1 out of 256' mode");
PrintAndLog(" uid (either): "); PrintAndLog(" uid (either): ");
PrintAndLog(" <8B hex> full UID eg E011223344556677"); PrintAndLog(" <8B hex> full UID eg E011223344556677");
PrintAndLog(" s selected tag"); PrintAndLog(" s selected tag");
PrintAndLog(" u unaddressed mode"); PrintAndLog(" u unaddressed mode");
PrintAndLog(" * scan for tag"); PrintAndLog(" * scan for tag");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf 15 info u"); PrintAndLog(" hf 15 info u");
return 0; return 0;
} }
@ -301,18 +301,18 @@ int usage_15_record(void){
int usage_15_reader(void){ int usage_15_reader(void){
PrintAndLog("This command identifies a ISO 15693 tag"); PrintAndLog("This command identifies a ISO 15693 tag");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("usage: hf 15 reader [h]"); PrintAndLog("Usage: hf 15 reader [h]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 15 reader"); PrintAndLog(" hf 15 reader");
return 0; return 0;
} }
int usage_15_sim(void){ int usage_15_sim(void){
PrintAndLog("usage: hf 15 sim <UID>"); PrintAndLog("Usage: hf 15 sim <UID>");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 15 sim E016240000000000"); PrintAndLog(" hf 15 sim E016240000000000");
return 0; return 0;
} }
@ -323,12 +323,12 @@ int usage_15_findafi(void){
int usage_15_dump(void){ int usage_15_dump(void){
PrintAndLog("This command dumps the contents of a ISO-15693 tag and save it to file"); PrintAndLog("This command dumps the contents of a ISO-15693 tag and save it to file");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("usage: hf 15 dump [h] <f filname> "); PrintAndLog("Usage: hf 15 dump [h] <f filname> ");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" f <name> filename, if no <name> UID will be used as filename"); PrintAndLog(" f <name> filename, if no <name> UID will be used as filename");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf 15 dump f"); PrintAndLog(" hf 15 dump f");
PrintAndLog(" hf 15 dump f mydump"); PrintAndLog(" hf 15 dump f mydump");
return 0; return 0;
@ -346,8 +346,8 @@ int usage_15_raw(void){
return 0; return 0;
} }
int usage_15_read(void){ int usage_15_read(void){
PrintAndLog("usage: hf 15 read [options] <uid|s|u|*> <page#>"); PrintAndLog("Usage: hf 15 read [options] <uid|s|u|*> <page#>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" -2 use slower '1 out of 256' mode"); PrintAndLog(" -2 use slower '1 out of 256' mode");
PrintAndLog(" uid (either): "); PrintAndLog(" uid (either): ");
PrintAndLog(" <8B hex> full UID eg E011223344556677"); PrintAndLog(" <8B hex> full UID eg E011223344556677");
@ -358,8 +358,8 @@ int usage_15_read(void){
return 0; return 0;
} }
int usage_15_write(void){ int usage_15_write(void){
PrintAndLog("usage: hf 15 write [options] <uid|s|u|*> <page#> <hexdata>"); PrintAndLog("Usage: hf 15 write [options] <uid|s|u|*> <page#> <hexdata>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" -2 use slower '1 out of 256' mode"); PrintAndLog(" -2 use slower '1 out of 256' mode");
PrintAndLog(" -o set OPTION Flag (needed for TI)"); PrintAndLog(" -o set OPTION Flag (needed for TI)");
PrintAndLog(" uid (either): "); PrintAndLog(" uid (either): ");
@ -373,7 +373,7 @@ int usage_15_write(void){
} }
int usage_15_readmulti(void){ int usage_15_readmulti(void){
PrintAndLog("Usage: hf 15 readmulti [options] <uid|s|u|*> <start#> <count#>"); PrintAndLog("Usage: hf 15 readmulti [options] <uid|s|u|*> <start#> <count#>");
PrintAndLog(" options:"); PrintAndLog("Options:");
PrintAndLog(" -2 use slower '1 out of 256' mode"); PrintAndLog(" -2 use slower '1 out of 256' mode");
PrintAndLog(" uid (either): "); PrintAndLog(" uid (either): ");
PrintAndLog(" <8B hex> full UID eg E011223344556677"); PrintAndLog(" <8B hex> full UID eg E011223344556677");
@ -680,10 +680,9 @@ int CmdHF15Dump(const char*Cmd) {
return 1; return 1;
} }
fptr += sprintf(fptr, "dump15_"); fptr += sprintf(fptr, "hf-15-");
FillFileNameByUID(fptr,uid,"-dump",sizeof(uid));
for (int j = sizeof(uid)-1; j >=0 ; j--)
fptr += sprintf(fptr, "%02X", uid[j]);
} }
// detect blocksize from card :) // detect blocksize from card :)

View file

@ -18,7 +18,7 @@ int usage_hf_emv_test(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv test"); PrintAndLog(" hf emv test");
return 0; return 0;
} }
@ -30,7 +30,7 @@ int usage_hf_emv_readrecord(void){
PrintAndLog(" <records> : number of records"); PrintAndLog(" <records> : number of records");
PrintAndLog(" <sfi> : number of SFI records"); PrintAndLog(" <sfi> : number of SFI records");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv readrecord 1 1"); PrintAndLog(" hf emv readrecord 1 1");
return 0; return 0;
} }
@ -41,7 +41,7 @@ int usage_hf_emv_clone(void){
PrintAndLog(" <records> : number of records"); PrintAndLog(" <records> : number of records");
PrintAndLog(" <sfi> : number of SFI records"); PrintAndLog(" <sfi> : number of SFI records");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv clone 10 10"); PrintAndLog(" hf emv clone 10 10");
return 0; return 0;
} }
@ -51,7 +51,7 @@ int usage_hf_emv_transaction(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv trans"); PrintAndLog(" hf emv trans");
return 0; return 0;
} }
@ -61,7 +61,7 @@ int usage_hf_emv_getrnd(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv getrnd"); PrintAndLog(" hf emv getrnd");
return 0; return 0;
} }
@ -72,7 +72,7 @@ int usage_hf_emv_eload(void){
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" o <filename> : filename w/o '.bin'"); PrintAndLog(" o <filename> : filename w/o '.bin'");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv eload o myfile"); PrintAndLog(" hf emv eload o myfile");
return 0; return 0;
} }
@ -84,7 +84,7 @@ int usage_hf_emv_dump(void){
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" o <filename> : filename w/o '.bin' to dump bytes"); PrintAndLog(" o <filename> : filename w/o '.bin' to dump bytes");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv dump"); PrintAndLog(" hf emv dump");
PrintAndLog(" hf emv dump o myfile"); PrintAndLog(" hf emv dump o myfile");
return 0; return 0;
@ -95,7 +95,7 @@ int usage_hf_emv_sim(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv sim"); PrintAndLog(" hf emv sim");
return 0; return 0;
} }

View file

@ -13,13 +13,13 @@ static int CmdHelp(const char *Cmd);
int usage_hf_felica_sim(void) { int usage_hf_felica_sim(void) {
PrintAndLog("\n Emulating ISO/18092 FeliCa tag \n"); PrintAndLog("\n Emulating ISO/18092 FeliCa tag \n");
PrintAndLog("usage: hf felica sim [h] t <type> [v]"); PrintAndLog("Usage: hf felica sim [h] t <type> [v]");
PrintAndLog("options: "); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" t : 1 = FeliCa"); PrintAndLog(" t : 1 = FeliCa");
PrintAndLog(" : 2 = FeliCaLiteS"); PrintAndLog(" : 2 = FeliCaLiteS");
PrintAndLog(" v : (Optional) Verbose"); PrintAndLog(" v : (Optional) Verbose");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf felica sim t 1 "); PrintAndLog(" hf felica sim t 1 ");
return 0; return 0;
} }
@ -29,27 +29,27 @@ int usage_hf_felica_sniff(void){
PrintAndLog("Usage: hf felica sniff <s > <t>"); PrintAndLog("Usage: hf felica sniff <s > <t>");
PrintAndLog(" s samples to skip (decimal)"); PrintAndLog(" s samples to skip (decimal)");
PrintAndLog(" t triggers to skip (decimal)"); PrintAndLog(" t triggers to skip (decimal)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf felica sniff s 1000"); PrintAndLog(" hf felica sniff s 1000");
return 0; return 0;
} }
int usage_hf_felica_simlite(void) { int usage_hf_felica_simlite(void) {
PrintAndLog("\n Emulating ISO/18092 FeliCa Lite tag \n"); PrintAndLog("\n Emulating ISO/18092 FeliCa Lite tag \n");
PrintAndLog("usage: hf felica litesim [h] u <uid>"); PrintAndLog("Usage: hf felica litesim [h] u <uid>");
PrintAndLog("options: "); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" uid : UID in hexsymbol"); PrintAndLog(" uid : UID in hexsymbol");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf felica litesim 11223344556677"); PrintAndLog(" hf felica litesim 11223344556677");
return 0; return 0;
} }
int usage_hf_felica_dumplite(void) { int usage_hf_felica_dumplite(void) {
PrintAndLog("\n Dump ISO/18092 FeliCa Lite tag \n"); PrintAndLog("\n Dump ISO/18092 FeliCa Lite tag \n");
PrintAndLog("press button to abort run, otherwise it will loop for 200sec."); PrintAndLog("press button to abort run, otherwise it will loop for 200sec.");
PrintAndLog("usage: hf felica litedump [h]"); PrintAndLog("Usage: hf felica litedump [h]");
PrintAndLog("options: "); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf felica litedump"); PrintAndLog(" hf felica litedump");
return 0; return 0;
} }

View file

@ -36,7 +36,7 @@ int usage_hf_iclass_sim(void) {
PrintAndLog(" 2 Reader-attack, gather reader responses to extract elite key"); PrintAndLog(" 2 Reader-attack, gather reader responses to extract elite key");
PrintAndLog(" 3 Full simulation using emulator memory (see 'hf iclass eload')"); PrintAndLog(" 3 Full simulation using emulator memory (see 'hf iclass eload')");
PrintAndLog(" 4 Reader-attack, adapted for KeyRoll mode, gather reader responses to extract elite key"); PrintAndLog(" 4 Reader-attack, adapted for KeyRoll mode, gather reader responses to extract elite key");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass sim 0 031FEC8AF7FF12E0"); PrintAndLog(" hf iclass sim 0 031FEC8AF7FF12E0");
PrintAndLog(" hf iclass sim 2"); PrintAndLog(" hf iclass sim 2");
PrintAndLog(" hf iclass eload 'tagdump.bin'"); PrintAndLog(" hf iclass eload 'tagdump.bin'");
@ -47,7 +47,7 @@ int usage_hf_iclass_sim(void) {
int usage_hf_iclass_eload(void) { int usage_hf_iclass_eload(void) {
PrintAndLog("Loads iclass tag-dump into emulator memory on device"); PrintAndLog("Loads iclass tag-dump into emulator memory on device");
PrintAndLog("Usage: hf iclass eload f <filename>"); PrintAndLog("Usage: hf iclass eload f <filename>");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass eload f iclass_tagdump-aa162d30f8ff12f1.bin"); PrintAndLog(" hf iclass eload f iclass_tagdump-aa162d30f8ff12f1.bin");
return 0; return 0;
} }
@ -60,7 +60,7 @@ int usage_hf_iclass_decrypt(void) {
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: hf iclass decrypt f <tagdump>"); PrintAndLog("Usage: hf iclass decrypt f <tagdump>");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog("S hf iclass decrypt f tagdump_12312342343.bin"); PrintAndLog("S hf iclass decrypt f tagdump_12312342343.bin");
return 0; return 0;
} }
@ -70,7 +70,7 @@ int usage_hf_iclass_encrypt(void) {
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: hf iclass encrypt <BlockData>"); PrintAndLog("Usage: hf iclass encrypt <BlockData>");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass encrypt 0102030405060708"); PrintAndLog(" hf iclass encrypt 0102030405060708");
PrintAndLog(""); PrintAndLog("");
return 0; return 0;
@ -85,7 +85,7 @@ int usage_hf_iclass_dump(void) {
PrintAndLog(" r : raw, the key is interpreted as raw block 3/4"); PrintAndLog(" r : raw, the key is interpreted as raw block 3/4");
PrintAndLog(" v : verbose output"); PrintAndLog(" v : verbose output");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass dump k 001122334455667B"); PrintAndLog(" hf iclass dump k 001122334455667B");
PrintAndLog(" hf iclass dump k AAAAAAAAAAAAAAAA c 001122334455667B"); PrintAndLog(" hf iclass dump k AAAAAAAAAAAAAAAA c 001122334455667B");
PrintAndLog(" hf iclass dump k AAAAAAAAAAAAAAAA e"); PrintAndLog(" hf iclass dump k AAAAAAAAAAAAAAAA e");
@ -101,7 +101,7 @@ int usage_hf_iclass_clone(void) {
PrintAndLog(" c : If 'c' is specified, the key set is assumed to be the credit key\n"); PrintAndLog(" c : If 'c' is specified, the key set is assumed to be the credit key\n");
PrintAndLog(" e : If 'e' is specified, elite computations applied to key"); PrintAndLog(" e : If 'e' is specified, elite computations applied to key");
PrintAndLog(" r : If 'r' is specified, no computations applied to key"); PrintAndLog(" r : If 'r' is specified, no computations applied to key");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 06 l 1A k 1122334455667788 e"); PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 06 l 1A k 1122334455667788 e");
PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 05 l 19 k 0"); PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 05 l 19 k 0");
PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 06 l 19 k 0 e"); PrintAndLog(" hf iclass clone f iclass_tagdump-121345.bin b 06 l 19 k 0 e");
@ -117,7 +117,7 @@ int usage_hf_iclass_writeblock(void) {
PrintAndLog(" e : elite computations applied to key"); PrintAndLog(" e : elite computations applied to key");
PrintAndLog(" r : raw, no computations applied to key"); PrintAndLog(" r : raw, no computations applied to key");
PrintAndLog(" v : verbose output"); PrintAndLog(" v : verbose output");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass writeblk b 0A d AAAAAAAAAAAAAAAA k 001122334455667B"); PrintAndLog(" hf iclass writeblk b 0A d AAAAAAAAAAAAAAAA k 001122334455667B");
PrintAndLog(" hf iclass writeblk b 1B d AAAAAAAAAAAAAAAA k 001122334455667B c"); PrintAndLog(" hf iclass writeblk b 1B d AAAAAAAAAAAAAAAA k 001122334455667B c");
return 0; return 0;
@ -131,7 +131,7 @@ int usage_hf_iclass_readblock(void) {
PrintAndLog(" e : elite computations applied to key"); PrintAndLog(" e : elite computations applied to key");
PrintAndLog(" r : raw, no computations applied to key"); PrintAndLog(" r : raw, no computations applied to key");
PrintAndLog(" v : verbose output"); PrintAndLog(" v : verbose output");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass readblk b 06 k 0011223344556677"); PrintAndLog(" hf iclass readblk b 06 k 0011223344556677");
PrintAndLog(" hf iclass readblk b 1B k 0011223344556677 c"); PrintAndLog(" hf iclass readblk b 1B k 0011223344556677 c");
PrintAndLog(" hf iclass readblk b 0A k 0"); PrintAndLog(" hf iclass readblk b 0A k 0");
@ -144,13 +144,13 @@ int usage_hf_iclass_readtagfile() {
int usage_hf_iclass_calc_newkey(void) { int usage_hf_iclass_calc_newkey(void) {
PrintAndLog("Calculate new key for updating\n"); PrintAndLog("Calculate new key for updating\n");
PrintAndLog("Usage: hf iclass calc_newkey o <Old key> n <New key> s [csn] e"); PrintAndLog("Usage: hf iclass calc_newkey o <Old key> n <New key> s [csn] e");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" o <oldkey> : *specify a key as 16 hex symbols or a key number as 1 symbol"); PrintAndLog(" o <oldkey> : *specify a key as 16 hex symbols or a key number as 1 symbol");
PrintAndLog(" n <newkey> : *specify a key as 16 hex symbols or a key number as 1 symbol"); PrintAndLog(" n <newkey> : *specify a key as 16 hex symbols or a key number as 1 symbol");
PrintAndLog(" s <csn> : specify a card Serial number to diversify the key (if omitted will attempt to read a csn)"); PrintAndLog(" s <csn> : specify a card Serial number to diversify the key (if omitted will attempt to read a csn)");
PrintAndLog(" e : specify new key as elite calc"); PrintAndLog(" e : specify new key as elite calc");
PrintAndLog(" ee : specify old and new key as elite calc"); PrintAndLog(" ee : specify old and new key as elite calc");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" e key to e key given csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899 s deadbeafdeadbeaf ee"); PrintAndLog(" e key to e key given csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899 s deadbeafdeadbeaf ee");
PrintAndLog(" std key to e key read csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899 e"); PrintAndLog(" std key to e key read csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899 e");
PrintAndLog(" std to std read csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899"); PrintAndLog(" std to std read csn : hf iclass calcnewkey o 1122334455667788 n 2233445566778899");
@ -160,14 +160,14 @@ int usage_hf_iclass_calc_newkey(void) {
int usage_hf_iclass_managekeys(void) { int usage_hf_iclass_managekeys(void) {
PrintAndLog("HELP : Manage iClass Keys in client memory:\n"); PrintAndLog("HELP : Manage iClass Keys in client memory:\n");
PrintAndLog("Usage: hf iclass managekeys n [keynbr] k [key] f [filename] s l p\n"); PrintAndLog("Usage: hf iclass managekeys n [keynbr] k [key] f [filename] s l p\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" n <keynbr> : specify the keyNbr to set in memory"); PrintAndLog(" n <keynbr> : specify the keyNbr to set in memory");
PrintAndLog(" k <key> : set a key in memory"); PrintAndLog(" k <key> : set a key in memory");
PrintAndLog(" f <filename>: specify a filename to use with load or save operations"); PrintAndLog(" f <filename>: specify a filename to use with load or save operations");
PrintAndLog(" s : save keys in memory to file specified by filename"); PrintAndLog(" s : save keys in memory to file specified by filename");
PrintAndLog(" l : load keys to memory from file specified by filename"); PrintAndLog(" l : load keys to memory from file specified by filename");
PrintAndLog(" p : print keys loaded into memory\n"); PrintAndLog(" p : print keys loaded into memory\n");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" set key : hf iclass managekeys n 0 k 1122334455667788"); PrintAndLog(" set key : hf iclass managekeys n 0 k 1122334455667788");
PrintAndLog(" save key file: hf iclass managekeys f mykeys.bin s"); PrintAndLog(" save key file: hf iclass managekeys f mykeys.bin s");
PrintAndLog(" load key file: hf iclass managekeys f mykeys.bin l"); PrintAndLog(" load key file: hf iclass managekeys f mykeys.bin l");
@ -180,7 +180,7 @@ int usage_hf_iclass_reader(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h This help text"); PrintAndLog(" h This help text");
PrintAndLog(" 1 read only 1 tag"); PrintAndLog(" 1 read only 1 tag");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass reader 1"); PrintAndLog(" hf iclass reader 1");
return 0; return 0;
} }
@ -190,14 +190,14 @@ int usage_hf_iclass_replay(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h This help text"); PrintAndLog(" h This help text");
PrintAndLog(" <mac> Mac bytes to replay (8 hexsymbols)"); PrintAndLog(" <mac> Mac bytes to replay (8 hexsymbols)");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass replay 00112233"); PrintAndLog(" hf iclass replay 00112233");
return 0; return 0;
} }
int usage_hf_iclass_sniff(void) { int usage_hf_iclass_sniff(void) {
PrintAndLog("Sniff the communication between reader and tag"); PrintAndLog("Sniff the communication between reader and tag");
PrintAndLog("Usage: hf iclass sniff [h]"); PrintAndLog("Usage: hf iclass sniff [h]");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass sniff"); PrintAndLog(" hf iclass sniff");
return 0; return 0;
} }
@ -224,7 +224,7 @@ int usage_hf_iclass_chk(void) {
PrintAndLog(" f <filename> Dictionary file with default iclass keys"); PrintAndLog(" f <filename> Dictionary file with default iclass keys");
PrintAndLog(" r raw"); PrintAndLog(" r raw");
PrintAndLog(" e elite"); PrintAndLog(" e elite");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass chk f default_iclass_keys.dic"); PrintAndLog(" hf iclass chk f default_iclass_keys.dic");
PrintAndLog(" hf iclass chk f default_iclass_keys.dic e"); PrintAndLog(" hf iclass chk f default_iclass_keys.dic e");
return 0; return 0;
@ -240,7 +240,7 @@ int usage_hf_iclass_lookup(void) {
PrintAndLog(" m macs"); PrintAndLog(" m macs");
PrintAndLog(" r raw"); PrintAndLog(" r raw");
PrintAndLog(" e elite"); PrintAndLog(" e elite");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass lookup u 9655a400f8ff12e0 p f0ffffffffffffff m 0000000089cb984b f default_iclass_keys.dic"); PrintAndLog(" hf iclass lookup u 9655a400f8ff12e0 p f0ffffffffffffff m 0000000089cb984b f default_iclass_keys.dic");
PrintAndLog(" hf iclass lookup u 9655a400f8ff12e0 p f0ffffffffffffff m 0000000089cb984b f default_iclass_keys.dic e"); PrintAndLog(" hf iclass lookup u 9655a400f8ff12e0 p f0ffffffffffffff m 0000000089cb984b f default_iclass_keys.dic e");
return 0; return 0;
@ -255,7 +255,7 @@ int usage_hf_iclass_permutekey(void){
PrintAndLog(" f permute key"); PrintAndLog(" f permute key");
PrintAndLog(" <bytes> input bytes"); PrintAndLog(" <bytes> input bytes");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf iclass permute r 0123456789abcdef"); PrintAndLog(" hf iclass permute r 0123456789abcdef");
return 0; return 0;
} }

View file

@ -23,7 +23,7 @@ int usage_legic_calccrc(void){
PrintAndLog(" u <uidcrc> : MCC hexbyte"); PrintAndLog(" u <uidcrc> : MCC hexbyte");
PrintAndLog(" c <8|16> : Crc type"); PrintAndLog(" c <8|16> : Crc type");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic crc d deadbeef1122"); PrintAndLog(" hf legic crc d deadbeef1122");
PrintAndLog(" hf legic crc d deadbeef1122 u 9A c 16"); PrintAndLog(" hf legic crc d deadbeef1122 u 9A c 16");
return 0; return 0;
@ -37,7 +37,7 @@ int usage_legic_rdmem(void){
PrintAndLog(" <length> : (hex) number of bytes to read"); PrintAndLog(" <length> : (hex) number of bytes to read");
PrintAndLog(" <IV> : (hex) (optional) Initialization vector to use. Must be odd and 7bits max"); PrintAndLog(" <IV> : (hex) (optional) Initialization vector to use. Must be odd and 7bits max");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic rdmem 0 16 - reads from byte[0] 0x16 bytes(system header)"); PrintAndLog(" hf legic rdmem 0 16 - reads from byte[0] 0x16 bytes(system header)");
PrintAndLog(" hf legic rdmem 0 4 55 - reads from byte[0] 0x4 bytes with IV 0x55"); PrintAndLog(" hf legic rdmem 0 4 55 - reads from byte[0] 0x4 bytes with IV 0x55");
PrintAndLog(" hf legic rdmem 0 100 55 - reads 0x100 bytes with IV 0x55"); PrintAndLog(" hf legic rdmem 0 100 55 - reads 0x100 bytes with IV 0x55");
@ -56,7 +56,7 @@ int usage_legic_sim(void){
PrintAndLog(" <frame> : frame drift"); PrintAndLog(" <frame> : frame drift");
PrintAndLog(" <reqresp> : reqresp drift"); PrintAndLog(" <reqresp> : reqresp drift");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic sim"); PrintAndLog(" hf legic sim");
PrintAndLog(" hf legic sim "); PrintAndLog(" hf legic sim ");
return 0; return 0;
@ -70,7 +70,7 @@ int usage_legic_write(void){
//PrintAndLog(" <IV> : (optional) Initialization vector to use (ODD and 7bits)"); //PrintAndLog(" <IV> : (optional) Initialization vector to use (ODD and 7bits)");
PrintAndLog(" d <data> : (hex symbols) bytes to write "); PrintAndLog(" d <data> : (hex symbols) bytes to write ");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic write o 10 d 11223344 - Write 0x11223344 starting from offset 0x10"); PrintAndLog(" hf legic write o 10 d 11223344 - Write 0x11223344 starting from offset 0x10");
return 0; return 0;
} }
@ -80,7 +80,7 @@ int usage_legic_reader(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic reader"); PrintAndLog(" hf legic reader");
return 0; return 0;
} }
@ -91,7 +91,7 @@ int usage_legic_info(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic info"); PrintAndLog(" hf legic info");
return 0; return 0;
} }
@ -104,7 +104,7 @@ int usage_legic_dump(void){
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" o <filename> : filename w/o '.bin' to dump bytes"); PrintAndLog(" o <filename> : filename w/o '.bin' to dump bytes");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic dump"); PrintAndLog(" hf legic dump");
PrintAndLog(" hf legic dump o myfile"); PrintAndLog(" hf legic dump o myfile");
return 0; return 0;
@ -117,7 +117,7 @@ int usage_legic_restore(void){
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" i <filename> : filename w/o '.bin' to restore bytes on to card from"); PrintAndLog(" i <filename> : filename w/o '.bin' to restore bytes on to card from");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic restore i myfile"); PrintAndLog(" hf legic restore i myfile");
return 0; return 0;
} }
@ -131,7 +131,7 @@ int usage_legic_eload(void){
PrintAndLog(" : 2 = MIM1024"); PrintAndLog(" : 2 = MIM1024");
PrintAndLog(" <filename> : filename w/o .bin to load"); PrintAndLog(" <filename> : filename w/o .bin to load");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic eload 2 myfile"); PrintAndLog(" hf legic eload 2 myfile");
return 0; return 0;
} }
@ -145,7 +145,7 @@ int usage_legic_esave(void){
PrintAndLog(" : 2 = MIM1024"); PrintAndLog(" : 2 = MIM1024");
PrintAndLog(" <filename> : filename w/o .bin to load"); PrintAndLog(" <filename> : filename w/o .bin to load");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic esave 2 myfile"); PrintAndLog(" hf legic esave 2 myfile");
return 0; return 0;
} }
@ -155,7 +155,7 @@ int usage_legic_wipe(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf legic wipe"); PrintAndLog(" hf legic wipe");
return 0; return 0;
} }

View file

@ -16,13 +16,38 @@
#define MIFARE_MINI_MAXBLOCK 20 #define MIFARE_MINI_MAXBLOCK 20
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
int usage_hf14_ice(void){
PrintAndLog("Usage: hf mf ice [l] <limit> [f] <name>");
PrintAndLog(" h this help");
PrintAndLog(" l <limit> nonces to be collected");
PrintAndLog(" f <name> save nonces to <name> instead of hf-mf-<UID>-nonces.bin");
PrintAndLog("");
PrintAndLog("Examples:");
PrintAndLog(" hf mf ice");
PrintAndLog(" hf mf ice f nonces.bin");
return 0;
}
int usage_hf14_dump(void){
PrintAndLog("Usage: hf mf dump [card memory] k <name> f <name>");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(" k <name> : key filename, if no <name> given, UID will be used as filename");
PrintAndLog(" f <name> : data filename, if no <name> given, UID will be used as filename");
PrintAndLog("");
PrintAndLog("Examples:");
PrintAndLog(" hf mf dump");
PrintAndLog(" hf mf dump 4");
return 0;
}
int usage_hf14_mifare(void){ int usage_hf14_mifare(void){
PrintAndLog("Usage: hf mf darkside [h] <block number> <A|B>"); PrintAndLog("Usage: hf mf darkside [h] <block number> <A|B>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <block number> (Optional) target other block"); PrintAndLog(" <block number> (Optional) target other block");
PrintAndLog(" <A|B> (optional) target key type"); PrintAndLog(" <A|B> (optional) target key type");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf darkside"); PrintAndLog(" hf mf darkside");
PrintAndLog(" hf mf darkside 16"); PrintAndLog(" hf mf darkside 16");
PrintAndLog(" hf mf darkside 16 B"); PrintAndLog(" hf mf darkside 16 B");
@ -30,7 +55,7 @@ int usage_hf14_mifare(void){
} }
int usage_hf14_mf1ksim(void){ int usage_hf14_mf1ksim(void){
PrintAndLog("Usage: hf mf sim [h] u <uid> n <numreads> [i] [x] [e] [v]"); PrintAndLog("Usage: hf mf sim [h] u <uid> n <numreads> [i] [x] [e] [v]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" u (Optional) UID 4,7 or 10bytes. If not specified, the UID 4b from emulator memory will be used"); PrintAndLog(" u (Optional) UID 4,7 or 10bytes. If not specified, the UID 4b from emulator memory will be used");
PrintAndLog(" n (Optional) Automatically exit simulation after <numreads> blocks have been read by reader. 0 = infinite"); PrintAndLog(" n (Optional) Automatically exit simulation after <numreads> blocks have been read by reader. 0 = infinite");
@ -38,7 +63,7 @@ int usage_hf14_mf1ksim(void){
PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a reader"); PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a reader");
PrintAndLog(" e (Optional) Fill simulator keys from found keys"); PrintAndLog(" e (Optional) Fill simulator keys from found keys");
PrintAndLog(" v (Optional) Verbose"); PrintAndLog(" v (Optional) Verbose");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf sim u 0a0a0a0a"); PrintAndLog(" hf mf sim u 0a0a0a0a");
PrintAndLog(" hf mf sim u 11223344556677"); PrintAndLog(" hf mf sim u 11223344556677");
PrintAndLog(" hf mf sim u 112233445566778899AA"); PrintAndLog(" hf mf sim u 112233445566778899AA");
@ -47,7 +72,7 @@ int usage_hf14_mf1ksim(void){
} }
int usage_hf14_dbg(void){ int usage_hf14_dbg(void){
PrintAndLog("Usage: hf mf dbg [h] <debug level>"); PrintAndLog("Usage: hf mf dbg [h] <debug level>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <debug level> (Optional) see list for valid levels"); PrintAndLog(" <debug level> (Optional) see list for valid levels");
PrintAndLog(" 0 - no debug messages"); PrintAndLog(" 0 - no debug messages");
@ -56,20 +81,20 @@ int usage_hf14_dbg(void){
PrintAndLog(" 3 - plus debug messages"); PrintAndLog(" 3 - plus debug messages");
PrintAndLog(" 4 - print even debug messages in timing critical functions"); PrintAndLog(" 4 - print even debug messages in timing critical functions");
PrintAndLog(" Note: this option therefore may cause malfunction itself"); PrintAndLog(" Note: this option therefore may cause malfunction itself");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf dbg 3"); PrintAndLog(" hf mf dbg 3");
return 0; return 0;
} }
int usage_hf14_sniff(void){ int usage_hf14_sniff(void){
PrintAndLog("It continuously gets data from the field and saves it to: log, emulator, emulator file."); PrintAndLog("It continuously gets data from the field and saves it to: log, emulator, emulator file.");
PrintAndLog("Usage: hf mf sniff [h] [l] [d] [f]"); PrintAndLog("Usage: hf mf sniff [h] [l] [d] [f]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" l save encrypted sequence to logfile `uid.log`"); PrintAndLog(" l save encrypted sequence to logfile `uid.log`");
PrintAndLog(" d decrypt sequence and put it to log file `uid.log`"); PrintAndLog(" d decrypt sequence and put it to log file `uid.log`");
// PrintAndLog(" n/a e decrypt sequence, collect read and write commands and save the result of the sequence to emulator memory"); // PrintAndLog(" n/a e decrypt sequence, collect read and write commands and save the result of the sequence to emulator memory");
PrintAndLog(" f decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`"); PrintAndLog(" f decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`");
PrintAndLog("sample:"); PrintAndLog("Example:");
PrintAndLog(" hf mf sniff l d f"); PrintAndLog(" hf mf sniff l d f");
return 0; return 0;
} }
@ -78,13 +103,13 @@ int usage_hf14_nested(void){
PrintAndLog(" all sectors: hf mf nested <card memory> <block number> <key A/B> <key (12 hex symbols)> [t,d]"); PrintAndLog(" all sectors: hf mf nested <card memory> <block number> <key A/B> <key (12 hex symbols)> [t,d]");
PrintAndLog(" one sector: hf mf nested o <block number> <key A/B> <key (12 hex symbols)>"); PrintAndLog(" one sector: hf mf nested o <block number> <key A/B> <key (12 hex symbols)>");
PrintAndLog(" <target block number> <target key A/B> [t]"); PrintAndLog(" <target block number> <target key A/B> [t]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" card memory - 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K, <other> - 1K"); PrintAndLog(" card memory - 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K, <other> - 1K");
PrintAndLog(" t transfer keys into emulator memory"); PrintAndLog(" t transfer keys into emulator memory");
PrintAndLog(" d write keys to binary file `dumpkeys.bin`"); PrintAndLog(" d write keys to binary file `hf-mf-<UID>-key.bin`");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF "); PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF ");
PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF t "); PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF t ");
PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF d "); PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF d ");
@ -96,28 +121,30 @@ int usage_hf14_hardnested(void){
PrintAndLog(" hf mf hardnested <block number> <key A|B> <key (12 hex symbols)>"); PrintAndLog(" hf mf hardnested <block number> <key A|B> <key (12 hex symbols)>");
PrintAndLog(" <target block number> <target key A|B> [known target key (12 hex symbols)] [w] [s]"); PrintAndLog(" <target block number> <target key A|B> [known target key (12 hex symbols)] [w] [s]");
PrintAndLog(" or hf mf hardnested r [known target key]"); PrintAndLog(" or hf mf hardnested r [known target key]");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" w acquire nonces and write them to binary file nonces.bin"); PrintAndLog(" w acquire nonces and UID, and write them to binary file with default name hf-mf-<UID>-nonces.bin");
PrintAndLog(" s slower acquisition (required by some non standard cards)"); PrintAndLog(" s slower acquisition (required by some non standard cards)");
PrintAndLog(" r read nonces.bin and start attack"); PrintAndLog(" r read hf-mf-<UID>-nonces.bin if tag present, otherwise read nonces.bin, then start attack");
PrintAndLog(" u <UID> read/write hf-mf-<UID>-nonces.bin instead of default name");
PrintAndLog(" f <name> read/write <name> instead of default name");
PrintAndLog(" t tests?"); PrintAndLog(" t tests?");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A"); PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A");
PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A w"); PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A w");
PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A w s"); PrintAndLog(" hf mf hardnested 0 A FFFFFFFFFFFF 4 A f nonces.bin w s");
PrintAndLog(" hf mf hardnested r"); PrintAndLog(" hf mf hardnested r");
PrintAndLog(" hf mf hardnested r a0a1a2a3a4a5"); PrintAndLog(" hf mf hardnested r a0a1a2a3a4a5");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("Add the known target key to check if it is present in the remaining key space:"); PrintAndLog("Add the known target key to check if it is present in the remaining key space:");
PrintAndLog(" sample5: hf mf hardnested 0 A A0A1A2A3A4A5 4 A FFFFFFFFFFFF"); PrintAndLog(" hf mf hardnested 0 A A0A1A2A3A4A5 4 A FFFFFFFFFFFF");
return 0; return 0;
} }
int usage_hf14_chk(void){ int usage_hf14_chk(void){
PrintAndLog("Usage: hf mf chk [h] <block number>|<*card memory> <key type (A/B/?)> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]"); PrintAndLog("Usage: hf mf chk [h] <block number>|<*card memory> <key type (A/B/?)> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" * all sectors based on card memory, other values then below defaults to 1k"); PrintAndLog(" * all sectors based on card memory, other values then below defaults to 1k");
PrintAndLog(" 0 - MINI(320 bytes)"); PrintAndLog(" 0 - MINI(320 bytes)");
@ -126,8 +153,8 @@ int usage_hf14_chk(void){
PrintAndLog(" 4 - 4K"); PrintAndLog(" 4 - 4K");
PrintAndLog(" d write keys to binary file"); PrintAndLog(" d write keys to binary file");
PrintAndLog(" t write keys to emulator memory\n"); PrintAndLog(" t write keys to emulator memory\n");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf chk 0 A 1234567890ab keys.dic -- target block 0, Key A"); PrintAndLog(" hf mf chk 0 A 1234567890ab keys.dic -- target block 0, Key A");
PrintAndLog(" hf mf chk *1 ? t -- target all blocks, all keys, 1K, write to emul"); PrintAndLog(" hf mf chk *1 ? t -- target all blocks, all keys, 1K, write to emul");
PrintAndLog(" hf mf chk *1 ? d -- target all blocks, all keys, 1K, write to file"); PrintAndLog(" hf mf chk *1 ? d -- target all blocks, all keys, 1K, write to file");
@ -136,7 +163,7 @@ int usage_hf14_chk(void){
int usage_hf14_chk_fast(void){ int usage_hf14_chk_fast(void){
PrintAndLog("This is a improved checkkeys method speedwise. It checks Mifare Classic tags sector keys against a dictionary file with keys"); PrintAndLog("This is a improved checkkeys method speedwise. It checks Mifare Classic tags sector keys against a dictionary file with keys");
PrintAndLog("Usage: hf mf fchk [h] <card memory> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]"); PrintAndLog("Usage: hf mf fchk [h] <card memory> [t|d] [<key (12 hex symbols)>] [<dic (*.dic)>]");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <cardmem> all sectors based on card memory, other values than below defaults to 1k"); PrintAndLog(" <cardmem> all sectors based on card memory, other values than below defaults to 1k");
PrintAndLog(" 0 - MINI(320 bytes)"); PrintAndLog(" 0 - MINI(320 bytes)");
@ -145,8 +172,8 @@ int usage_hf14_chk_fast(void){
PrintAndLog(" 4 - 4K"); PrintAndLog(" 4 - 4K");
PrintAndLog(" d write keys to binary file"); PrintAndLog(" d write keys to binary file");
PrintAndLog(" t write keys to emulator memory\n"); PrintAndLog(" t write keys to emulator memory\n");
PrintAndLog(" "); PrintAndLog("");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf fchk 1 1234567890ab keys.dic -- target 1K using key 1234567890ab, using dictionary file"); PrintAndLog(" hf mf fchk 1 1234567890ab keys.dic -- target 1K using key 1234567890ab, using dictionary file");
PrintAndLog(" hf mf fchk 1 t -- target 1K, write to emulator memory"); PrintAndLog(" hf mf fchk 1 t -- target 1K, write to emulator memory");
PrintAndLog(" hf mf fchk 1 d -- target 1K, write to file"); PrintAndLog(" hf mf fchk 1 d -- target 1K, write to file");
@ -160,33 +187,40 @@ int usage_hf14_keybrute(void){
PrintAndLog(" ---[ This attack is obsolete, try hardnested instead ]---"); PrintAndLog(" ---[ This attack is obsolete, try hardnested instead ]---");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: hf mf keybrute [h] <block number> <A|B> <key>"); PrintAndLog("Usage: hf mf keybrute [h] <block number> <A|B> <key>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <block number> target block number"); PrintAndLog(" <block number> target block number");
PrintAndLog(" <A|B> target key type"); PrintAndLog(" <A|B> target key type");
PrintAndLog(" <key> candidate key from mf_nonce_brute tool"); PrintAndLog(" <key> candidate key from mf_nonce_brute tool");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf keybrute 1 A 000011223344"); PrintAndLog(" hf mf keybrute 1 A 000011223344");
return 0; return 0;
} }
int usage_hf14_restore(void){ int usage_hf14_restore(void){
PrintAndLog("Usage: hf mf restore [card memory]"); PrintAndLog("Usage: hf mf restore [card memory] u <UID> k <name> f <name>");
PrintAndLog("Options:");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(" u <UID> : uid, try to restore from hf-mf-<UID>-key.bin and hf-mf-<UID>-data.bin");
PrintAndLog(" k <name> : key filename, specific the full filename of key file");
PrintAndLog(" f <name> : data filename, specific the full filename of data file");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples: hf mf restore"); PrintAndLog("Examples:");
PrintAndLog(" hf mf restore 4"); PrintAndLog(" hf mf restore -- read the UID from tag first, then restore from hf-mf-<UID>-key.bin and and hf-mf-<UID>-data.bin");
PrintAndLog(" hf mf restore 1 u 12345678 -- restore from hf-mf-12345678-key.bin and hf-mf-12345678-data.bin");
PrintAndLog(" hf mf restore 1 u 12345678 k dumpkey.bin -- restore from dumpkey.bin and hf-mf-12345678-data.bin");
PrintAndLog(" hf mf restore 4 -- read the UID from tag with 4K memory first, then restore from hf-mf-<UID>-key.bin and and hf-mf-<UID>-data.bin");
return 0; return 0;
} }
int usage_hf14_decryptbytes(void){ int usage_hf14_decryptbytes(void){
PrintAndLog("Decrypt Crypto-1 encrypted bytes given some known state of crypto. See tracelog to gather needed values\n"); PrintAndLog("Decrypt Crypto-1 encrypted bytes given some known state of crypto. See tracelog to gather needed values\n");
PrintAndLog("usage: hf mf decrypt [h] <nt> <ar_enc> <at_enc> <data>"); PrintAndLog("Usage: hf mf decrypt [h] <nt> <ar_enc> <at_enc> <data>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <nt> reader nonce"); PrintAndLog(" <nt> reader nonce");
PrintAndLog(" <ar_enc> encrypted reader response"); PrintAndLog(" <ar_enc> encrypted reader response");
PrintAndLog(" <at_enc> encrypted tag response"); PrintAndLog(" <at_enc> encrypted tag response");
PrintAndLog(" <data> encrypted data, taken directly after at_enc and forward"); PrintAndLog(" <data> encrypted data, taken directly after at_enc and forward");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf decrypt b830049b 9248314a 9280e203 41e586f9\n"); PrintAndLog(" hf mf decrypt b830049b 9248314a 9280e203 41e586f9\n");
PrintAndLog(" this sample decrypts 41e586f9 -> 3003999a Annotated: 30 03 [99 9a] auth block 3 [crc]"); PrintAndLog(" this sample decrypts 41e586f9 -> 3003999a Annotated: 30 03 [99 9a] auth block 3 [crc]");
return 0; return 0;
@ -194,7 +228,8 @@ int usage_hf14_decryptbytes(void){
int usage_hf14_eget(void){ int usage_hf14_eget(void){
PrintAndLog("Usage: hf mf eget <block number>"); PrintAndLog("Usage: hf mf eget <block number>");
PrintAndLog(" sample: hf mf eget 0 "); PrintAndLog("Examples:");
PrintAndLog(" hf mf eget 0 ");
return 0; return 0;
} }
int usage_hf14_eclr(void){ int usage_hf14_eclr(void){
@ -204,7 +239,8 @@ int usage_hf14_eclr(void){
} }
int usage_hf14_eset(void){ int usage_hf14_eset(void){
PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>"); PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>");
PrintAndLog("sample: hf mf eset 1 000102030405060708090a0b0c0d0e0f "); PrintAndLog("Examples:");
PrintAndLog(" hf mf eset 1 000102030405060708090a0b0c0d0e0f ");
return 0; return 0;
} }
int usage_hf14_eload(void){ int usage_hf14_eload(void){
@ -212,7 +248,8 @@ int usage_hf14_eload(void){
PrintAndLog("Usage: hf mf eload [card memory] <file name w/o `.eml`> [numblocks]"); PrintAndLog("Usage: hf mf eload [card memory] <file name w/o `.eml`> [numblocks]");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K, u = UL"); PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K, u = UL");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: hf mf eload filename"); PrintAndLog("Examples:");
PrintAndLog(" hf mf eload filename");
PrintAndLog(" hf mf eload 4 filename"); PrintAndLog(" hf mf eload 4 filename");
return 0; return 0;
} }
@ -221,7 +258,8 @@ int usage_hf14_esave(void){
PrintAndLog(" Usage: hf mf esave [card memory] [file name w/o `.eml`]"); PrintAndLog(" Usage: hf mf esave [card memory] [file name w/o `.eml`]");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: hf mf esave "); PrintAndLog("Examples:");
PrintAndLog(" hf mf esave ");
PrintAndLog(" hf mf esave 4"); PrintAndLog(" hf mf esave 4");
PrintAndLog(" hf mf esave 4 filename"); PrintAndLog(" hf mf esave 4 filename");
return 0; return 0;
@ -232,7 +270,8 @@ int usage_hf14_ecfill(void){
PrintAndLog("Usage: hf mf ecfill <key A/B> [card memory]"); PrintAndLog("Usage: hf mf ecfill <key A/B> [card memory]");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("samples: hf mf ecfill A"); PrintAndLog("Examples:");
PrintAndLog(" hf mf ecfill A");
PrintAndLog(" hf mf ecfill A 4"); PrintAndLog(" hf mf ecfill A 4");
return 0; return 0;
} }
@ -241,7 +280,8 @@ int usage_hf14_ekeyprn(void){
PrintAndLog("Usage: hf mf ekeyprn [card memory]"); PrintAndLog("Usage: hf mf ekeyprn [card memory]");
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: hf mf ekeyprn 1"); PrintAndLog("Examples:");
PrintAndLog(" hf mf ekeyprn 1");
return 0; return 0;
} }
@ -255,7 +295,7 @@ int usage_hf14_csetuid(void){
PrintAndLog(" <uid> UID 8 hex symbols"); PrintAndLog(" <uid> UID 8 hex symbols");
PrintAndLog(" <atqa> ATQA 4 hex symbols"); PrintAndLog(" <atqa> ATQA 4 hex symbols");
PrintAndLog(" <sak> SAK 2 hex symbols"); PrintAndLog(" <sak> SAK 2 hex symbols");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf csetuid 01020304"); PrintAndLog(" hf mf csetuid 01020304");
PrintAndLog(" hf mf csetuid 01020304 0004 08 w"); PrintAndLog(" hf mf csetuid 01020304 0004 08 w");
return 0; return 0;
@ -269,7 +309,7 @@ int usage_hf14_csetblk(void){
PrintAndLog(" w wipe card before writing"); PrintAndLog(" w wipe card before writing");
PrintAndLog(" <block> block number"); PrintAndLog(" <block> block number");
PrintAndLog(" <data> block data to write (32 hex symbols)"); PrintAndLog(" <data> block data to write (32 hex symbols)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf csetblk 1 01020304050607080910111213141516"); PrintAndLog(" hf mf csetblk 1 01020304050607080910111213141516");
PrintAndLog(" hf mf csetblk 1 01020304050607080910111213141516 w"); PrintAndLog(" hf mf csetblk 1 01020304050607080910111213141516 w");
return 0; return 0;
@ -283,7 +323,7 @@ int usage_hf14_cload(void){
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" e load card with data from emulator memory"); PrintAndLog(" e load card with data from emulator memory");
PrintAndLog(" <filename> load card with data from file"); PrintAndLog(" <filename> load card with data from file");
PrintAndLog(" samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf cload mydump"); PrintAndLog(" hf mf cload mydump");
PrintAndLog(" hf mf cload e"); PrintAndLog(" hf mf cload e");
return 0; return 0;
@ -295,7 +335,7 @@ int usage_hf14_cgetblk(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <block> block number"); PrintAndLog(" <block> block number");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf cgetblk 1"); PrintAndLog(" hf mf cgetblk 1");
return 0; return 0;
} }
@ -306,7 +346,7 @@ int usage_hf14_cgetsc(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" <sector> sector number"); PrintAndLog(" <sector> sector number");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf cgetsc 0"); PrintAndLog(" hf mf cgetsc 0");
return 0; return 0;
} }
@ -322,7 +362,7 @@ int usage_hf14_csave(void){
PrintAndLog(" card memory 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); PrintAndLog(" card memory 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");
PrintAndLog(" o <filename> save data to file"); PrintAndLog(" o <filename> save data to file");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf csave u 1"); PrintAndLog(" hf mf csave u 1");
PrintAndLog(" hf mf csave e 1"); PrintAndLog(" hf mf csave e 1");
PrintAndLog(" hf mf csave 4 o filename"); PrintAndLog(" hf mf csave 4 o filename");
@ -335,11 +375,47 @@ int usage_hf14_nack(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h this help"); PrintAndLog(" h this help");
PrintAndLog(" v verbose"); PrintAndLog(" v verbose");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mf nack"); PrintAndLog(" hf mf nack");
return 0; return 0;
} }
int GetHFMF14AUID(uint8_t *uid, int *uidlen) {
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT, 0, 0}};
clearCommandBuffer();
SendCommand(&c);
UsbCommand resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
//if (!silent)
PrintAndLog("iso14443a card select failed");
DropField();
return 0;
}
iso14a_card_select_t card;
memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
memcpy(uid, card.uid, card.uidlen * sizeof(uint8_t));
*uidlen=card.uidlen;
return 1;
}
char * GenerateFilename(const char *prefix, const char *suffix){
uint8_t uid[10] = {0,0,0,0,0,0,0,0,0,0};
int uidlen=0;
char * fptr = malloc (sizeof (char) * (strlen(prefix) + strlen(suffix)) + sizeof(uid)*2 + 1);
GetHFMF14AUID(uid, &uidlen);
if (!uidlen) {
PrintAndLog("No tag found.");
return NULL;
}
strcpy(fptr, prefix);
FillFileNameByUID(fptr,uid,suffix,uidlen);
return fptr;
}
int CmdHF14ADarkside(const char *Cmd) { int CmdHF14ADarkside(const char *Cmd) {
uint8_t blockno = 0, key_type = MIFARE_AUTH_KEYA; uint8_t blockno = 0, key_type = MIFARE_AUTH_KEYA;
uint64_t key = 0; uint64_t key = 0;
@ -378,7 +454,8 @@ int CmdHF14AMfWrBl(const char *Cmd) {
if (strlen(Cmd)<3) { if (strlen(Cmd)<3) {
PrintAndLog("Usage: hf mf wrbl <block number> <key A/B> <key (12 hex symbols)> <block data (32 hex symbols)>"); PrintAndLog("Usage: hf mf wrbl <block number> <key A/B> <key (12 hex symbols)> <block data (32 hex symbols)>");
PrintAndLog(" sample: hf mf wrbl 0 A FFFFFFFFFFFF 000102030405060708090A0B0C0D0E0F"); PrintAndLog("Examples:");
PrintAndLog(" hf mf wrbl 0 A FFFFFFFFFFFF 000102030405060708090A0B0C0D0E0F");
return 0; return 0;
} }
@ -425,7 +502,8 @@ int CmdHF14AMfRdBl(const char *Cmd) {
if (strlen(Cmd)<3) { if (strlen(Cmd)<3) {
PrintAndLog("Usage: hf mf rdbl <block number> <key A/B> <key (12 hex symbols)>"); PrintAndLog("Usage: hf mf rdbl <block number> <key A/B> <key (12 hex symbols)>");
PrintAndLog(" sample: hf mf rdbl 0 A FFFFFFFFFFFF "); PrintAndLog("Examples:");
PrintAndLog(" hf mf rdbl 0 A FFFFFFFFFFFF ");
return 0; return 0;
} }
@ -474,7 +552,8 @@ int CmdHF14AMfRdSc(const char *Cmd) {
if (strlen(Cmd)<3) { if (strlen(Cmd)<3) {
PrintAndLog("Usage: hf mf rdsc <sector number> <key A/B> <key (12 hex symbols)>"); PrintAndLog("Usage: hf mf rdsc <sector number> <key A/B> <key (12 hex symbols)>");
PrintAndLog(" sample: hf mf rdsc 0 A FFFFFFFFFFFF "); PrintAndLog("Examples:");
PrintAndLog(" hf mf rdsc 0 A FFFFFFFFFFFF ");
return 0; return 0;
} }
@ -563,23 +642,55 @@ int CmdHF14AMfDump(const char *Cmd) {
uint8_t rights[40][4]; uint8_t rights[40][4];
uint8_t carddata[256][16]; uint8_t carddata[256][16];
uint8_t numSectors = 16; uint8_t numSectors = 16;
uint8_t cmdp = 0;
char keyFilename[FILE_PATH_SIZE] = {0};
char dataFilename[FILE_PATH_SIZE] = {0};
char * fptr;
FILE *fin, *fout; FILE *fin, *fout;
UsbCommand resp; UsbCommand resp;
char cmdp = param_getchar(Cmd, 0); while(param_getchar(Cmd, cmdp) != 0x00) {
numSectors = NumOfSectors(cmdp); switch(param_getchar(Cmd, cmdp)) {
case 'h':
case 'H':
return usage_hf14_dump();
case 'k':
case 'K':
param_getstr(Cmd, cmdp+1, keyFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
case 'f':
case 'F':
param_getstr(Cmd, cmdp+1, dataFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
default:
if (cmdp==0)
{
numSectors = NumOfSectors(param_getchar(Cmd, cmdp));
cmdp++;
}
else
{
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') { PrintAndLog("Unknown parameter '%c'\n", param_getchar(Cmd, cmdp));
PrintAndLog("Usage: hf mf dump [card memory]"); return usage_hf14_dump();
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K"); }
PrintAndLog(""); }
PrintAndLog("Samples: hf mf dump");
PrintAndLog(" hf mf dump 4");
return 0;
} }
if ((fin = fopen("dumpkeys.bin","rb")) == NULL) { if (keyFilename[0] == 0x00)
PrintAndLog("Could not find file dumpkeys.bin"); {
fptr = GenerateFilename("hf-mf-","-key.bin");
if (fptr == NULL)
return 1;
strcpy(keyFilename, fptr);
}
if ((fin = fopen(keyFilename,"rb")) == NULL) {
PrintAndLog("Could not find file %s", keyFilename);
return 1; return 1;
} }
@ -715,14 +826,21 @@ int CmdHF14AMfDump(const char *Cmd) {
} }
if (isOK) { if (isOK) {
if ((fout = fopen("dumpdata.bin","wb")) == NULL) { if (dataFilename[0] == 0x00) {
PrintAndLog("[!] could not create file name dumpdata.bin"); fptr=GenerateFilename("hf-mf-","-data.bin");
if (fptr == NULL)
return 1;
strcpy(dataFilename, fptr);
}
if ((fout = fopen(dataFilename,"wb")) == NULL) {
PrintAndLog("[!] could not create file name %s", dataFilename);
return 1; return 1;
} }
uint16_t numblocks = FirstBlockOfSector(numSectors - 1) + NumBlocksPerSector(numSectors - 1); uint16_t numblocks = FirstBlockOfSector(numSectors - 1) + NumBlocksPerSector(numSectors - 1);
fwrite(carddata, 1, 16*numblocks, fout); fwrite(carddata, 1, 16*numblocks, fout);
fclose(fout); fclose(fout);
PrintAndLog("[+] dumped %d blocks (%d bytes) to file dumpdata.bin", numblocks, 16*numblocks); PrintAndLog("[+} dumped %d blocks (%d bytes) to file %s", numblocks, 16*numblocks, dataFilename);
} }
return 0; return 0;
} }
@ -734,17 +852,62 @@ int CmdHF14AMfRestore(const char *Cmd) {
uint8_t bldata[16] = {0x00}; uint8_t bldata[16] = {0x00};
uint8_t keyA[40][6]; uint8_t keyA[40][6];
uint8_t keyB[40][6]; uint8_t keyB[40][6];
uint8_t numSectors; uint8_t numSectors = 16;
uint8_t cmdp = 0;
char keyFilename[FILE_PATH_SIZE]="";
char dataFilename[FILE_PATH_SIZE]="";
char szTemp[FILE_PATH_SIZE]="";
char *fptr;
FILE *fdump, *fkeys; FILE *fdump, *fkeys;
char cmdp = param_getchar(Cmd, 0); while(param_getchar(Cmd, cmdp) != 0x00) {
numSectors = NumOfSectors(cmdp); switch(param_getchar(Cmd, cmdp)) {
case 'h':
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') case 'H':
return usage_hf14_restore(); return usage_hf14_restore();
case 'u':
case 'U':
param_getstr(Cmd, cmdp+1, szTemp, FILE_PATH_SIZE);
if(keyFilename[0]==0x00)
snprintf(keyFilename, FILE_PATH_SIZE, "hf-mf-%s-key.bin", szTemp);
if(dataFilename[0]==0x00)
snprintf(dataFilename, FILE_PATH_SIZE, "hf-mf-%s-data.bin", szTemp);
cmdp+=2;
break;
case 'k':
case 'K':
param_getstr(Cmd, cmdp+1, keyFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
case 'f':
case 'F':
param_getstr(Cmd, cmdp+1, dataFilename, FILE_PATH_SIZE);
cmdp += 2;
break;
default:
if (cmdp==0)
{
numSectors = NumOfSectors(param_getchar(Cmd, cmdp));
cmdp++;
}
else
{
PrintAndLog("Unknown parameter '%c'\n", param_getchar(Cmd, cmdp));
return usage_hf14_restore();
}
}
}
if ((fkeys = fopen("dumpkeys.bin","rb")) == NULL) { if(keyFilename[0]==0x00)
PrintAndLog("Could not find file dumpkeys.bin"); {
fptr=GenerateFilename("hf-mf-","-key.bin");
if (fptr == NULL)
return 1;
strcpy(keyFilename,fptr);
}
if ((fkeys = fopen(keyFilename,"rb")) == NULL) {
PrintAndLog("Could not find file %s", keyFilename);
return 1; return 1;
} }
@ -752,7 +915,7 @@ int CmdHF14AMfRestore(const char *Cmd) {
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
bytes_read = fread( keyA[sectorNo], 1, 6, fkeys ); bytes_read = fread( keyA[sectorNo], 1, 6, fkeys );
if ( bytes_read != 6) { if ( bytes_read != 6) {
PrintAndLog("File reading error (dumpkeys.bin)."); PrintAndLog("File reading error (%s).", keyFilename);
fclose(fkeys); fclose(fkeys);
return 2; return 2;
} }
@ -761,7 +924,7 @@ int CmdHF14AMfRestore(const char *Cmd) {
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
bytes_read = fread( keyB[sectorNo], 1, 6, fkeys ); bytes_read = fread( keyB[sectorNo], 1, 6, fkeys );
if ( bytes_read != 6) { if ( bytes_read != 6) {
PrintAndLog("File reading error (dumpkeys.bin)."); PrintAndLog("File reading error (%s).", keyFilename);
fclose(fkeys); fclose(fkeys);
return 2; return 2;
} }
@ -769,11 +932,19 @@ int CmdHF14AMfRestore(const char *Cmd) {
fclose(fkeys); fclose(fkeys);
if ((fdump = fopen("dumpdata.bin","rb")) == NULL) { if( dataFilename[0]==0x00)
PrintAndLog("Could not find file dumpdata.bin"); {
fptr=GenerateFilename("hf-mf-","-data.bin");
if (fptr == NULL)
return 1;
strcpy(dataFilename,fptr);
}
if ((fdump = fopen(dataFilename,"rb")) == NULL) {
PrintAndLog("Could not find file %s", dataFilename);
return 1; return 1;
} }
PrintAndLog("Restoring dumpdata.bin to card"); PrintAndLog("Restoring %s to card", dataFilename);
for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {
for(blockNo = 0; blockNo < NumBlocksPerSector(sectorNo); blockNo++) { for(blockNo = 0; blockNo < NumBlocksPerSector(sectorNo); blockNo++) {
@ -781,7 +952,7 @@ int CmdHF14AMfRestore(const char *Cmd) {
memcpy(c.d.asBytes, key, 6); memcpy(c.d.asBytes, key, 6);
bytes_read = fread(bldata, 1, 16, fdump); bytes_read = fread(bldata, 1, 16, fdump);
if ( bytes_read != 16) { if ( bytes_read != 16) {
PrintAndLog("File reading error (dumpdata.bin)."); PrintAndLog("File reading error (%s).", dataFilename);
fclose(fdump); fclose(fdump);
fdump = NULL; fdump = NULL;
return 2; return 2;
@ -838,7 +1009,7 @@ int CmdHF14AMfNested(const char *Cmd) {
FILE *fkeys; FILE *fkeys;
uint8_t standart[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t standart[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
char *fptr;
if (strlen(Cmd)<3) return usage_hf14_nested(); if (strlen(Cmd)<3) return usage_hf14_nested();
char cmdp, ctmp; char cmdp, ctmp;
@ -1031,14 +1202,17 @@ int CmdHF14AMfNested(const char *Cmd) {
// Create dump file // Create dump file
if (createDumpFile) { if (createDumpFile) {
fptr = GenerateFilename("hf-mf-","-key.bin");
if (fptr == NULL)
return 1;
if ((fkeys = fopen("dumpkeys.bin","wb")) == NULL) { if ((fkeys = fopen(fptr, "wb")) == NULL) {
PrintAndLog("[!] could not create file dumpkeys.bin"); PrintAndLog("[!] could not create file %s", fptr);
free(e_sector); free(e_sector);
return 1; return 1;
} }
PrintAndLog("[+] saving keys to binary file dumpkeys.bin..."); PrintAndLog("[+] saving keys to binary file %s...", fptr);
for (i=0; i<SectorsCnt; i++) { for (i=0; i<SectorsCnt; i++) {
if (e_sector[i].foundKey[0]){ if (e_sector[i].foundKey[0]){
num_to_bytes(e_sector[i].Key[0], 6, tempkey); num_to_bytes(e_sector[i].Key[0], 6, tempkey);
@ -1070,11 +1244,10 @@ int CmdHF14AMfNestedHard(const char *Cmd) {
uint8_t trgKeyType = 0; uint8_t trgKeyType = 0;
uint8_t key[6] = {0, 0, 0, 0, 0, 0}; uint8_t key[6] = {0, 0, 0, 0, 0, 0};
uint8_t trgkey[6] = {0, 0, 0, 0, 0, 0}; uint8_t trgkey[6] = {0, 0, 0, 0, 0, 0};
uint8_t cmdp=0;
char filename[FILE_PATH_SIZE], *fptr;
char szTemp[FILE_PATH_SIZE];
char ctmp; char ctmp;
ctmp = param_getchar(Cmd, 0);
if (ctmp == 'H' || ctmp == 'h' ) return usage_hf14_hardnested();
if (ctmp != 'R' && ctmp != 'r' && ctmp != 'T' && ctmp != 't' && strlen(Cmd) < 20) return usage_hf14_hardnested();
bool know_target_key = false; bool know_target_key = false;
bool nonce_file_read = false; bool nonce_file_read = false;
@ -1082,20 +1255,37 @@ int CmdHF14AMfNestedHard(const char *Cmd) {
bool slow = false; bool slow = false;
int tests = 0; int tests = 0;
switch(tolower(param_getchar(Cmd, cmdp))) {
case 'h': return usage_hf14_hardnested();
case 'r':
fptr=GenerateFilename("hf-mf-","-nonces.bin");
if(fptr==NULL)
strncpy(filename,"nonces.bin", FILE_PATH_SIZE);
else
strncpy(filename,fptr, FILE_PATH_SIZE);
if (ctmp == 'R' || ctmp == 'r') {
nonce_file_read = true; nonce_file_read = true;
if (!param_gethex(Cmd, 1, trgkey, 12)) { if (!param_gethex(Cmd, cmdp+1, trgkey, 12)) {
know_target_key = true; know_target_key = true;
} }
} else if (ctmp == 'T' || ctmp == 't') { cmdp++;
tests = param_get32ex(Cmd, 1, 100, 10); break;
if (!param_gethex(Cmd, 2, trgkey, 12)) { case 't':
tests = param_get32ex(Cmd, cmdp+1, 100, 10);
if (!param_gethex(Cmd, cmdp+2, trgkey, 12)) {
know_target_key = true; know_target_key = true;
} }
} else { cmdp+=2;
blockNo = param_get8(Cmd, 0); break;
ctmp = param_getchar(Cmd, 1); default:
if(param_getchar(Cmd, cmdp) == 0x00)
{
PrintAndLog("Block number is missing");
return 1;
}
blockNo = param_get8(Cmd, cmdp);
ctmp = param_getchar(Cmd, cmdp+1);
if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') { if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') {
PrintAndLog("Key type must be A or B"); PrintAndLog("Key type must be A or B");
return 1; return 1;
@ -1104,13 +1294,20 @@ int CmdHF14AMfNestedHard(const char *Cmd) {
keyType = 1; keyType = 1;
} }
if (param_gethex(Cmd, 2, key, 12)) { if (param_gethex(Cmd, cmdp+2, key, 12)) {
PrintAndLog("Key must include 12 HEX symbols"); PrintAndLog("Key must include 12 HEX symbols");
return 1; return 1;
} }
trgBlockNo = param_get8(Cmd, 3); if(param_getchar(Cmd, cmdp+3) == 0x00)
ctmp = param_getchar(Cmd, 4); {
PrintAndLog("Target block number is missing");
return 1;
}
trgBlockNo = param_get8(Cmd, cmdp+3);
ctmp = param_getchar(Cmd, cmdp+4);
if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') { if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') {
PrintAndLog("Target key type must be A or B"); PrintAndLog("Target key type must be A or B");
return 1; return 1;
@ -1118,25 +1315,42 @@ int CmdHF14AMfNestedHard(const char *Cmd) {
if (ctmp != 'A' && ctmp != 'a') { if (ctmp != 'A' && ctmp != 'a') {
trgKeyType = 1; trgKeyType = 1;
} }
cmdp+=5;
uint16_t i = 5; }
if (!param_gethex(Cmd, cmdp, trgkey, 12)) {
if (!param_gethex(Cmd, 5, trgkey, 12)) {
know_target_key = true; know_target_key = true;
i++; cmdp++;
} }
while ((ctmp = param_getchar(Cmd, i))) { while ((ctmp = param_getchar(Cmd, cmdp))) {
if (ctmp == 's' || ctmp == 'S') { switch(tolower(ctmp))
{
case 's':
slow = true; slow = true;
} else if (ctmp == 'w' || ctmp == 'W') { break;
case 'w':
nonce_file_write = true; nonce_file_write = true;
} else { fptr=GenerateFilename("hf-mf-","-nonces.bin");
PrintAndLog("Possible options are w and/or s"); if (fptr == NULL)
return 1;
strncpy(filename, fptr, FILE_PATH_SIZE);
break;
case 'u':
param_getstr(Cmd, cmdp+1, szTemp, FILE_PATH_SIZE);
snprintf(filename, FILE_PATH_SIZE, "hf-mf-%s-nonces.bin", szTemp);
cmdp++;
break;
case 'f':
param_getstr(Cmd, cmdp+1, szTemp, FILE_PATH_SIZE);
strncpy(filename, szTemp, FILE_PATH_SIZE);
cmdp++;
break;
default:
PrintAndLog("Unknown parameter '%c'\n", ctmp);
usage_hf14_hardnested();
return 1; return 1;
} }
i++; cmdp++;
}
} }
if ( !know_target_key ) { if ( !know_target_key ) {
@ -1159,7 +1373,7 @@ int CmdHF14AMfNestedHard(const char *Cmd) {
tests); tests);
uint64_t foundkey = 0; uint64_t foundkey = 0;
int16_t isOK = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, know_target_key ? trgkey : NULL, nonce_file_read, nonce_file_write, slow, tests, &foundkey); int16_t isOK = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, know_target_key ? trgkey : NULL, nonce_file_read, nonce_file_write, slow, tests, &foundkey, filename);
DropField(); DropField();
if (isOK) { if (isOK) {
@ -1177,7 +1391,7 @@ int randInRange(int min, int max) {
return min + (int) (rand() / (double) (RAND_MAX) * (max - min + 1)); return min + (int) (rand() / (double) (RAND_MAX) * (max - min + 1));
} }
//FisherYates shuffle //FisherYates shuffle
void shuffle( uint8_t *array, uint16_t len) { void shuffle( uint8_t *array, uint16_t len) {
uint8_t tmp[6]; uint8_t tmp[6];
uint16_t x; uint16_t x;
@ -1201,6 +1415,7 @@ int CmdHF14AMfChk_fast(const char *Cmd) {
FILE * f; FILE * f;
char filename[FILE_PATH_SIZE]={0}; char filename[FILE_PATH_SIZE]={0};
char buf[13]; char buf[13];
char *fptr;
uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
uint8_t *keyBlock = NULL, *p; uint8_t *keyBlock = NULL, *p;
uint8_t sectorsCnt = 1; uint8_t sectorsCnt = 1;
@ -1374,14 +1589,18 @@ out:
} }
if (createDumpFile) { if (createDumpFile) {
FILE *fkeys = fopen("dumpkeys.bin","wb"); fptr = GenerateFilename("hf-mf-","-key.bin");
if (fptr == NULL)
return 1;
FILE *fkeys = fopen(fptr,"wb");
if (fkeys == NULL) { if (fkeys == NULL) {
PrintAndLog("Could not create file dumpkeys.bin"); PrintAndLog("Could not create file %s", filename);
free(keyBlock); free(keyBlock);
free(e_sector); free(e_sector);
return 1; return 1;
} }
PrintAndLog("Printing keys to binary file dumpkeys.bin..."); PrintAndLog("Printing keys to binary file %s...", filename);
for (i=0; i<sectorsCnt; i++) { for (i=0; i<sectorsCnt; i++) {
num_to_bytes(e_sector[i].Key[0], 6, tempkey); num_to_bytes(e_sector[i].Key[0], 6, tempkey);
@ -1394,7 +1613,7 @@ out:
} }
fclose(fkeys); fclose(fkeys);
PrintAndLog("Found keys have been dumped to file dumpkeys.bin. 0xffffffffffff has been inserted for unknown keys."); PrintAndLog("Found keys have been dumped to file %s. 0xffffffffffff has been inserted for unknown keys.", filename);
} }
free(keyBlock); free(keyBlock);
@ -1420,6 +1639,7 @@ int CmdHF14AMfChk(const char *Cmd) {
uint32_t keyitems = MIFARE_DEFAULTKEYS_SIZE; uint32_t keyitems = MIFARE_DEFAULTKEYS_SIZE;
uint64_t key64 = 0; uint64_t key64 = 0;
uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t tempkey[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
char *fptr;
int clen = 0; int clen = 0;
int transferToEml = 0; int transferToEml = 0;
int createDumpFile = 0; int createDumpFile = 0;
@ -1654,14 +1874,18 @@ out:
} }
if (createDumpFile) { if (createDumpFile) {
FILE *fkeys = fopen("dumpkeys.bin","wb"); fptr = GenerateFilename("hf-mf-","-key.bin");
if (fptr == NULL)
return 1;
FILE *fkeys = fopen(fptr,"wb");
if (fkeys == NULL) { if (fkeys == NULL) {
PrintAndLog("Could not create file dumpkeys.bin"); PrintAndLog("Could not create file %s", fptr);
free(keyBlock); free(keyBlock);
free(e_sector); free(e_sector);
return 1; return 1;
} }
PrintAndLog("Printing keys to binary file dumpkeys.bin..."); PrintAndLog("Printing keys to binary file %s...", fptr);
for( i=0; i<SectorsCnt; i++) { for( i=0; i<SectorsCnt; i++) {
num_to_bytes(e_sector[i].Key[0], 6, tempkey); num_to_bytes(e_sector[i].Key[0], 6, tempkey);
@ -1672,7 +1896,7 @@ out:
fwrite ( tempkey, 1, 6, fkeys ); fwrite ( tempkey, 1, 6, fkeys );
} }
fclose(fkeys); fclose(fkeys);
PrintAndLog("Found keys have been dumped to file dumpkeys.bin. 0xffffffffffff has been inserted for unknown keys."); PrintAndLog("Found keys have been dumped to file %s. 0xffffffffffff has been inserted for unknown keys.", fptr);
} }
free(keyBlock); free(keyBlock);
@ -2828,18 +3052,50 @@ int CmdHF14AMfice(const char *Cmd) {
bool slow = false; bool slow = false;
bool initialize = true; bool initialize = true;
bool acquisition_completed = false; bool acquisition_completed = false;
uint8_t cmdp=0;
uint32_t flags = 0; uint32_t flags = 0;
uint32_t total_num_nonces = 0; uint32_t total_num_nonces = 0;
char ctmp;
char filename[FILE_PATH_SIZE], *fptr;
FILE *fnonces = NULL; FILE *fnonces = NULL;
UsbCommand resp; UsbCommand resp;
uint32_t part_limit = 3000; uint32_t part_limit = 3000;
uint32_t limit = param_get32ex(Cmd, 0, 50000, 10); uint32_t limit = 50000;
while ((ctmp = param_getchar(Cmd, cmdp))) {
switch(tolower(ctmp))
{
case 'h':
return usage_hf14_ice();
case 'f':
param_getstr(Cmd, cmdp+1, filename, FILE_PATH_SIZE);
cmdp++;
break;
case 'l':
limit = param_get32ex(Cmd, cmdp+1, 50000, 10);
cmdp++;
break;
default:
PrintAndLog("Unknown parameter '%c'\n", ctmp);
usage_hf14_ice();
return 1;
}
cmdp++;
}
if(filename[0]=='\0')
{
fptr = GenerateFilename("hf-mf-","-nonces.bin");
if (fptr == NULL)
return 1;
strcpy(filename, fptr);
}
printf("Collecting %u nonces \n", limit); printf("Collecting %u nonces \n", limit);
if ((fnonces = fopen("nonces.bin","wb")) == NULL) { if ((fnonces = fopen(filename,"wb")) == NULL) {
PrintAndLog("Could not create file nonces.bin"); PrintAndLog("Could not create file %s",filename);
return 3; return 3;
} }

View file

@ -568,8 +568,9 @@ int CmdHF14ADesAuth(const char *Cmd){
PrintAndLog(" Crypto"); PrintAndLog(" Crypto");
PrintAndLog(" 1 = DES 2 = 3DES 3 = 3K3DES 4 = AES"); PrintAndLog(" 1 = DES 2 = 3DES 3 = 3K3DES 4 = AES");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: hf mfdes auth 1 1 0 11223344"); PrintAndLog("Examples:");
PrintAndLog(" sample: hf mfdes auth 3 4 0 404142434445464748494a4b4c4d4e4f"); PrintAndLog(" hf mfdes auth 1 1 0 11223344");
PrintAndLog(" hf mfdes auth 3 4 0 404142434445464748494a4b4c4d4e4f");
return 0; return 0;
} }
uint8_t cmdAuthMode = param_get8(Cmd,0); uint8_t cmdAuthMode = param_get8(Cmd,0);

View file

@ -48,7 +48,8 @@ int CmdHF14AMfDESAuth(const char *Cmd){
if (strlen(Cmd)<1) { if (strlen(Cmd)<1) {
PrintAndLog("Usage: hf desfire des-auth k <key number>"); PrintAndLog("Usage: hf desfire des-auth k <key number>");
PrintAndLog(" sample: hf desfire des-auth k 0"); PrintAndLog("Examples:");
PrintAndLog(" hf desfire des-auth k 0");
return 0; return 0;
} }
@ -144,7 +145,8 @@ int CmdHF14AMfAESAuth(const char *Cmd){
if (strlen(Cmd)<1) { if (strlen(Cmd)<1) {
PrintAndLog("Usage: hf desfire aes-auth k <key number>"); PrintAndLog("Usage: hf desfire aes-auth k <key number>");
PrintAndLog(" sample: hf desfire aes-auth k 0"); PrintAndLog("Examples:");
PrintAndLog(" hf desfire aes-auth k 0");
return 0; return 0;
} }

View file

@ -1054,9 +1054,10 @@ static void estimate_sum_a8(void)
} }
static int read_nonce_file(void) static int read_nonce_file(char *filename)
{ {
FILE *fnonces = NULL; FILE *fnonces = NULL;
char progress_text[80]="";
size_t bytes_read; size_t bytes_read;
uint8_t trgBlockNo; uint8_t trgBlockNo;
uint8_t trgKeyType; uint8_t trgKeyType;
@ -1065,12 +1066,12 @@ static int read_nonce_file(void)
uint8_t par_enc; uint8_t par_enc;
num_acquired_nonces = 0; num_acquired_nonces = 0;
if ((fnonces = fopen("nonces.bin","rb")) == NULL) { if ((fnonces = fopen(filename,"rb")) == NULL) {
PrintAndLog("Could not open file nonces.bin"); PrintAndLog("Could not open file %s",filename);
return 1; return 1;
} }
snprintf(progress_text, 80, "Reading nonces from file %s...",filename);
hardnested_print_progress(0, "Reading nonces from file nonces.bin...", (float)(1LL<<47), 0); hardnested_print_progress(0, progress_text, (float)(1LL<<47), 0);
bytes_read = fread(read_buf, 1, 6, fnonces); bytes_read = fread(read_buf, 1, 6, fnonces);
if (bytes_read != 6) { if (bytes_read != 6) {
PrintAndLog("File reading error."); PrintAndLog("File reading error.");
@ -1387,7 +1388,7 @@ static void simulate_acquire_nonces()
} }
static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, bool nonce_file_write, bool slow) static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, bool nonce_file_write, bool slow, char *filename)
{ {
last_sample_clock = msclock(); last_sample_clock = msclock();
sample_period = 2000; // initial rough estimate. Will be refined. sample_period = 2000; // initial rough estimate. Will be refined.
@ -1400,6 +1401,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
uint32_t total_num_nonces = 0; uint32_t total_num_nonces = 0;
float brute_force; float brute_force;
bool reported_suma8 = false; bool reported_suma8 = false;
char progress_text[80];
FILE *fnonces = NULL; FILE *fnonces = NULL;
UsbCommand resp; UsbCommand resp;
@ -1432,11 +1434,12 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
cuid = resp.arg[1]; cuid = resp.arg[1];
if (nonce_file_write && fnonces == NULL) { if (nonce_file_write && fnonces == NULL) {
if ((fnonces = fopen("nonces.bin","wb")) == NULL) { if ((fnonces = fopen(filename,"wb")) == NULL) {
PrintAndLog("Could not create file nonces.bin"); PrintAndLog("Could not create file %s", filename);
return 3; return 3;
} }
hardnested_print_progress(0, "Writing acquired nonces to binary file nonces.bin", (float)(1LL<<47), 0); snprintf(progress_text, 80, "Writing acquired nonces to binary file %s", filename);
hardnested_print_progress(0, progress_text, (float)(1LL<<47), 0);
num_to_bytes(cuid, 4, write_buf); num_to_bytes(cuid, 4, write_buf);
fwrite(write_buf, 1, 4, fnonces); fwrite(write_buf, 1, 4, fnonces);
fwrite(&trgBlockNo, 1, 1, fnonces); fwrite(&trgBlockNo, 1, 1, fnonces);
@ -2203,7 +2206,7 @@ static void set_test_state(uint8_t byte)
} }
int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *trgkey, bool nonce_file_read, bool nonce_file_write, bool slow, int tests, uint64_t *foundkey) int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *trgkey, bool nonce_file_read, bool nonce_file_write, bool slow, int tests, uint64_t *foundkey, char *filename)
{ {
char progress_text[80]; char progress_text[80];
@ -2334,7 +2337,7 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc
update_reduction_rate(0.0, true); update_reduction_rate(0.0, true);
if (nonce_file_read) { // use pre-acquired data from file nonces.bin if (nonce_file_read) { // use pre-acquired data from file nonces.bin
if (read_nonce_file() != 0) { if (read_nonce_file(filename) != 0) {
free_bitflip_bitarrays(); free_bitflip_bitarrays();
free_nonces_memory(); free_nonces_memory();
free_bitarray(all_bitflips_bitarray[ODD_STATE]); free_bitarray(all_bitflips_bitarray[ODD_STATE]);
@ -2348,7 +2351,7 @@ int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBloc
float brute_force; float brute_force;
shrink_key_space(&brute_force); shrink_key_space(&brute_force);
} else { // acquire nonces. } else { // acquire nonces.
uint16_t is_OK = acquire_nonces(blockNo, keyType, key, trgBlockNo, trgKeyType, nonce_file_write, slow); uint16_t is_OK = acquire_nonces(blockNo, keyType, key, trgBlockNo, trgKeyType, nonce_file_write, slow, filename);
if (is_OK != 0) { if (is_OK != 0) {
free_bitflip_bitarrays(); free_bitflip_bitarrays();
free_nonces_memory(); free_nonces_memory();

View file

@ -41,7 +41,7 @@ typedef struct noncelist {
noncelistentry_t *first; noncelistentry_t *first;
} noncelist_t; } noncelist_t;
extern int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *trgkey, bool nonce_file_read, bool nonce_file_write, bool slow, int tests, uint64_t *foundkey); extern int mfnestedhard(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t *trgkey, bool nonce_file_read, bool nonce_file_write, bool slow, int tests, uint64_t *foundkey, char *filename);
extern void hardnested_print_progress(uint32_t nonces, char *activity, float brute_force, uint64_t min_diff_print_time); extern void hardnested_print_progress(uint32_t nonces, char *activity, float brute_force, uint64_t min_diff_print_time);
#endif #endif

View file

@ -1396,9 +1396,10 @@ int usage_hf_mfu_info(void) {
PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]"); PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]");
PrintAndLog(" l : (optional) swap entered key's endianness"); PrintAndLog(" l : (optional) swap entered key's endianness");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample : hf mfu info"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu info k 00112233445566778899AABBCCDDEEFF"); PrintAndLog(" hf mfu info");
PrintAndLog(" : hf mfu info k AABBCCDDD"); PrintAndLog(" hf mfu info k 00112233445566778899AABBCCDDEEFF");
PrintAndLog(" hf mfu info k AABBCCDDD");
return 0; return 0;
} }
@ -1415,10 +1416,11 @@ int usage_hf_mfu_dump(void) {
PrintAndLog(" p <Pg > : starting Page number to manually set a page to start the dump at"); PrintAndLog(" p <Pg > : starting Page number to manually set a page to start the dump at");
PrintAndLog(" q <qty> : number of Pages to manually set how many pages to dump"); PrintAndLog(" q <qty> : number of Pages to manually set how many pages to dump");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample : hf mfu dump"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu dump n myfile"); PrintAndLog(" hf mfu dump");
PrintAndLog(" : hf mfu dump k 00112233445566778899AABBCCDDEEFF"); PrintAndLog(" hf mfu dump n myfile");
PrintAndLog(" : hf mfu dump k AABBCCDDD\n"); PrintAndLog(" hf mfu dump k 00112233445566778899AABBCCDDEEFF");
PrintAndLog(" hf mfu dump k AABBCCDDD\n");
return 0; return 0;
} }
@ -1433,38 +1435,40 @@ int usage_hf_mfu_restore(void){
PrintAndLog(" r : (optional) use the password found in dumpfile to configure tag. requires 'e' parameter to work"); PrintAndLog(" r : (optional) use the password found in dumpfile to configure tag. requires 'e' parameter to work");
PrintAndLog(" f <FN> : filename w/o .bin to restore"); PrintAndLog(" f <FN> : filename w/o .bin to restore");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" samples:"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu restore s f myfile"); PrintAndLog(" hf mfu restore s f myfile");
PrintAndLog(" : hf mfu restore k AABBCCDDD s f myfile\n"); PrintAndLog(" hf mfu restore k AABBCCDDD s f myfile\n");
PrintAndLog(" : hf mfu restore k AABBCCDDD s e r f myfile\n"); PrintAndLog(" hf mfu restore k AABBCCDDD s e r f myfile\n");
return 0; return 0;
} }
int usage_hf_mfu_rdbl(void) { int usage_hf_mfu_rdbl(void) {
PrintAndLog("Read a block and print. It autodetects card type.\n"); PrintAndLog("Read a block and print. It autodetects card type.\n");
PrintAndLog("Usage: hf mfu rdbl b <block number> k <key> l\n"); PrintAndLog("Usage: hf mfu rdbl b <block number> k <key> l\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" b <no> : block to read"); PrintAndLog(" b <no> : block to read");
PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]"); PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]");
PrintAndLog(" l : (optional) swap entered key's endianness"); PrintAndLog(" l : (optional) swap entered key's endianness");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample : hf mfu rdbl b 0"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu rdbl b 0 k 00112233445566778899AABBCCDDEEFF"); PrintAndLog(" hf mfu rdbl b 0");
PrintAndLog(" : hf mfu rdbl b 0 k AABBCCDDD\n"); PrintAndLog(" hf mfu rdbl b 0 k 00112233445566778899AABBCCDDEEFF");
PrintAndLog(" hf mfu rdbl b 0 k AABBCCDDD\n");
return 0; return 0;
} }
int usage_hf_mfu_wrbl(void) { int usage_hf_mfu_wrbl(void) {
PrintAndLog("Write a block. It autodetects card type.\n"); PrintAndLog("Write a block. It autodetects card type.\n");
PrintAndLog("Usage: hf mfu wrbl b <block number> d <data> k <key> l\n"); PrintAndLog("Usage: hf mfu wrbl b <block number> d <data> k <key> l\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" b <no> : block to write"); PrintAndLog(" b <no> : block to write");
PrintAndLog(" d <data> : block data - (8 hex symbols)"); PrintAndLog(" d <data> : block data - (8 hex symbols)");
PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]"); PrintAndLog(" k <key> : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]");
PrintAndLog(" l : (optional) swap entered key's endianness"); PrintAndLog(" l : (optional) swap entered key's endianness");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample : hf mfu wrbl b 0 d 01234567"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu wrbl b 0 d 01234567 k AABBCCDDD\n"); PrintAndLog(" hf mfu wrbl b 0 d 01234567");
PrintAndLog(" hf mfu wrbl b 0 d 01234567 k AABBCCDDD\n");
return 0; return 0;
} }
@ -1487,12 +1491,14 @@ int usage_hf_mfu_sim(void) {
PrintAndLog("\nEmulating Ultralight tag from emulator memory\n"); PrintAndLog("\nEmulating Ultralight tag from emulator memory\n");
PrintAndLog("\nBe sure to load the emulator memory first!\n"); PrintAndLog("\nBe sure to load the emulator memory first!\n");
PrintAndLog("Usage: hf mfu sim t 7 u <uid>"); PrintAndLog("Usage: hf mfu sim t 7 u <uid>");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" t 7 : 7 = NTAG or Ultralight sim (required)"); PrintAndLog(" t 7 : 7 = NTAG or Ultralight sim (required)");
PrintAndLog(" u <uid> : 4 or 7 byte UID (optional)"); PrintAndLog(" u <uid> : 4 or 7 byte UID (optional)");
PrintAndLog("\n sample : hf mfu sim t 7"); PrintAndLog("");
PrintAndLog(" : hf mfu sim t 7 u 1122344556677\n"); PrintAndLog("Examples:");
PrintAndLog(" hf mfu sim t 7");
PrintAndLog(" hf mfu sim t 7 u 1122344556677\n");
return 0; return 0;
} }
@ -1506,8 +1512,9 @@ int usage_hf_mfu_ucauth(void) {
PrintAndLog(" 4 : all 0x01 key"); PrintAndLog(" 4 : all 0x01 key");
PrintAndLog(" 5 : all 0xff key"); PrintAndLog(" 5 : all 0xff key");
PrintAndLog(" 6 : 0x00-0xFF key"); PrintAndLog(" 6 : 0x00-0xFF key");
PrintAndLog("\n sample : hf mfu cauth k"); PrintAndLog("Examples:");
PrintAndLog(" : hf mfu cauth k 3"); PrintAndLog(" hf mfu cauth k");
PrintAndLog(" hf mfu cauth k 3");
return 0; return 0;
} }
@ -1515,7 +1522,8 @@ int usage_hf_mfu_ucsetpwd(void) {
PrintAndLog("Usage: hf mfu setpwd <password (32 hex symbols)>"); PrintAndLog("Usage: hf mfu setpwd <password (32 hex symbols)>");
PrintAndLog(" [password] - (32 hex symbols)"); PrintAndLog(" [password] - (32 hex symbols)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("sample: hf mfu setpwd 000102030405060708090a0b0c0d0e0f"); PrintAndLog("Examples:");
PrintAndLog(" hf mfu setpwd 000102030405060708090a0b0c0d0e0f");
PrintAndLog(""); PrintAndLog("");
return 0; return 0;
} }
@ -1525,18 +1533,19 @@ int usage_hf_mfu_ucsetuid(void) {
PrintAndLog(" [uid] - (14 hex symbols)"); PrintAndLog(" [uid] - (14 hex symbols)");
PrintAndLog("\nThis only works for Magic Ultralight tags."); PrintAndLog("\nThis only works for Magic Ultralight tags.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("sample: hf mfu setuid 11223344556677"); PrintAndLog("Examples:");
PrintAndLog(" hf mfu setuid 11223344556677");
PrintAndLog(""); PrintAndLog("");
return 0; return 0;
} }
int usage_hf_mfu_gendiverse(void){ int usage_hf_mfu_gendiverse(void){
PrintAndLog("Usage: hf mfu gen [h] [r] <uid (8 hex symbols)>"); PrintAndLog("Usage: hf mfu gen [h] [r] <uid (8 hex symbols)>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" r : read uid from tag"); PrintAndLog(" r : read uid from tag");
PrintAndLog(" <uid> : 4 byte UID (optional)"); PrintAndLog(" <uid> : 4 byte UID (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mfu gen r"); PrintAndLog(" hf mfu gen r");
PrintAndLog(" hf mfu gen 11223344"); PrintAndLog(" hf mfu gen 11223344");
PrintAndLog(""); PrintAndLog("");
@ -1545,12 +1554,12 @@ int usage_hf_mfu_gendiverse(void){
int usage_hf_mfu_pwdgen(void){ int usage_hf_mfu_pwdgen(void){
PrintAndLog("Usage: hf mfu pwdgen [h|t] [r] <uid (14 hex symbols)>"); PrintAndLog("Usage: hf mfu pwdgen [h|t] [r] <uid (14 hex symbols)>");
PrintAndLog("options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" t : selftest"); PrintAndLog(" t : selftest");
PrintAndLog(" r : read uid from tag"); PrintAndLog(" r : read uid from tag");
PrintAndLog(" <uid> : 7 byte UID (optional)"); PrintAndLog(" <uid> : 7 byte UID (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf mfu pwdgen r"); PrintAndLog(" hf mfu pwdgen r");
PrintAndLog(" hf mfu pwdgen 11223344556677"); PrintAndLog(" hf mfu pwdgen 11223344556677");
PrintAndLog(" hf mfu pwdgen t"); PrintAndLog(" hf mfu pwdgen t");

View file

@ -37,7 +37,7 @@ int usage_lf_read(void){
PrintAndLog(" d #samples # samples to collect (optional)"); PrintAndLog(" d #samples # samples to collect (optional)");
PrintAndLog("Use 'lf config' to set parameters."); PrintAndLog("Use 'lf config' to set parameters.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf read s d 12000 - collects 12000samples silent"); PrintAndLog(" lf read s d 12000 - collects 12000samples silent");
PrintAndLog(" lf read s"); PrintAndLog(" lf read s");
return 0; return 0;
@ -90,7 +90,8 @@ int usage_lf_simfsk(void) {
//PrintAndLog(" s TBD- -STT to enable a gap between playback repetitions - default: no gap"); //PrintAndLog(" s TBD- -STT to enable a gap between playback repetitions - default: no gap");
PrintAndLog(" d <hexdata> Data to sim as hex - omit to sim from DemodBuffer"); PrintAndLog(" d <hexdata> Data to sim as hex - omit to sim from DemodBuffer");
PrintAndLog("\n NOTE: if you set one clock manually set them all manually"); PrintAndLog("\n NOTE: if you set one clock manually set them all manually");
PrintAndLog("\nSamples:"); PrintAndLog("");
PrintAndLog("Examples:");
PrintAndLog(" lf simfsk c 40 H 8 L 5 d 010203 - FSK1 rf/40 data 010203"); PrintAndLog(" lf simfsk c 40 H 8 L 5 d 010203 - FSK1 rf/40 data 010203");
PrintAndLog(" lf simfsk c 40 H 5 L 8 d 010203 - FSK1a rf/40 data 010203"); PrintAndLog(" lf simfsk c 40 H 5 L 8 d 010203 - FSK1a rf/40 data 010203");
PrintAndLog(" lf simfsk c 64 H 10 L 8 d 010203 - FSK2 rf/64 data 010203"); PrintAndLog(" lf simfsk c 64 H 10 L 8 d 010203 - FSK2 rf/64 data 010203");

View file

@ -24,7 +24,7 @@ int usage_lf_awid_read(void) {
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" 1 : (optional) stop after reading a single card"); PrintAndLog(" 1 : (optional) stop after reading a single card");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf awid read"); PrintAndLog(" lf awid read");
PrintAndLog(" lf awid read 1"); PrintAndLog(" lf awid read 1");
return 0; return 0;
@ -41,7 +41,7 @@ int usage_lf_awid_sim(void) {
PrintAndLog(" <facility-code> : 8|16bit value facility code"); PrintAndLog(" <facility-code> : 8|16bit value facility code");
PrintAndLog(" <card number> : 16|32-bit value card number"); PrintAndLog(" <card number> : 16|32-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf awid sim 26 224 1337"); PrintAndLog(" lf awid sim 26 224 1337");
PrintAndLog(" lf awid sim 50 2001 deadc0de"); PrintAndLog(" lf awid sim 50 2001 deadc0de");
return 0; return 0;
@ -59,7 +59,7 @@ int usage_lf_awid_clone(void) {
PrintAndLog(" <card number> : 16|32-bit value card number"); PrintAndLog(" <card number> : 16|32-bit value card number");
PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf awid clone 26 224 1337"); PrintAndLog(" lf awid clone 26 224 1337");
PrintAndLog(" lf awid clone 50 2001 13371337"); PrintAndLog(" lf awid clone 50 2001 13371337");
return 0; return 0;
@ -79,7 +79,7 @@ int usage_lf_awid_brute(void){
PrintAndLog(" d <delay> : delay betweens attempts in ms. Default 1000ms"); PrintAndLog(" d <delay> : delay betweens attempts in ms. Default 1000ms");
PrintAndLog(" v : verbose logging, show all tries"); PrintAndLog(" v : verbose logging, show all tries");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf awid brute a 26 f 224"); PrintAndLog(" lf awid brute a 26 f 224");
PrintAndLog(" lf awid brute a 50 f 2001 d 2000"); PrintAndLog(" lf awid brute a 50 f 2001 d 2000");
PrintAndLog(" lf awid brute v a 50 f 2001 c 200 d 2000"); PrintAndLog(" lf awid brute v a 50 f 2001 c 200 d 2000");

View file

@ -19,7 +19,7 @@ int usage_lf_cotag_read(void){
PrintAndLog(" : 1 - translation of HI/LO into bytes with manchester 0,1"); PrintAndLog(" : 1 - translation of HI/LO into bytes with manchester 0,1");
PrintAndLog(" : 2 - raw signal; maxlength bigbuff"); PrintAndLog(" : 2 - raw signal; maxlength bigbuff");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample:"); PrintAndLog("Example:");
PrintAndLog(" lf cotag read 0"); PrintAndLog(" lf cotag read 0");
PrintAndLog(" lf cotag read 1"); PrintAndLog(" lf cotag read 1");
return 0; return 0;

View file

@ -23,11 +23,12 @@ int usage_lf_em410x_demod(void){
PrintAndLog(" <0|1> - 0 normal output, 1 for invert output"); PrintAndLog(" <0|1> - 0 normal output, 1 for invert output");
PrintAndLog(" maxerror - set maximum allowed errors, default = 100."); PrintAndLog(" maxerror - set maximum allowed errors, default = 100.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" sample: lf em 410x_demod = demod an EM410x Tag ID from GraphBuffer"); PrintAndLog("Examples:");
PrintAndLog(" : lf em 410x_demod 32 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/32"); PrintAndLog(" lf em 410x_demod = demod an EM410x Tag ID from GraphBuffer");
PrintAndLog(" : lf em 410x_demod 32 1 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLog(" lf em 410x_demod 32 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/32");
PrintAndLog(" : lf em 410x_demod 1 = demod an EM410x Tag ID from GraphBuffer while inverting data"); PrintAndLog(" lf em 410x_demod 32 1 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/32 and inverting data");
PrintAndLog(" : lf em 410x_demod 64 1 0 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/64 and inverting data and allowing 0 demod errors"); PrintAndLog(" lf em 410x_demod 1 = demod an EM410x Tag ID from GraphBuffer while inverting data");
PrintAndLog(" lf em 410x_demod 64 1 0 = demod an EM410x Tag ID from GraphBuffer using a clock of RF/64 and inverting data and allowing 0 demod errors");
return 0; return 0;
} }
int usage_lf_em410x_write(void) { int usage_lf_em410x_write(void) {
@ -39,7 +40,7 @@ int usage_lf_em410x_write(void) {
PrintAndLog(" <id> - ID number"); PrintAndLog(" <id> - ID number");
PrintAndLog(" <card> - 0|1 T5555 (Q5) / T55x7"); PrintAndLog(" <card> - 0|1 T5555 (Q5) / T55x7");
PrintAndLog(" <clock> - 16|32|40|64, optional, set R/F clock rate, defaults to 64"); PrintAndLog(" <clock> - 16|32|40|64, optional, set R/F clock rate, defaults to 64");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 410x_write 0F0368568B"); PrintAndLog(" lf em 410x_write 0F0368568B");
return 0; return 0;
} }
@ -49,7 +50,7 @@ int usage_lf_em410x_ws(void) {
PrintAndLog("Usage: lf em 410x_spoof [h]"); PrintAndLog("Usage: lf em 410x_spoof [h]");
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 410x_spoof"); PrintAndLog(" lf em 410x_spoof");
return 0; return 0;
} }
@ -61,7 +62,7 @@ int usage_lf_em410x_clone(void) {
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" uid - uid (10 HEX symbols)"); PrintAndLog(" uid - uid (10 HEX symbols)");
PrintAndLog(" clock - clock (32|64) (optional)"); PrintAndLog(" clock - clock (32|64) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 410x_clone 0F0368568B"); PrintAndLog(" lf em 410x_clone 0F0368568B");
PrintAndLog(" lf em 410x_clone 0F0368568B 32"); PrintAndLog(" lf em 410x_clone 0F0368568B 32");
return 0; return 0;
@ -74,7 +75,7 @@ int usage_lf_em410x_sim(void) {
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" uid - uid (10 HEX symbols)"); PrintAndLog(" uid - uid (10 HEX symbols)");
PrintAndLog(" clock - clock (32|64) (optional)"); PrintAndLog(" clock - clock (32|64) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 410x_sim 0F0368568B"); PrintAndLog(" lf em 410x_sim 0F0368568B");
PrintAndLog(" lf em 410x_sim 0F0368568B 32"); PrintAndLog(" lf em 410x_sim 0F0368568B 32");
return 0; return 0;
@ -88,7 +89,7 @@ int usage_lf_em410x_brute(void) {
PrintAndLog(" ids.txt - file with UIDs in HEX format, one per line"); PrintAndLog(" ids.txt - file with UIDs in HEX format, one per line");
PrintAndLog(" d (2000) - pause delay in milliseconds between UIDs simulation, default 1000 ms (optional)"); PrintAndLog(" d (2000) - pause delay in milliseconds between UIDs simulation, default 1000 ms (optional)");
PrintAndLog(" c (32) - clock (32|64), default 64 (optional)"); PrintAndLog(" c (32) - clock (32|64), default 64 (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 410x_brute ids.txt"); PrintAndLog(" lf em 410x_brute ids.txt");
PrintAndLog(" lf em 410x_brute ids.txt c 32"); PrintAndLog(" lf em 410x_brute ids.txt c 32");
PrintAndLog(" lf em 410x_brute ids.txt d 3000"); PrintAndLog(" lf em 410x_brute ids.txt d 3000");
@ -104,7 +105,7 @@ int usage_lf_em4x50_dump(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x50_dump"); PrintAndLog(" lf em 4x50_dump");
PrintAndLog(" lf em 4x50_dump 11223344"); PrintAndLog(" lf em 4x50_dump 11223344");
return 0; return 0;
@ -117,7 +118,7 @@ int usage_lf_em4x50_read(void) {
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" address - memory address to read. (0-15)"); PrintAndLog(" address - memory address to read. (0-15)");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x50_read 1"); PrintAndLog(" lf em 4x50_read 1");
PrintAndLog(" lf em 4x50_read 1 11223344"); PrintAndLog(" lf em 4x50_read 1 11223344");
return 0; return 0;
@ -131,7 +132,7 @@ int usage_lf_em4x50_write(void) {
PrintAndLog(" address - memory address to write to. (0-15)"); PrintAndLog(" address - memory address to write to. (0-15)");
PrintAndLog(" data - data to write (hex)"); PrintAndLog(" data - data to write (hex)");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x50_write 1 deadc0de"); PrintAndLog(" lf em 4x50_write 1 deadc0de");
PrintAndLog(" lf em 4x50_write 1 deadc0de 11223344"); PrintAndLog(" lf em 4x50_write 1 deadc0de 11223344");
return 0; return 0;
@ -145,7 +146,7 @@ int usage_lf_em4x05_dump(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x05_dump"); PrintAndLog(" lf em 4x05_dump");
PrintAndLog(" lf em 4x05_dump 11223344"); PrintAndLog(" lf em 4x05_dump 11223344");
return 0; return 0;
@ -158,7 +159,7 @@ int usage_lf_em4x05_read(void) {
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" address - memory address to read. (0-15)"); PrintAndLog(" address - memory address to read. (0-15)");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x05_read 1"); PrintAndLog(" lf em 4x05_read 1");
PrintAndLog(" lf em 4x05_read 1 11223344"); PrintAndLog(" lf em 4x05_read 1 11223344");
return 0; return 0;
@ -172,7 +173,7 @@ int usage_lf_em4x05_write(void) {
PrintAndLog(" address - memory address to write to. (0-15)"); PrintAndLog(" address - memory address to write to. (0-15)");
PrintAndLog(" data - data to write (hex)"); PrintAndLog(" data - data to write (hex)");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x05_write 1 deadc0de"); PrintAndLog(" lf em 4x05_write 1 deadc0de");
PrintAndLog(" lf em 4x05_write 1 deadc0de 11223344"); PrintAndLog(" lf em 4x05_write 1 deadc0de 11223344");
return 0; return 0;
@ -184,7 +185,7 @@ int usage_lf_em4x05_info(void) {
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h - this help"); PrintAndLog(" h - this help");
PrintAndLog(" pwd - password (hex) (optional)"); PrintAndLog(" pwd - password (hex) (optional)");
PrintAndLog("samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf em 4x05_info"); PrintAndLog(" lf em 4x05_info");
PrintAndLog(" lf em 4x05_info deadc0de"); PrintAndLog(" lf em 4x05_info deadc0de");
return 0; return 0;

View file

@ -44,7 +44,8 @@ int usage_lf_fdx_clone(void){
// extended data // extended data
PrintAndLog(" <Q5> : Specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : Specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf fdx clone 999 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf fdx clone 999 112233");
return 0; return 0;
} }
@ -58,7 +59,8 @@ int usage_lf_fdx_sim(void) {
PrintAndLog(" <country id> : Country ID"); PrintAndLog(" <country id> : Country ID");
PrintAndLog(" <animal id> : Animal ID"); PrintAndLog(" <animal id> : Animal ID");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf fdx sim 999 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf fdx sim 999 112233");
return 0; return 0;
} }

View file

@ -17,12 +17,13 @@ int usage_lf_guard_clone(void){
PrintAndLog("Currently work only on 26bit"); PrintAndLog("Currently work only on 26bit");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf gprox clone [h] <format> <Facility-Code> <Card-Number>"); PrintAndLog("Usage: lf gprox clone [h] <format> <Facility-Code> <Card-Number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" <format> : format length 26|32|36|40"); PrintAndLog(" <format> : format length 26|32|36|40");
PrintAndLog(" <Facility-Code> : 8-bit value facility code"); PrintAndLog(" <Facility-Code> : 8-bit value facility code");
PrintAndLog(" <Card Number> : 16-bit value card number"); PrintAndLog(" <Card Number> : 16-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf gprox clone 26 123 11223"); PrintAndLog("Examples:");
PrintAndLog(" lf gprox clone 26 123 11223");
return 0; return 0;
} }
@ -33,12 +34,13 @@ int usage_lf_guard_sim(void) {
PrintAndLog("Currently work only on 26bit"); PrintAndLog("Currently work only on 26bit");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf gprox sim [h] <format> <Facility-Code> <Card-Number>"); PrintAndLog("Usage: lf gprox sim [h] <format> <Facility-Code> <Card-Number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" <format> : format length 26|32|36|40"); PrintAndLog(" <format> : format length 26|32|36|40");
PrintAndLog(" <Facility-Code> : 8-bit value facility code"); PrintAndLog(" <Facility-Code> : 8-bit value facility code");
PrintAndLog(" <Card Number> : 16-bit value card number"); PrintAndLog(" <Card Number> : 16-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf gprox sim 26 123 11223"); PrintAndLog("Examples:");
PrintAndLog(" lf gprox sim 26 123 11223");
return 0; return 0;
} }

View file

@ -26,7 +26,7 @@ int usage_lf_hid_read(void){
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" 1 : (optional) stop after reading a single card"); PrintAndLog(" 1 : (optional) stop after reading a single card");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf hid read"); PrintAndLog(" lf hid read");
PrintAndLog(" lf hid read 1"); PrintAndLog(" lf hid read 1");
return 0; return 0;
@ -40,7 +40,7 @@ int usage_lf_hid_wiegand(void){
PrintAndLog(" OEM - OEM number / site code"); PrintAndLog(" OEM - OEM number / site code");
PrintAndLog(" FC - facility code"); PrintAndLog(" FC - facility code");
PrintAndLog(" CN - card number"); PrintAndLog(" CN - card number");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf hid wiegand 0 101 2001"); PrintAndLog(" lf hid wiegand 0 101 2001");
return 0; return 0;
} }
@ -52,7 +52,7 @@ int usage_lf_hid_sim(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h - This help"); PrintAndLog(" h - This help");
PrintAndLog(" ID - HID id"); PrintAndLog(" ID - HID id");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf hid sim 2006ec0c86"); PrintAndLog(" lf hid sim 2006ec0c86");
return 0; return 0;
} }
@ -64,7 +64,7 @@ int usage_lf_hid_clone(void){
PrintAndLog(" h - This help"); PrintAndLog(" h - This help");
PrintAndLog(" ID - HID id"); PrintAndLog(" ID - HID id");
PrintAndLog(" L - 84bit ID"); PrintAndLog(" L - 84bit ID");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf hid clone 2006ec0c86"); PrintAndLog(" lf hid clone 2006ec0c86");
PrintAndLog(" lf hid clone 2006ec0c86 L"); PrintAndLog(" lf hid clone 2006ec0c86 L");
return 0; return 0;
@ -75,7 +75,7 @@ int usage_lf_hid_brute(void){
PrintAndLog("if cardnumber is not given, it starts with 1 and goes up to 65535"); PrintAndLog("if cardnumber is not given, it starts with 1 and goes up to 65535");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf hid brute [h] [v] a <format> f <facility-code> c <cardnumber> d <delay>"); PrintAndLog("Usage: lf hid brute [h] [v] a <format> f <facility-code> c <cardnumber> d <delay>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" a <format> : 26|33|34|35|37|40|44|84"); PrintAndLog(" a <format> : 26|33|34|35|37|40|44|84");
PrintAndLog(" f <facility-code> : 8-bit value HID facility code"); PrintAndLog(" f <facility-code> : 8-bit value HID facility code");
@ -83,7 +83,7 @@ int usage_lf_hid_brute(void){
PrintAndLog(" d <delay> : delay betweens attempts in ms. Default 1000ms"); PrintAndLog(" d <delay> : delay betweens attempts in ms. Default 1000ms");
PrintAndLog(" v : verbose logging, show all tries"); PrintAndLog(" v : verbose logging, show all tries");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" lf hid brute a 26 f 224"); PrintAndLog(" lf hid brute a 26 f 224");
PrintAndLog(" lf hid brute a 26 f 21 d 2000"); PrintAndLog(" lf hid brute a 26 f 21 d 2000");
PrintAndLog(" lf hid brute v a 26 f 21 c 200 d 2000"); PrintAndLog(" lf hid brute v a 26 f 21 c 200 d 2000");

View file

@ -17,10 +17,10 @@ int usage_lf_indala_demod(void) {
PrintAndLog("By default, values are printed and logged until the button is pressed or another USB command is issued."); PrintAndLog("By default, values are printed and logged until the button is pressed or another USB command is issued.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf indala demod [h]"); PrintAndLog("Usage: lf indala demod [h]");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf indala demod"); PrintAndLog(" lf indala demod");
return 0; return 0;
} }
@ -30,11 +30,11 @@ int usage_lf_indala_sim(void) {
PrintAndLog("Simulation runs until the button is pressed or another USB command is issued."); PrintAndLog("Simulation runs until the button is pressed or another USB command is issued.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf indala sim [h] <uid>"); PrintAndLog("Usage: lf indala sim [h] <uid>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <uid> : 64/224 UID"); PrintAndLog(" <uid> : 64/224 UID");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf indala sim deadc0de"); PrintAndLog(" lf indala sim deadc0de");
return 0; return 0;
} }
@ -44,12 +44,12 @@ int usage_lf_indala_clone(void) {
PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process."); PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf indala clone [h] <uid> [Q5]"); PrintAndLog("Usage: lf indala clone [h] <uid> [Q5]");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <uid> : 64/224 UID"); PrintAndLog(" <uid> : 64/224 UID");
PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf indala clone 112233"); PrintAndLog(" lf indala clone 112233");
return 0; return 0;
} }

View file

@ -18,11 +18,11 @@ int usage_lf_io_read(void) {
PrintAndLog("If the [1] option is provided, reader mode is exited after reading a single card."); PrintAndLog("If the [1] option is provided, reader mode is exited after reading a single card.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf io read [h] [1]"); PrintAndLog("Usage: lf io read [h] [1]");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" 1 : (optional) stop after reading a single card"); PrintAndLog(" 1 : (optional) stop after reading a single card");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf io read"); PrintAndLog(" lf io read");
PrintAndLog(" lf io read 1"); PrintAndLog(" lf io read 1");
return 0; return 0;
@ -33,13 +33,13 @@ int usage_lf_io_sim(void) {
PrintAndLog("Simulation runs until the button is pressed or another USB command is issued."); PrintAndLog("Simulation runs until the button is pressed or another USB command is issued.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf io sim [h] <version> <facility-code> <card-number>"); PrintAndLog("Usage: lf io sim [h] <version> <facility-code> <card-number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <version> : 8bit version"); PrintAndLog(" <version> : 8bit version");
PrintAndLog(" <facility-code> : 8bit value facility code"); PrintAndLog(" <facility-code> : 8bit value facility code");
PrintAndLog(" <card number> : 16bit value card number"); PrintAndLog(" <card number> : 16bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf io sim 26 101 1337"); PrintAndLog(" lf io sim 26 101 1337");
return 0; return 0;
} }
@ -49,14 +49,14 @@ int usage_lf_io_clone(void) {
PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process."); PrintAndLog("The T55x7 must be on the antenna when issuing this command. T55x7 blocks are calculated and printed in the process.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]"); PrintAndLog("Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <version> : 8bit version"); PrintAndLog(" <version> : 8bit version");
PrintAndLog(" <facility-code> : 8bit value facility code"); PrintAndLog(" <facility-code> : 8bit value facility code");
PrintAndLog(" <card number> : 16bit value card number"); PrintAndLog(" <card number> : 16bit value card number");
PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples"); PrintAndLog("Examples:");
PrintAndLog(" lf io clone 26 101 1337"); PrintAndLog(" lf io clone 26 101 1337");
return 0; return 0;
} }

View file

@ -20,7 +20,8 @@ int usage_lf_jablotron_clone(void){
PrintAndLog(" <card ID> : jablotron card ID"); PrintAndLog(" <card ID> : jablotron card ID");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf jablotron clone 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf jablotron clone 112233");
return 0; return 0;
} }
@ -33,7 +34,8 @@ int usage_lf_jablotron_sim(void) {
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <card ID> : jablotron card ID"); PrintAndLog(" <card ID> : jablotron card ID");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf jablotron sim 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf jablotron sim 112233");
return 0; return 0;
} }

View file

@ -19,7 +19,8 @@ int usage_lf_nedap_clone(void){
PrintAndLog(" <Card Number> : 24-bit value card number"); PrintAndLog(" <Card Number> : 24-bit value card number");
// PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); // PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf nedap clone 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf nedap clone 112233");
return 0; return 0;
} }
@ -32,7 +33,8 @@ int usage_lf_nedap_sim(void) {
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <Card Number> : 24-bit value card number"); PrintAndLog(" <Card Number> : 24-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf nedap sim 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf nedap sim 112233");
return 0; return 0;
} }

View file

@ -20,7 +20,8 @@ int usage_lf_noralsy_clone(void){
PrintAndLog(" <year> : Tag allocation year"); PrintAndLog(" <year> : Tag allocation year");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf noralsy clone 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf noralsy clone 112233");
return 0; return 0;
} }
@ -34,7 +35,8 @@ int usage_lf_noralsy_sim(void) {
PrintAndLog(" <card id> : Noralsy card ID"); PrintAndLog(" <card id> : Noralsy card ID");
PrintAndLog(" <year> : Tag allocation year"); PrintAndLog(" <year> : Tag allocation year");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf noralsy sim 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf noralsy sim 112233");
return 0; return 0;
} }

View file

@ -27,12 +27,13 @@ int usage_lf_paradox_sim(void) {
PrintAndLog("The facility-code is 8-bit and the card number is 16-bit. Larger values are truncated."); PrintAndLog("The facility-code is 8-bit and the card number is 16-bit. Larger values are truncated.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf paradox sim [h] <Facility-Code> <Card-Number>"); PrintAndLog("Usage: lf paradox sim [h] <Facility-Code> <Card-Number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" <Facility-Code> : 8-bit value facility code"); PrintAndLog(" <Facility-Code> : 8-bit value facility code");
PrintAndLog(" <Card Number> : 16-bit value card number"); PrintAndLog(" <Card Number> : 16-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf paradox sim 123 11223"); PrintAndLog("Examples:");
PrintAndLog(" lf paradox sim 123 11223");
return 0; return 0;
} }

View file

@ -13,13 +13,14 @@ static int CmdHelp(const char *Cmd);
int usage_lf_presco_clone(void){ int usage_lf_presco_clone(void){
PrintAndLog("clone a Presco tag to a T55x7 tag."); PrintAndLog("clone a Presco tag to a T55x7 tag.");
PrintAndLog("Usage: lf presco clone [h] d <Card-ID> H <hex-ID> <Q5>"); PrintAndLog("Usage: lf presco clone [h] d <Card-ID> H <hex-ID> <Q5>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" d <Card-ID> : 9 digit presco card ID"); PrintAndLog(" d <Card-ID> : 9 digit presco card ID");
PrintAndLog(" H <hex-ID> : 8 digit hex card number"); PrintAndLog(" H <hex-ID> : 8 digit hex card number");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf presco clone d 123456789"); PrintAndLog("Examples:");
PrintAndLog(" lf presco clone d 123456789");
return 0; return 0;
} }
@ -29,12 +30,13 @@ int usage_lf_presco_sim(void) {
PrintAndLog("Per presco format, the card number is 9 digit number and can contain *# chars. Larger values are truncated."); PrintAndLog("Per presco format, the card number is 9 digit number and can contain *# chars. Larger values are truncated.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf presco sim [h] d <Card-ID> or H <hex-ID>"); PrintAndLog("Usage: lf presco sim [h] d <Card-ID> or H <hex-ID>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" d <Card-ID> : 9 digit presco card number"); PrintAndLog(" d <Card-ID> : 9 digit presco card number");
PrintAndLog(" H <hex-ID> : 8 digit hex card number"); PrintAndLog(" H <hex-ID> : 8 digit hex card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf presco sim d 123456789"); PrintAndLog("Examples:");
PrintAndLog(" lf presco sim d 123456789");
return 0; return 0;
} }

View file

@ -17,13 +17,14 @@ int usage_lf_pyramid_clone(void){
PrintAndLog("Currently only works on 26bit"); PrintAndLog("Currently only works on 26bit");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf pyramid clone [h] <Facility-Code> <Card-Number> [Q5]"); PrintAndLog("Usage: lf pyramid clone [h] <Facility-Code> <Card-Number> [Q5]");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" <Facility-Code> : 8-bit value facility code"); PrintAndLog(" <Facility-Code> : 8-bit value facility code");
PrintAndLog(" <Card Number> : 16-bit value card number"); PrintAndLog(" <Card Number> : 16-bit value card number");
PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLog(" Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf pyramid clone 123 11223"); PrintAndLog("Examples:");
PrintAndLog(" lf pyramid clone 123 11223");
return 0; return 0;
} }
@ -34,12 +35,13 @@ int usage_lf_pyramid_sim(void) {
PrintAndLog("Currently work only on 26bit"); PrintAndLog("Currently work only on 26bit");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf pyramid sim [h] <Facility-Code> <Card-Number>"); PrintAndLog("Usage: lf pyramid sim [h] <Facility-Code> <Card-Number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(" <Facility-Code> : 8-bit value facility code"); PrintAndLog(" <Facility-Code> : 8-bit value facility code");
PrintAndLog(" <Card Number> : 16-bit value card number"); PrintAndLog(" <Card Number> : 16-bit value card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf pyramid sim 123 11223"); PrintAndLog("Examples:");
PrintAndLog(" lf pyramid sim 123 11223");
return 0; return 0;
} }

View file

@ -14,11 +14,12 @@ static int CmdHelp(const char *Cmd);
int usage_lf_viking_clone(void) { int usage_lf_viking_clone(void) {
PrintAndLog("clone a Viking AM tag to a T55x7 tag."); PrintAndLog("clone a Viking AM tag to a T55x7 tag.");
PrintAndLog("Usage: lf viking clone <Card ID - 8 hex digits> <Q5>"); PrintAndLog("Usage: lf viking clone <Card ID - 8 hex digits> <Q5>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" <Card Number> : 8 digit hex viking card number"); PrintAndLog(" <Card Number> : 8 digit hex viking card number");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf viking clone 1A337 Q5"); PrintAndLog("Examples:");
PrintAndLog(" lf viking clone 1A337 Q5");
return 0; return 0;
} }
@ -28,10 +29,11 @@ int usage_lf_viking_sim(void) {
PrintAndLog("Per viking format, the card number is 8 digit hex number. Larger values are truncated."); PrintAndLog("Per viking format, the card number is 8 digit hex number. Larger values are truncated.");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Usage: lf viking sim <Card-Number>"); PrintAndLog("Usage: lf viking sim <Card-Number>");
PrintAndLog("Options :"); PrintAndLog("Options:");
PrintAndLog(" <Card Number> : 8 digit hex viking card number"); PrintAndLog(" <Card Number> : 8 digit hex viking card number");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample : lf viking sim 1A337"); PrintAndLog("Examples:");
PrintAndLog(" lf viking sim 1A337");
return 0; return 0;
} }

View file

@ -23,7 +23,8 @@ int usage_lf_visa2k_clone(void){
PrintAndLog(" <card ID> : Visa2k card ID"); PrintAndLog(" <card ID> : Visa2k card ID");
PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLog(" <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf visa2000 clone 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf visa2000 clone 112233");
return 0; return 0;
} }
@ -36,7 +37,8 @@ int usage_lf_visa2k_sim(void) {
PrintAndLog(" h : This help"); PrintAndLog(" h : This help");
PrintAndLog(" <card ID> : Visa2k card ID"); PrintAndLog(" <card ID> : Visa2k card ID");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Sample: lf visa2000 sim 112233"); PrintAndLog("Examples:");
PrintAndLog(" lf visa2000 sim 112233");
return 0; return 0;
} }

View file

@ -16,12 +16,12 @@ static int CmdHelp(const char *Cmd);
int usage_emv_select(void) { int usage_emv_select(void) {
PrintAndLog("Executes select applet command:\n"); PrintAndLog("Executes select applet command:\n");
PrintAndLog("Usage: hf emv select [-s][-k][-a][-t] <HEX applet AID>\n"); PrintAndLog("Usage: hf emv select [-s][-k][-a][-t] <HEX applet AID>\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" -s : select card"); PrintAndLog(" -s : select card");
PrintAndLog(" -k : keep field for next command"); PrintAndLog(" -k : keep field for next command");
PrintAndLog(" -a : show APDU reqests and responses\n"); PrintAndLog(" -a : show APDU reqests and responses\n");
PrintAndLog(" -t : TLV decode results\n"); PrintAndLog(" -t : TLV decode results\n");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv select -s a00000000101 -> select card, select applet"); PrintAndLog(" hf emv select -s a00000000101 -> select card, select applet");
PrintAndLog(" hf emv select -s -t a00000000101 -> select card, select applet, show result in TLV"); PrintAndLog(" hf emv select -s -t a00000000101 -> select card, select applet, show result in TLV");
return 0; return 0;
@ -108,12 +108,12 @@ int CmdHFEMVSelect(const char *cmd) {
int usage_emv_search(void) { int usage_emv_search(void) {
PrintAndLog("Tries to select all applets from applet list:\n"); PrintAndLog("Tries to select all applets from applet list:\n");
PrintAndLog("Usage: hf emv search [-s][-k][-a][-t]\n"); PrintAndLog("Usage: hf emv search [-s][-k][-a][-t]\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" -s : select card"); PrintAndLog(" -s : select card");
PrintAndLog(" -k : keep field for next command"); PrintAndLog(" -k : keep field for next command");
PrintAndLog(" -a : show APDU reqests and responses\n"); PrintAndLog(" -a : show APDU reqests and responses\n");
PrintAndLog(" -t : TLV decode results of selected applets\n"); PrintAndLog(" -t : TLV decode results of selected applets\n");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv search -s -> select card and search"); PrintAndLog(" hf emv search -s -> select card and search");
PrintAndLog(" hf emv search -s -t -> select card, search and show result in TLV"); PrintAndLog(" hf emv search -s -t -> select card, search and show result in TLV");
return 0; return 0;
@ -185,14 +185,14 @@ int CmdHFEMVSearch(const char *cmd) {
int usage_emv_ppse(void) { int usage_emv_ppse(void) {
PrintAndLog("Executes PSE/PPSE select command. It returns list of applet on the card:\n"); PrintAndLog("Executes PSE/PPSE select command. It returns list of applet on the card:\n");
PrintAndLog("Usage: hf emv pse [-s][-k][-1][-2][-a][-t]\n"); PrintAndLog("Usage: hf emv pse [-s][-k][-1][-2][-a][-t]\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" -s : select card"); PrintAndLog(" -s : select card");
PrintAndLog(" -k : keep field for next command"); PrintAndLog(" -k : keep field for next command");
PrintAndLog(" -1 : ppse (1PAY.SYS.DDF01)"); PrintAndLog(" -1 : ppse (1PAY.SYS.DDF01)");
PrintAndLog(" -2 : pse (2PAY.SYS.DDF01)"); PrintAndLog(" -2 : pse (2PAY.SYS.DDF01)");
PrintAndLog(" -a : show APDU reqests and responses\n"); PrintAndLog(" -a : show APDU reqests and responses\n");
PrintAndLog(" -t : TLV decode results\n"); PrintAndLog(" -t : TLV decode results\n");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv pse -s -1 -> select, get pse"); PrintAndLog(" hf emv pse -s -1 -> select, get pse");
PrintAndLog(" hf emv pse -s -k -2 -> select, get ppse, keep field"); PrintAndLog(" hf emv pse -s -k -2 -> select, get ppse, keep field");
PrintAndLog(" hf emv pse -s -t -2 -> select, get ppse, show result in TLV"); PrintAndLog(" hf emv pse -s -t -2 -> select, get ppse, show result in TLV");
@ -269,7 +269,7 @@ int CmdHFEMVPPSE(const char *cmd) {
int usage_emv_exec(void) { int usage_emv_exec(void) {
PrintAndLog("Executes EMV contactless transaction:\n"); PrintAndLog("Executes EMV contactless transaction:\n");
PrintAndLog("Usage: hf emv exec [-s][-a][-t][-f][-v][-c][-x][-g]\n"); PrintAndLog("Usage: hf emv exec [-s][-a][-t][-f][-v][-c][-x][-g]\n");
PrintAndLog(" Options:"); PrintAndLog("Options:");
PrintAndLog(" -s : select card"); PrintAndLog(" -s : select card");
PrintAndLog(" -a : show APDU reqests and responses\n"); PrintAndLog(" -a : show APDU reqests and responses\n");
PrintAndLog(" -t : TLV decode results\n"); PrintAndLog(" -t : TLV decode results\n");
@ -279,7 +279,7 @@ int usage_emv_exec(void) {
PrintAndLog(" -x : transaction type - VSDC. For test only. Not a standart behavior.\n"); PrintAndLog(" -x : transaction type - VSDC. For test only. Not a standart behavior.\n");
PrintAndLog(" -g : VISA. generate AC from GPO\n"); PrintAndLog(" -g : VISA. generate AC from GPO\n");
PrintAndLog("By default : transaction type - MSD.\n"); PrintAndLog("By default : transaction type - MSD.\n");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv exec -s -a -t -> execute MSD transaction"); PrintAndLog(" hf emv exec -s -a -t -> execute MSD transaction");
PrintAndLog(" hf emv exec -s -a -t -c -> execute CDA transaction"); PrintAndLog(" hf emv exec -s -a -t -c -> execute CDA transaction");
return 0; return 0;
@ -816,7 +816,7 @@ int usage_emv_getrnd(void){
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h : this help"); PrintAndLog(" h : this help");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("Samples:"); PrintAndLog("Examples:");
PrintAndLog(" hf emv getrnd"); PrintAndLog(" hf emv getrnd");
return 0; return 0;
} }

View file

@ -545,11 +545,15 @@ static int l_hardnested(lua_State *L){
const char *p_tests = luaL_checklstring(L, 10, &size); const char *p_tests = luaL_checklstring(L, 10, &size);
if(size != 1) return returnToLuaWithError(L,"Wrong size of tests, got %d bytes, expected 1", (int) size); if(size != 1) return returnToLuaWithError(L,"Wrong size of tests, got %d bytes, expected 1", (int) size);
char filename[FILE_PATH_SIZE]="nonces.bin";
const char *p_filename = luaL_checklstring(L, 11, &size);
if(size != 0)
strcpy(filename, p_filename);
uint32_t blockNo = 0, keyType = 0; uint32_t blockNo = 0, keyType = 0;
uint32_t trgBlockNo = 0, trgKeyType = 0; uint32_t trgBlockNo = 0, trgKeyType = 0;
uint32_t slow = 0, tests = 0; uint32_t slow = 0, tests = 0;
uint32_t nonce_file_read = 0, nonce_file_write = 0; uint32_t nonce_file_read = 0, nonce_file_write = 0;
sscanf(p_blockno, "%02x", &blockNo); sscanf(p_blockno, "%02x", &blockNo);
sscanf(p_keytype, "%x", &keyType); sscanf(p_keytype, "%x", &keyType);
sscanf(p_trg_blockno, "%02x", &trgBlockNo); sscanf(p_trg_blockno, "%02x", &trgBlockNo);
@ -572,7 +576,7 @@ static int l_hardnested(lua_State *L){
} }
uint64_t foundkey = 0; uint64_t foundkey = 0;
int retval = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, haveTarget ? trgkey : NULL, nonce_file_read, nonce_file_write, slow, tests, &foundkey); int retval = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, haveTarget ? trgkey : NULL, nonce_file_read, nonce_file_write, slow, tests, &foundkey, filename);
DropField(); DropField();
//Push the key onto the stack //Push the key onto the stack

View file

@ -101,17 +101,19 @@ void AddLogCurrentDT(char *fn) {
// param *uid - pointer to uid byte array // param *uid - pointer to uid byte array
// param *ext - ".log" // param *ext - ".log"
// param uidlen - length of uid array. // param uidlen - length of uid array.
void FillFileNameByUID(char *fn, uint8_t *uid, char *ext, int uidlen) { void FillFileNameByUID(char *filenamePrefix, uint8_t *uid, const char *ext, int uidlen) {
if ( fn == NULL || uid == NULL || ext == NULL ){ if ( filenamePrefix == NULL || uid == NULL || ext == NULL ){
printf("[!] error parameter is NULL\n"); printf("[!] error parameter is NULL\n");
return; return;
} }
char *fnameptr = fn;
memset(fn, 0x00, FILE_PATH_SIZE);
for (int j = 0; j < uidlen; j++, fnameptr += 2) int len=0;
sprintf(fnameptr, "%02X", uid[j]); len=strlen(filenamePrefix);
sprintf(fnameptr, "%s", ext); //memset(fn, 0x00, FILE_PATH_SIZE);
for (int j = 0; j < uidlen; j++)
sprintf(filenamePrefix + len + j * 2, "%02X", uid[j]);
strcat(filenamePrefix, ext);
} }
void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, const size_t hex_max_len, void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, const size_t hex_max_len,

View file

@ -174,7 +174,7 @@ extern void AddLogLine(char *fileName, char *extData, char *c);
extern void AddLogHex(char *fileName, char *extData, const uint8_t * data, const size_t len); extern void AddLogHex(char *fileName, char *extData, const uint8_t * data, const size_t len);
extern void AddLogUint64(char *fileName, char *extData, const uint64_t data); extern void AddLogUint64(char *fileName, char *extData, const uint64_t data);
extern void AddLogCurrentDT(char *fileName); extern void AddLogCurrentDT(char *fileName);
extern void FillFileNameByUID(char *fileName, uint8_t * uid, char *ext, int byteCount); extern void FillFileNameByUID(char *filenamePrefix, uint8_t * uid, const char *ext, int uidlen);
extern void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len, extern void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex_len,
const size_t hex_max_len, const size_t min_str_len, const size_t spaces_between, const size_t hex_max_len, const size_t min_str_len, const size_t spaces_between,