X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/76ef5273d84d043288e22c91d941558e75fcb793..refs/pull/208/head:/client/cmdhfmf.c

diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c
index 9f337a5b..36c8e6c3 100644
--- a/client/cmdhfmf.c
+++ b/client/cmdhfmf.c
@@ -1079,14 +1079,15 @@ void readerAttack(nonces_t ar_resp[], bool setEmulatorMem) {
 			}
 		}
 	}
-	//moebius attack
+	/*
+	//un-comment to use as well moebius attack
 	for (uint8_t i = ATTACK_KEY_COUNT; i<ATTACK_KEY_COUNT*2; i++) {
 		if (ar_resp[i].ar2 > 0) {
 			if (tryMfk32_moebius(ar_resp[i], &key)) {
 				PrintAndLog("M-Found Key%s for sector %02d: [%04x%08x]", (ar_resp[i].keytype) ? "B" : "A", ar_resp[i].sector, (uint32_t) (key>>32), (uint32_t) (key &0xFFFFFFFF));
 			}
 		}
-	}
+	}*/
 }
 
 int usage_hf14_mf1ksim(void) {
@@ -1123,7 +1124,6 @@ int CmdHF14AMf1kSim(const char *Cmd) {
 	memset(filename, 0x00, sizeof(filename));
 	int len = 0;
 	char buf[64];
-	uint8_t uidBuffer[64];
 
 	uint8_t cmdp = 0;
 	bool errors = false;
@@ -1202,7 +1202,7 @@ int CmdHF14AMf1kSim(const char *Cmd) {
 		PrintAndLog("Loading file and simulating. Press keyboard to abort");
 		while(!feof(f) && !ukbhit()){
 			memset(buf, 0, sizeof(buf));
-			memset(uidBuffer, 0, sizeof(uidBuffer));
+			memset(uid, 0, sizeof(uid));
 
 			if (fgets(buf, sizeof(buf), f) == NULL) {			
 				if (count > 0) break;
@@ -1211,21 +1211,21 @@ int CmdHF14AMf1kSim(const char *Cmd) {
 				fclose(f);
 				return 2;
 			}
-			if(strlen(buf) && feof(f)) break;
+			if(!strlen(buf) && feof(f)) break;
 
-			uidlen = strlen(buf);
+			uidlen = strlen(buf)-1;
 			switch(uidlen) {
-				case 20: flags = FLAG_10B_UID_IN_DATA;	break; //not complete
-				case 14: flags = FLAG_7B_UID_IN_DATA; break;
-				case  8: flags = FLAG_4B_UID_IN_DATA; break;
+				case 20: flags |= FLAG_10B_UID_IN_DATA;	break; //not complete
+				case 14: flags |= FLAG_7B_UID_IN_DATA; break;
+				case  8: flags |= FLAG_4B_UID_IN_DATA; break;
 				default: 
-					PrintAndLog("uid in file wrong length at %d",count);
+					PrintAndLog("uid in file wrong length at %d (length: %d) [%s]",count, uidlen, buf);
 					fclose(f);
 					return 2;
 			}
 
 			for (uint8_t i = 0; i < uidlen; i += 2) {
-				sscanf(&buf[i], "%02x", (unsigned int *)&uidBuffer[i / 2]);
+				sscanf(&buf[i], "%02x", (unsigned int *)&uid[i / 2]);
 			}
 			
 			PrintAndLog("mf 1k sim uid: %s, numreads:%d, flags:%d (0x%02x) - press button to abort",