ADD: the option to simulate tnp3xxx inthe command "hf mf sim"
ADD: found some new default keys ADD: changed alot of memorys buffers to use constant values. like usbbuffer sizes, tracelogs, etc etc ADD: all changes Peter filmoore has in his pull request.
This commit is contained in:
@@ -44,7 +44,7 @@ int CmdHF14AList(const char *Cmd)
|
||||
ShowWaitCycles = true;
|
||||
}
|
||||
|
||||
uint8_t got[1920];
|
||||
uint8_t got[TRACE_BUFFER_SIZE];
|
||||
GetFromBigBuf(got,sizeof(got),0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
|
||||
@@ -62,7 +62,7 @@ int CmdHF14AList(const char *Cmd)
|
||||
uint32_t EndOfTransmissionTimestamp = 0;
|
||||
|
||||
for (;;) {
|
||||
if(i >= 1900) {
|
||||
if(i >= TRACE_BUFFER_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int CmdHF14AList(const char *Cmd)
|
||||
if (len > 100) {
|
||||
break;
|
||||
}
|
||||
if (i + len >= 1900) {
|
||||
if (i + len >= TRACE_BUFFER_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -400,6 +400,7 @@ int CmdHF14ASim(const char *Cmd)
|
||||
PrintAndLog(" 2 = MIFARE Ultralight");
|
||||
PrintAndLog(" 3 = MIFARE DESFIRE");
|
||||
PrintAndLog(" 4 = ISO/IEC 14443-4");
|
||||
PrintAndLog(" 5 = MIFARE TNP3XXX");
|
||||
PrintAndLog("");
|
||||
return 1;
|
||||
}
|
||||
@@ -628,7 +629,7 @@ static void waitCmd(uint8_t iSelect)
|
||||
UsbCommand resp;
|
||||
char *hexout;
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp,1000)) {
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp,10000)) {
|
||||
recv = resp.d.asBytes;
|
||||
uint8_t iLen = iSelect ? resp.arg[1] : resp.arg[0];
|
||||
PrintAndLog("received %i octets",iLen);
|
||||
|
||||
@@ -144,7 +144,7 @@ demodError:
|
||||
|
||||
int CmdHF14BList(const char *Cmd)
|
||||
{
|
||||
uint8_t got[960];
|
||||
uint8_t got[TRACE_BUFFER_SIZE];
|
||||
GetFromBigBuf(got,sizeof(got),0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
|
||||
@@ -156,9 +156,8 @@ int CmdHF14BList(const char *Cmd)
|
||||
int prev = -1;
|
||||
|
||||
for(;;) {
|
||||
if(i >= 900) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(i >= TRACE_BUFFER_SIZE) { break; }
|
||||
|
||||
bool isResponse;
|
||||
int timestamp = *((uint32_t *)(got+i));
|
||||
@@ -175,7 +174,7 @@ int CmdHF14BList(const char *Cmd)
|
||||
if(len > 100) {
|
||||
break;
|
||||
}
|
||||
if(i + len >= 900) {
|
||||
if(i + len >= TRACE_BUFFER_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -357,7 +356,7 @@ int CmdHF14BCmdRaw (const char *cmd) {
|
||||
SendCommand(&c);
|
||||
|
||||
if (reply) {
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp,1000)) {
|
||||
if (WaitForResponseTimeout(CMD_ACK,&resp,10000)) {
|
||||
recv = resp.d.asBytes;
|
||||
PrintAndLog("received %i octets",resp.arg[0]);
|
||||
if(!resp.arg[0])
|
||||
|
||||
@@ -45,7 +45,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
|
||||
WaitForResponse(CMD_ACK,&resp);
|
||||
WaitForResponse(CMD_ACK,&resp);
|
||||
|
||||
// check if command failed
|
||||
if (resp.arg[0] != 0) {
|
||||
@@ -68,6 +68,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// UI-related stuff
|
||||
// UI-related stuff
|
||||
|
||||
static const command_t CommandTable[] =
|
||||
|
||||
@@ -55,7 +55,7 @@ int CmdHFiClassList(const char *Cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t got[1920];
|
||||
uint8_t got[TRACE_BUFFER_SIZE];
|
||||
GetFromBigBuf(got,sizeof(got),0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
|
||||
@@ -77,7 +77,7 @@ int CmdHFiClassList(const char *Cmd)
|
||||
uint32_t EndOfTransmissionTimestamp = 0;
|
||||
|
||||
|
||||
for( i=0; i < 1900;)
|
||||
for( i=0; i < TRACE_BUFFER_SIZE;)
|
||||
{
|
||||
//First 32 bits contain
|
||||
// isResponse (1 bit)
|
||||
|
||||
@@ -2003,7 +2003,7 @@ int CmdHF14AMfCSave(const char *Cmd) {
|
||||
|
||||
|
||||
int CmdHF14AMfSniff(const char *Cmd){
|
||||
// params
|
||||
|
||||
bool wantLogToFile = 0;
|
||||
bool wantDecrypt = 0;
|
||||
//bool wantSaveToEml = 0; TODO
|
||||
@@ -2031,8 +2031,8 @@ int CmdHF14AMfSniff(const char *Cmd){
|
||||
PrintAndLog(" l - save encrypted sequence to logfile `uid.log`");
|
||||
PrintAndLog(" d - decrypt sequence and put it to log file `uid.log`");
|
||||
PrintAndLog(" n/a e - decrypt sequence, collect read and write commands and save the result of the sequence to emulator memory");
|
||||
PrintAndLog(" r - decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`");
|
||||
PrintAndLog("Usage: hf mf sniff [l][d][e][r]");
|
||||
PrintAndLog(" f - decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`");
|
||||
PrintAndLog("Usage: hf mf sniff [l][d][e][f]");
|
||||
PrintAndLog(" sample: hf mf sniff l d e");
|
||||
return 0;
|
||||
}
|
||||
@@ -2220,9 +2220,6 @@ int GetCardSize()
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
uint8_t CMDPOS = 0;
|
||||
uint8_t LENPOS = 1;
|
||||
|
||||
uint8_t key_zero_data[16] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
|
||||
uint8_t key_zero_data[16] = { 0x00 };
|
||||
uint8_t key_ones_data[16] = { 0x01 };
|
||||
uint8_t key_defa_data[16] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f };
|
||||
uint8_t key_ones_data[16] = { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 };
|
||||
uint8_t key_picc_data[16] = { 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f };
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
@@ -537,11 +537,6 @@ int CmdHF14ADesEnumApplications(const char *Cmd){
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CmdHF14ADesNonces(const char *Cmd){
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// MIAFRE DesFire Authentication
|
||||
//
|
||||
#define BUFSIZE 256
|
||||
@@ -670,7 +665,6 @@ static command_t CommandTable[] =
|
||||
{"wb", CmdHF14ADesWb, 0, "write MIFARE DesFire block"},
|
||||
{"info", CmdHF14ADesInfo, 0, "Get MIFARE DesFire information"},
|
||||
{"enum", CmdHF14ADesEnumApplications,0, "Tries enumerate all applications"},
|
||||
{"nonce", CmdHF14ADesNonces, 0, "<n> Collect n>0 nonces"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ int CmdHF14ADesRb(const char* cmd);
|
||||
int CmdHF14ADesWb(const char* cmd);
|
||||
int CmdHF14ADesInfo(const char *Cmd);
|
||||
int CmdHF14ADesEnumApplications(const char *Cmd);
|
||||
int CmdHF14ADesNonces(const char *Cmd);
|
||||
|
||||
char * GetCardSizeStr( uint8_t fsize );
|
||||
char * GetVendorStr( uint8_t id);
|
||||
char * GetProtocolStr(uint8_t id);
|
||||
|
||||
@@ -29,7 +29,7 @@ size_t nbytes(size_t nbits) {
|
||||
|
||||
int CmdLFHitagList(const char *Cmd)
|
||||
{
|
||||
uint8_t got[3000];
|
||||
uint8_t got[TRACE_BUFFER_SIZE];
|
||||
GetFromBigBuf(got,sizeof(got),0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
|
||||
@@ -44,9 +44,8 @@ int CmdLFHitagList(const char *Cmd)
|
||||
FILE* pf = NULL;
|
||||
|
||||
for (;;) {
|
||||
if(i >= 1900) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(i >= TRACE_BUFFER_SIZE) { break; }
|
||||
|
||||
bool isResponse;
|
||||
int timestamp = *((uint32_t *)(got+i));
|
||||
@@ -71,9 +70,7 @@ int CmdLFHitagList(const char *Cmd)
|
||||
if (len > 100) {
|
||||
break;
|
||||
}
|
||||
if (i + len >= 1900) {
|
||||
break;
|
||||
}
|
||||
if (i + len >= TRACE_BUFFER_SIZE) { break;}
|
||||
|
||||
uint8_t *frame = (got+i+9);
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//trace buffer size as defined in armsrc/apps.h TRACE_SIZE
|
||||
#define TRACE_BUFFER_SIZE 4096
|
||||
#define FILE_PATH_SIZE 1000
|
||||
#define SAMPLE_BUFFER_SIZE 64
|
||||
|
||||
|
||||
@@ -147,6 +147,18 @@ local _keys = {
|
||||
--]]
|
||||
'4b0b20107ccb',
|
||||
|
||||
--[[
|
||||
Kiev metro cards
|
||||
--]]
|
||||
'8fe644038790',
|
||||
'f14ee7cae863',
|
||||
'632193be1c3c',
|
||||
'569369c5a0e5',
|
||||
'9de89e070277',
|
||||
'eff603e1efe9',
|
||||
'644672bd4afe',
|
||||
|
||||
'b5ff67cba951',
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
@@ -349,7 +349,7 @@ local function main(args)
|
||||
err = LoadEmulator(blocks)
|
||||
if err then return oops(err) end
|
||||
core.clearCommandBuffer()
|
||||
print('The simulation is now prepared. run \"hf mf sim\" ')
|
||||
print('The simulation is now prepared.\n --> run \"hf mf sim 5 '..uid..'\" <--')
|
||||
end
|
||||
end
|
||||
main(args)
|
||||
Reference in New Issue
Block a user