make style

This commit is contained in:
Philippe Teuwen 2021-07-08 09:53:50 +02:00
commit 3c31ee793d
15 changed files with 101 additions and 185 deletions

View file

@ -52,7 +52,7 @@ void ModInfo(void) {
* technologies. Be brave enough to share your knowledge & inspire others. Salvador Mendoza. * technologies. Be brave enough to share your knowledge & inspire others. Salvador Mendoza.
*/ */
// Default GET PROCESSING // Default GET PROCESSING
static uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00}; static uint8_t ppdol [255] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00};
// Generate GET PROCESSING // Generate GET PROCESSING
@ -133,14 +133,14 @@ void RunMod(void) {
//Specific for Visa cards: select ppse, select Visa AID, GET PROCESSING, SFI //Specific for Visa cards: select ppse, select Visa AID, GET PROCESSING, SFI
uint8_t ppse[20] = { uint8_t ppse[20] = {
0x00, 0xA4, 0x04, 0x00, 0x0e, 0x32, 0x50, 0x41, 0x00, 0xA4, 0x04, 0x00, 0x0e, 0x32, 0x50, 0x41,
0x59, 0x2e, 0x53, 0x59, 0x53, 0x2e, 0x44, 0x44, 0x59, 0x2e, 0x53, 0x59, 0x53, 0x2e, 0x44, 0x44,
0x46, 0x30, 0x31, 0x00 0x46, 0x30, 0x31, 0x00
}; };
uint8_t visa[13] = { uint8_t visa[13] = {
0x00, 0xA4, 0x04, 0x00, 0x07, 0xa0, 0x00, 0x00, 0x00, 0xA4, 0x04, 0x00, 0x07, 0xa0, 0x00, 0x00,
0x00, 0x03, 0x10, 0x10, 0x00 0x00, 0x03, 0x10, 0x10, 0x00
}; };
uint8_t processing [8] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00}; uint8_t processing [8] = {0x80, 0xA8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00};
uint8_t sfi[5] = {0x00, 0xb2, 0x01, 0x0c, 0x00}; uint8_t sfi[5] = {0x00, 0xb2, 0x01, 0x0c, 0x00};
@ -168,12 +168,12 @@ void RunMod(void) {
// Allocate 512 bytes for the dynamic modulation, created when the reader queries for it // Allocate 512 bytes for the dynamic modulation, created when the reader queries for it
// Such a response is less time critical, so we can prepare them on the fly // Such a response is less time critical, so we can prepare them on the fly
#define DYNAMIC_RESPONSE_BUFFER_SIZE 64 #define DYNAMIC_RESPONSE_BUFFER_SIZE 64
#define DYNAMIC_MODULATION_BUFFER_SIZE 512 #define DYNAMIC_MODULATION_BUFFER_SIZE 512
// UID 4 bytes(could be 7 bytes if needed it) // UID 4 bytes(could be 7 bytes if needed it)
uint8_t flags = FLAG_4B_UID_IN_DATA; uint8_t flags = FLAG_4B_UID_IN_DATA;
// in case there is a read command received we shouldn't break // in case there is a read command received we shouldn't break
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00}; uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
uint8_t visauid[7] = {0x01, 0x02, 0x03, 0x04}; uint8_t visauid[7] = {0x01, 0x02, 0x03, 0x04};
@ -231,10 +231,10 @@ void RunMod(void) {
int button_pressed = BUTTON_HELD(1000); int button_pressed = BUTTON_HELD(1000);
if (button_pressed == BUTTON_HOLD) if (button_pressed == BUTTON_HOLD)
break; break;
else if (button_pressed == BUTTON_SINGLE_CLICK) { else if (button_pressed == BUTTON_SINGLE_CLICK) {
// pressing one time change between reading & emulation // pressing one time change between reading & emulation
if (state == STATE_READ) { if (state == STATE_READ) {
if (chktoken == true && token[0] != 0x00) { if (chktoken == true && token[0] != 0x00) {
// only change to emulation if it saved a track 2 in memory // only change to emulation if it saved a track 2 in memory
@ -277,7 +277,7 @@ void RunMod(void) {
for (uint8_t u = 0; u < apdulen; u++) { for (uint8_t u = 0; u < apdulen; u++) {
if (i == 1) { if (i == 1) {
// check for PDOL // check for PDOL
if (apdubuffer[u] == 0x9F && apdubuffer[u + 1] == 0x38) { if (apdubuffer[u] == 0x9F && apdubuffer[u + 1] == 0x38) {
for (uint8_t e = 0; e <= apdubuffer[u + 2]; e++) for (uint8_t e = 0; e <= apdubuffer[u + 2]; e++)
pdol[e] = apdubuffer[u + e + 2]; pdol[e] = apdubuffer[u + e + 2];
@ -346,8 +346,8 @@ void RunMod(void) {
iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN); iso14443a_setup(FPGA_HF_ISO14443A_TAGSIM_LISTEN);
// command length // command length
int len = 0; int len = 0;
// to check emulation status // to check emulation status
int retval = PM3_SUCCESS; int retval = PM3_SUCCESS;
bool odd_reply = true; bool odd_reply = true;
@ -375,28 +375,28 @@ void RunMod(void) {
p_response = &responses[RESP_INDEX_ATQA]; p_response = &responses[RESP_INDEX_ATQA];
} }
// received a HALT // received a HALT
} else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) { } else if (receivedCmd[0] == ISO14443A_CMD_HALT && len == 4) {
DbpString(_YELLOW_("+") "Received a HALT"); DbpString(_YELLOW_("+") "Received a HALT");
p_response = NULL; p_response = NULL;
// received a WAKEUP // received a WAKEUP
} else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) { } else if (receivedCmd[0] == ISO14443A_CMD_WUPA && len == 1) {
DbpString(_YELLOW_("+") "WAKEUP Received"); DbpString(_YELLOW_("+") "WAKEUP Received");
prevCmd = 0; prevCmd = 0;
p_response = &responses[RESP_INDEX_ATQA]; p_response = &responses[RESP_INDEX_ATQA];
// received request for UID (cascade 1) // received request for UID (cascade 1)
} else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) { } else if (receivedCmd[1] == 0x20 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 2) {
DbpString(_YELLOW_("+") "Request for UID C1"); DbpString(_YELLOW_("+") "Request for UID C1");
p_response = &responses[RESP_INDEX_UIDC1]; p_response = &responses[RESP_INDEX_UIDC1];
// received a SELECT (cascade 1) // received a SELECT (cascade 1)
} else if (receivedCmd[1] == 0x70 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 9) { } else if (receivedCmd[1] == 0x70 && receivedCmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && len == 9) {
DbpString(_YELLOW_("+") "Request for SELECT S1"); DbpString(_YELLOW_("+") "Request for SELECT S1");
p_response = &responses[RESP_INDEX_SAKC1]; p_response = &responses[RESP_INDEX_SAKC1];
// received a RATS request // received a RATS request
} else if (receivedCmd[0] == ISO14443A_CMD_RATS && len == 4) { } else if (receivedCmd[0] == ISO14443A_CMD_RATS && len == 4) {
DbpString(_YELLOW_("+") "Request for RATS"); DbpString(_YELLOW_("+") "Request for RATS");
prevCmd = 0; prevCmd = 0;
@ -412,39 +412,39 @@ void RunMod(void) {
// depending on card reader commands, the Proxmark will answer to fool the reader // depending on card reader commands, the Proxmark will answer to fool the reader
// respond with PPSE // respond with PPSE
if (receivedCmd[2] == 0xA4 && receivedCmd[6] == 0x32 && prevCmd == 0) { if (receivedCmd[2] == 0xA4 && receivedCmd[6] == 0x32 && prevCmd == 0) {
uint8_t ppsea[39] = { uint8_t ppsea[39] = {
0x6F, 0x23, 0x84, 0x0E, 0x32, 0x50, 0x41, 0x59, 0x6F, 0x23, 0x84, 0x0E, 0x32, 0x50, 0x41, 0x59,
0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46,
0x30, 0x31, 0xA5, 0x11, 0xBF, 0x0C, 0x0E, 0x61, 0x30, 0x31, 0xA5, 0x11, 0xBF, 0x0C, 0x0E, 0x61,
0x0C, 0x4F, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x4F, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x03,
0x10, 0x10, 0x87, 0x01, 0x01, 0x90, 0x00 0x10, 0x10, 0x87, 0x01, 0x01, 0x90, 0x00
}; };
memcpy(&dynamic_response_info.response[1], ppsea, sizeof(ppsea)); memcpy(&dynamic_response_info.response[1], ppsea, sizeof(ppsea));
dynamic_response_info.response_n = sizeof(ppsea) + 1; dynamic_response_info.response_n = sizeof(ppsea) + 1;
prevCmd++; prevCmd++;
// respond Visa AID // respond Visa AID
} else if (receivedCmd[2] == 0xA4 && receivedCmd[10] == 0x03 && receivedCmd[11] == 0x10 && prevCmd == 1) { } else if (receivedCmd[2] == 0xA4 && receivedCmd[10] == 0x03 && receivedCmd[11] == 0x10 && prevCmd == 1) {
uint8_t visauid_long[34] = { uint8_t visauid_long[34] = {
0x6F, 0x1E, 0x84, 0x07, 0xA0, 0x00, 0x00, 0x00, 0x6F, 0x1E, 0x84, 0x07, 0xA0, 0x00, 0x00, 0x00,
0x03, 0x10, 0x10, 0xA5, 0x13, 0x50, 0x0B, 0x56, 0x03, 0x10, 0x10, 0xA5, 0x13, 0x50, 0x0B, 0x56,
0x49, 0x53, 0x41, 0x20, 0x43, 0x52, 0x45, 0x44, 0x49, 0x53, 0x41, 0x20, 0x43, 0x52, 0x45, 0x44,
0x49, 0x54, 0x9F, 0x38, 0x03, 0x9F, 0x66, 0x02, 0x49, 0x54, 0x9F, 0x38, 0x03, 0x9F, 0x66, 0x02,
0x90, 0x00 0x90, 0x00
}; };
memcpy(&dynamic_response_info.response[1], visauid_long, sizeof(visauid_long)); memcpy(&dynamic_response_info.response[1], visauid_long, sizeof(visauid_long));
dynamic_response_info.response_n = sizeof(visauid_long) + 1; dynamic_response_info.response_n = sizeof(visauid_long) + 1;
prevCmd++; prevCmd++;
// GET PROCESSING // GET PROCESSING
} else if (receivedCmd[1] == 0x80 && receivedCmd[2] == 0xA8 && receivedCmd[6] == 0x83 && prevCmd == 2) { } else if (receivedCmd[1] == 0x80 && receivedCmd[2] == 0xA8 && receivedCmd[6] == 0x83 && prevCmd == 2) {
uint8_t processing_long[10] = {0x80, 0x06, 0x00, 0x80, 0x08, 0x01, 0x01, 0x00, 0x90, 0x00}; uint8_t processing_long[10] = {0x80, 0x06, 0x00, 0x80, 0x08, 0x01, 0x01, 0x00, 0x90, 0x00};
memcpy(&dynamic_response_info.response[1], processing_long, sizeof(processing_long)); memcpy(&dynamic_response_info.response[1], processing_long, sizeof(processing_long));
dynamic_response_info.response_n = sizeof(processing_long) + 1; dynamic_response_info.response_n = sizeof(processing_long) + 1;
prevCmd++; prevCmd++;
// SFI // SFI
} else if (receivedCmd[1] == 0x00 && receivedCmd[2] == 0xB2 && prevCmd == 3) { } else if (receivedCmd[1] == 0x00 && receivedCmd[2] == 0xB2 && prevCmd == 3) {
uint8_t last[4] = {0x70, 0x15, 0x57, 0x13}; uint8_t last[4] = {0x70, 0x15, 0x57, 0x13};
uint8_t statusapdu[2] = {0x90, 0x00}; uint8_t statusapdu[2] = {0x90, 0x00};
@ -504,4 +504,4 @@ void RunMod(void) {
} }
DbpString(_YELLOW_("[=]") "exiting"); DbpString(_YELLOW_("[=]") "exiting");
LEDsoff(); LEDsoff();
} }

View file

@ -33,12 +33,12 @@ void ModInfo(void) {
* *
* Instructions: * Instructions:
* *
* I recommend setting up & run the other end before start sending or receving data in this Proxmark3 * I recommend setting up & run the other end before start sending or receving data in this Proxmark3
* standalone. * standalone.
* *
* For the reading mode: * For the reading mode:
* - Set up and run the other end first, to where the Proxmark will send the data. * - Set up and run the other end first, to where the Proxmark will send the data.
* - After the card is detected, Proxmark3 will send a package. The first byte will be the package * - After the card is detected, Proxmark3 will send a package. The first byte will be the package
* length, then, the card data. Use the first length byte to read the whole package. * length, then, the card data. Use the first length byte to read the whole package.
* - Proxmark3 will expect a raw APDU from the other end, then it will be sent to the card. * - Proxmark3 will expect a raw APDU from the other end, then it will be sent to the card.
* - The answer of the card will be sent back to the connection, repeating the cycle. * - The answer of the card will be sent back to the connection, repeating the cycle.
@ -46,16 +46,16 @@ void ModInfo(void) {
* For the emulation mode: * For the emulation mode:
* - Set up and run the other end first, from where the Proxmark will receive the data. * - Set up and run the other end first, from where the Proxmark will receive the data.
* - When the Proxmark3 detected the terminal, it will send the command to the connection. * - When the Proxmark3 detected the terminal, it will send the command to the connection.
* - The first byte will be the package length, then, the terminal command. Use the first * - The first byte will be the package length, then, the terminal command. Use the first
* length byte to read the whole package. * length byte to read the whole package.
* - Proxmark3 will expect a raw APDU from the other end, then it will be sent to the terminal. * - Proxmark3 will expect a raw APDU from the other end, then it will be sent to the terminal.
* - The command of the terminal will be sent back to the connection, repeating the cycle. * - The command of the terminal will be sent back to the connection, repeating the cycle.
* *
* Notes: * Notes:
* - The emulation mode was tested in a real SumUp payment terminal. This does not mean * - The emulation mode was tested in a real SumUp payment terminal. This does not mean
* that it will work in all the terminals around the world. * that it will work in all the terminals around the world.
* - The emulation mode implements different techniques to try to keep the connection alive: * - The emulation mode implements different techniques to try to keep the connection alive:
* WTX or ACK for NACK requests. Some of these requests could be denied depending on * WTX or ACK for NACK requests. Some of these requests could be denied depending on
* the reader configuration. * the reader configuration.
* *
* *

View file

@ -342,7 +342,7 @@ int CLIGetOptionList(struct arg_str *argstr, const CLIParserOption *option_array
const char *CLIGetOptionListStr(const CLIParserOption *option_array, int value) { const char *CLIGetOptionListStr(const CLIParserOption *option_array, int value) {
static const char *errmsg = "n/a"; static const char *errmsg = "n/a";
for (int i = 0; i < CLI_MAX_OPTLIST_LEN && option_array[i].text != NULL; i++) { for (int i = 0; i < CLI_MAX_OPTLIST_LEN && option_array[i].text != NULL; i++) {
if (option_array[i].code == value) if (option_array[i].code == value)
return option_array[i].text; return option_array[i].text;

View file

@ -175,17 +175,17 @@ static void DesfireCryptoEncDecSingleBlock(uint8_t *key, DesfireCryptoAlgorythm
void DesfireCryptoEncDecEx(DesfireContext *ctx, bool use_session_key, uint8_t *srcdata, size_t srcdatalen, uint8_t *dstdata, bool encode, uint8_t *iv) { void DesfireCryptoEncDecEx(DesfireContext *ctx, bool use_session_key, uint8_t *srcdata, size_t srcdatalen, uint8_t *dstdata, bool encode, uint8_t *iv) {
uint8_t data[1024] = {0}; uint8_t data[1024] = {0};
uint8_t xiv[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0}; uint8_t xiv[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
if (ctx->secureChannel == DACd40) if (ctx->secureChannel == DACd40)
memset(ctx->IV, 0, DESFIRE_MAX_CRYPTO_BLOCK_SIZE); memset(ctx->IV, 0, DESFIRE_MAX_CRYPTO_BLOCK_SIZE);
size_t block_size = desfire_get_key_block_length(ctx->keyType); size_t block_size = desfire_get_key_block_length(ctx->keyType);
if (iv == NULL) if (iv == NULL)
memcpy(xiv, ctx->IV, block_size); memcpy(xiv, ctx->IV, block_size);
else else
memcpy(xiv, iv, block_size); memcpy(xiv, iv, block_size);
size_t offset = 0; size_t offset = 0;
while (offset < srcdatalen) { while (offset < srcdatalen) {
if (use_session_key) if (use_session_key)
@ -243,14 +243,14 @@ void DesfireCryptoCMAC(DesfireContext *ctx, uint8_t *data, size_t len, uint8_t *
int kbs = desfire_get_key_block_length(ctx->keyType); int kbs = desfire_get_key_block_length(ctx->keyType);
if (kbs == 0) if (kbs == 0)
return; return;
uint8_t buffer[padded_data_length(len, kbs)]; uint8_t buffer[padded_data_length(len, kbs)];
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
uint8_t sk1[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0}; uint8_t sk1[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
uint8_t sk2[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0}; uint8_t sk2[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
DesfireCMACGenerateSubkeys(ctx, sk1, sk2); DesfireCMACGenerateSubkeys(ctx, sk1, sk2);
memcpy(buffer, data, len); memcpy(buffer, data, len);
if ((!len) || (len % kbs)) { if ((!len) || (len % kbs)) {

View file

@ -17,7 +17,7 @@
* *
* $Id$ * $Id$
*/ */
#ifndef __DESFIRECRYPTO_H #ifndef __DESFIRECRYPTO_H
#define __DESFIRECRYPTO_H #define __DESFIRECRYPTO_H

View file

@ -130,13 +130,13 @@ static void DesfireSecureChannelDecodeEV1(DesfireContext *ctx, uint8_t *srcdata,
case DCMMACed: case DCMMACed:
if (srcdatalen < DesfireGetMACLength(ctx)) if (srcdatalen < DesfireGetMACLength(ctx))
break; break;
memcpy(dstdata, srcdata, srcdatalen - DesfireGetMACLength(ctx)); memcpy(dstdata, srcdata, srcdatalen - DesfireGetMACLength(ctx));
*dstdatalen = srcdatalen - DesfireGetMACLength(ctx); *dstdatalen = srcdatalen - DesfireGetMACLength(ctx);
memcpy(data, srcdata, *dstdatalen); memcpy(data, srcdata, *dstdatalen);
data[*dstdatalen] = respcode; data[*dstdatalen] = respcode;
uint8_t cmac[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0}; uint8_t cmac[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
DesfireCryptoCMAC(ctx, data, *dstdatalen + 1, cmac); DesfireCryptoCMAC(ctx, data, *dstdatalen + 1, cmac);
if (memcmp(&srcdata[*dstdatalen], cmac, DesfireGetMACLength(ctx)) != 0) { if (memcmp(&srcdata[*dstdatalen], cmac, DesfireGetMACLength(ctx)) != 0) {

View file

@ -58,7 +58,7 @@ extern "C" void RepaintGraphWindow(void) {
} }
// hook up picture viewer // hook up picture viewer
extern "C" void ShowPictureWindow(char *fn) { extern "C" void ShowPictureWindow(char *fn) {
if (!gui) { if (!gui) {
// Show a notice if X11/XQuartz isn't available // Show a notice if X11/XQuartz isn't available

View file

@ -23,7 +23,7 @@ void ShowGraphWindow(void);
void HideGraphWindow(void); void HideGraphWindow(void);
void RepaintGraphWindow(void); void RepaintGraphWindow(void);
// hook up picture viewer // hook up picture viewer
void ShowPictureWindow(char *fn); void ShowPictureWindow(char *fn);
void HidePictureWindow(void); void HidePictureWindow(void);
void RepaintPictureWindow(void); void RepaintPictureWindow(void);

View file

@ -103,10 +103,10 @@ void ProxGuiQT::_HideGraphWindow(void) {
plotwidget->hide(); plotwidget->hide();
} }
// picture viewer // picture viewer
void ProxGuiQT::_ShowPictureWindow(char *fn) { void ProxGuiQT::_ShowPictureWindow(char *fn) {
if (!plotapp) if (!plotapp)
return; return;
if (fn == NULL) if (fn == NULL)
@ -116,7 +116,7 @@ void ProxGuiQT::_ShowPictureWindow(char *fn) {
if (slen == 0) if (slen == 0)
return; return;
char *myfn = (char*)calloc(slen + 1, sizeof(uint8_t)); char *myfn = (char *)calloc(slen + 1, sizeof(uint8_t));
if (myfn == NULL) if (myfn == NULL)
return; return;
@ -132,7 +132,7 @@ void ProxGuiQT::_ShowPictureWindow(char *fn) {
} }
QPixmap pm; QPixmap pm;
if(pm.load(myfn) == false){ if (pm.load(myfn) == false) {
qWarning("Failed to load %s", myfn); qWarning("Failed to load %s", myfn);
} }
free(myfn); free(myfn);
@ -146,9 +146,9 @@ void ProxGuiQT::_ShowPictureWindow(char *fn) {
pictureController->lbl_pm->setAlignment(Qt::AlignCenter); pictureController->lbl_pm->setAlignment(Qt::AlignCenter);
QString s = QString("w: %1 h: %2") QString s = QString("w: %1 h: %2")
.arg(pm.size().width()) .arg(pm.size().width())
.arg(pm.size().height() .arg(pm.size().height()
); );
pictureController->lbl_sz->setText(s); pictureController->lbl_sz->setText(s);
pictureWidget->show(); pictureWidget->show();
} }
@ -184,7 +184,7 @@ void ProxGuiQT::_StartProxmarkThread(void) {
void ProxGuiQT::MainLoop() { void ProxGuiQT::MainLoop() {
plotapp = new QApplication(argc, argv); plotapp = new QApplication(argc, argv);
// Setup the picture widget // Setup the picture widget
pictureWidget = new PictureWidget(); pictureWidget = new PictureWidget();
pictureController = new Ui::PictureForm(); pictureController = new Ui::PictureForm();
@ -205,7 +205,7 @@ void ProxGuiQT::MainLoop() {
connect(this, SIGNAL(ExitSignal()), this, SLOT(_Exit())); connect(this, SIGNAL(ExitSignal()), this, SLOT(_Exit()));
// hook up picture viewer signals // hook up picture viewer signals
connect(this, SIGNAL(ShowPictureWindowSignal(char*)), this, SLOT(_ShowPictureWindow(char*))); connect(this, SIGNAL(ShowPictureWindowSignal(char *)), this, SLOT(_ShowPictureWindow(char *)));
connect(this, SIGNAL(RepaintPictureWindowSignal()), this, SLOT(_RepaintPictureWindow())); connect(this, SIGNAL(RepaintPictureWindowSignal()), this, SLOT(_RepaintPictureWindow()));
connect(this, SIGNAL(HidePictureWindowSignal()), this, SLOT(_HidePictureWindow())); connect(this, SIGNAL(HidePictureWindowSignal()), this, SLOT(_HidePictureWindow()));
@ -220,7 +220,7 @@ void ProxGuiQT::MainLoop() {
plotapp->exec(); plotapp->exec();
} }
ProxGuiQT::ProxGuiQT(int argc, char **argv, WorkerThread *wthread) : ProxGuiQT::ProxGuiQT(int argc, char **argv, WorkerThread *wthread) :
plotapp(NULL), plotwidget(NULL), pictureController(NULL), pictureWidget(NULL), argc(argc), argv(argv), proxmarkThread(wthread) { plotapp(NULL), plotwidget(NULL), pictureController(NULL), pictureWidget(NULL), argc(argc), argv(argv), proxmarkThread(wthread) {
} }
@ -253,7 +253,7 @@ PictureWidget::PictureWidget() {
// if (session.preferences_loaded) // if (session.preferences_loaded)
// setGeometry(session.pw.x, session.pw.y, session.pw.w, session.pw.h); // setGeometry(session.pw.x, session.pw.y, session.pw.w, session.pw.h);
// else // else
resize(400, 400); resize(400, 400);
} }
void PictureWidget::closeEvent(QCloseEvent *event) { void PictureWidget::closeEvent(QCloseEvent *event) {

View file

@ -149,7 +149,7 @@ class ProxGuiQT : public QObject {
void RepaintGraphWindow(void); void RepaintGraphWindow(void);
void HideGraphWindow(void); void HideGraphWindow(void);
// hook up picture viewer // hook up picture viewer
void ShowPictureWindow(char *fn); void ShowPictureWindow(char *fn);
void HidePictureWindow(void); void HidePictureWindow(void);
void RepaintPictureWindow(void); void RepaintPictureWindow(void);
@ -162,7 +162,7 @@ class ProxGuiQT : public QObject {
void _RepaintGraphWindow(void); void _RepaintGraphWindow(void);
void _HideGraphWindow(void); void _HideGraphWindow(void);
// hook up picture viewer // hook up picture viewer
void _ShowPictureWindow(char *fn); void _ShowPictureWindow(char *fn);
void _HidePictureWindow(void); void _HidePictureWindow(void);
void _RepaintPictureWindow(void); void _RepaintPictureWindow(void);
@ -175,7 +175,7 @@ class ProxGuiQT : public QObject {
void RepaintGraphWindowSignal(void); void RepaintGraphWindowSignal(void);
void HideGraphWindowSignal(void); void HideGraphWindowSignal(void);
void ExitSignal(void); void ExitSignal(void);
// hook up picture viewer signals // hook up picture viewer signals
void ShowPictureWindowSignal(char *fn); void ShowPictureWindowSignal(char *fn);
void HidePictureWindowSignal(void); void HidePictureWindowSignal(void);

View file

@ -973,7 +973,7 @@
}, },
"help": { "help": {
"command": "help", "command": "help",
"description": "help use `<command> help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log e:\\proxspace\\pm3/.proxmark3/logs/log_20210706.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save", "description": "help use `<command> help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log /home/phil/.proxmark3/logs/log_20210708.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save",
"notes": [ "notes": [
"auto" "auto"
], ],
@ -1722,22 +1722,6 @@
], ],
"usage": "hf cipurse auth [-hav] [-n <dec>] [-k <hex>]" "usage": "hf cipurse auth [-hav] [-n <dec>] [-k <hex>]"
}, },
"hf cipurse default": {
"command": "hf cipurse default",
"description": "set default parameters for access to cipurse card",
"notes": [
"hf cipurse default -n 1 -k 65656565656565656565656565656565 --fid 2ff7 -> set key, key id and file id"
],
"offline": false,
"options": [
"-h, --help this help",
"--clear resets to defaults",
"-n <dec> key id",
"-k, --key <hex> authentication key",
"--fid <hex> file id"
],
"usage": "hf cipurse default [-h] [--clear] [-n <dec>] [-k <hex>] [--fid <hex>]"
},
"hf cipurse delete": { "hf cipurse delete": {
"command": "hf cipurse delete", "command": "hf cipurse delete",
"description": "read file by file id with key id and key. if no key is supplied, default key of 737373...7373 will be used", "description": "read file by file id with key id and key. if no key is supplied, default key of 737373...7373 will be used",
@ -3938,31 +3922,6 @@
], ],
"usage": "hf mf wrbl [-hab] --blk <dec> [-k <hex>] [-d <hex>]" "usage": "hf mf wrbl [-hab] --blk <dec> [-k <hex>] [-d <hex>]"
}, },
"hf mfdes auth": {
"command": "hf mfdes auth",
"description": "authenticates mifare desfire using key",
"notes": [
"hf mfdes auth -m 3 -t 4 -a 808301 -n 0 -k 00000000000000000000000000000000 -> aes,keynumber 0, aid 0x803201",
"hf mfdes auth -m 2 -t 2 -a 000000 -n 1 -k 00000000000000000000000000000000 -> 3des,keynumber 1, aid 0x000000",
"hf mfdes auth -m 1 -t 1 -a 000000 -n 2 -k 0000000000000000 -> des,keynumber 2, aid 0x000000",
"hf mfdes auth -m 1 -t 1 -a 000000 -n 0 -> des, defaultkey, aid 0x000000",
"hf mfdes auth -m 2 -t 2 -a 000000 -n 0 -> 3des, defaultkey, aid 0x000000",
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> 3k3des, defaultkey, aid 0x000000",
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> aes, defaultkey, aid 0x000000"
],
"offline": false,
"options": [
"-h, --help this help",
"-m, --type <type> auth type (1=normal, 2=iso, 3=aes)",
"-t, --algo <algo> crypt algo (1=des, 2=3des(2k2des), 3=3k3des, 4=aes)",
"-a, --aid <aid> aid used for authentification (hex 3 bytes)",
"-n, --keyno <keyno> key number used for authentification",
"-k, --key <key> key for checking (hex 8-24 bytes)",
"-d, --kdf <kdf> key derivation function (kdf) (0=none, 1=an10922, 2=gallagher)",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)"
],
"usage": "hf mfdes auth [-h] [-m <type>] [-t <algo>] [-a <aid>]... [-n <keyno>] [-k <key>] [-d <kdf>] [-i <kdfi>]"
},
"hf mfdes bruteaid": { "hf mfdes bruteaid": {
"command": "hf mfdes bruteaid", "command": "hf mfdes bruteaid",
"description": "recover aids by bruteforce. warning: this command takes a long time", "description": "recover aids by bruteforce. warning: this command takes a long time",
@ -4193,50 +4152,6 @@
], ],
"usage": "hf mfdes formatpicc [-h]" "usage": "hf mfdes formatpicc [-h]"
}, },
"hf mfdes getaids": {
"command": "hf mfdes getaids",
"description": "get application ids list from card. master key needs to be provided.",
"notes": [
"hf mfdes getaids -n 0 -t des -k 0000000000000000 -f none -> execute with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2"
],
"usage": "hf mfdes getaids [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>]"
},
"hf mfdes getappnames": {
"command": "hf mfdes getappnames",
"description": "get application ids, iso ids and df names from card. master key needs to be provided.",
"notes": [
"hf mfdes getappnames -n 0 -t des -k 0000000000000000 -f none -> execute with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2"
],
"usage": "hf mfdes getappnames [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>]"
},
"hf mfdes getuid": { "hf mfdes getuid": {
"command": "hf mfdes getuid", "command": "hf mfdes getuid",
"description": "get uid from a mifare desfire tag", "description": "get uid from a mifare desfire tag",
@ -4265,23 +4180,28 @@
}, },
"hf mfdes help": { "hf mfdes help": {
"command": "hf mfdes help", "command": "hf mfdes help",
"description": "help this help list list desfire (iso 14443a) history --------------------------------------------------------------------------------------- hf mfdes default available offline: no get application ids, iso ids and df names from card. master key needs to be provided.", "description": "help this help list list desfire (iso 14443a) history --------------------------------------------------------------------------------------- hf mfdes auth available offline: no authenticates mifare desfire using key",
"notes": [ "notes": [
"hf mfdes getappnames -n 0 -t des -k 0000000000000000 -f none -> execute with default factory setup" "hf mfdes auth -m 3 -t 4 -a 808301 -n 0 -k 00000000000000000000000000000000 -> aes,keynumber 0, aid 0x803201",
"hf mfdes auth -m 2 -t 2 -a 000000 -n 1 -k 00000000000000000000000000000000 -> 3des,keynumber 1, aid 0x000000",
"hf mfdes auth -m 1 -t 1 -a 000000 -n 2 -k 0000000000000000 -> des,keynumber 2, aid 0x000000",
"hf mfdes auth -m 1 -t 1 -a 000000 -n 0 -> des, defaultkey, aid 0x000000",
"hf mfdes auth -m 2 -t 2 -a 000000 -n 0 -> 3des, defaultkey, aid 0x000000",
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> 3k3des, defaultkey, aid 0x000000",
"hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> aes, defaultkey, aid 0x000000"
], ],
"offline": true, "offline": true,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --keyno <keyno> key number", "-m, --type <type> auth type (1=normal, 2=iso, 3=aes)",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes", "-t, --algo <algo> crypt algo (1=des, 2=3des(2k2des), 3=3k3des, 4=aes)",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", "-a, --aid <aid> aid used for authentification (hex 3 bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher", "-n, --keyno <keyno> key number used for authentification",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)", "-k, --key <key> key for checking (hex 8-24 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt", "-d, --kdf <kdf> key derivation function (kdf) (0=none, 1=an10922, 2=gallagher)",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso", "-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)"
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2"
], ],
"usage": "hf mfdes default [-h] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>]" "usage": "hf mfdes auth [-h] [-m <type>] [-t <algo>] [-a <aid>]... [-n <keyno>] [-k <key>] [-d <kdf>] [-i <kdfi>]"
}, },
"hf mfdes info": { "hf mfdes info": {
"command": "hf mfdes info", "command": "hf mfdes info",
@ -5158,8 +5078,8 @@
"command": "hw connect", "command": "hw connect",
"description": "connects to a proxmark3 device via specified serial port. baudrate here is only for physical uart or uart-bt, not for usb-cdc or blue shark add-on", "description": "connects to a proxmark3 device via specified serial port. baudrate here is only for physical uart or uart-bt, not for usb-cdc or blue shark add-on",
"notes": [ "notes": [
"hw connect -p com3", "hw connect -p /dev/ttyacm0",
"hw connect -p com3 -b 115200" "hw connect -p /dev/ttyacm0 -b 115200"
], ],
"offline": true, "offline": true,
"options": [ "options": [
@ -9281,8 +9201,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 575, "commands_extracted": 571,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2021-07-06T09:14:57" "extracted_on": "2021-07-08T07:53:00"
} }
} }

View file

@ -247,7 +247,6 @@ Check column "offline" for their availability.
|`hf cipurse write `|N |`Write binary file` |`hf cipurse write `|N |`Write binary file`
|`hf cipurse aread `|N |`Read file attributes` |`hf cipurse aread `|N |`Read file attributes`
|`hf cipurse delete `|N |`Delete file` |`hf cipurse delete `|N |`Delete file`
|`hf cipurse default `|N |`Set default key and file id for all the other commands`
|`hf cipurse test `|Y |`Tests` |`hf cipurse test `|Y |`Tests`
@ -501,7 +500,6 @@ Check column "offline" for their availability.
|command |offline |description |command |offline |description
|------- |------- |----------- |------- |------- |-----------
|`hf mfdes help `|Y |`This help` |`hf mfdes help `|Y |`This help`
|`hf mfdes default `|N |`[new]Set defaults for all the commands`
|`hf mfdes auth `|N |`Tries a MIFARE DesFire Authentication` |`hf mfdes auth `|N |`Tries a MIFARE DesFire Authentication`
|`hf mfdes changekey `|N |`Change Key` |`hf mfdes changekey `|N |`Change Key`
|`hf mfdes chk `|N |`Check keys` |`hf mfdes chk `|N |`Check keys`
@ -514,8 +512,6 @@ Check column "offline" for their availability.
|`hf mfdes createaid `|N |`Create Application ID` |`hf mfdes createaid `|N |`Create Application ID`
|`hf mfdes deleteaid `|N |`Delete Application ID` |`hf mfdes deleteaid `|N |`Delete Application ID`
|`hf mfdes selectaid `|N |`Select Application ID` |`hf mfdes selectaid `|N |`Select Application ID`
|`hf mfdes getaids `|N |`[new]Get Application IDs list`
|`hf mfdes getappnames `|N |`[new]Get Applications list`
|`hf mfdes changevalue `|N |`Write value of a value file (credit/debit/clear)` |`hf mfdes changevalue `|N |`Write value of a value file (credit/debit/clear)`
|`hf mfdes clearfile `|N |`Clear record File` |`hf mfdes clearfile `|N |`Clear record File`
|`hf mfdes createfile `|N |`Create Standard/Backup File` |`hf mfdes createfile `|N |`Create Standard/Backup File`

View file

@ -226,7 +226,7 @@ def main():
child.sendline('hw version') child.sendline('hw version')
i = child.expect('pm3 --> ') i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before)) msg = escape_ansi(str(child.before))
if signature_msg in msg: if signature_msg in msg:
print("[+] RDV4 signature ", color('[OK]', fg='green')) print("[+] RDV4 signature ", color('[OK]', fg='green'))
res += 1 res += 1
@ -238,7 +238,7 @@ def main():
child.sendline('hw status') child.sendline('hw status')
i = child.expect('pm3 --> ') i = child.expect('pm3 --> ')
msg = escape_ansi(str(child.before)) msg = escape_ansi(str(child.before))
if sm_version in msg: if sm_version in msg:
print("[+] Smart card firmware version ", color('[OK]', fg='green')) print("[+] Smart card firmware version ", color('[OK]', fg='green'))
res += 1 res += 1

View file

@ -47,9 +47,9 @@ for x in apdu:
print(toHexString(x)) print(toHexString(x))
print('--') print('--')
lenpk = ser.read(1) #first byte is the buffer length lenpk = ser.read(1) #first byte is the buffer length
bufferlen = pd(lenpk)[0] bufferlen = pd(lenpk)[0]
buffer = pd(ser.read(bufferlen)) buffer = pd(ser.read(bufferlen))
print('Terminal command:'), print('Terminal command:'),
print(toHexString(buffer)) print(toHexString(buffer))

View file

@ -57,10 +57,10 @@ for x in apdu:
ser.write(x) ser.write(x)
print(toHexString(x)) print(toHexString(x))
lenpk = ser.read(1) #first byte is the buffer length lenpk = ser.read(1) #first byte is the buffer length
bufferlen = pd(lenpk)[0] bufferlen = pd(lenpk)[0]
buffer = pd(ser.read(bufferlen)) buffer = pd(ser.read(bufferlen))
print('Card Response:'), print('Card Response:'),
print(toHexString(buffer)) print(toHexString(buffer))
print('--') print('--')