This commit is contained in:
Bjoern Kerler 2020-06-13 15:11:10 +02:00
commit 631be7af32
1097 changed files with 50849 additions and 20982 deletions

View file

@ -5,12 +5,22 @@
#define _BLUE_(s) "\x1b[34m" s AEND
#define _RED_(s) "\x1b[31m" s AEND
#define _BOLD_RED_(s) "\x1b[1;31m" s AEND
#define _GREEN_(s) "\x1b[32m" s AEND
#define _BOLD_GREEN_(s) "\x1b[1;32m" s AEND
#define _YELLOW_(s) "\x1b[33m" s AEND
#define _MAGENTA_(s) "\x1b[35m" s AEND
#define _CYAN_(s) "\x1b[36m" s AEND
#define _WHITE_(s) "\x1b[37m" s AEND
// https://wiki.hackzine.org/development/misc/readline-color-prompt.html
// Applications may indicate that the prompt contains
// characters that take up no physical screen space when displayed by
// bracketing a sequence of such characters with the special markers
// RL_PROMPT_START_IGNORE = '\001' and RL_PROMPT_END_IGNORE = '\002'
#define RL_ESC(a) "\001" a "\002"
#define _RL_RED_(s) RL_ESC("\x1b[31m") s RL_ESC(AEND)
#define _RL_GREEN_(s) RL_ESC("\x1b[32m") s RL_ESC(AEND)
#define _RL_BOLD_RED_(s) RL_ESC("\x1b[1;31m") s RL_ESC(AEND)
#define _RL_BOLD_GREEN_(s) RL_ESC("\x1b[1;32m") s RL_ESC(AEND)
#endif

View file

@ -24,18 +24,30 @@
#define PM3_USER_DIRECTORY PATHSEP ".proxmark3" PATHSEP
// PM3 subdirectories:
#define PYTHON_SCRIPTS_SUBDIR "pyscripts" PATHSEP
#define CMD_SCRIPTS_SUBDIR "cmdscripts" PATHSEP
#define DICTIONARIES_SUBDIR "dictionaries" PATHSEP
#define LUA_LIBRARIES_SUBDIR "lualibs" PATHSEP
#define LUA_SCRIPTS_SUBDIR "luascripts" PATHSEP
#define RESOURCES_SUBDIR "resources" PATHSEP
#define TRACES_SUBDIR "traces" PATHSEP
#define LOGS_SUBDIR "logs" PATHSEP
#define FIRMWARES_SUBDIR "firmware" PATHSEP
#define BOOTROM_SUBDIR "bootrom/obj" PATHSEP
#define FULLIMAGE_SUBDIR "armsrc/obj" PATHSEP
#define BOOTROM_SUBDIR "bootrom" PATHSEP "obj" PATHSEP
#define FULLIMAGE_SUBDIR "armsrc" PATHSEP "obj" PATHSEP
#define PACKED __attribute__((packed))
#define VERSION_INFORMATION_MAGIC 0x56334d50 // "PM3V"
struct version_information {
int magic; /* Magic sequence to identify this as a correct version information structure. Must be VERSION_INFORMATION_MAGIC */
char versionversion; /* Must be 1 */
char present; /* 1 if the version information could be created at compile time, otherwise 0 and the remaining fields (except for magic) are empty */
char clean; /* 1: Tree was clean, no local changes. 0: Tree was unclean. 2: Couldn't be determined */
char gitversion[50]; /* String with the git revision */
char buildtime[30]; /* string with the build time */
} PACKED;
// debug
#define DBG_NONE 0 // no messages
#define DBG_ERROR 1 // errors only
@ -58,7 +70,10 @@ extern int DBGLEVEL;
#ifndef ABS
# define ABS(a) ( ((a)<0) ? -(a) : (a) )
#endif
#define RAMFUNC __attribute((long_call, section(".ramfunc")))
//#define RAMFUNC __attribute((long_call, section(".ramfunc")))
#define RAMFUNC __attribute((long_call, section(".ramfunc"))) __attribute__((target("arm")))
#ifndef ROTR
# define ROTR(x,n) (((uintmax_t)(x) >> (n)) | ((uintmax_t)(x) << ((sizeof(x) * 8) - (n))))

