+int usage_legic_rdmem(void){
+ PrintAndLog("Read data from a legic tag.");
+ PrintAndLog("Usage: hf legic rdmem [h] <offset> <length> <IV>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <offset> : (hex) offset in data array to start download from");
+ PrintAndLog(" <length> : (hex) number of bytes to read");
+ PrintAndLog(" <IV> : (hex) (optional) Initialization vector to use. Must be odd and 7bits max");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ 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 100 55 - reads 0x100 bytes with IV 0x55");
+ return 0;
+}
+int usage_legic_sim(void){
+ PrintAndLog("Simulates a LEGIC Prime tag. MIM22, MIM256, MIM1024 types can be emulated");
+ PrintAndLog("Use eload/esave to upload a dump into emulator memory");
+ PrintAndLog("Usage: hf legic sim [h] <tagtype> <phase> <frame> <reqresp>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" <tagtype> : 0 = MIM22");
+ PrintAndLog(" : 1 = MIM256 (default)");
+ PrintAndLog(" : 2 = MIM1024");
+ PrintAndLog(" <phase> : phase drift");
+ PrintAndLog(" <frame> : frame drift");
+ PrintAndLog(" <reqresp> : reqresp drift");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic sim");
+ PrintAndLog(" hf legic sim ");
+ return 0;
+}
+int usage_legic_write(void){
+ PrintAndLog("Write data to a LEGIC Prime tag. It autodetects tagsize to make sure size");
+ PrintAndLog("Usage: hf legic write [h] o <offset> d <data (hex symbols)>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" o <offset> : (hex) offset in data array to start writing");
+ //PrintAndLog(" <IV> : (optional) Initialization vector to use (ODD and 7bits)");
+ PrintAndLog(" d <data> : (hex symbols) bytes to write ");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic write o 10 d 11223344 - Write 0x11223344 starting from offset 0x10");
+ return 0;
+}
+int usage_legic_reader(void){
+ PrintAndLog("Read UID and type information from a legic tag.");
+ PrintAndLog("Usage: hf legic reader [h]");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic reader");
+ return 0;
+}
+int usage_legic_info(void){
+ PrintAndLog("Reads information from a legic prime tag.");
+ PrintAndLog("Shows systemarea, user areas etc");
+ PrintAndLog("Usage: hf legic info [h]");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic info");
+ return 0;
+}
+int usage_legic_dump(void){
+ PrintAndLog("Reads all pages from LEGIC Prime MIM22, MIM256, MIM1024");
+ PrintAndLog("and saves binary dump into the file `filename.bin` or `cardUID.bin`");
+ PrintAndLog("It autodetects card type.\n");
+ PrintAndLog("Usage: hf legic dump [h] o <filename w/o .bin>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" o <filename> : filename w/o '.bin' to dump bytes");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic dump");
+ PrintAndLog(" hf legic dump o myfile");
+ return 0;
+}
+int usage_legic_restore(void){
+ PrintAndLog("Reads binary file and it autodetects card type and verifies that the file has the same size");
+ PrintAndLog("Then write the data back to card. All bytes except the first 7bytes [UID(4) MCC(1) DCF(2)]\n");
+ PrintAndLog("Usage: hf legic restore [h] i <filename w/o .bin>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" i <filename> : filename w/o '.bin' to restore bytes on to card from");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic restore i myfile");
+ return 0;
+}
+int usage_legic_eload(void){
+ PrintAndLog("It loads binary dump from the file `filename.bin`");
+ PrintAndLog("Usage: hf legic eload [h] [card memory] <file name w/o `.bin`>");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" [card memory] : 0 = MIM22");
+ PrintAndLog(" : 1 = MIM256 (default)");
+ PrintAndLog(" : 2 = MIM1024");
+ PrintAndLog(" <filename> : filename w/o .bin to load");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic eload 2 myfile");
+ return 0;
+}
+int usage_legic_esave(void){
+ PrintAndLog("It saves binary dump into the file `filename.bin` or `cardID.bin`");
+ PrintAndLog(" Usage: hf legic esave [h] [card memory] [file name w/o `.bin`]");
+ PrintAndLog("Options:");
+ PrintAndLog(" h : this help");
+ PrintAndLog(" [card memory] : 0 = MIM22");
+ PrintAndLog(" : 1 = MIM256 (default)");
+ PrintAndLog(" : 2 = MIM1024");
+ PrintAndLog(" <filename> : filename w/o .bin to load");
+ PrintAndLog("");
+ PrintAndLog("Samples:");
+ PrintAndLog(" hf legic esave 2 myfile");