]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Added @marshmellow42 "hf search"
authoriceman1001 <iceman@iuse.se>
Wed, 13 May 2015 07:13:42 +0000 (09:13 +0200)
committericeman1001 <iceman@iuse.se>
Wed, 13 May 2015 07:13:42 +0000 (09:13 +0200)
armsrc/iclass.c
client/cmdhf15.c
client/cmdhf15.h
client/cmdhficlass.c
client/cmdhficlass.h
include/usb_cmd.h

index 4d2f924c5f41e65e8e25f1971a41013e186e297e..51a9011f100c058fe8d5c7cdb741ea3d255010af 100644 (file)
@@ -633,8 +633,6 @@ static RAMFUNC int ManchesterDecoding(int v)
 //-----------------------------------------------------------------------------
 void RAMFUNC SnoopIClass(void)
 {
-
-
     // We won't start recording the frames that we acquire until we trigger;
     // a good trigger condition to get started is probably when we see a
     // response from the tag.
@@ -1689,13 +1687,15 @@ void ReaderIClass(uint8_t arg0) {
     int read_status= 0;
        uint8_t result_status = 0;
     bool abort_after_read = arg0 & FLAG_ICLASS_READER_ONLY_ONCE;
-
+       bool try_once = arg0 & FLAG_ICLASS_READER_ONE_TRY;
        set_tracing(TRUE);
     setupIclassReader();
 
+       uint16_t tryCnt=0;
     while(!BUTTON_PRESS())
     {
-
+               if (try_once && tryCnt > 5) break; 
+               tryCnt++;
                if(!tracing) {
                        DbpString("Trace full");
                        break;
index cff13b5b5cb2b6632e16d420e5ceaef38218a30f..caf0799e585102295661c55b40b7eba02bc66625 100644 (file)
@@ -374,6 +374,20 @@ int CmdHF15Record(const char *Cmd)
        return 0;
 }
 
+int HF15Reader(const char *Cmd, bool verbose)
+{
+       uint8_t uid[8];
+
+       if (!getUID(uid)) {
+               if (verbose) PrintAndLog("No Tag found.");
+               return 0;
+       }
+
+       PrintAndLog("Tag UID : %s",sprintUID(NULL,uid));
+       PrintAndLog("Tag Info: %s",getTagInfo(uid));
+       return 1;
+}
+
 int CmdHF15Reader(const char *Cmd)
 {
        UsbCommand c = {CMD_READER_ISO_15693, {strtol(Cmd, NULL, 0), 0, 0}};
@@ -469,7 +483,7 @@ int CmdHF15DumpMem(const char*Cmd) {
                                        // PrintAndLog("bn=%i",blocknum);
                                } else {
                                        PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1])); 
-                                       return 0;
+                                       return 1;
                                }
                        } // else PrintAndLog("crc");
                } // else PrintAndLog("r null");
@@ -481,7 +495,7 @@ int CmdHF15DumpMem(const char*Cmd) {
 //             PrintAndLog("CRC Failed");
 //     else 
 //             PrintAndLog("Tag returned Error %i: %s",recv[1],TagErrorStr(recv[1])); 
-       return 0;
+       return 1;
 }
 
 
@@ -782,6 +796,8 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
                PrintAndLog("               s         selected tag");
                PrintAndLog("               u         unaddressed mode");
                PrintAndLog("               *         scan for tag");
+               PrintAndLog("           start#:       page number to start 0-255");  
+               PrintAndLog("           count#:       number of pages");  
                return 0;
        }       
        
index 8d78e13f1c60fd30d63d27290bd135bc2d955257..c6264604670d1980b9f3d943d6088d32535fbeb6 100644 (file)
@@ -15,6 +15,7 @@ int CmdHF15(const char *Cmd);
 
 int CmdHF15Demod(const char *Cmd);
 int CmdHF15Read(const char *Cmd);
+int HF15Reader(const char *Cmd, bool verbose);
 int CmdHF15Reader(const char *Cmd);
 int CmdHF15Sim(const char *Cmd);
 int CmdHF15Record(const char *Cmd);
index b83371960d007958e6ae5c1a7d6f1d861693a9de..d6c791656806f2540797b0facc30478bc658738d 100644 (file)
@@ -165,10 +165,12 @@ int CmdHFiClassSim(const char *Cmd)
        return 0;
 }
 
-int CmdHFiClassReader(const char *Cmd)
+int HFiClassReader(const char *Cmd, bool loop, bool verbose)
 {
+       bool tagFound = false;
        UsbCommand c = {CMD_READER_ICLASS, {FLAG_ICLASS_READER_CSN|
                                        FLAG_ICLASS_READER_CONF|FLAG_ICLASS_READER_AA}};
+       if (!loop) c.arg[0] |= FLAG_ICLASS_READER_ONLY_ONCE | FLAG_ICLASS_READER_ONE_TRY;
        SendCommand(&c);
        UsbCommand resp;
        while(!ukbhit()){
@@ -176,23 +178,34 @@ int CmdHFiClassReader(const char *Cmd)
                        uint8_t readStatus    = resp.arg[0] & 0xff;
                        uint8_t * data  = resp.d.asBytes;
 
+                       if (verbose)
                        PrintAndLog("Readstatus:%02x", readStatus);
                        if( readStatus == 0){
                                //Aborted
-                               PrintAndLog("Quitting...");
+                               if (verbose) PrintAndLog("Quitting...");
                                return 0;
                        }
-                       if( readStatus & FLAG_ICLASS_READER_CSN) PrintAndLog("CSN: %s",sprint_hex(data,8));
+                       if( readStatus & FLAG_ICLASS_READER_CSN){
+                               PrintAndLog("CSN: %s",sprint_hex(data,8));
+                               tagFound = true;
+                       }
                        if( readStatus & FLAG_ICLASS_READER_CC)  PrintAndLog("CC: %s",sprint_hex(data+16,8));
                        if( readStatus & FLAG_ICLASS_READER_CONF){
                                printIclassDumpInfo(data);
                        }
+                       if (tagFound && !loop) return 1;
                } else {
-                       PrintAndLog("Command execute timeout");
+                       if (verbose) PrintAndLog("Command execute timeout");
                }
+               if (!loop) break;
        }
-
        return 0;
+
+}
+
+int CmdHFiClassReader(const char *Cmd)
+{
+       return HFiClassReader(Cmd, true, true);
 }
 
 int CmdHFiClassReader_Replay(const char *Cmd)
index e4048eb170092b4f6cbfa5266830405ba70f406b..30c6a8a7b1907f2bedf6f121b79ffad46293c9a1 100644 (file)
@@ -17,6 +17,7 @@ int CmdHFiClass(const char *Cmd);
 int CmdHFiClassSnoop(const char *Cmd);
 int CmdHFiClassSim(const char *Cmd);
 int CmdHFiClassList(const char *Cmd);
+int HFiClassReader(const char *Cmd, bool loop, bool verbose);
 int CmdHFiClassReader(const char *Cmd);
 int CmdHFiClassReader_Replay(const char *Cmd);
 
index d61a255899aea2105cfcadb8d81ae534a66410b1..3b19f2c795cb7598175022c5deb71ad5be9e8c5b 100644 (file)
@@ -211,6 +211,7 @@ typedef struct{
 #define FLAG_ICLASS_READER_CSN         0x04
 #define FLAG_ICLASS_READER_CONF                0x08
 #define FLAG_ICLASS_READER_AA          0x10
+#define FLAG_ICLASS_READER_ONE_TRY      0x20
 
 
 
Impressum, Datenschutz