فهرست منبع

fix 0credits bug, add full access tag support

Pi3rrot 8 سال پیش
والد
کامیت
8f15118a23
9فایلهای تغییر یافته به همراه20 افزوده شده و 5 حذف شده
  1. 7 3
      Makefile
  2. BIN
      dump/blank_card.mfd
  3. BIN
      dump/lim_full_annuel.mfd
  4. BIN
      dump/lim_full_annuel_second_passage.mfd
  5. BIN
      dump/lim_test_keep.mfd
  6. BIN
      dump/lim_test_keep2.mfd
  7. BIN
      dump/lim_unite.mfd
  8. BIN
      dump/lim_unite2.mfd
  9. 13 2
      poolset.c

+ 7 - 3
Makefile

@@ -1,6 +1,6 @@
 restore_tag:
-	nfc-mfclassic f A dump/lim_10.mfd dump/lim_10.mfd f
-	nfc-mfclassic w a dump/lim_10.mfd f
+	nfc-mfclassic f A dump/lim_10.mfd dump/lim_10.mfd
+	nfc-mfclassic w a dump/lim_10.mfd 
 
 magic_card_10:
 	make restore_tag
@@ -8,11 +8,15 @@ magic_card_10:
 
 selecta_change_from_orig:
 	mfoc -O temp.mfd
-	nfc-mfclassic f B dump/lim_10.mfd temp.mfd f
+	nfc-mfclassic f B dump/lim_10.mfd temp.mfd 
 	nfc-mfclassic w A dump/lim_10.mfd
 	rm temp.mfd
 	./poolset --write 10 25/11/16 25/11/19
 
+#uid0:
+#	nfc-mfsetuid $(openssl rand -hex 4)
+#	Don't work in Makefile !
+
 all:
 	gcc -o poolset -lusb -lnfc -lfreefare poolset.c
 

BIN
dump/blank_card.mfd


BIN
dump/lim_full_annuel.mfd


BIN
dump/lim_full_annuel_second_passage.mfd


BIN
dump/lim_test_keep.mfd


BIN
dump/lim_test_keep2.mfd


BIN
dump/lim_unite.mfd


BIN
dump/lim_unite2.mfd


+ 13 - 2
poolset.c

@@ -67,17 +67,20 @@ void rw_tag(int coins, char *buy_date, char *expire_date) {
 
 			printf("=> Trying to authenticate with SecretKey "ANSI_COLOR_YELLOW"%.2x %.2x %.2x %.2x %.2x %.2x"ANSI_COLOR_RESET" ...\n", SecretKey[0][0], SecretKey[0][1], SecretKey[0][2], SecretKey[0][3], SecretKey[0][4], SecretKey[0][5]);
 
+			//Check for a good tag type
 			if(mifare_classic_connect(tags[i]) == OPERATION_OK) {
 				printf(ANSI_COLOR_GREEN"=> Mifare tag connected !\n"ANSI_COLOR_RESET);
 			}
 			else printf(ANSI_COLOR_RED"Non ca chie dans la colle mais grave, ton tag est moisi\n"ANSI_COLOR_RESET);
 			
+			//Authenticating the tag
 			if(mifare_classic_authenticate(tags[i], 5, SecretKey[0], MFC_KEY_A) == OPERATION_OK) {
 				printf(ANSI_COLOR_GREEN"=> Tag authenticated !\n"ANSI_COLOR_RESET);
 			}
 			else printf(ANSI_COLOR_RED"Non ca chie dans la colle mais grave, check ta clé\n"ANSI_COLOR_RESET);
 
-			if(coins != 0 && buy_date != NULL && expire_date != NULL) {
+			//Check of arguements in rw_tag() for read only or write/read
+			if((coins != 0 || coins == 0) && buy_date != NULL && expire_date != NULL) {
 
 				char *token;
 				token = strtok (buy_date,"/");
@@ -109,7 +112,6 @@ void rw_tag(int coins, char *buy_date, char *expire_date) {
 				printf("Reading a second time to check...\n");
 			} 
 
-
 			if( (mifare_classic_read(tags[i], 5, &data_read5) == OPERATION_OK) 
 				&& 
 				(mifare_classic_read(tags[i], 4, &data_read4) == OPERATION_OK) )
@@ -119,6 +121,15 @@ void rw_tag(int coins, char *buy_date, char *expire_date) {
 				printf("  => Credits :\t\t"ANSI_COLOR_YELLOW"%.2d\n"ANSI_COLOR_RESET, data_read5[7]);
 				printf("  => Buy date :\t\t"ANSI_COLOR_YELLOW"%.2d/%.2d/%.2d\n"ANSI_COLOR_RESET, data_read5[0], data_read5[1], data_read5[2]);
 				printf("  => Expiration date :\t"ANSI_COLOR_YELLOW"%.2d/%.2d/%.2d\n"ANSI_COLOR_RESET, data_read5[3], data_read5[4], data_read5[5]);
+				if (data_read5[7] == 0) {
+					printf("  => Type : "ANSI_COLOR_YELLOW"\t\tFull access tag (Probably)\n"ANSI_COLOR_RESET);
+					printf("  => Last validation :\t"ANSI_COLOR_YELLOW"%.2d/%.2d/%.2d at %.2d:%.2d\n"ANSI_COLOR_RESET,
+						data_read5[8], data_read5[9], data_read5[10], data_read5[11], data_read5[12]);
+				}
+
+				else
+					printf("  => Type : "ANSI_COLOR_YELLOW"\t\tCredited card\n"ANSI_COLOR_RESET);										
+
 				//printf("  => Card keeped :\t");
 			}