mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
1. updated usb commands
2. added abilities to: clear, get, set, load from card, load from nested card emulator dump 3. tried to fix proxmark promt have seen everywhere (not so good) 4. reorganized arm code
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ APP_CFLAGS = -O2 -DWITH_LF -DWITH_ISO15693 -DWITH_ISO14443a -DWITH_ISO14443b
|
||||
#SRC_LCD = fonts.c LCD.c
|
||||
SRC_LF = lfops.c hitag2.c
|
||||
SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c
|
||||
SRC_ISO14443b = iso14443.c
|
||||
SRC_CRAPTO1 = crapto1.c crypto1.c
|
||||
|
||||
|
||||
@@ -713,6 +713,23 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||
case CMD_SIMULATE_MIFARE_CARD:
|
||||
Mifare1ksim(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
|
||||
// emulator
|
||||
case CMD_MIFARE_SET_DBGMODE:
|
||||
MifareSetDbgLvl(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
case CMD_MIFARE_EML_MEMCLR:
|
||||
MifareEMemClr(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
case CMD_MIFARE_EML_MEMSET:
|
||||
MifareEMemSet(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
case CMD_MIFARE_EML_MEMGET:
|
||||
MifareEMemGet(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
case CMD_MIFARE_EML_CARDLOAD:
|
||||
MifareECardLoad(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ void SnoopIso14443(void);
|
||||
void RAMFUNC SnoopIso14443a(void);
|
||||
void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag
|
||||
void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
|
||||
|
||||
// mifarecmd.h
|
||||
void ReaderMifare(uint32_t parameter);
|
||||
void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *data);
|
||||
void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
|
||||
@@ -114,6 +116,11 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
||||
void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
void MifareChkKeys(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
|
||||
void Mifare1ksim(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
|
||||
void MifareSetDbgLvl(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
void MifareEMemClr(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
void MifareEMemGet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
|
||||
|
||||
/// iso15693.h
|
||||
void RecordRawAdcSamplesIso15693(void);
|
||||
|
||||
+56
-594
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -27,7 +27,6 @@
|
||||
#define CARD_MEMORY 6000
|
||||
#define CARD_MEMORY_LEN 1024
|
||||
|
||||
|
||||
typedef struct nestedVector { uint32_t nt, ks1; } nestedVector;
|
||||
|
||||
extern byte_t oddparity (const byte_t bt);
|
||||
@@ -44,4 +43,8 @@ extern void iso14443a_setup();
|
||||
extern int iso14443a_select_card(uint8_t * uid_ptr, iso14a_card_select_t * resp_data, uint32_t * cuid_ptr);
|
||||
extern void iso14a_set_trigger(int enable);
|
||||
|
||||
extern void iso14a_clear_tracelen(void);
|
||||
extern void iso14a_set_tracing(int enable);
|
||||
extern int LogTrace(const uint8_t * btBytes, int iLen, int iSamples, uint32_t dwParity, int bReader);
|
||||
|
||||
#endif /* __ISO14443A_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Merlok - June 2011
|
||||
// Gerhard de Koning Gans - May 2008
|
||||
// Hagen Fritsch - June 2010
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Routines to support ISO 14443 type A.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __MIFARECMD_H
|
||||
#define __MIFARECMD_H
|
||||
|
||||
#include "proxmark3.h"
|
||||
#include "apps.h"
|
||||
#include "util.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "iso14443crc.h"
|
||||
#include "iso14443a.h"
|
||||
#include "crapto1.h"
|
||||
#include "mifareutil.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -339,6 +339,14 @@ void emlGetMemBt(uint8_t *data, int bytePtr, int byteCount) {
|
||||
memcpy(data, emCARD + bytePtr, byteCount);
|
||||
}
|
||||
|
||||
uint64_t emlGetKey(int sectorNum, int keyType) {
|
||||
uint8_t key[6];
|
||||
uint8_t* emCARD = eml_get_bigbufptr_cardmem();
|
||||
|
||||
memcpy(key, emCARD + 3 * 16 + sectorNum * 4 * 16 + keyType * 10, 6);
|
||||
return bytes_to_num(key, 6);
|
||||
}
|
||||
|
||||
void emlClearMem(void) {
|
||||
int i;
|
||||
|
||||
|
||||
@@ -82,5 +82,6 @@ void emlClearMem(void);
|
||||
void emlSetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
void emlGetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
void emlGetMemBt(uint8_t *data, int bytePtr, int byteCount);
|
||||
uint64_t emlGetKey(int sectorNum, int keyType);
|
||||
|
||||
#endif
|
||||
+160
-10
@@ -9,6 +9,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "cmdhfmf.h"
|
||||
#include "proxmark3.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
@@ -268,17 +269,20 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
uint8_t key[6] = {0, 0, 0, 0, 0, 0};
|
||||
uint8_t keyBlock[16 * 6];
|
||||
uint64_t key64 = 0;
|
||||
int transferToEml = 0;
|
||||
|
||||
char cmdp, ctmp;
|
||||
|
||||
if (strlen(Cmd)<3) {
|
||||
PrintAndLog("Usage:");
|
||||
PrintAndLog(" all sectors: hf mf nested <card memory> <block number> <key A/B> <key (12 hex symbols)>");
|
||||
PrintAndLog(" one sector: hf mf nested o <block number> <key A/B> <key (12 hex symbols)>");
|
||||
PrintAndLog(" all sectors: hf mf nested <card memory> <block number> <key A/B> <key (12 hex symbols)> [t]");
|
||||
PrintAndLog(" one sector: hf mf nested o <block number> <key A/B> <key (12 hex symbols)> [t]");
|
||||
PrintAndLog(" <target block number> <target key A/B>");
|
||||
PrintAndLog("card memory - 0 - MINI(320 bytes), 1 - 1K, 2 - 2K, 4 - 4K, <other> - 1K");
|
||||
PrintAndLog("t - transfer keys into emulator memory");
|
||||
PrintAndLog(" ");
|
||||
PrintAndLog(" sample1: hf mf nested 1 0 A FFFFFFFFFFFF ");
|
||||
PrintAndLog(" sample1: hf mf nested 1 0 A FFFFFFFFFFFF t ");
|
||||
PrintAndLog(" sample2: hf mf nested o 0 A FFFFFFFFFFFF 4 A");
|
||||
return 0;
|
||||
}
|
||||
@@ -296,7 +300,7 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cmdp =='o' || cmdp == 'O') {
|
||||
if (cmdp == 'o' || cmdp == 'O') {
|
||||
cmdp = 'o';
|
||||
trgBlockNo = param_get8(Cmd, 4);
|
||||
ctmp = param_getchar(Cmd, 5);
|
||||
@@ -314,8 +318,13 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
default: SectorsCnt = 16;
|
||||
}
|
||||
}
|
||||
|
||||
ctmp = param_getchar(Cmd, 4);
|
||||
if (ctmp == 't' || ctmp == 'T') transferToEml = 1;
|
||||
ctmp = param_getchar(Cmd, 6);
|
||||
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
||||
|
||||
PrintAndLog("--block no:%02x key type:%02x key:%s ", blockNo, keyType, sprint_hex(key, 6));
|
||||
PrintAndLog("--block no:%02x key type:%02x key:%s etrans:%d", blockNo, keyType, sprint_hex(key, 6), transferToEml);
|
||||
if (cmdp == 'o')
|
||||
PrintAndLog("--target block no:%02x target key type:%02x ", trgBlockNo, trgKeyType);
|
||||
|
||||
@@ -333,10 +342,22 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
res = mfCheckKeys(trgBlockNo, trgKeyType, 8, keyBlock, &key64);
|
||||
if (res)
|
||||
res = mfCheckKeys(trgBlockNo, trgKeyType, 8, &keyBlock[6 * 8], &key64);
|
||||
if (!res)
|
||||
if (!res) {
|
||||
PrintAndLog("Found valid key:%012llx", key64);
|
||||
else
|
||||
|
||||
// transfer key to the emulator
|
||||
if (transferToEml) {
|
||||
mfEmlGetMem(keyBlock, (trgBlockNo / 4) * 4 + 3, 1);
|
||||
|
||||
if (!trgKeyType)
|
||||
num_to_bytes(key64, 6, keyBlock);
|
||||
else
|
||||
num_to_bytes(key64, 6, &keyBlock[10]);
|
||||
mfEmlSetMem(keyBlock, (trgBlockNo / 4) * 4 + 3, 1);
|
||||
}
|
||||
} else {
|
||||
PrintAndLog("No valid key found");
|
||||
}
|
||||
} else // ------------------------------------ multiple sectors working
|
||||
{
|
||||
blDiff = blockNo % 4;
|
||||
@@ -401,6 +422,18 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||
}
|
||||
PrintAndLog("|---|----------------|---|----------------|---|");
|
||||
|
||||
// transfer them to the emulator
|
||||
if (transferToEml) {
|
||||
for (i = 0; i < SectorsCnt; i++) {
|
||||
mfEmlGetMem(keyBlock, i * 4 + 3, 1);
|
||||
if (e_sector[i].foundKey[0])
|
||||
num_to_bytes(e_sector[i].Key[1], 6, keyBlock);
|
||||
if (e_sector[i].foundKey[1])
|
||||
num_to_bytes(e_sector[i].Key[1], 6, &keyBlock[10]);
|
||||
mfEmlSetMem(keyBlock, i * 4 + 3, 1);
|
||||
}
|
||||
}
|
||||
|
||||
free(e_sector);
|
||||
}
|
||||
|
||||
@@ -488,7 +521,12 @@ int CmdHF14AMf1kSim(const char *Cmd)
|
||||
|
||||
int CmdHF14AMfDbg(const char *Cmd)
|
||||
{
|
||||
if (strlen(Cmd) < 1) {
|
||||
int dbgMode = param_get32ex(Cmd, 0, 0, 10);
|
||||
if (dbgMode > 4) {
|
||||
PrintAndLog("Max debud mode parameter is 4 \n");
|
||||
}
|
||||
|
||||
if (strlen(Cmd) < 1 || !param_getchar(Cmd, 0) || dbgMode > 4) {
|
||||
PrintAndLog("Usage: hf mf dbg <debug level>");
|
||||
PrintAndLog(" 0 - no debug messages");
|
||||
PrintAndLog(" 1 - error messages");
|
||||
@@ -497,19 +535,83 @@ int CmdHF14AMfDbg(const char *Cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PrintAndLog("No code here (");
|
||||
UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}};
|
||||
SendCommand(&c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AMfEGet(const char *Cmd)
|
||||
{
|
||||
PrintAndLog("No code here (");
|
||||
uint8_t blockNo = 0;
|
||||
uint8_t data[3 * 16];
|
||||
int i;
|
||||
|
||||
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
|
||||
PrintAndLog("Usage: hf mf eget <block number>");
|
||||
PrintAndLog(" sample: hf mf eget 0 ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
blockNo = param_get8(Cmd, 0);
|
||||
if (blockNo >= 16 * 4) {
|
||||
PrintAndLog("Block number must be in [0..63] as in MIFARE classic.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog(" ");
|
||||
if (!mfEmlGetMem(data, blockNo, 3)) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
PrintAndLog("data[%d]:%s", blockNo + i, sprint_hex(data + i * 16, 16));
|
||||
}
|
||||
} else {
|
||||
PrintAndLog("Command execute timeout");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AMfEClear(const char *Cmd)
|
||||
{
|
||||
if (param_getchar(Cmd, 0) == 'h') {
|
||||
PrintAndLog("Usage: hf mf eclr");
|
||||
PrintAndLog("It set card emulator memory to empty data blocks and key A/B FFFFFFFFFFFF \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMCLR, {0, 0, 0}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AMfESet(const char *Cmd)
|
||||
{
|
||||
PrintAndLog("No code here (");
|
||||
uint8_t memBlock[16];
|
||||
uint8_t blockNo = 0;
|
||||
|
||||
memset(memBlock, 0x00, sizeof(memBlock));
|
||||
|
||||
if (strlen(Cmd) < 3 || param_getchar(Cmd, 0) == 'h') {
|
||||
PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>");
|
||||
PrintAndLog(" sample: hf mf eset 1 000102030405060708090a0b0c0d0e0f ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
blockNo = param_get8(Cmd, 0);
|
||||
if (blockNo >= 16 * 4) {
|
||||
PrintAndLog("Block number must be in [0..63] as in MIFARE classic.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (param_gethex(Cmd, 1, memBlock, 32)) {
|
||||
PrintAndLog("block data must include 32 HEX symbols");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 1 - blocks count
|
||||
UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNo, 1, 0}};
|
||||
memcpy(c.d.asBytes, memBlock, 16);
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -525,6 +627,51 @@ int CmdHF14AMfESave(const char *Cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AMfECFill(const char *Cmd) {
|
||||
uint8_t keyType = 0;
|
||||
|
||||
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {
|
||||
PrintAndLog("Usage: hf mf efill <key A/B>");
|
||||
PrintAndLog("sample: hf mf efill A");
|
||||
PrintAndLog("Card data blocks transfers to card emulator memory.");
|
||||
PrintAndLog("Keys must be laid in the simulator memory. \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
char ctmp = param_getchar(Cmd, 0);
|
||||
if (ctmp == 0x00) {
|
||||
PrintAndLog("Key type must be A or B");
|
||||
return 1;
|
||||
}
|
||||
if (ctmp != 'A' && ctmp != 'a') keyType = 1;
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_EML_CARDLOAD, {0, keyType, 0}};
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14AMfEKeyPrn(const char *Cmd) {
|
||||
int i;
|
||||
uint8_t data[16];
|
||||
uint64_t keyA, keyB;
|
||||
|
||||
PrintAndLog("|---|----------------|----------------|");
|
||||
PrintAndLog("|sec|key A |key B |");
|
||||
PrintAndLog("|---|----------------|----------------|");
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (mfEmlGetMem(data, i * 4 + 3, 1)) {
|
||||
PrintAndLog("error get block %d", i * 4 + 3);
|
||||
break;
|
||||
}
|
||||
keyA = bytes_to_num(data, 6);
|
||||
keyB = bytes_to_num(data + 10, 6);
|
||||
PrintAndLog("|%03d| %012llx | %012llx |", i, keyA, keyB);
|
||||
}
|
||||
PrintAndLog("|---|----------------|----------------|");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
@@ -536,10 +683,13 @@ static command_t CommandTable[] =
|
||||
{"mifare", CmdHF14AMifare, 0, "Read parity error messages. param - <used card nonce>"},
|
||||
{"nested", CmdHF14AMfNested, 0, "Test nested authentication"},
|
||||
{"sim", CmdHF14AMf1kSim, 0, "Simulate MIFARE 1k card"},
|
||||
{"eclr", CmdHF14AMfEClear, 0, "Clear simulator memory block"},
|
||||
{"eget", CmdHF14AMfEGet, 0, "Set simulator memory block"},
|
||||
{"eset", CmdHF14AMfESet, 0, "Get simulator memory block"},
|
||||
{"eload", CmdHF14AMfELoad, 0, "Load from file emul dump"},
|
||||
{"esave", CmdHF14AMfESave, 0, "Save to file emul dump"},
|
||||
{"ecfill", CmdHF14AMfECFill, 0, "Fill simulator memory with help of keys from simulator"},
|
||||
{"ekeyprn", CmdHF14AMfEKeyPrn, 0, "Print keys from simulator memory"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "proxmark3.h"
|
||||
#include "iso14443crc.h"
|
||||
#include "data.h"
|
||||
#include "proxusb.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,4 +42,6 @@ typedef struct {
|
||||
|
||||
int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * ResultKeys);
|
||||
int mfCheckKeys (uint8_t blockNo, uint8_t keyType, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key);
|
||||
int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);
|
||||
|
||||
|
||||
+28
-16
@@ -13,6 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#include "proxusb.h"
|
||||
@@ -40,7 +41,11 @@ static void *usb_receiver(void *targ)
|
||||
for (int i = 0; i < strlen(PROXPROMPT); i++)
|
||||
putchar(0x08);
|
||||
UsbCommandReceived(&cmdbuf);
|
||||
printf(PROXPROMPT);
|
||||
// there is a big bug )
|
||||
if (cmdbuf.cmd > 0x0100 && cmdbuf.cmd < 0x0110) { // debug commands
|
||||
rl_on_new_line_with_prompt();
|
||||
rl_forced_update_display();
|
||||
}
|
||||
fflush(NULL);
|
||||
}
|
||||
}
|
||||
@@ -61,21 +66,28 @@ static void *main_loop(void *targ)
|
||||
pthread_create(&reader_thread, NULL, &usb_receiver, &rarg);
|
||||
}
|
||||
|
||||
while(1) {
|
||||
cmd = readline(PROXPROMPT);
|
||||
if (cmd) {
|
||||
while(cmd[strlen(cmd) - 1] == ' ')
|
||||
cmd[strlen(cmd) - 1] = 0x00;
|
||||
if (cmd[0] != 0x00) {
|
||||
CommandReceived(cmd);
|
||||
add_history(cmd);
|
||||
}
|
||||
free(cmd);
|
||||
} else {
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
read_history(".history");
|
||||
while(1) {
|
||||
cmd = readline(PROXPROMPT);
|
||||
if (cmd) {
|
||||
while(cmd[strlen(cmd) - 1] == ' ')
|
||||
cmd[strlen(cmd) - 1] = 0x00;
|
||||
|
||||
if (cmd[0] != 0x00) {
|
||||
if (strncmp(cmd, "quit", 4) == 0) {
|
||||
write_history(".history");
|
||||
break;
|
||||
}
|
||||
|
||||
CommandReceived(cmd);
|
||||
add_history(cmd);
|
||||
}
|
||||
free(cmd);
|
||||
} else {
|
||||
printf("\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg->usb_present == 1) {
|
||||
rarg.run = 0;
|
||||
|
||||
+11
-9
@@ -103,18 +103,20 @@ typedef struct {
|
||||
|
||||
// For mifare commands
|
||||
#define CMD_MIFARE_SET_DBGMODE 0x0600
|
||||
#define CMD_MIFARE_EML_MEMSET 0x0601
|
||||
#define CMD_MIFARE_EML_MEMGET 0x0602
|
||||
#define CMD_MIFARE_EML_MEMCLR 0x0601
|
||||
#define CMD_MIFARE_EML_MEMSET 0x0602
|
||||
#define CMD_MIFARE_EML_MEMGET 0x0603
|
||||
#define CMD_MIFARE_EML_CARDLOAD 0x0604
|
||||
|
||||
#define CMD_SIMULATE_MIFARE_CARD 0x0603
|
||||
#define CMD_SIMULATE_MIFARE_CARD 0x0610
|
||||
|
||||
#define CMD_READER_MIFARE 0x0605
|
||||
#define CMD_MIFARE_NESTED 0x0606
|
||||
#define CMD_READER_MIFARE 0x0611
|
||||
#define CMD_MIFARE_NESTED 0x0612
|
||||
|
||||
#define CMD_MIFARE_READBL 0x0610
|
||||
#define CMD_MIFARE_READSC 0x0611
|
||||
#define CMD_MIFARE_WRITEBL 0x0612
|
||||
#define CMD_MIFARE_CHKKEYS 0x0613
|
||||
#define CMD_MIFARE_READBL 0x0620
|
||||
#define CMD_MIFARE_READSC 0x0621
|
||||
#define CMD_MIFARE_WRITEBL 0x0622
|
||||
#define CMD_MIFARE_CHKKEYS 0x0623
|
||||
|
||||
#define CMD_UNKNOWN 0xFFFF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user