Merge branch 'master' into experimental_varlen
* master: rework Dbprintf & add color support use color macros doc magic archive and fix hid-flasher update standalone readme
This commit is contained in:
@@ -499,11 +499,7 @@ void pm3_version(bool verbose) {
|
||||
#else
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
|
||||
#endif
|
||||
#ifdef __WIN32
|
||||
PrintAndLogEx(NORMAL, "\n [ Proxmark3 RFID instrument ]\n");
|
||||
#else
|
||||
PrintAndLogEx(NORMAL, "\n\e[34m [ Proxmark3 RFID instrument ]\e[0m\n");
|
||||
#endif
|
||||
PrintAndLogEx(NORMAL, "\n" _BLUE_(" [ Proxmark3 RFID instrument ]") "\n");
|
||||
char s[60] = {0};
|
||||
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) || defined(WITH_FPC)
|
||||
strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
|
||||
|
||||
@@ -235,6 +235,39 @@ static int getReply(PacketResponseNG *packet) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void memcpy_filtered(void *dest, const void *src, size_t n, bool filter) {
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
memcpy(dest, src, n);
|
||||
#else
|
||||
if (filter)
|
||||
// Filter out ANSI sequences on these OS
|
||||
uint16_t si=0;
|
||||
for (uint16_t i=0; i < n; i++) {
|
||||
if ((src[i] == '\x1b') && (i < n - 1) && (src[i+1] >= 0x40) && (src[i+1] <= 0x5F)) { // entering ANSI sequence
|
||||
i++;
|
||||
if ((src[i] == '[') && (i < n - 1)) { // entering CSI sequence
|
||||
i++;
|
||||
while ((i < n - 1) && (src[i] >= 0x30) && (src[i] <= 0x3F)) { // parameter bytes
|
||||
i++;
|
||||
}
|
||||
while ((i < n - 1) && (src[i] >= 0x20) && (src[i] <= 0x2F)) { // intermediate bytes
|
||||
i++;
|
||||
}
|
||||
if ((src[i] >= 0x40) && (src[i] <= 0x7F)) { // final byte
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dest[si++] = src[i];
|
||||
}
|
||||
} else {
|
||||
memcpy(dest, src, n);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Entry point into our code: called whenever we received a packet over USB
|
||||
// that we weren't necessarily expecting, for example a debug print.
|
||||
@@ -263,31 +296,24 @@ static void PacketResponseReceived(PacketResponseNG *packet) {
|
||||
} PACKED;
|
||||
struct d *data = (struct d *)&packet->data.asBytes;
|
||||
len = packet->length - sizeof(data->flag);
|
||||
memcpy(s, data->buf, len);
|
||||
flag = data->flag;
|
||||
memcpy_filtered(s, data->buf, len, flag & FLAG_ANSI);
|
||||
} else {
|
||||
len = MIN(packet->oldarg[0], USB_CMD_DATA_SIZE);
|
||||
memcpy(s, packet->data.asBytes, len);
|
||||
flag = packet->oldarg[1];
|
||||
memcpy_filtered(s, packet->data.asBytes, len, flag & FLAG_ANSI);
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
case FLAG_RAWPRINT:
|
||||
printf("%s", s);
|
||||
break;
|
||||
case FLAG_NONEWLINE:
|
||||
printf("\r%s", s);
|
||||
break;
|
||||
case FLAG_NOLOG:
|
||||
printf("%s\r\n", s);
|
||||
break;
|
||||
//case FLAG_NOPROMPT:
|
||||
// break;
|
||||
case FLAG_NOOPT:
|
||||
default:
|
||||
PrintAndLogEx(NORMAL, "#db# %s", s);
|
||||
break;
|
||||
if (flag & FLAG_LOG) {
|
||||
PrintAndLogEx(NORMAL, "#db# %s", s);
|
||||
} else {
|
||||
if (flag & FLAG_INPLACE)
|
||||
printf("\r");
|
||||
printf("%s", s);
|
||||
if (flag & FLAG_NEWLINE)
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,26 +3,23 @@
|
||||
# at your option, any later version. See the LICENSE.txt file for the text of
|
||||
# the license.
|
||||
#-----------------------------------------------------------------------------
|
||||
include ../../common/Makefile.common
|
||||
|
||||
CC=gcc
|
||||
CXX=g++
|
||||
#COMMON_FLAGS = -m32
|
||||
|
||||
VPATH = ../../common
|
||||
OBJDIR = obj
|
||||
|
||||
LDLIBS = -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
ifeq ($(platform),Darwin)
|
||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lusb-1.0 -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -I. -I../include -I../common -I/usr/local/include -I/opt/local/include -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
LDLIBS += -lusb-1.0
|
||||
else
|
||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib -lusb -lreadline -lpthread
|
||||
CFLAGS = -std=gnu99 -I. -I../include -I../common -I/opt/local/include -Wall -Wno-unused-function $(COMMON_FLAGS) -g -O3
|
||||
LDLIBS += -lusb
|
||||
endif
|
||||
|
||||
LDFLAGS = $(COMMON_FLAGS)
|
||||
CXXFLAGS =
|
||||
QTLDLIBS =
|
||||
|
||||
RM = rm -f
|
||||
BINS = flasher
|
||||
@@ -11,11 +11,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "util_posix.h"
|
||||
#include "proxusb.h"
|
||||
#include "flash.h"
|
||||
#include "elf.h"
|
||||
#include "proxendian.h"
|
||||
#include "sleep.h"
|
||||
|
||||
#define FLASH_START 0x100000
|
||||
#define FLASH_SIZE (256*1024)
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "util_posix.h"
|
||||
#include "proxusb.h"
|
||||
#include "flash.h"
|
||||
#include "sleep.h"
|
||||
|
||||
static void usage(char *argv0) {
|
||||
fprintf(stderr, "Usage: %s [-b] image.elf [image.elf...]\n\n", argv0);
|
||||
@@ -9,6 +9,7 @@
|
||||
// USB utilities
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "proxusb.h"
|
||||
#include "sleep.h"
|
||||
|
||||
// It seems to be missing for mingw
|
||||
#ifndef ETIMEDOUT
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <errno.h>
|
||||
#include "proxmark3.h"
|
||||
#include "usb_cmd.h"
|
||||
#include "util_posix.h"
|
||||
|
||||
extern unsigned char return_on_error;
|
||||
extern unsigned char error_occured;
|
||||
@@ -916,7 +916,7 @@ int detect_classic_nackbug(bool verbose) {
|
||||
} else {
|
||||
printf(
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
"\e[32m\e[s%c\e[u\e[0m", star[(staridx++ % 4) ]
|
||||
_GREEN_("\e[s%c\e[u"), star[(staridx++ % 4) ]
|
||||
#else
|
||||
"."
|
||||
#endif
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
static void showBanner(void) {
|
||||
printf("\n\n");
|
||||
#if defined(__linux__) || (__APPLE__)
|
||||
printf("\e[34m██████╗ ███╗ ███╗ ████╗\e[0m ...iceman fork\n");
|
||||
printf("\e[34m██╔══██╗████╗ ████║ ══█║\e[0m ...dedicated to \e[34mRDV40\e[0m\n");
|
||||
printf("\e[34m██████╔╝██╔████╔██║ ████╔╝\e[0m\n");
|
||||
printf("\e[34m██╔═══╝ ██║╚██╔╝██║ ══█║\e[0m iceman@icesql.net\n");
|
||||
printf("\e[34m██║ ██║ ╚═╝ ██║ ████╔╝\e[0m https://github.com/rfidresearchgroup/proxmark3/\n");
|
||||
printf("\e[34m╚═╝ ╚═╝ ╚═╝ ╚═══╝\e[0m pre-release v4.0\n");
|
||||
printf(_BLUE_("██████╗ ███╗ ███╗ ████╗ ") " ...iceman fork\n");
|
||||
printf(_BLUE_("██╔══██╗████╗ ████║ ══█║") " ...dedicated to " _BLUE_("RDV40") "\n");
|
||||
printf(_BLUE_("██████╔╝██╔████╔██║ ████╔╝") "\n");
|
||||
printf(_BLUE_("██╔═══╝ ██║╚██╔╝██║ ══█║") " iceman@icesql.net\n");
|
||||
printf(_BLUE_("██║ ██║ ╚═╝ ██║ ████╔╝") " https://github.com/rfidresearchgroup/proxmark3/\n");
|
||||
printf(_BLUE_("╚═╝ ╚═╝ ╚═╝ ╚═══╝ ") "pre-release v4.0\n");
|
||||
#else
|
||||
printf("======. ===. ===. ====. ...iceman fork\n");
|
||||
printf("==...==.====. ====. ..=. ...dedicated to RDV40\n");
|
||||
|
||||
Reference in New Issue
Block a user