mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge remote-tracking branch 'upstream/master' into hf_mf_sim
This commit is contained in:
+10
-1
@@ -1,6 +1,15 @@
|
||||
# .gitattributes
|
||||
|
||||
# prevent binary files from CRLF handling, diff and merge:
|
||||
fpga/fpga.bit -crlf -diff
|
||||
*.bin -crlf -diff
|
||||
*.z -crlf -diff
|
||||
|
||||
|
||||
# Force LF
|
||||
*.c text=auto eol=lf
|
||||
*.cpp text=auto eol=lf
|
||||
*.h text=auto eol=lf
|
||||
*.lua text=auto eol=lf
|
||||
*.py text=auto eol=lf
|
||||
*.pl text=auto eol=lf
|
||||
Makefile text=auto eol=lf
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*.exe
|
||||
*.dsym
|
||||
version.c
|
||||
*.json
|
||||
|
||||
!client/hardnested/*.bin
|
||||
!client/hardnested/tables/*.z
|
||||
|
||||
@@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- *WIP* Add FPC usart with pm3 client: WITH_FPC_HOST. (@doegox)
|
||||
- Add '-b baudrate' option to the pm3 client. (@doegox)
|
||||
- Change 'lf t55xx info': tell if known configuration block0. (@iceman)
|
||||
- Fix/Add FPC usart: fix TX, bring RX, full speed. (@doegox)
|
||||
- Change 'lf t55xx config' options: allow to toggle on/off i/q5/st
|
||||
- Change 'lf t55xx info': support offline block0, Q5, fix extended, add warns. (@doegox)
|
||||
- Avoid race condition when flasher finds the not yet closed pm3 port. (@doegox)
|
||||
- Fix 'lf t55xx trace': read the proper block. (@doegox)
|
||||
- Fix Indala 64 on T55xx: use PSK1. (@doegox)
|
||||
- Force proper Linefeed (LF) handling in ProxSpace. (@vratiskol)
|
||||
- Fix Makefiles race conditions to allow parallel compilation, e.g. 'make -j8'. (@doegox)
|
||||
- Add - dictionary key file for MFU. (not in use at the moment) (@mazodude)
|
||||
- Change 'lf fdx demod - better biphase maxerrors. (@MalteHillmann)
|
||||
- Change 'hf mf sim' - now works better against android (@mceloff)
|
||||
- Fix 'lf t55xx brute' - now works after aquiredata adaptations (@iceman)
|
||||
- Fix 'lf t55xx chk' - now works after aquiredata adaptations (@iceman)
|
||||
- Fix 'lf t55xx recoverpwd' - now works after aquiredata adaptations (@iceman)
|
||||
- Fix 'data detect p' - reverted bad clock detection (@iceman)
|
||||
- Change 'data detect a' - better clock detection (@iceman)
|
||||
- Add 'hf 14a info' - now detects some magic card Gen2 (@iceman)
|
||||
- Removed 'LCD' code in armsrc compilation (@iceman)
|
||||
- Change - Generic fixes of codestyle (@doegox) (@iceman)
|
||||
- Change 'lf indala demod' - refactoring (@iceman)
|
||||
- Change - handling fault bit markers (7) and partial nibbles in hex printing (@doegox)
|
||||
- Change - printing of fault bit markers (7) using a dot (@doegox)
|
||||
- Change 'sc upgrade' - firmware file integrity check (@piwi)
|
||||
|
||||
@@ -128,7 +128,7 @@ style:
|
||||
@which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
|
||||
# Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
-exec perl -pi -e 's/[ \t\r]+$$//' {} \; \
|
||||
-exec perl -pi -e 's/[ \t]+$$//' {} \; \
|
||||
-exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \
|
||||
-exec sh -c "echo >> {}" \;
|
||||
# Apply astyle on *.c, *.h, *.cpp
|
||||
|
||||
+25
-22
@@ -632,7 +632,6 @@ void ListenReaderField(int limit) {
|
||||
|
||||
void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
UsbCommand *c = (UsbCommand *)packet;
|
||||
|
||||
//Dbprintf("received %d bytes, with command: 0x%04x and args: %d %d %d", len, c->cmd, c->arg[0], c->arg[1], c->arg[2]);
|
||||
|
||||
switch (c->cmd) {
|
||||
@@ -1105,29 +1104,32 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
*/
|
||||
|
||||
|
||||
char dest[USB_CMD_DATA_SIZE] = { '\0' };
|
||||
static const char *welcome = "Proxmark3 Serial interface via FPC ready\n";
|
||||
strncat(dest, welcome, sizeof(dest) - strlen(dest) - 1);
|
||||
sprintf(dest + strlen(dest) - 1, "| bytes 0x%02x 0x%02x 0x%02x 0x%02x \n"
|
||||
char dest[USB_CMD_DATA_SIZE] = {'\0'};
|
||||
if (usart_dataavailable()) {
|
||||
Dbprintf("RX DATA!");
|
||||
uint16_t len = usart_readbuffer((uint8_t *)dest);
|
||||
dest[len] = '\0';
|
||||
Dbprintf("RX: %d | %02X %02X %02X %02X %02X %02X %02X %02X ", len, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
|
||||
}
|
||||
|
||||
static const char *welcome = "Proxmark3 Serial interface via FPC ready\r\n";
|
||||
usart_writebuffer((uint8_t *)welcome, strlen(welcome));
|
||||
|
||||
sprintf(dest, "| bytes 0x%02x 0x%02x 0x%02x 0x%02x\r\n"
|
||||
, c->d.asBytes[0]
|
||||
, c->d.asBytes[1]
|
||||
, c->d.asBytes[2]
|
||||
, c->d.asBytes[3]
|
||||
);
|
||||
usart_writebuffer((uint8_t *)dest, strlen(dest));
|
||||
|
||||
UsbCommand txcmd = { CMD_DEBUG_PRINT_STRING, { strlen(dest), 0, 0 } };
|
||||
memcpy(txcmd.d.asBytes, dest, sizeof(dest));
|
||||
|
||||
LED_A_ON();
|
||||
|
||||
usart_init();
|
||||
usart_writebuffer((uint8_t *)&txcmd, sizeof(UsbCommand));
|
||||
|
||||
//usb
|
||||
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
|
||||
LED_A_OFF();
|
||||
|
||||
|
||||
/*
|
||||
uint8_t my_rx[sizeof(UsbCommand)];
|
||||
while (!BUTTON_PRESS() && !usb_poll_validate_length()) {
|
||||
@@ -1136,13 +1138,12 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||
//UsbPacketReceived(my_rx, sizeof(my_rx));
|
||||
|
||||
UsbCommand *my = (UsbCommand *)my_rx;
|
||||
if (mc->cmd > 0 ) {
|
||||
if (my->cmd > 0 ) {
|
||||
Dbprintf("received command: 0x%04x and args: %d %d %d", my->cmd, my->arg[0], my->arg[1], my->arg[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
|
||||
|
||||
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
|
||||
@@ -1558,17 +1559,19 @@ void __attribute__((noreturn)) AppMain(void) {
|
||||
|
||||
// Check if there is a usb packet available
|
||||
if (usb_poll_validate_length()) {
|
||||
if (usb_read(rx, sizeof(rx)))
|
||||
if (usb_read(rx, sizeof(rx))) {
|
||||
#ifdef WITH_FPC_HOST
|
||||
reply_via_fpc = 0;
|
||||
#endif
|
||||
UsbPacketReceived(rx, sizeof(rx));
|
||||
}
|
||||
}
|
||||
#ifdef WITH_FPC_HOST
|
||||
// Check if there is a FPC packet available
|
||||
if (usart_readcommand(rx) > 0) {
|
||||
reply_via_fpc = 1;
|
||||
UsbPacketReceived(rx, sizeof(rx));
|
||||
}
|
||||
#ifdef WITH_FPC
|
||||
// Check is there is FPC package available
|
||||
/*
|
||||
usart_init();
|
||||
if (usart_readbuffer(rx, sizeof(rx)) )
|
||||
UsbPacketReceived(rx, sizeof(rx) );
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
// Press button for one second to enter a possible standalone mode
|
||||
|
||||
+6
-6
@@ -138,7 +138,7 @@ static void hitag_send_bit(int bit) {
|
||||
|
||||
static void hitag_send_frame(const uint8_t *frame, size_t frame_len) {
|
||||
// SOF - send start of frame
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
hitag_send_bit(1);
|
||||
@@ -399,10 +399,10 @@ static bool hitag2_write_page(uint8_t *rx, const size_t rxlen, uint8_t *tx, size
|
||||
break;
|
||||
case WRITE_STATE_PAGENUM_WRITTEN:
|
||||
// Check if page number was received correctly
|
||||
if ( (rxlen == 10)
|
||||
&& (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2)))
|
||||
&& (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) {
|
||||
|
||||
if ((rxlen == 10)
|
||||
&& (rx[0] == (0x82 | (blocknr << 3) | ((blocknr ^ 7) >> 2)))
|
||||
&& (rx[1] == (((blocknr & 0x3) ^ 0x3) << 6))) {
|
||||
|
||||
*txlen = 32;
|
||||
memset(tx, 0, HITAG_FRAME_LEN);
|
||||
memcpy(tx, writedata, 4);
|
||||
@@ -1280,7 +1280,7 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) {
|
||||
|
||||
// Receive frame, watch for at most T0*EOF periods
|
||||
while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_WAIT_MAX) {
|
||||
|
||||
|
||||
// Check if falling edge in tag modulation is detected
|
||||
if (AT91C_BASE_TC1->TC_SR & AT91C_TC_LDRAS) {
|
||||
// Retrieve the new timing values
|
||||
|
||||
+1
-1
@@ -2980,4 +2980,4 @@ void DetectNACKbug() {
|
||||
|
||||
void AppendCrc14443a(uint8_t *data, int len) {
|
||||
compute_crc(CRC_14443_A, data, len, data + len, data + len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-7
@@ -1529,7 +1529,7 @@ void T55xxReadBlock(uint16_t arg0, uint8_t Block, uint32_t Pwd) {
|
||||
// Turn field on to read the response
|
||||
// 137*8 seems to get to the start of data pretty well...
|
||||
// but we want to go past the start and let the repeating data settle in...
|
||||
TurnReadLFOn(200 * 8);
|
||||
TurnReadLFOn(150 * 8);
|
||||
|
||||
// Acquisition
|
||||
// Now do the acquisition
|
||||
@@ -1731,14 +1731,15 @@ void CopyIOtoT55x7(uint32_t hi, uint32_t lo) {
|
||||
// Clone Indala 64-bit tag by UID to T55x7
|
||||
void CopyIndala64toT55x7(uint32_t hi, uint32_t lo) {
|
||||
//Program the 2 data blocks for supplied 64bit UID
|
||||
// and the Config for Indala 64 format (RF/32;PSK2 with RF/2;Maxblock=2)
|
||||
uint32_t data[] = { T55x7_BITRATE_RF_32 | T55x7_MODULATION_PSK2 | (2 << T55x7_MAXBLOCK_SHIFT), hi, lo};
|
||||
// and the Config for Indala 64 format (RF/32;PSK1 with RF/2;Maxblock=2)
|
||||
uint32_t data[] = { T55x7_BITRATE_RF_32 | T55x7_MODULATION_PSK1 | (2 << T55x7_MAXBLOCK_SHIFT), hi, lo};
|
||||
//TODO add selection of chip for Q5 or T55x7
|
||||
// data[0] = T5555_SET_BITRATE(32 | T5555_MODULATION_PSK2 | 2 << T5555_MAXBLOCK_SHIFT;
|
||||
|
||||
// data[0] = T5555_SET_BITRATE(32 | T5555_MODULATION_PSK1 | 2 << T5555_MAXBLOCK_SHIFT;
|
||||
LED_D_ON();
|
||||
WriteT55xx(data, 0, 3);
|
||||
//Alternative config for Indala (Extended mode;RF/32;PSK2 with RF/2;Maxblock=2;Inverse data)
|
||||
//Alternative config for Indala (Extended mode;RF/32;PSK1 with RF/2;Maxblock=2;Inverse data)
|
||||
// T5567WriteBlock(0x603E1042,0);
|
||||
LED_D_OFF();
|
||||
}
|
||||
// Clone Indala 224-bit tag by UID to T55x7
|
||||
void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t uid4, uint32_t uid5, uint32_t uid6, uint32_t uid7) {
|
||||
@@ -1749,9 +1750,11 @@ void CopyIndala224toT55x7(uint32_t uid1, uint32_t uid2, uint32_t uid3, uint32_t
|
||||
data[0] = T55x7_BITRATE_RF_32 | T55x7_MODULATION_PSK2 | (7 << T55x7_MAXBLOCK_SHIFT);
|
||||
//TODO add selection of chip for Q5 or T55x7
|
||||
// data[0] = T5555_SET_BITRATE(32 | T5555_MODULATION_PSK2 | 7 << T5555_MAXBLOCK_SHIFT;
|
||||
LED_D_ON();
|
||||
WriteT55xx(data, 0, 8);
|
||||
//Alternative config for Indala (Extended mode;RF/32;PSK2 with RF/2;Maxblock=7;Inverse data)
|
||||
//Alternative config for Indala (Extended mode;RF/32;PSK1 with RF/2;Maxblock=7;Inverse data)
|
||||
// T5567WriteBlock(0x603E10E2,0);
|
||||
LED_D_OFF();
|
||||
}
|
||||
// clone viking tag to T55xx
|
||||
void CopyVikingtoT55xx(uint32_t block1, uint32_t block2, uint8_t Q5) {
|
||||
|
||||
+6
-6
@@ -1938,13 +1938,13 @@ void MifareCIdent() {
|
||||
uint8_t *buf = BigBuf_malloc(USB_CMD_DATA_SIZE);
|
||||
uint8_t *uid = BigBuf_malloc(10);
|
||||
uint32_t cuid = 0;
|
||||
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
// Generation 1 test
|
||||
ReaderTransmitBitsPar(wupC1, 7, NULL, NULL);
|
||||
if (!ReaderReceive(rec, recpar) || (rec[0] != 0x0a)) {
|
||||
goto TEST2;
|
||||
goto TEST2;
|
||||
};
|
||||
isGen = GEN_1B;
|
||||
|
||||
@@ -1960,10 +1960,10 @@ TEST2:
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
SpinDelay(100);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
|
||||
int res = iso14443a_select_card(uid, NULL, &cuid, true, 0, true);
|
||||
if ( res == 2 ) {
|
||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||
if (res == 2) {
|
||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||
res = ReaderReceive(buf, par);
|
||||
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
||||
isGen = GEN_2;
|
||||
@@ -1973,7 +1973,7 @@ TEST2:
|
||||
isGen = GEN_2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
OUT:
|
||||
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
|
||||
// turns off
|
||||
|
||||
+8
-8
@@ -137,15 +137,15 @@ bool IsBlock0PCF7931(uint8_t *block) {
|
||||
bool IsBlock1PCF7931(uint8_t *block) {
|
||||
// assuming all RFU bits are set to 0
|
||||
if (block[10] == 0
|
||||
&& block[11] == 0
|
||||
&& block[12] == 0
|
||||
&& block[13] == 0) {
|
||||
|
||||
if ( (block[14] & 0x7f) <= 9
|
||||
&& block[15] <= 9) {
|
||||
return true;
|
||||
}
|
||||
&& block[11] == 0
|
||||
&& block[12] == 0
|
||||
&& block[13] == 0) {
|
||||
|
||||
if ((block[14] & 0x7f) <= 9
|
||||
&& block[15] <= 9) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+13
-14
@@ -282,8 +282,7 @@ ifeq "$(SUPPORTS_AVX512)" "True"
|
||||
endif
|
||||
|
||||
BINS = proxmark3 flasher fpga_compress
|
||||
WINBINS = $(patsubst %, %.exe, $(BINS))
|
||||
CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/usb_cmd.lua lualibs/mf_default_keys.lua
|
||||
CLEAN = $(BINS) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/usb_cmd.lua lualibs/mf_default_keys.lua
|
||||
|
||||
# need to assign dependancies to build these first...
|
||||
all: lua_build jansson_build mbedtls_build cbor_build $(BINS)
|
||||
@@ -347,28 +346,28 @@ cbor_build:
|
||||
print-%: ; @echo $* = $($*)
|
||||
|
||||
$(OBJDIR)/%_NOSIMD.o : %.c $(OBJDIR)/%_NOSIMD.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_NOSIMD) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_NOSIMD.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_NOSIMD.Td) $(CFLAGS) $(HARD_SWITCH_NOSIMD) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_NOSIMD.Td $(OBJDIR)/$*_NOSIMD.d
|
||||
|
||||
$(OBJDIR)/%_MMX.o : %.c $(OBJDIR)/%_MMX.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_MMX) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_MMX.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_MMX.Td) $(CFLAGS) $(HARD_SWITCH_MMX) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_MMX.Td $(OBJDIR)/$*_MMX.d
|
||||
|
||||
$(OBJDIR)/%_SSE2.o : %.c $(OBJDIR)/%_SSE2.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_SSE2) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_SSE2.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_SSE2.Td) $(CFLAGS) $(HARD_SWITCH_SSE2) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_SSE2.Td $(OBJDIR)/$*_SSE2.d
|
||||
|
||||
$(OBJDIR)/%_AVX.o : %.c $(OBJDIR)/%_AVX.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_AVX.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_AVX.Td) $(CFLAGS) $(HARD_SWITCH_AVX) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_AVX.Td $(OBJDIR)/$*_AVX.d
|
||||
|
||||
$(OBJDIR)/%_AVX2.o : %.c $(OBJDIR)/%_AVX2.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX2) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_AVX2.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_AVX2.Td) $(CFLAGS) $(HARD_SWITCH_AVX2) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_AVX2.Td $(OBJDIR)/$*_AVX2.d
|
||||
|
||||
$(OBJDIR)/%_AVX512.o : %.c $(OBJDIR)/%_AVX512.d
|
||||
$(CC) $(DEPFLAGS) $(CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
|
||||
$(POSTCOMPILE:%.d=%_AVX512.d)
|
||||
$(CC) $(DEPFLAGS:%.Td=%_AVX512.Td) $(CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
|
||||
$(MV) -f $(OBJDIR)/$*_AVX512.Td $(OBJDIR)/$*_AVX512.d
|
||||
|
||||
%.o: %.c
|
||||
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ int GetModels(char *Models[], int *count, uint8_t *width) {
|
||||
PrintAndLogEx(WARNING, "out of memory?");
|
||||
return 0;
|
||||
}
|
||||
if ( model.name != NULL ) {
|
||||
if (model.name != NULL) {
|
||||
memcpy(tmp, model.name, size);
|
||||
Models[mode] = tmp;
|
||||
width[mode] = plen(model.spoly);
|
||||
|
||||
+19
-16
@@ -459,7 +459,7 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
|
||||
|
||||
sscanf(Cmd, "%i %i %i %i %c", &clk, &invert, &maxErr, &maxLen, &);
|
||||
|
||||
|
||||
if (!maxLen) maxLen = BIGBUF_SIZE;
|
||||
|
||||
if (invert != 0 && invert != 1) {
|
||||
@@ -486,17 +486,17 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||
if (amp == 'a') {
|
||||
askAmp(bits, BitLen);
|
||||
}
|
||||
|
||||
|
||||
size_t ststart = 0, stend = 0;
|
||||
// if (*stCheck)
|
||||
bool st = DetectST(bits, &BitLen, &foundclk, &ststart, &stend);
|
||||
|
||||
if ( clk == 0 ) {
|
||||
if ( foundclk == 32 || foundclk == 64 ) {
|
||||
if (clk == 0) {
|
||||
if (foundclk == 32 || foundclk == 64) {
|
||||
clk = foundclk;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (st) {
|
||||
*stCheck = st;
|
||||
CursorCPos = ststart;
|
||||
@@ -615,12 +615,15 @@ int Cmdmandecoderaw(const char *Cmd) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//by marshmellow
|
||||
//biphase decode
|
||||
//take 01 or 10 = 0 and 11 or 00 = 1
|
||||
//takes 2 arguments "offset" default = 0 if 1 it will shift the decode by one bit
|
||||
// and "invert" default = 0 if 1 it will invert output
|
||||
// the argument offset allows us to manually shift if the output is incorrect - [EDIT: now auto detects]
|
||||
/*
|
||||
* @author marshmellow
|
||||
* biphase decode
|
||||
* decodes 01 or 10 -> ZERO
|
||||
* 11 or 00 -> ONE
|
||||
* param offset adjust start position
|
||||
* param invert invert output
|
||||
* param masxErr maximum tolerated errors
|
||||
*/
|
||||
int CmdBiphaseDecodeRaw(const char *Cmd) {
|
||||
size_t size = 0;
|
||||
int offset = 0, invert = 0, maxErr = 20, errCnt = 0;
|
||||
@@ -1095,9 +1098,9 @@ int CmdFSKrawdemod(const char *Cmd) {
|
||||
//attempt to psk1 demod graph buffer
|
||||
int PSKDemod(const char *Cmd, bool verbose) {
|
||||
int invert = 0, clk = 0, maxErr = 100;
|
||||
|
||||
|
||||
sscanf(Cmd, "%i %i %i", &clk, &invert, &maxErr);
|
||||
|
||||
|
||||
if (clk == 1) {
|
||||
invert = 1;
|
||||
clk = 0;
|
||||
@@ -1112,9 +1115,9 @@ int PSKDemod(const char *Cmd, bool verbose) {
|
||||
|
||||
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
|
||||
size_t bitlen = getFromGraphBuf(bits);
|
||||
if (bitlen == 0)
|
||||
if (bitlen == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
int startIdx = 0;
|
||||
int errCnt = pskRawDemod_ext(bits, &bitlen, &clk, &invert, &startIdx);
|
||||
if (errCnt > maxErr) {
|
||||
@@ -1317,7 +1320,7 @@ int CmdRawDemod(const char *Cmd) {
|
||||
void setClockGrid(int clk, int offset) {
|
||||
g_DemodStartIdx = offset;
|
||||
g_DemodClock = clk;
|
||||
if ( clk == 0 && offset == 0)
|
||||
if (clk == 0 && offset == 0)
|
||||
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) clear settings");
|
||||
else
|
||||
PrintAndLogEx(DEBUG, "DEBUG: (setClockGrid) demodoffset %d, clk %d", offset, clk);
|
||||
|
||||
+8
-8
@@ -524,7 +524,7 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||
(tb1 ? "" : " NOT"),
|
||||
(tc1 ? "" : " NOT"),
|
||||
fsci,
|
||||
fsci < sizeof(atsFSC)/sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
|
||||
fsci < sizeof(atsFSC) / sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
|
||||
);
|
||||
}
|
||||
pos = 2;
|
||||
@@ -544,8 +544,8 @@ int CmdHF14AInfo(const char *Cmd) {
|
||||
((card.ats[pos] & 0x80) ? " NOT" : ""),
|
||||
dr,
|
||||
ds
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
pos++;
|
||||
}
|
||||
if (tb1) {
|
||||
@@ -959,7 +959,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||
// get frame length from ATS in data field
|
||||
if (resp.arg[0] > 1) {
|
||||
uint8_t fsci = resp.d.asBytes[1] & 0x0f;
|
||||
if (fsci < sizeof(atsFSC)/sizeof(atsFSC[0]))
|
||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
||||
frameLength = atsFSC[fsci];
|
||||
}
|
||||
} else {
|
||||
@@ -967,7 +967,7 @@ int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||
iso14a_card_select_t *vcard = (iso14a_card_select_t *) resp.d.asBytes;
|
||||
if (vcard->ats_len > 1) {
|
||||
uint8_t fsci = vcard->ats[1] & 0x0f;
|
||||
if (fsci < sizeof(atsFSC)/sizeof(atsFSC[0]))
|
||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
||||
frameLength = atsFSC[fsci];
|
||||
}
|
||||
|
||||
@@ -1000,10 +1000,10 @@ int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool activa
|
||||
// here length USB_CMD_DATA_SIZE=512
|
||||
// timeout must be authomatically set by "get ATS"
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_APDU | ISO14A_NO_DISCONNECT | cmdc, (datainlen & 0xFFFF), 0}};
|
||||
|
||||
if ( datain )
|
||||
|
||||
if (datain)
|
||||
memcpy(c.d.asBytes, datain, datainlen);
|
||||
|
||||
|
||||
SendCommand(&c);
|
||||
|
||||
uint8_t *recv;
|
||||
|
||||
@@ -425,8 +425,8 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
||||
}
|
||||
|
||||
uint64_t tracelen = resp.arg[1];
|
||||
if (tracelen == 0)
|
||||
return 1;
|
||||
if (tracelen == 0)
|
||||
return 1;
|
||||
|
||||
uint8_t *trace = calloc(tracelen, sizeof(uint8_t));
|
||||
if (trace == NULL) {
|
||||
@@ -444,14 +444,14 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
|
||||
|
||||
print_hex_break(trace, tracelen, 32);
|
||||
printSep();
|
||||
|
||||
|
||||
uint16_t tracepos = 0;
|
||||
while (tracepos < tracelen)
|
||||
tracepos = PrintFliteBlock(tracepos, trace, tracelen);
|
||||
|
||||
printSep();
|
||||
|
||||
free(trace);
|
||||
free(trace);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ int CmdHFiClassDecrypt(const char *Cmd) {
|
||||
|
||||
saveFile(outfilename, "bin", decrypted, fsize);
|
||||
printIclassDumpContents(decrypted, 1, (fsize / 8), fsize);
|
||||
free(decrypted);
|
||||
free(decrypted);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -169,7 +169,7 @@ int CmdLegicInfo(const char *Cmd) {
|
||||
int crc = 0, wrp = 0, wrc = 0;
|
||||
uint8_t stamp_len = 0;
|
||||
uint16_t datalen = 0;
|
||||
char token_type[5] = {0, 0, 0, 0, 0};
|
||||
char token_type[6] = {0, 0, 0, 0, 0, 0};
|
||||
int dcf = 0;
|
||||
int bIsSegmented = 0;
|
||||
|
||||
@@ -1282,7 +1282,7 @@ int CmdLegicWipe(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "ok\n");
|
||||
free(data);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -423,7 +423,7 @@ int CmdVersion(const char *Cmd) {
|
||||
#else
|
||||
PrintAndLogEx(NORMAL, "\n\e[34m [ Proxmark3 RFID instrument ]\e[0m\n");
|
||||
#endif
|
||||
char s[50] = {0};
|
||||
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);
|
||||
#endif
|
||||
@@ -434,7 +434,11 @@ int CmdVersion(const char *Cmd) {
|
||||
strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1);
|
||||
#endif
|
||||
#ifdef WITH_FPC
|
||||
#ifdef WITH_FPC_HOST
|
||||
strncat(s, "fpc-host; ", sizeof(s) - strlen(s) - 1);
|
||||
#else
|
||||
strncat(s, "fpc; ", sizeof(s) - strlen(s) - 1);
|
||||
#endif
|
||||
#endif
|
||||
PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
|
||||
PrintAndLogEx(NORMAL, " client: iceman %s \n", s);
|
||||
|
||||
+1
-1
@@ -839,7 +839,7 @@ bool CheckChipType(bool getDeviceData) {
|
||||
|
||||
//check for t55xx chip...
|
||||
if (tryDetectP1(true)) {
|
||||
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("Atmel T55xx") " found");
|
||||
PrintAndLogEx(SUCCESS, "\nChipset detection : " _GREEN_("T55xx") " found");
|
||||
PrintAndLogEx(SUCCESS, "Try " _YELLOW_("`lf t55xx`")" commands");
|
||||
retval = true;
|
||||
goto out;
|
||||
|
||||
+17
-17
@@ -344,7 +344,7 @@ int CmdLFHitagSim(const char *Cmd) {
|
||||
}
|
||||
|
||||
static void printHitagConfiguration(uint8_t config) {
|
||||
|
||||
|
||||
char msg[100];
|
||||
memset(msg, 0, sizeof(msg));
|
||||
|
||||
@@ -357,10 +357,10 @@ static void printHitagConfiguration(uint8_t config) {
|
||||
|
||||
PrintAndLogEx(INFO, "\n\nHitag2 tag information ");
|
||||
PrintAndLogEx(INFO, "------------------------------------");
|
||||
|
||||
|
||||
//configuration byte
|
||||
PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Config byte : 0x%02X [ %s ]", config, bits);
|
||||
|
||||
// encoding
|
||||
strcat(msg, "Encoding : ");
|
||||
if (config & 0x1) {
|
||||
@@ -415,7 +415,7 @@ static void printHitagConfiguration(uint8_t config) {
|
||||
memset(msg, 0, sizeof(msg));
|
||||
|
||||
// page access
|
||||
strcat(msg, "Page 4,5 : ");
|
||||
strcat(msg, "Page 4,5 : ");
|
||||
if (config & 0x20) {
|
||||
strcat(msg + strlen(msg), "read only");
|
||||
} else {
|
||||
@@ -467,9 +467,9 @@ static bool getHitagUid(uint32_t *uid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( uid )
|
||||
if (uid)
|
||||
*uid = bytes_to_num(resp.d.asBytes, 4);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -480,18 +480,18 @@ int CmdLFHitagInfo(const char *Cmd) {
|
||||
|
||||
char ctmp = tolower(param_getchar(Cmd, 0));
|
||||
if (ctmp == 'h') return usage_hitag_info();
|
||||
|
||||
|
||||
// pwd or key
|
||||
|
||||
// read UID
|
||||
uint32_t uid = 0;
|
||||
if ( getHitagUid( &uid ) == false )
|
||||
if (getHitagUid(&uid) == false)
|
||||
return 1;
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID: %08X", uid);
|
||||
|
||||
|
||||
// how to detemine Hitag types?
|
||||
|
||||
|
||||
// read block3, get configuration byte.
|
||||
|
||||
// common configurations.
|
||||
@@ -503,7 +503,7 @@ int CmdLFHitagInfo(const char *Cmd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: iceman
|
||||
// TODO: iceman
|
||||
// Hitag2 reader, problem is that this command mixes up stuff. So 26 give uid. 21 etc will also give you a memory dump !?
|
||||
//
|
||||
int CmdLFHitagReader(const char *Cmd) {
|
||||
@@ -568,8 +568,8 @@ int CmdLFHitagReader(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: %08x", id);
|
||||
if (htf != RHT2F_UID_ONLY) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Dumping tag memory..." );
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Dumping tag memory...");
|
||||
uint8_t *data = resp.d.asBytes;
|
||||
|
||||
char filename[FILE_PATH_SIZE];
|
||||
@@ -580,9 +580,9 @@ int CmdLFHitagReader(const char *Cmd) {
|
||||
saveFile(filename, "bin", data, 48);
|
||||
saveFileEML(filename, "eml", data, 48, 4);
|
||||
saveFileJSON(filename, "json", jsfHitag, data, 48);
|
||||
|
||||
|
||||
// block3, 1 byte
|
||||
printHitagConfiguration(data[4*3] );
|
||||
printHitagConfiguration(data[4 * 3]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user