Compare commits
8 Commits
d46f80e7ea
...
9a00ad0230
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a00ad0230 | ||
|
|
f63bc96980 | ||
|
|
0d017908b4 | ||
|
|
b974a07736 | ||
|
|
b9bf84dbf1 | ||
|
|
436fedcbe4 | ||
|
|
6a444eb208 | ||
|
|
6447653c64 |
2
Makefile
2
Makefile
@@ -312,7 +312,7 @@ release:
|
|||||||
# - Tagging temporarily...
|
# - Tagging temporarily...
|
||||||
@git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
|
@git tag -a -m "Release $(VERSION) - $(RELEASE_NAME)" $(VERSION)
|
||||||
# - Changing default version information based on new tag
|
# - Changing default version information based on new tag
|
||||||
@$(SH) tools/mkversion.sh > common/default_version.c.tmp && $(MV) common/default_version.c.tmp common/default_version.c
|
@$(SH) tools/mkversion.sh > common/default_version_pm3.c.tmp && $(MV) common/default_version_pm3.c.tmp common/default_version_pm3.c
|
||||||
# - Removing mkversion calls
|
# - Removing mkversion calls
|
||||||
@sed -i 's#^.*\.\./tools/mkversion.sh.*|| #\t$$(Q)#' client/Makefile bootrom/Makefile armsrc/Makefile
|
@sed -i 's#^.*\.\./tools/mkversion.sh.*|| #\t$$(Q)#' client/Makefile bootrom/Makefile armsrc/Makefile
|
||||||
@sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt
|
@sed -i '/COMMAND/s/sh .*|| //' client/CMakeLists.txt
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ ARMSRC = fpgaloader.c \
|
|||||||
usb_cdc.c \
|
usb_cdc.c \
|
||||||
cmd.c
|
cmd.c
|
||||||
|
|
||||||
VERSIONSRC = version.c \
|
VERSIONSRC = version_pm3.c \
|
||||||
fpga_version_info.c
|
fpga_version_info.c
|
||||||
|
|
||||||
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
|
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
|
||||||
@@ -163,8 +163,8 @@ showinfo:
|
|||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
# version.c should be remade on every time fullimage.stage1.elf should be remade
|
# version_pm3.c should be remade on every time fullimage.stage1.elf should be remade
|
||||||
version.c: default_version.c $(OBJDIR)/fpga_version_info.o $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
|
version_pm3.c: default_version_pm3.c $(OBJDIR)/fpga_version_info.o $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
|
||||||
$(info [-] GEN $@)
|
$(info [-] GEN $@)
|
||||||
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ clean:
|
|||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.d
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.d
|
||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.z
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.z
|
||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.bin
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.bin
|
||||||
$(Q)$(RM) version.c
|
$(Q)$(RM) version_pm3.c version.c
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(info [@] Installing fullimage to $(DESTDIR)$(PREFIX)...)
|
$(info [@] Installing fullimage to $(DESTDIR)$(PREFIX)...)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ THUMBSRC = usb_cdc.c \
|
|||||||
bootrom.c
|
bootrom.c
|
||||||
|
|
||||||
ASMSRC = ram-reset.s flash-reset.s
|
ASMSRC = ram-reset.s flash-reset.s
|
||||||
VERSIONSRC = version.c
|
VERSIONSRC = version_pm3.c
|
||||||
|
|
||||||
## There is a strange bug with the linker: Sometimes it will not emit the glue to call
|
## There is a strange bug with the linker: Sometimes it will not emit the glue to call
|
||||||
## BootROM from ARM mode. The symbol is emitted, but the section will be filled with
|
## BootROM from ARM mode. The symbol is emitted, but the section will be filled with
|
||||||
@@ -36,8 +36,8 @@ INSTALLFW = $(OBJDIR)/bootrom.elf
|
|||||||
|
|
||||||
OBJS = $(OBJDIR)/bootrom.s19
|
OBJS = $(OBJDIR)/bootrom.s19
|
||||||
|
|
||||||
# version.c should be remade on every compilation
|
# version_pm3.c should be remade on every compilation
|
||||||
version.c: default_version.c
|
version_pm3.c: default_version_pm3.c
|
||||||
$(info [=] GEN $@)
|
$(info [=] GEN $@)
|
||||||
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ clean:
|
|||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.s19
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.s19
|
||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.map
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.map
|
||||||
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.d
|
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.d
|
||||||
$(Q)$(RM) version.c
|
$(Q)$(RM) version_pm3.c version.c
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$(info [@] Installing bootrom to $(DESTDIR)$(PREFIX)...)
|
$(info [@] Installing bootrom to $(DESTDIR)$(PREFIX)...)
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ set (TARGET_SOURCES
|
|||||||
${PM3_ROOT}/client/src/cmdhfmfhard.c
|
${PM3_ROOT}/client/src/cmdhfmfhard.c
|
||||||
${PM3_ROOT}/client/src/cmdhfmfp.c
|
${PM3_ROOT}/client/src/cmdhfmfp.c
|
||||||
${PM3_ROOT}/client/src/cmdhfmfu.c
|
${PM3_ROOT}/client/src/cmdhfmfu.c
|
||||||
|
${PM3_ROOT}/client/src/cmdhfseos.c
|
||||||
${PM3_ROOT}/client/src/cmdhfst.c
|
${PM3_ROOT}/client/src/cmdhfst.c
|
||||||
${PM3_ROOT}/client/src/cmdhfthinfilm.c
|
${PM3_ROOT}/client/src/cmdhfthinfilm.c
|
||||||
${PM3_ROOT}/client/src/cmdhftopaz.c
|
${PM3_ROOT}/client/src/cmdhftopaz.c
|
||||||
@@ -313,13 +314,13 @@ set (TARGET_SOURCES
|
|||||||
${PM3_ROOT}/client/src/util.c
|
${PM3_ROOT}/client/src/util.c
|
||||||
${PM3_ROOT}/client/src/wiegand_formats.c
|
${PM3_ROOT}/client/src/wiegand_formats.c
|
||||||
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
||||||
${CMAKE_BINARY_DIR}/version.c
|
${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version.c ${CMAKE_BINARY_DIR}/version.c
|
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
DEPENDS ${PM3_ROOT}/common/default_version.c
|
DEPENDS ${PM3_ROOT}/common/default_version_pm3.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(ADDITIONAL_SRC "")
|
set(ADDITIONAL_SRC "")
|
||||||
|
|||||||
@@ -481,6 +481,7 @@ SRCS = aiddesfire.c \
|
|||||||
cmdhfmfhard.c \
|
cmdhfmfhard.c \
|
||||||
cmdhfmfu.c \
|
cmdhfmfu.c \
|
||||||
cmdhfmfp.c \
|
cmdhfmfp.c \
|
||||||
|
cmdhfseos.c \
|
||||||
cmdhfst.c \
|
cmdhfst.c \
|
||||||
cmdhfthinfilm.c \
|
cmdhfthinfilm.c \
|
||||||
cmdhftopaz.c \
|
cmdhftopaz.c \
|
||||||
@@ -581,7 +582,7 @@ SRCS = aiddesfire.c \
|
|||||||
tea.c \
|
tea.c \
|
||||||
ui.c \
|
ui.c \
|
||||||
util.c \
|
util.c \
|
||||||
version.c \
|
version_pm3.c \
|
||||||
wiegand_formats.c \
|
wiegand_formats.c \
|
||||||
wiegand_formatutils.c
|
wiegand_formatutils.c
|
||||||
|
|
||||||
@@ -630,7 +631,7 @@ OBJS += $(OBJCSRCS:%.m=$(OBJDIR)/%.o)
|
|||||||
|
|
||||||
BINS = proxmark3
|
BINS = proxmark3
|
||||||
|
|
||||||
CLEAN = $(BINS) src/version.c src/*.moc.cpp src/ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mfc_default_keys.lua
|
CLEAN = $(BINS) src/version_pm3.c src/*.moc.cpp src/ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mfc_default_keys.lua
|
||||||
# transition: cleaning also old path stuff
|
# transition: cleaning also old path stuff
|
||||||
CLEAN += flasher *.moc.cpp ui/ui_overlays.h
|
CLEAN += flasher *.moc.cpp ui/ui_overlays.h
|
||||||
|
|
||||||
@@ -770,8 +771,8 @@ src/pm3_pywrap.c: pm3.i
|
|||||||
|
|
||||||
.PHONY: all clean install uninstall tarbin .FORCE
|
.PHONY: all clean install uninstall tarbin .FORCE
|
||||||
|
|
||||||
# version.c should be remade on every compilation
|
# version_pm3.c should be remade on every compilation
|
||||||
src/version.c: default_version.c
|
src/version_pm3.c: default_version_pm3.c
|
||||||
$(info [=] GEN $@)
|
$(info [=] GEN $@)
|
||||||
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
$(Q)$(SH) ../tools/mkversion.sh > $@ || $(PERL) ../tools/mkversion.pl > $@ || $(CP) $< $@
|
||||||
|
|
||||||
|
|||||||
@@ -313,13 +313,13 @@ set (TARGET_SOURCES
|
|||||||
${PM3_ROOT}/client/src/util.c
|
${PM3_ROOT}/client/src/util.c
|
||||||
${PM3_ROOT}/client/src/wiegand_formats.c
|
${PM3_ROOT}/client/src/wiegand_formats.c
|
||||||
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
${PM3_ROOT}/client/src/wiegand_formatutils.c
|
||||||
${CMAKE_BINARY_DIR}/version.c
|
${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
OUTPUT ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version.c ${CMAKE_BINARY_DIR}/version.c
|
COMMAND sh ${PM3_ROOT}/tools/mkversion.sh > ${CMAKE_BINARY_DIR}/version_pm3.c || perl ${PM3_ROOT}/tools/mkversion.pl > ${CMAKE_BINARY_DIR}/version_pm3.c || ${CMAKE_COMMAND} -E copy ${PM3_ROOT}/common/default_version_pm3.c ${CMAKE_BINARY_DIR}/version_pm3.c
|
||||||
DEPENDS ${PM3_ROOT}/common/default_version.c
|
DEPENDS ${PM3_ROOT}/common/default_version_pm3.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(ADDITIONAL_SRC "")
|
set(ADDITIONAL_SRC "")
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "cmdhfthinfilm.h" // Thinfilm
|
#include "cmdhfthinfilm.h" // Thinfilm
|
||||||
#include "cmdhflto.h" // LTO-CM
|
#include "cmdhflto.h" // LTO-CM
|
||||||
#include "cmdhfcryptorf.h" // CryptoRF
|
#include "cmdhfcryptorf.h" // CryptoRF
|
||||||
|
#include "cmdhfseos.h" // SEOS
|
||||||
#include "cmdhfst.h" // ST rothult
|
#include "cmdhfst.h" // ST rothult
|
||||||
#include "cmdhfwaveshare.h" // Waveshare
|
#include "cmdhfwaveshare.h" // Waveshare
|
||||||
#include "cmdtrace.h" // trace list
|
#include "cmdtrace.h" // trace list
|
||||||
@@ -410,6 +411,7 @@ static command_t CommandTable[] = {
|
|||||||
{"mfp", CmdHFMFP, AlwaysAvailable, "{ MIFARE Plus RFIDs... }"},
|
{"mfp", CmdHFMFP, AlwaysAvailable, "{ MIFARE Plus RFIDs... }"},
|
||||||
{"mfu", CmdHFMFUltra, AlwaysAvailable, "{ MIFARE Ultralight RFIDs... }"},
|
{"mfu", CmdHFMFUltra, AlwaysAvailable, "{ MIFARE Ultralight RFIDs... }"},
|
||||||
{"mfdes", CmdHFMFDes, AlwaysAvailable, "{ MIFARE Desfire RFIDs... }"},
|
{"mfdes", CmdHFMFDes, AlwaysAvailable, "{ MIFARE Desfire RFIDs... }"},
|
||||||
|
{"seos", CmdHFSeos, AlwaysAvailable, "{ SEOS RFIDs... }"},
|
||||||
{"st", CmdHFST, AlwaysAvailable, "{ ST Rothult RFIDs... }"},
|
{"st", CmdHFST, AlwaysAvailable, "{ ST Rothult RFIDs... }"},
|
||||||
{"thinfilm", CmdHFThinfilm, AlwaysAvailable, "{ Thinfilm RFIDs... }"},
|
{"thinfilm", CmdHFThinfilm, AlwaysAvailable, "{ Thinfilm RFIDs... }"},
|
||||||
{"topaz", CmdHFTopaz, AlwaysAvailable, "{ TOPAZ (NFC Type 1) RFIDs... }"},
|
{"topaz", CmdHFTopaz, AlwaysAvailable, "{ TOPAZ (NFC Type 1) RFIDs... }"},
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
|||||||
static int CmdHF14AReader(const char *Cmd) {
|
static int CmdHF14AReader(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf 14a reader",
|
CLIParserInit(&ctx, "hf 14a reader",
|
||||||
"Reader for ISO 14443A based tags",
|
"Act as a ISO-14443a reader to identify tag. Look for ISO-14443a tags until Enter or the pm3 button is pressed",
|
||||||
"hf 14a reader -@ -> Continuous mode");
|
"hf 14a reader -@ -> Continuous mode");
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
|
|||||||
@@ -119,14 +119,13 @@ static void print_service_code_list_constraints(void) {
|
|||||||
/*
|
/*
|
||||||
static int usage_hf_felica_sim(void) {
|
static int usage_hf_felica_sim(void) {
|
||||||
PrintAndLogEx(INFO, "\n Emulating ISO/18092 FeliCa tag \n");
|
PrintAndLogEx(INFO, "\n Emulating ISO/18092 FeliCa tag \n");
|
||||||
PrintAndLogEx(INFO, "Usage: hf felica sim [h] t <type> [v]");
|
PrintAndLogEx(INFO, "Usage: hf felica sim -t <type> [-v]");
|
||||||
PrintAndLogEx(INFO, "Options:");
|
PrintAndLogEx(INFO, "Options:");
|
||||||
PrintAndLogEx(INFO, " h : This help");
|
|
||||||
PrintAndLogEx(INFO, " t : 1 = FeliCa");
|
PrintAndLogEx(INFO, " t : 1 = FeliCa");
|
||||||
PrintAndLogEx(INFO, " : 2 = FeliCaLiteS");
|
PrintAndLogEx(INFO, " : 2 = FeliCaLiteS");
|
||||||
PrintAndLogEx(INFO, " v : (Optional) Verbose");
|
PrintAndLogEx(INFO, " v : (Optional) Verbose");
|
||||||
PrintAndLogEx(INFO, "Examples:");
|
PrintAndLogEx(INFO, "Examples:");
|
||||||
PrintAndLogEx(INFO, " hf felica sim t 1 ");
|
PrintAndLogEx(INFO, " hf felica sim -t 1");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -259,7 +258,7 @@ int read_felica_uid(bool loop, bool verbose) {
|
|||||||
static int CmdHFFelicaReader(const char *Cmd) {
|
static int CmdHFFelicaReader(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica reader",
|
CLIParserInit(&ctx, "hf felica reader",
|
||||||
"Reader for FeliCa based tags",
|
"Act as a ISO 18092 / FeliCa reader. Look for FeliCa tags until Enter or the pm3 button is pressed",
|
||||||
"hf felica reader -@ -> Continuous mode");
|
"hf felica reader -@ -> Continuous mode");
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
|||||||
uint8_t *p = realloc(data, tot_bytes);
|
uint8_t *p = realloc(data, tot_bytes);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
PrintAndLogEx(FAILED, "failed to allocate memory");
|
PrintAndLogEx(FAILED, "failed to allocate memory");
|
||||||
//free(data);
|
free(data);
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
data = p;
|
data = p;
|
||||||
|
|||||||
@@ -1903,16 +1903,18 @@ static int handler_desfire_debit(mfdes_value_t *value, uint8_t cs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int handler_desfire_readdata(mfdes_data_t *data, MFDES_FILE_TYPE_T type, uint8_t cs) {
|
static int handler_desfire_readdata(mfdes_data_t *data, MFDES_FILE_TYPE_T type, uint8_t cs) {
|
||||||
if (data->fileno > 0x1F) return PM3_EINVARG;
|
if (data->fileno > 0x1F) {
|
||||||
sAPDU apdu = {0x90, MFDES_READ_DATA, 0x00, 0x00, 1 + 3 + 3, (uint8_t *)data}; // 0xBD
|
return PM3_EINVARG;
|
||||||
if (type == MFDES_RECORD_FILE) apdu.INS = MFDES_READ_RECORDS; //0xBB
|
}
|
||||||
|
|
||||||
uint16_t sw = 0;
|
sAPDU apdu = {0x90, MFDES_READ_DATA, 0x00, 0x00, 1 + 3 + 3, (uint8_t *)data}; // 0xBD
|
||||||
uint32_t resplen = 0;
|
if (type == MFDES_RECORD_FILE) {
|
||||||
|
apdu.INS = MFDES_READ_RECORDS; //0xBB
|
||||||
|
}
|
||||||
|
|
||||||
// we need the CMD 0xBD <data> to calc the CMAC
|
// we need the CMD 0xBD <data> to calc the CMAC
|
||||||
uint8_t tmp_data[8]; // Since the APDU is hardcoded to 7 bytes of payload 7+1 = 8 is enough.
|
uint8_t tmp_data[8]; // Since the APDU is hardcoded to 7 bytes of payload 7+1 = 8 is enough.
|
||||||
tmp_data[0] = 0xBD;
|
tmp_data[0] = apdu.INS;
|
||||||
memcpy(&tmp_data[1], data, 7);
|
memcpy(&tmp_data[1], data, 7);
|
||||||
|
|
||||||
// size_t plen = apdu.Lc;
|
// size_t plen = apdu.Lc;
|
||||||
@@ -1926,6 +1928,8 @@ static int handler_desfire_readdata(mfdes_data_t *data, MFDES_FILE_TYPE_T type,
|
|||||||
apdu.Lc = 7;
|
apdu.Lc = 7;
|
||||||
apdu.data = (uint8_t *)data;
|
apdu.data = (uint8_t *)data;
|
||||||
|
|
||||||
|
uint16_t sw = 0;
|
||||||
|
uint32_t resplen = 0;
|
||||||
int res = send_desfire_cmd(&apdu, false, data->data, &resplen, &sw, 0, true);
|
int res = send_desfire_cmd(&apdu, false, data->data, &resplen, &sw, 0, true);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(WARNING, _RED_(" Can't read data -> %s"), GetErrorString(res, &sw));
|
PrintAndLogEx(WARNING, _RED_(" Can't read data -> %s"), GetErrorString(res, &sw));
|
||||||
@@ -4970,8 +4974,6 @@ static int CmdHF14aDesNDEF(const char *Cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintAndLogEx(INFO, "reading data from tag");
|
|
||||||
|
|
||||||
if (!datalen) {
|
if (!datalen) {
|
||||||
PrintAndLogEx(ERR, "no NDEF data");
|
PrintAndLogEx(ERR, "no NDEF data");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|||||||
132
client/src/cmdhfseos.c
Normal file
132
client/src/cmdhfseos.c
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2021 iceman
|
||||||
|
//
|
||||||
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||||
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
|
// the license.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// SEOS commands
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "cmdhfseos.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h> // tolower
|
||||||
|
#include "cliparser.h"
|
||||||
|
#include "cmdparser.h" // command_t
|
||||||
|
#include "comms.h" // clearCommandBuffer
|
||||||
|
#include "cmdtrace.h"
|
||||||
|
#include "crc16.h"
|
||||||
|
#include "ui.h"
|
||||||
|
#include "cmdhf14a.h" // manufacture
|
||||||
|
#include "protocols.h" // definitions of ISO14A/7816 protocol
|
||||||
|
#include "emv/apduinfo.h" // GetAPDUCodeDescription
|
||||||
|
#include "crypto/asn1utils.h" // ASN1 decode / print
|
||||||
|
|
||||||
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
static uint16_t get_sw(uint8_t *d, uint8_t n) {
|
||||||
|
if (n < 2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
n -= 2;
|
||||||
|
return d[n] * 0x0100 + d[n + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int seos_select(void) {
|
||||||
|
bool activate_field = true;
|
||||||
|
bool keep_field_on = true;
|
||||||
|
uint8_t response[PM3_CMD_DATA_SIZE];
|
||||||
|
int resplen = 0;
|
||||||
|
|
||||||
|
// --------------- Select NDEF Tag application ----------------
|
||||||
|
uint8_t aSELECT_AID[80];
|
||||||
|
int aSELECT_AID_n = 0;
|
||||||
|
param_gethex_to_eol("00a404000aa000000440000101000100", 0, aSELECT_AID, sizeof(aSELECT_AID), &aSELECT_AID_n);
|
||||||
|
int res = ExchangeAPDU14a(aSELECT_AID, aSELECT_AID_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
DropField();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resplen < 2) {
|
||||||
|
DropField();
|
||||||
|
return PM3_ESOFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t sw = get_sw(response, resplen);
|
||||||
|
if (sw != 0x9000) {
|
||||||
|
PrintAndLogEx(ERR, "Selecting SEOS applet aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
|
DropField();
|
||||||
|
return PM3_ESOFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
activate_field = false;
|
||||||
|
keep_field_on = false;
|
||||||
|
// --------------- CC file reading ----------------
|
||||||
|
|
||||||
|
uint8_t aSELECT_FILE_ADF[30];
|
||||||
|
int aSELECT_FILE_ADF_n = 0;
|
||||||
|
param_gethex_to_eol("80a504001306112b0601040181e43801010201180101020200", 0, aSELECT_FILE_ADF, sizeof(aSELECT_FILE_ADF), &aSELECT_FILE_ADF_n);
|
||||||
|
res = ExchangeAPDU14a(aSELECT_FILE_ADF, aSELECT_FILE_ADF_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
DropField();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw = get_sw(response, resplen);
|
||||||
|
if (sw != 0x9000) {
|
||||||
|
PrintAndLogEx(ERR, "Selecting ADF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
|
DropField();
|
||||||
|
return PM3_ESOFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the 2byte SW
|
||||||
|
asn1_print(response, resplen - 2, " ");
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int infoSeos(bool verbose) {
|
||||||
|
int res = seos_select();
|
||||||
|
if (res == PM3_SUCCESS) {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
|
||||||
|
}
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CmdHfSeosInfo(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf seos info",
|
||||||
|
"Get info from SEOS tags",
|
||||||
|
"hf seos info");
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
return infoSeos(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CmdHfSeosList(const char *Cmd) {
|
||||||
|
return CmdTraceListAlias(Cmd, "hf seos", "7816");
|
||||||
|
}
|
||||||
|
|
||||||
|
static command_t CommandTable[] = {
|
||||||
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
|
{"info", CmdHfSeosInfo, IfPm3NfcBarcode, "Tag information"},
|
||||||
|
{"list", CmdHfSeosList, AlwaysAvailable, "List SEOS history"},
|
||||||
|
{NULL, NULL, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
static int CmdHelp(const char *Cmd) {
|
||||||
|
(void)Cmd; // Cmd is not used so far
|
||||||
|
CmdsHelp(CommandTable);
|
||||||
|
return PM3_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CmdHFSeos(const char *Cmd) {
|
||||||
|
clearCommandBuffer();
|
||||||
|
return CmdsParse(CommandTable, Cmd);
|
||||||
|
}
|
||||||
19
client/src/cmdhfseos.h
Normal file
19
client/src/cmdhfseos.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2021 iceman
|
||||||
|
//
|
||||||
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||||
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
|
// the license.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// SEOS commands
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef CMDHFSEOS_H__
|
||||||
|
#define CMDHFSEOS_H__
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
int infoSeos(bool verbose);
|
||||||
|
int CmdHFSeos(const char *Cmd);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
/* This is the default version.c file that Makefile.common falls back to if neither sh nor perl are available */
|
/* This is the default version_pm3.c file that Makefile.common falls back to if neither sh nor perl are available */
|
||||||
#ifndef ON_DEVICE
|
#ifndef ON_DEVICE
|
||||||
#define SECTVERSINFO
|
#define SECTVERSINFO
|
||||||
#else
|
#else
|
||||||
@@ -145,17 +145,7 @@ typedef struct {
|
|||||||
#define TRACELOG_HDR_LEN sizeof(tracelog_hdr_t)
|
#define TRACELOG_HDR_LEN sizeof(tracelog_hdr_t)
|
||||||
#define TRACELOG_PARITY_LEN(x) (((x)->data_len - 1) / 8 + 1)
|
#define TRACELOG_PARITY_LEN(x) (((x)->data_len - 1) / 8 + 1)
|
||||||
|
|
||||||
/*
|
// T55XX - Extended to support 1 of 4 timing
|
||||||
typedef struct {
|
|
||||||
uint16_t start_gap;
|
|
||||||
uint16_t write_gap;
|
|
||||||
uint16_t write_0;
|
|
||||||
uint16_t write_1;
|
|
||||||
uint16_t read_gap;
|
|
||||||
} t55xx_config;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Extended to support 1 of 4 timing
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t start_gap;
|
uint16_t start_gap;
|
||||||
uint16_t write_gap;
|
uint16_t write_gap;
|
||||||
@@ -166,22 +156,14 @@ typedef struct {
|
|||||||
uint16_t write_3;
|
uint16_t write_3;
|
||||||
} t55xx_config_t;
|
} t55xx_config_t;
|
||||||
|
|
||||||
// This setup will allow for the 4 downlink modes "m" as well as other items if needed.
|
// T55XX - This setup will allow for the 4 downlink modes "m" as well as other items if needed.
|
||||||
// Given the one struct we can then read/write to flash/client in one go.
|
// Given the one struct we can then read/write to flash/client in one go.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
t55xx_config_t m[4]; // mode
|
t55xx_config_t m[4]; // mode
|
||||||
} t55xx_configurations_t;
|
} t55xx_configurations_t;
|
||||||
|
|
||||||
/*typedef struct {
|
|
||||||
uint16_t start_gap [4];
|
// Capabilities struct to keep track of what functions was compiled in the device firmware
|
||||||
uint16_t write_gap [4];
|
|
||||||
uint16_t write_0 [4];
|
|
||||||
uint16_t write_1 [4];
|
|
||||||
uint16_t write_2 [4];
|
|
||||||
uint16_t write_3 [4];
|
|
||||||
uint16_t read_gap [4];
|
|
||||||
} t55xx_config;
|
|
||||||
*/
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint32_t baudrate;
|
uint32_t baudrate;
|
||||||
|
|||||||
@@ -40,9 +40,13 @@ static bool all_feof(FILE *infile[], uint8_t num_infiles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
||||||
uint8_t *fpga_config;
|
|
||||||
|
|
||||||
fpga_config = calloc(num_infiles * FPGA_CONFIG_SIZE, sizeof(uint8_t));
|
uint8_t *fpga_config = calloc(num_infiles * FPGA_CONFIG_SIZE, sizeof(uint8_t));
|
||||||
|
if (fpga_config == NULL) {
|
||||||
|
fprintf(stderr, "failed to allocate memory");
|
||||||
|
return (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
// read the input files. Interleave them into fpga_config[]
|
// read the input files. Interleave them into fpga_config[]
|
||||||
uint32_t total_size = 0;
|
uint32_t total_size = 0;
|
||||||
do {
|
do {
|
||||||
@@ -99,6 +103,9 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
|
|||||||
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
|
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
|
||||||
if (cmp_bytes < 0 ){
|
if (cmp_bytes < 0 ){
|
||||||
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
|
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
|
||||||
|
free(ring_buffer);
|
||||||
|
free(outbuf);
|
||||||
|
free(fpga_config);
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
fwrite(&cmp_bytes, sizeof(int), 1, outfile);
|
fwrite(&cmp_bytes, sizeof(int), 1, outfile);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env perl -w
|
#!/usr/bin/env perl -w
|
||||||
|
|
||||||
# Output a version.c file that includes information about the current build
|
# Output a version_pm3.c file that includes information about the current build
|
||||||
# Normally a couple of lines of bash would be enough (see openpcd project, original firmware by Harald Welte and Milosch Meriac)
|
# Normally a couple of lines of bash would be enough (see openpcd project, original firmware by Harald Welte and Milosch Meriac)
|
||||||
# but this will, at least in theory, also work on Windows with our current compile environment.
|
# but this will, at least in theory, also work on Windows with our current compile environment.
|
||||||
# -- Henryk Plötz <henryk@ploetzli.ch> 2009-09-28
|
# -- Henryk Plötz <henryk@ploetzli.ch> 2009-09-28
|
||||||
@@ -23,7 +23,7 @@ my $undecided = (defined $ARGV[0]) && ($ARGV[0] =~ '--undecided');
|
|||||||
#######
|
#######
|
||||||
# solves some bug on macos i.e:
|
# solves some bug on macos i.e:
|
||||||
##
|
##
|
||||||
# perl ../tools/mkversion.pl .. > version.c || cp ../common/default_version.c version.c
|
# perl ../tools/mkversion.pl .. > version_pm3.c || cp ../common/default_version_pm3.c version_pm3.c
|
||||||
# /usr/bin/which: /usr/bin/which: cannot execute binary file
|
# /usr/bin/which: /usr/bin/which: cannot execute binary file
|
||||||
# fatal: No names found, cannot describe anything.
|
# fatal: No names found, cannot describe anything.
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Output a version.c file that includes information about the current build
|
# Output a version_pm3.c file that includes information about the current build
|
||||||
# From mkversion.pl
|
# From mkversion.pl
|
||||||
# pure sh POSIX as now even on Windows we use WSL or ProxSpace with sh available
|
# pure sh POSIX as now even on Windows we use WSL or ProxSpace with sh available
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user