mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
UPDATES HF_COLIN to current
This commit is contained in:
+4
-3
@@ -24,7 +24,7 @@ APP_CFLAGS = -DWITH_CRC \
|
||||
-DWITH_FELICA \
|
||||
-DWITH_FLASH \
|
||||
-DWITH_HFSNOOP \
|
||||
-DWITH_HF_YOUNG \
|
||||
-DWITH_HF_COLIN \
|
||||
-fno-strict-aliasing -ffunction-sections -fdata-sections
|
||||
|
||||
### IMPORTANT - move the commented variable below this line
|
||||
@@ -103,7 +103,8 @@ ARMSRC = fpgaloader.c \
|
||||
parity.c \
|
||||
usb_cdc.c \
|
||||
cmd.c \
|
||||
hf_young.c
|
||||
hf_colin.c \
|
||||
vtsend.c
|
||||
# lf_samyrun.c \
|
||||
# lf_hidbrute.c \
|
||||
# lf_proxbrute.c \
|
||||
@@ -169,4 +170,4 @@ help:
|
||||
@echo Multi-OS Makefile, you are running on $(DETECTED_OS)
|
||||
@echo Possible targets:
|
||||
@echo + all - Build the full image $(OBJDIR)/fullimage.s19
|
||||
@echo + clean - Clean $(OBJDIR)
|
||||
@echo + clean - Clean $(OBJDIR)
|
||||
|
||||
+411
-179
File diff suppressed because it is too large
Load Diff
+468
-28
File diff suppressed because it is too large
Load Diff
+281
@@ -0,0 +1,281 @@
|
||||
/**
|
||||
* @file vtsend.c
|
||||
* @author CuBeatSystems
|
||||
* @author Shinichiro Nakamura
|
||||
* @copyright
|
||||
* ===============================================================
|
||||
* Natural Tiny Shell (NT-Shell) Version 0.3.1
|
||||
* ===============================================================
|
||||
* Copyright (c) 2010-2016 Shinichiro Nakamura
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "vtsend.h"
|
||||
#include "apps.h"
|
||||
|
||||
#define ESC (0x1B)
|
||||
//#define UART_WRITE(P, BUF, SIZ) (P)->uart_write(BUF, SIZ, (P)->extobj)
|
||||
#define UART_WRITE(BUF) DbprintfEx(FLAG_RAWPRINT, "%s", BUF)
|
||||
|
||||
int vtsend_init(vtsend_t *p, VTSEND_SERIAL_WRITE uart_write, void *extobj) {
|
||||
p->uart_write = uart_write;
|
||||
p->extobj = extobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_position(vtsend_t *p, const int column, const int line) {
|
||||
char buf[1 + 8];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (line / 10);
|
||||
buf[3] = '0' + (line % 10);
|
||||
buf[4] = ';';
|
||||
buf[5] = '0' + (column / 10);
|
||||
buf[6] = '0' + (column % 10);
|
||||
buf[7] = 'H';
|
||||
buf[8] = '\0';
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_up(vtsend_t *p, const int n) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (n / 10);
|
||||
buf[3] = '0' + (n % 10);
|
||||
buf[4] = 'A';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_down(vtsend_t *p, const int n) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (n / 10);
|
||||
buf[3] = '0' + (n % 10);
|
||||
buf[4] = 'B';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_forward(vtsend_t *p, const int n) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (n / 10);
|
||||
buf[3] = '0' + (n % 10);
|
||||
buf[4] = 'C';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_backward(vtsend_t *p, const int n) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (n / 10);
|
||||
buf[3] = '0' + (n % 10);
|
||||
buf[4] = 'D';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_position_save(vtsend_t *p) {
|
||||
char buf[1 + 3];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = 's';
|
||||
buf[3] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_cursor_position_restore(vtsend_t *p) {
|
||||
char buf[1 + 3];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = 'u';
|
||||
buf[3] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_erase_display(vtsend_t *p) {
|
||||
char buf[1 + 4];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '2';
|
||||
buf[3] = 'J';
|
||||
buf[4] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_erase_line(vtsend_t *p) {
|
||||
char buf[1 + 4];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '2';
|
||||
buf[3] = 'K';
|
||||
buf[4] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_set_color_foreground(vtsend_t *p, const int color) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + ((30 + color) / 10);
|
||||
buf[3] = '0' + ((30 + color) % 10);
|
||||
buf[4] = 'm';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_set_color_background(vtsend_t *p, const int color) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + ((40 + color) / 10);
|
||||
buf[3] = '0' + ((40 + color) % 10);
|
||||
buf[4] = 'm';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_set_attribute(vtsend_t *p, const int attr) {
|
||||
char buf[1 + 5];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + ((attr) / 10);
|
||||
buf[3] = '0' + ((attr) % 10);
|
||||
buf[4] = 'm';
|
||||
buf[5] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_set_scroll_region(vtsend_t *p, const int top, const int bottom) {
|
||||
char buf[1 + 8];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '0' + (top / 10);
|
||||
buf[3] = '0' + (top % 10);
|
||||
buf[4] = ';';
|
||||
buf[5] = '0' + (bottom / 10);
|
||||
buf[6] = '0' + (bottom % 10);
|
||||
buf[7] = 'r';
|
||||
buf[8] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_set_cursor(vtsend_t *p, const int visible) {
|
||||
if (visible) {
|
||||
char buf[1 + 6];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '?';
|
||||
buf[3] = '2';
|
||||
buf[4] = '5';
|
||||
buf[5] = 'h';
|
||||
buf[6] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
} else {
|
||||
char buf[1 + 6];
|
||||
buf[0] = ESC;
|
||||
buf[1] = '[';
|
||||
buf[2] = '?';
|
||||
buf[3] = '2';
|
||||
buf[4] = '5';
|
||||
buf[5] = 'l';
|
||||
buf[6] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_reset(vtsend_t *p) {
|
||||
char buf[1 + 2];
|
||||
buf[0] = ESC;
|
||||
buf[1] = 'c';
|
||||
buf[2] = '\0';
|
||||
|
||||
UART_WRITE(buf); // UART_WRITE(p, buf, sizeof(buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_draw_box(vtsend_t *p, const int x1, const int y1, const int x2, const int y2) {
|
||||
int i;
|
||||
|
||||
vtsend_cursor_position(p, x1, y1);
|
||||
for (i = x1; i <= x2; i++) {
|
||||
UART_WRITE("-");
|
||||
}
|
||||
vtsend_cursor_position(p, x1, y2);
|
||||
for (i = x1; i <= x2; i++) {
|
||||
UART_WRITE("-");
|
||||
}
|
||||
for (i = y1; i <= y2; i++) {
|
||||
vtsend_cursor_position(p, x1, i);
|
||||
UART_WRITE("|");
|
||||
vtsend_cursor_position(p, x2, i);
|
||||
UART_WRITE("|");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vtsend_fill_box(vtsend_t *p, const int x1, const int y1, const int x2, const int y2) {
|
||||
int i, j;
|
||||
for (i = y1; i <= y2; i++) {
|
||||
vtsend_cursor_position(p, x1, i);
|
||||
for (j = x1; j <= x2; j++) {
|
||||
UART_WRITE(" ");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @file vtsend.h
|
||||
* @author CuBeatSystems
|
||||
* @author Shinichiro Nakamura
|
||||
* @copyright
|
||||
* ===============================================================
|
||||
* Natural Tiny Shell (NT-Shell) Version 0.3.1
|
||||
* ===============================================================
|
||||
* Copyright (c) 2010-2016 Shinichiro Nakamura
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef VTSEND_H
|
||||
#define VTSEND_H
|
||||
|
||||
#define VTSEND_COLOR_BLACK (0)
|
||||
#define VTSEND_COLOR_RED (1)
|
||||
#define VTSEND_COLOR_GREEN (2)
|
||||
#define VTSEND_COLOR_YELLOW (3)
|
||||
#define VTSEND_COLOR_BLUE (4)
|
||||
#define VTSEND_COLOR_MAGENTA (5)
|
||||
#define VTSEND_COLOR_CYAN (6)
|
||||
#define VTSEND_COLOR_WHITE (7)
|
||||
|
||||
#define VTSEND_ATTR_OFF (0)
|
||||
#define VTSEND_ATTR_BOLD_ON (1)
|
||||
#define VTSEND_ATTR_UNDERSCORE (4)
|
||||
#define VTSEND_ATTR_BLINK_ON (5)
|
||||
#define VTSEND_ATTR_REVERSE (7)
|
||||
#define VTSEND_ATTR_CONCEALED_ON (8)
|
||||
|
||||
typedef int (*VTSEND_SERIAL_WRITE)(const char *buf, const int siz, void *extobj);
|
||||
|
||||
typedef struct {
|
||||
VTSEND_SERIAL_WRITE uart_write;
|
||||
void *extobj;
|
||||
} vtsend_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int vtsend_init(vtsend_t *p, VTSEND_SERIAL_WRITE uart_write, void *extobj);
|
||||
int vtsend_cursor_position(vtsend_t *p, const int column, const int line);
|
||||
int vtsend_cursor_up(vtsend_t *p, const int n);
|
||||
int vtsend_cursor_down(vtsend_t *p, const int n);
|
||||
int vtsend_cursor_forward(vtsend_t *p, const int n);
|
||||
int vtsend_cursor_backward(vtsend_t *p, const int n);
|
||||
int vtsend_cursor_position_save(vtsend_t *p);
|
||||
int vtsend_cursor_position_restore(vtsend_t *p);
|
||||
int vtsend_erase_display(vtsend_t *p);
|
||||
int vtsend_erase_line(vtsend_t *p);
|
||||
int vtsend_set_color_foreground(vtsend_t *p, const int color);
|
||||
int vtsend_set_color_background(vtsend_t *p, const int color);
|
||||
int vtsend_set_attribute(vtsend_t *p, const int attr);
|
||||
int vtsend_set_scroll_region(vtsend_t *p, const int top, const int bottom);
|
||||
int vtsend_set_cursor(vtsend_t *p, const int visible);
|
||||
int vtsend_reset(vtsend_t *p);
|
||||
|
||||
int vtsend_draw_box(
|
||||
vtsend_t *p,
|
||||
const int x1, const int y1, const int x2, const int y2);
|
||||
int vtsend_fill_box(
|
||||
vtsend_t *p,
|
||||
const int x1, const int y1, const int x2, const int y2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -272,6 +272,13 @@ typedef struct{
|
||||
#define FLAG_ICLASS_READER_ONE_TRY 0x20
|
||||
#define FLAG_ICLASS_READER_CEDITKEY 0x40
|
||||
|
||||
// Dbprintf flags
|
||||
#define FLAG_RAWPRINT 0x0111
|
||||
#define FLAG_NOOPT 0x0000
|
||||
#define FLAG_NOLOG 0x0001
|
||||
#define FLAG_NONEWLINE 0x0010
|
||||
#define FLAG_NOPROMPT 0x0100
|
||||
|
||||
// CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions:
|
||||
/* Whether a bootloader that understands the common_area is present */
|
||||
#define DEVICE_INFO_FLAG_BOOTROM_PRESENT (1<<0)
|
||||
|
||||
Reference in New Issue
Block a user