View file

@ -21,8 +21,10 @@ typedef enum {
RHTSF_KEY = 02,
WHTSF_CHALLENGE = 03,
WHTSF_KEY = 04,
HTS_LAST_CMD = WHTSF_KEY,
RHT1F_PLAIN = 11,
RHT1F_AUTHENTICATE = 12,
HT1_LAST_CMD = RHT1F_AUTHENTICATE,
RHT2F_PASSWORD = 21,
RHT2F_AUTHENTICATE = 22,
RHT2F_CRYPTO = 23,
@ -30,6 +32,7 @@ typedef enum {
RHT2F_TEST_AUTH_ATTEMPTS = 25,
RHT2F_UID_ONLY = 26,
WHT2F_PASSWORD = 27,
HT2_LAST_CMD = WHT2F_PASSWORD,
} hitag_function;
typedef struct {

View file

@ -121,6 +121,20 @@ typedef struct {
int32_t samples_to_skip;
bool verbose;
} PACKED sample_config;
typedef struct {
uint32_t timestamp;
uint16_t duration;
uint16_t data_len : 15;
bool isResponse : 1;
uint8_t frame[];
// data_len bytes of data
// ceil(data_len/8) bytes of parity
} PACKED tracelog_hdr_t;
#define TRACELOG_HDR_LEN sizeof(tracelog_hdr_t)
#define TRACELOG_PARITY_LEN(x) (((x)->data_len - 1) / 8 + 1)
/*
typedef struct {
uint16_t start_gap;
@ -161,6 +175,7 @@ typedef struct {
typedef struct {
uint8_t version;
uint32_t baudrate;
uint32_t bigbuf_size;
bool via_fpc : 1;
bool via_usb : 1;
// rdv4
@ -189,7 +204,7 @@ typedef struct {
bool hw_available_flash : 1;
bool hw_available_smartcard : 1;
} PACKED capabilities_t;
#define CAPABILITIES_VERSION 4
#define CAPABILITIES_VERSION 5
extern capabilities_t pm3_capabilities;
// For CMD_LF_T55XX_WRITEBL
@ -613,7 +628,7 @@ typedef struct {
// Initialization error pm3: error related to trying to initalize the pm3 / fpga for different operations
#define PM3_EINIT -15
// Expected a different answer error client/pm3: error when expecting one answer and got another one
#define PM3_EWRONGANSVER -16
#define PM3_EWRONGANSWER -16
// Memory out-of-bounds error client/pm3: error when a read/write is outside the expected array
#define PM3_EOUTOFBOUND -17
// exchange with card error client/pm3: error when cant get answer from card or got an incorrect answer

View file

@ -14,9 +14,6 @@
#include "common.h"
// Flashmem spi baudrate
extern uint32_t FLASHMEM_SPIBAUDRATE;
// RDV40 Section
// 256kb divided into 4k sectors.
//

View file

@ -115,15 +115,7 @@
//NVDD goes LOW when USB is attached.
#define USB_ATTACHED() !((AT91C_BASE_PIOA->PIO_PDSR & GPIO_NVDD_ON) == GPIO_NVDD_ON)
#define VERSION_INFORMATION_MAGIC 0x56334d50 // "PM3V"
struct version_information {
int magic; /* Magic sequence to identify this as a correct version information structure. Must be VERSION_INFORMATION_MAGIC */
char versionversion; /* Must be 1 */
char present; /* 1 if the version information could be created at compile time, otherwise 0 and the remaining fields (except for magic) are empty */
char clean; /* 1: Tree was clean, no local changes. 0: Tree was unclean. 2: Couldn't be determined */
char gitversion[50]; /* String with the git revision */
char buildtime[30]; /* string with the build time */
} PACKED;
// VERSION_INFORMATION is now in common.h
#define COMMON_AREA_MAGIC 0x43334d50 // "PM3C"
#define COMMON_AREA_COMMAND_NONE 0