]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/appmain.c
Merge branch 'master' of https://github.com/Proxmark/proxmark3
[proxmark3-svn] / armsrc / appmain.c
index 31e17e880a5c12eed13aaa5d2d569090ba360654..04503a4fa58da584f36518d7d226dbfc25309602 100644 (file)
 
 #include "../common/usb_cdc.h"
 #include "../common/cmd.h"
-
 #include "../include/proxmark3.h"
+#include "../include/hitag2.h"
 #include "apps.h"
 #include "util.h"
 #include "printf.h"
 #include "string.h"
 #include <stdarg.h>
-
 #include "legicrf.h"
-#include "../include/hitag2.h"
 #include "lfsampling.h"
+#include "BigBuf.h"
 
 #ifdef WITH_LCD
  #include "LCD.h"
@@ -647,7 +646,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        setSamplingConfig((sample_config *) c->d.asBytes);
                        break;
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K:
-                       cmd_send(CMD_ACK,SampleLF(),0,0,0,0);
+                       cmd_send(CMD_ACK,SampleLF(c->arg[0]),0,0,0,0);
                        break;
                case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:
                        ModThenAcquireRawAdcSamples125k(c->arg[0],c->arg[1],c->arg[2],c->d.asBytes);
@@ -661,6 +660,15 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_HID_SIM_TAG:
                        CmdHIDsimTAG(c->arg[0], c->arg[1], 1);
                        break;
+               case CMD_FSK_SIM_TAG:
+                       CmdFSKsimTAG(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       break;
+               case CMD_ASK_SIM_TAG:
+                       CmdASKsimTag(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       break;
+               case CMD_PSK_SIM_TAG:
+                       CmdPSKsimTag(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       break;
                case CMD_HID_CLONE_TAG:
                        CopyHIDtoT55x7(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]);
                        break;
@@ -683,8 +691,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        WriteTItag(c->arg[0],c->arg[1],c->arg[2]);
                        break;
                case CMD_SIMULATE_TAG_125K:
-                       SimulateTagLowFrequency(c->arg[0], c->arg[1], 0);
-                       //SimulateTagLowFrequencyA(c->arg[0], c->arg[1]);
+                       LED_A_ON();
+                       SimulateTagLowFrequency(c->arg[0], c->arg[1], 1);
+                       LED_A_OFF();
                        break;
                case CMD_LF_SIMULATE_BIDIR:
                        SimulateTagLowFrequencyBidir(c->arg[0], c->arg[1]);
@@ -727,7 +736,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        ReaderHitag((hitag_function)c->arg[0],(hitag_data*)c->d.asBytes);
                        break;
 #endif
-            
+
 #ifdef WITH_ISO15693
                case CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693:
                        AcquireRawAdcSamplesIso15693();
@@ -793,7 +802,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
 
 #ifdef WITH_ISO14443a
                case CMD_SNOOP_ISO_14443a:
-                       SnoopIso14443a(c->arg[0]);
+                       SniffIso14443a(c->arg[0]);
                        break;
                case CMD_READER_ISO_14443a:
                        ReaderIso14443a(c);
@@ -817,19 +826,16 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        MifareReadBlock(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                        break;
                case CMD_MIFAREU_READBL:
-                       MifareUReadBlock(c->arg[0],c->d.asBytes);
-                       break;
-               case CMD_MIFAREUC_AUTH1:
-                       MifareUC_Auth1(c->arg[0],c->d.asBytes);
+                       MifareUReadBlock(c->arg[0],c->arg[1], c->d.asBytes);
                        break;
-               case CMD_MIFAREUC_AUTH2:
-                       MifareUC_Auth2(c->arg[0],c->d.asBytes);
+               case CMD_MIFAREUC_AUTH:
+                       MifareUC_Auth(c->arg[0],c->d.asBytes);
                        break;
                case CMD_MIFAREU_READCARD:
-                       MifareUReadCard(c->arg[0], c->arg[1], c->d.asBytes);
-                        break;
-               case CMD_MIFAREUC_READCARD:
-                       MifareUReadCard(c->arg[0], c->arg[1], c->d.asBytes);
+                       MifareUReadCard(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       break;
+               case CMD_MIFAREUC_SETPWD: 
+                       MifareUSetPwd(c->arg[0], c->d.asBytes);
                        break;
                case CMD_MIFARE_READSC:
                        MifareReadSector(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
@@ -839,10 +845,11 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        break;
                case CMD_MIFAREU_WRITEBL_COMPAT:
                        MifareUWriteBlock(c->arg[0], c->d.asBytes);
-                        break;
+                       break;
                case CMD_MIFAREU_WRITEBL:
-                        MifareUWriteBlock_Special(c->arg[0], c->d.asBytes);
-                        break;
+                       MifareUWriteBlock_Special(c->arg[0], c->d.asBytes);
+                       MifareUWriteBlock_Special(c->arg[0], c->arg[1], c->d.asBytes);
+                       break;
                case CMD_MIFARE_NESTED:
                        MifareNested(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
                        break;
@@ -886,6 +893,28 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        SniffMifare(c->arg[0]);
                        break;
 
+               //mifare desfire
+               case CMD_MIFARE_DESFIRE_READBL: break;
+               case CMD_MIFARE_DESFIRE_WRITEBL: break;
+               case CMD_MIFARE_DESFIRE_AUTH1:
+                       MifareDES_Auth1(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
+                       break;
+               case CMD_MIFARE_DESFIRE_AUTH2:
+                       //MifareDES_Auth2(c->arg[0],c->d.asBytes);
+                       break;
+               case CMD_MIFARE_DES_READER:
+                       //readermifaredes(c->arg[0], c->arg[1], c->d.asBytes);
+                       break;
+               case CMD_MIFARE_DESFIRE_INFO:
+                       MifareDesfireGetInformation();
+                       break;
+               case CMD_MIFARE_DESFIRE:
+                       MifareSendCommand(c->arg[0], c->arg[1], c->d.asBytes);
+                       break;
+
+               case CMD_MIFARE_COLLECT_NONCES:
+                       MifareCollectNonces(c->arg[0], c->arg[1]);
+                       break;
 #endif
 
 #ifdef WITH_ICLASS
@@ -902,6 +931,9 @@ void UsbPacketReceived(uint8_t *packet, int len)
                case CMD_READER_ICLASS_REPLAY:
                        ReaderIClass_Replay(c->arg[0], c->d.asBytes);
                        break;
+       case CMD_ICLASS_EML_MEMSET:
+                       emlSet(c->d.asBytes,c->arg[0], c->arg[1]);
+                       break;
 #endif
 
                case CMD_SIMULATE_TAG_HF_LISTEN:
@@ -936,10 +968,10 @@ void UsbPacketReceived(uint8_t *packet, int len)
                        uint8_t *BigBuf = BigBuf_get_addr();
                        for(size_t i=0; i<c->arg[1]; i += USB_CMD_DATA_SIZE) {
                                size_t len = MIN((c->arg[1] - i),USB_CMD_DATA_SIZE);
-                               cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K,i,len,traceLen,BigBuf+c->arg[0]+i,len);
+                               cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K,i,len,BigBuf_get_traceLen(),BigBuf+c->arg[0]+i,len);
                        }
                        // Trigger a finish downloading signal with an ACK frame
-                       cmd_send(CMD_ACK,1,0,traceLen,getSamplingConfig(),sizeof(sample_config));
+                       cmd_send(CMD_ACK,1,0,BigBuf_get_traceLen(),getSamplingConfig(),sizeof(sample_config));
                        LED_B_OFF();
                        break;
 
@@ -1015,7 +1047,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
 void  __attribute__((noreturn)) AppMain(void)
 {
        SpinDelay(100);
-
+       clear_trace();
        if(common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
                /* Initialize common area */
                memset(&common_area, 0, sizeof(common_area));
Impressum, Datenschutz