X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/f397b5cc874ac7d658173199d92c30f3f717a300..26fdb4ab49f74415b43363d999063261ed4cb9da:/client/mifarehost.c diff --git a/client/mifarehost.c b/client/mifarehost.c index aab1ae33..f52fb602 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -9,7 +9,7 @@ //----------------------------------------------------------------------------- #include -#include +#include #include "mifarehost.h" @@ -195,3 +195,23 @@ int mfCheckKeys (uint8_t blockNo, uint8_t keyType, uint8_t keycnt, uint8_t * key *key = bytes_to_num(resp->d.asBytes, 6); return 0; } + +int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount) { + UsbCommand c = {CMD_MIFARE_EML_MEMGET, {blockNum, blocksCount, 0}}; + + SendCommand(&c); + + UsbCommand * resp = WaitForResponseTimeout(CMD_ACK, 1500); + + if (resp == NULL) return 1; + memcpy(data, resp->d.asBytes, blocksCount * 16); + return 0; +} + +int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount) { + UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNum, blocksCount, 0}}; + memcpy(c.d.asBytes, data, blocksCount * 16); + SendCommand(&c); + return 0; +} +