mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
add: first part emv @merlokk
This commit is contained in:
parent
ccfcd8e991
commit
23506bd1d7
10 changed files with 1443 additions and 0 deletions
57
client/emv/dump.c
Normal file
57
client/emv/dump.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* libopenemv - a library to work with EMV family of smart cards
|
||||
* Copyright (C) 2015 Dmitry Eremin-Solenikov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "dump.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void dump_buffer_simple(const unsigned char *ptr, size_t len, FILE *f)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!f)
|
||||
f = stdout;
|
||||
|
||||
for (i = 0; i < len; i ++)
|
||||
fprintf(f, "%s%02hhX", i ? " " : "", ptr[i]);
|
||||
}
|
||||
|
||||
void dump_buffer(const unsigned char *ptr, size_t len, FILE *f)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (!f)
|
||||
f = stdout;
|
||||
|
||||
for (i = 0; i < len; i += 16) {
|
||||
fprintf(f, "\t%02x:", i);
|
||||
for (j = 0; j < 16; j++) {
|
||||
if (i + j < len)
|
||||
fprintf(f, " %02hhx", ptr[i + j]);
|
||||
else
|
||||
fprintf(f, " ");
|
||||
}
|
||||
fprintf(f, " |");
|
||||
for (j = 0; j < 16 && i + j < len; j++) {
|
||||
fprintf(f, "%c", (ptr[i+j] >= 0x20 && ptr[i+j] < 0x7f) ? ptr[i+j] : '.' );
|
||||
}
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue