2010-02-21 08:47:22 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Hardware commands
|
2019-05-07 17:42:36 +08:00
|
|
|
// low-level hardware control
|
2010-02-21 08:47:22 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-08-08 22:57:33 +08:00
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "cmdparser.h" // command_t
|
2020-10-09 07:52:42 +08:00
|
|
|
#include "cliparser.h"
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "comms.h"
|
|
|
|
#include "usart_defs.h"
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
#include "ui.h"
|
|
|
|
#include "cmdhw.h"
|
2015-01-08 05:51:34 +08:00
|
|
|
#include "cmddata.h"
|
2020-05-20 21:53:47 +08:00
|
|
|
#include "commonutil.h"
|
2020-10-16 01:29:54 +08:00
|
|
|
#include "pm3_cmd.h"
|
2021-02-17 18:52:23 +08:00
|
|
|
#include "pmflash.h" // rdv40validation_t
|
|
|
|
#include "cmdflashmem.h" // get_signature..
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
|
|
|
|
static int CmdHelp(const char *Cmd);
|
|
|
|
|
2019-03-10 18:20:22 +08:00
|
|
|
static void lookupChipID(uint32_t iChipID, uint32_t mem_used) {
|
2019-03-10 06:35:06 +08:00
|
|
|
char asBuff[120];
|
|
|
|
memset(asBuff, 0, sizeof(asBuff));
|
|
|
|
uint32_t mem_avail = 0;
|
2020-08-21 23:58:07 +08:00
|
|
|
PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("Hardware") " ]");
|
2019-03-09 15:59:13 +08:00
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
switch (iChipID) {
|
|
|
|
case 0x270B0A40:
|
|
|
|
sprintf(asBuff, "AT91SAM7S512 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x270B0A4F:
|
|
|
|
sprintf(asBuff, "AT91SAM7S512 Rev B");
|
|
|
|
break;
|
|
|
|
case 0x270D0940:
|
|
|
|
sprintf(asBuff, "AT91SAM7S256 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x270B0941:
|
|
|
|
sprintf(asBuff, "AT91SAM7S256 Rev B");
|
|
|
|
break;
|
|
|
|
case 0x270B0942:
|
|
|
|
sprintf(asBuff, "AT91SAM7S256 Rev C");
|
|
|
|
break;
|
|
|
|
case 0x270B0943:
|
|
|
|
sprintf(asBuff, "AT91SAM7S256 Rev D");
|
|
|
|
break;
|
|
|
|
case 0x270C0740:
|
|
|
|
sprintf(asBuff, "AT91SAM7S128 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x270A0741:
|
|
|
|
sprintf(asBuff, "AT91SAM7S128 Rev B");
|
|
|
|
break;
|
|
|
|
case 0x270A0742:
|
|
|
|
sprintf(asBuff, "AT91SAM7S128 Rev C");
|
|
|
|
break;
|
|
|
|
case 0x270A0743:
|
|
|
|
sprintf(asBuff, "AT91SAM7S128 Rev D");
|
|
|
|
break;
|
|
|
|
case 0x27090540:
|
|
|
|
sprintf(asBuff, "AT91SAM7S64 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x27090543:
|
|
|
|
sprintf(asBuff, "AT91SAM7S64 Rev B");
|
|
|
|
break;
|
|
|
|
case 0x27090544:
|
|
|
|
sprintf(asBuff, "AT91SAM7S64 Rev C");
|
|
|
|
break;
|
|
|
|
case 0x27080342:
|
|
|
|
sprintf(asBuff, "AT91SAM7S321 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x27080340:
|
|
|
|
sprintf(asBuff, "AT91SAM7S32 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x27080341:
|
|
|
|
sprintf(asBuff, "AT91SAM7S32 Rev B");
|
|
|
|
break;
|
|
|
|
case 0x27050241:
|
|
|
|
sprintf(asBuff, "AT9SAM7S161 Rev A");
|
|
|
|
break;
|
|
|
|
case 0x27050240:
|
|
|
|
sprintf(asBuff, "AT91SAM7S16 Rev A");
|
|
|
|
break;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2021-02-07 07:18:21 +08:00
|
|
|
PrintAndLogEx(NORMAL, " --= uC: " _YELLOW_("%s"), asBuff);
|
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
switch ((iChipID & 0xE0) >> 5) {
|
|
|
|
case 1:
|
|
|
|
sprintf(asBuff, "ARM946ES");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf(asBuff, "ARM7TDMI");
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprintf(asBuff, "ARM920T");
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprintf(asBuff, "ARM926EJS");
|
|
|
|
break;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2019-03-10 07:00:59 +08:00
|
|
|
PrintAndLogEx(NORMAL, " --= Embedded Processor: %s", asBuff);
|
2019-03-09 15:59:13 +08:00
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
switch ((iChipID & 0xF0000) >> 16) {
|
|
|
|
case 1:
|
|
|
|
sprintf(asBuff, "1K bytes");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf(asBuff, "2K bytes");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sprintf(asBuff, "6K bytes");
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprintf(asBuff, "112K bytes");
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprintf(asBuff, "4K bytes");
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
sprintf(asBuff, "80K bytes");
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
sprintf(asBuff, "160K bytes");
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
sprintf(asBuff, "8K bytes");
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
sprintf(asBuff, "16K bytes");
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
sprintf(asBuff, "32K bytes");
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
sprintf(asBuff, "64K bytes");
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
sprintf(asBuff, "128K bytes");
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
sprintf(asBuff, "256K bytes");
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
sprintf(asBuff, "96K bytes");
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
sprintf(asBuff, "512K bytes");
|
|
|
|
break;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2021-02-07 07:18:21 +08:00
|
|
|
PrintAndLogEx(NORMAL, " --= Internal SRAM size: %s", asBuff);
|
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
switch ((iChipID & 0xFF00000) >> 20) {
|
|
|
|
case 0x19:
|
|
|
|
sprintf(asBuff, "AT91SAM9xx Series");
|
|
|
|
break;
|
|
|
|
case 0x29:
|
|
|
|
sprintf(asBuff, "AT91SAM9XExx Series");
|
|
|
|
break;
|
|
|
|
case 0x34:
|
|
|
|
sprintf(asBuff, "AT91x34 Series");
|
|
|
|
break;
|
|
|
|
case 0x37:
|
|
|
|
sprintf(asBuff, "CAP7 Series");
|
|
|
|
break;
|
|
|
|
case 0x39:
|
|
|
|
sprintf(asBuff, "CAP9 Series");
|
|
|
|
break;
|
|
|
|
case 0x3B:
|
|
|
|
sprintf(asBuff, "CAP11 Series");
|
|
|
|
break;
|
|
|
|
case 0x40:
|
|
|
|
sprintf(asBuff, "AT91x40 Series");
|
|
|
|
break;
|
|
|
|
case 0x42:
|
|
|
|
sprintf(asBuff, "AT91x42 Series");
|
|
|
|
break;
|
|
|
|
case 0x55:
|
|
|
|
sprintf(asBuff, "AT91x55 Series");
|
|
|
|
break;
|
|
|
|
case 0x60:
|
|
|
|
sprintf(asBuff, "AT91SAM7Axx Series");
|
|
|
|
break;
|
|
|
|
case 0x61:
|
|
|
|
sprintf(asBuff, "AT91SAM7AQxx Series");
|
|
|
|
break;
|
|
|
|
case 0x63:
|
|
|
|
sprintf(asBuff, "AT91x63 Series");
|
|
|
|
break;
|
|
|
|
case 0x70:
|
|
|
|
sprintf(asBuff, "AT91SAM7Sxx Series");
|
|
|
|
break;
|
|
|
|
case 0x71:
|
|
|
|
sprintf(asBuff, "AT91SAM7XCxx Series");
|
|
|
|
break;
|
|
|
|
case 0x72:
|
|
|
|
sprintf(asBuff, "AT91SAM7SExx Series");
|
|
|
|
break;
|
|
|
|
case 0x73:
|
|
|
|
sprintf(asBuff, "AT91SAM7Lxx Series");
|
|
|
|
break;
|
|
|
|
case 0x75:
|
|
|
|
sprintf(asBuff, "AT91SAM7Xxx Series");
|
|
|
|
break;
|
|
|
|
case 0x92:
|
|
|
|
sprintf(asBuff, "AT91x92 Series");
|
|
|
|
break;
|
|
|
|
case 0xF0:
|
|
|
|
sprintf(asBuff, "AT75Cxx Series");
|
|
|
|
break;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2021-02-07 07:18:21 +08:00
|
|
|
PrintAndLogEx(NORMAL, " --= Architecture identifier: %s", asBuff);
|
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
switch ((iChipID & 0x70000000) >> 28) {
|
|
|
|
case 0:
|
|
|
|
sprintf(asBuff, "ROM");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprintf(asBuff, "ROMless or on-chip Flash");
|
|
|
|
break;
|
|
|
|
case 2:
|
2021-02-20 03:40:00 +08:00
|
|
|
sprintf(asBuff, "Embedded flash memory");
|
2019-03-10 07:00:59 +08:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-02-20 03:40:00 +08:00
|
|
|
sprintf(asBuff, "ROM and Embedded flash memory\nNVPSIZ is ROM size\nNVPSIZ2 is Flash size");
|
2019-03-10 07:00:59 +08:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprintf(asBuff, "SRAM emulating ROM");
|
|
|
|
break;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2021-02-07 07:18:21 +08:00
|
|
|
switch ((iChipID & 0xF00) >> 8) {
|
|
|
|
case 0:
|
|
|
|
mem_avail = 0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
mem_avail = 8;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
mem_avail = 16;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
mem_avail = 32;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
mem_avail = 64;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
mem_avail = 128;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
mem_avail = 256;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
mem_avail = 512;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
mem_avail = 1024;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
mem_avail = 2048;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-02-20 03:40:00 +08:00
|
|
|
PrintAndLogEx(NORMAL, " --= %s " _YELLOW_("%uK") " bytes ( " _YELLOW_("%2.0f%%") " used )"
|
2021-02-09 23:56:55 +08:00
|
|
|
, asBuff
|
2021-02-20 03:40:00 +08:00
|
|
|
, mem_avail
|
2021-02-09 23:56:55 +08:00
|
|
|
, mem_avail == 0 ? 0.0f : (float)mem_used / (mem_avail * 1024) * 100
|
|
|
|
);
|
2021-02-07 07:18:21 +08:00
|
|
|
|
2021-02-20 03:40:00 +08:00
|
|
|
/*
|
2021-02-07 07:18:21 +08:00
|
|
|
switch ((iChipID & 0xF000) >> 12) {
|
|
|
|
case 0:
|
|
|
|
sprintf(asBuff, "None");
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprintf(asBuff, "8K bytes");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf(asBuff, "16K bytes");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sprintf(asBuff, "32K bytes");
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sprintf(asBuff, "64K bytes");
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
sprintf(asBuff, "128K bytes");
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
sprintf(asBuff, "256K bytes");
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
sprintf(asBuff, "512K bytes");
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
sprintf(asBuff, "1024K bytes");
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
sprintf(asBuff, "2048K bytes");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PrintAndLogEx(NORMAL, " --= Second nonvolatile program memory size: %s", asBuff);
|
2021-02-20 03:40:00 +08:00
|
|
|
*/
|
2013-10-05 02:54:10 +08:00
|
|
|
}
|
|
|
|
|
2019-10-25 06:55:16 +08:00
|
|
|
static int CmdDbg(const char *Cmd) {
|
2019-06-06 17:31:47 +08:00
|
|
|
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw dbg",
|
|
|
|
"Set device side debug level output.\n"
|
|
|
|
"Note: option -4, this option may cause malfunction itself",
|
|
|
|
"hw dbg -1\n"
|
|
|
|
);
|
2019-06-06 17:31:47 +08:00
|
|
|
|
2021-01-04 19:01:55 +08:00
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_lit0("0", NULL, "no debug messages"),
|
|
|
|
arg_lit0("1", NULL, "error messages"),
|
|
|
|
arg_lit0("2", NULL, "plus information messages"),
|
|
|
|
arg_lit0("3", NULL, "plus debug messages"),
|
|
|
|
arg_lit0("4", NULL, "print even debug messages in timing critical functions"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
bool lv0 = arg_get_lit(ctx, 1);
|
|
|
|
bool lv1 = arg_get_lit(ctx, 2);
|
|
|
|
bool lv2 = arg_get_lit(ctx, 3);
|
2021-01-29 19:13:54 +08:00
|
|
|
bool lv3 = arg_get_lit(ctx, 4);
|
|
|
|
bool lv4 = arg_get_lit(ctx, 5);
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserFree(ctx);
|
2019-06-06 17:31:47 +08:00
|
|
|
|
2021-01-04 19:01:55 +08:00
|
|
|
if ((lv0 + lv1 + lv2 + lv3 + lv4) > 1) {
|
|
|
|
PrintAndLogEx(INFO, "Can only set one debug level");
|
|
|
|
return PM3_EINVARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t dbg = 0;
|
|
|
|
if (lv0)
|
|
|
|
dbg = 0;
|
|
|
|
else if (lv1)
|
|
|
|
dbg = 1;
|
|
|
|
else if (lv2)
|
2021-01-14 18:39:45 +08:00
|
|
|
dbg = 2;
|
2021-01-04 19:01:55 +08:00
|
|
|
else if (lv3)
|
2021-01-14 18:39:45 +08:00
|
|
|
dbg = 3;
|
2021-01-04 19:01:55 +08:00
|
|
|
else if (lv4)
|
|
|
|
dbg = 4;
|
|
|
|
|
|
|
|
SendCommandNG(CMD_SET_DBGMODE, &dbg, sizeof(dbg));
|
2019-06-06 17:31:47 +08:00
|
|
|
return PM3_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdDetectReader(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw detectreader",
|
|
|
|
"Start to detect presences of reader field",
|
|
|
|
"hw detectreader -L\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_lit0("L", "LF", "detect low frequence 125/134 kHz"),
|
|
|
|
arg_lit0("H", "HF", "detect high frequence 13.56 MHZ"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
bool lf = arg_get_lit(ctx, 1);
|
|
|
|
bool hf = arg_get_lit(ctx, 2);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
|
|
|
if ((lf + hf) > 1) {
|
|
|
|
PrintAndLogEx(INFO, "Can only set one frequence");
|
|
|
|
return PM3_EINVARG;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2019-04-28 17:09:46 +08:00
|
|
|
|
2021-01-04 19:01:55 +08:00
|
|
|
uint8_t arg = 0;
|
|
|
|
if (lf)
|
|
|
|
arg = 1;
|
|
|
|
else if (hf)
|
|
|
|
arg = 2;
|
|
|
|
|
|
|
|
PrintAndLogEx(INFO, "press pm3 button to change modes and finally exit");
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-20 16:28:34 +08:00
|
|
|
SendCommandNG(CMD_LISTEN_READER_FIELD, (uint8_t *)&arg, sizeof(arg));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ## FPGA Control
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdFPGAOff(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw fpgaoff",
|
|
|
|
"Turn of fpga and antenna field",
|
|
|
|
"hw fpgaoff\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-08 01:51:33 +08:00
|
|
|
SendCommandNG(CMD_FPGA_MAJOR_MODE_OFF, NULL, 0);
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdLCD(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw lcd",
|
|
|
|
"Send command/data to LCD",
|
|
|
|
"hw lcd -r AA -c 03 -> sends 0xAA three times"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_int1("r", "raw", "<hex>", "data "),
|
|
|
|
arg_int1("c", "cnt", "<dec>", "number of times to send"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
|
|
|
int r_len = 0;
|
|
|
|
uint8_t raw[1] = {0};
|
|
|
|
CLIGetHexWithReturn(ctx, 1, raw, &r_len);
|
|
|
|
int j = arg_get_int(ctx, 2);
|
|
|
|
if (j < 1) {
|
|
|
|
PrintAndLogEx(WARNING, "Count must be larger than zero");
|
|
|
|
return PM3_EINVARG;
|
|
|
|
}
|
|
|
|
|
2019-03-10 06:35:06 +08:00
|
|
|
while (j--) {
|
|
|
|
clearCommandBuffer();
|
2021-01-04 19:01:55 +08:00
|
|
|
SendCommandMIX(CMD_LCD, raw[0], 0, 0, NULL, 0);
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdLCDReset(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw lcdreset",
|
|
|
|
"Hardware reset LCD",
|
|
|
|
"hw lcdreset\n"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-20 16:28:34 +08:00
|
|
|
SendCommandNG(CMD_LCD_RESET, NULL, 0);
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdReadmem(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw readmem",
|
|
|
|
"Read memory at decimal address from ARM chip flash.",
|
|
|
|
"hw readmem -a 10000"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_u64_1("a", "adr", "<dec>", "address to read"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
uint32_t address = arg_get_u32(ctx, 1);
|
|
|
|
CLIParserFree(ctx);
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-20 16:28:34 +08:00
|
|
|
SendCommandNG(CMD_READ_MEM, (uint8_t *)&address, sizeof(address));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdReset(const char *Cmd) {
|
2021-01-04 19:01:55 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw reset",
|
|
|
|
"Reset the Proxmark3 device.",
|
|
|
|
"hw reset"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-08 01:51:33 +08:00
|
|
|
SendCommandNG(CMD_HARDWARE_RESET, NULL, 0);
|
2019-05-08 17:14:29 +08:00
|
|
|
PrintAndLogEx(INFO, "Proxmark3 has been reset.");
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sets the divisor for LF frequency clock: lets the user choose any LF frequency below
|
|
|
|
* 600kHz.
|
|
|
|
*/
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdSetDivisor(const char *Cmd) {
|
2021-01-04 19:25:03 +08:00
|
|
|
|
|
|
|
CLIParserContext *ctx;
|
2021-01-06 09:04:57 +08:00
|
|
|
CLIParserInit(&ctx, "hw setlfdivisor",
|
2021-01-04 19:25:03 +08:00
|
|
|
"Drive LF antenna at 12 MHz / (divisor + 1).",
|
2021-01-06 09:04:57 +08:00
|
|
|
"hw setlfdivisor -d 88"
|
2021-01-04 19:25:03 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_u64_1("d", "div", "<dec>", "19 - 255 divisor value (def 95)"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
uint8_t arg = arg_get_u32_def(ctx, 1, 95);
|
|
|
|
CLIParserFree(ctx);
|
2019-03-09 15:59:13 +08:00
|
|
|
|
2019-05-20 16:28:34 +08:00
|
|
|
if (arg < 19) {
|
2021-01-06 09:04:57 +08:00
|
|
|
PrintAndLogEx(ERR, "Divisor must be between" _YELLOW_("19") " and " _YELLOW_("255"));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_EINVARG;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2019-08-06 19:51:10 +08:00
|
|
|
// 12 000 000 (12MHz)
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-08-04 01:17:00 +08:00
|
|
|
SendCommandNG(CMD_LF_SET_DIVISOR, (uint8_t *)&arg, sizeof(arg));
|
2019-12-11 22:56:36 +08:00
|
|
|
PrintAndLogEx(SUCCESS, "Divisor set, expected " _YELLOW_("%.1f")" kHz", ((double)12000 / (arg + 1)));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdSetMux(const char *Cmd) {
|
2019-03-09 15:59:13 +08:00
|
|
|
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw setmux",
|
|
|
|
"Set the ADC mux to a specific value",
|
|
|
|
"hw setmux --hiraw -> set HIGH RAW"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_lit0(NULL, "lopkd", "low peak"),
|
|
|
|
arg_lit0(NULL, "loraw", "low raw"),
|
|
|
|
arg_lit0(NULL, "hipkd", "high peak"),
|
|
|
|
arg_lit0(NULL, "hiraw", "high raw"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
bool lopkd = arg_get_lit(ctx, 1);
|
|
|
|
bool loraw = arg_get_lit(ctx, 2);
|
|
|
|
bool hipkd = arg_get_lit(ctx, 3);
|
|
|
|
bool hiraw = arg_get_lit(ctx, 4);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
|
|
|
if ((lopkd + loraw + hipkd + hiraw) > 1) {
|
|
|
|
PrintAndLogEx(INFO, "Can only set one mux");
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_EINVARG;
|
2019-03-10 06:35:06 +08:00
|
|
|
}
|
2019-03-09 15:59:13 +08:00
|
|
|
|
2019-05-06 20:38:56 +08:00
|
|
|
uint8_t arg = 0;
|
2021-01-05 04:58:50 +08:00
|
|
|
if (lopkd)
|
2019-09-26 22:39:02 +08:00
|
|
|
arg = 0;
|
2021-01-05 04:58:50 +08:00
|
|
|
else if (loraw)
|
2019-09-26 22:39:02 +08:00
|
|
|
arg = 1;
|
2021-01-05 04:58:50 +08:00
|
|
|
else if (hipkd)
|
2019-09-26 22:39:02 +08:00
|
|
|
arg = 2;
|
2021-01-05 04:58:50 +08:00
|
|
|
else if (hiraw)
|
2019-09-26 22:39:02 +08:00
|
|
|
arg = 3;
|
2021-01-05 04:58:50 +08:00
|
|
|
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-20 16:28:34 +08:00
|
|
|
SendCommandNG(CMD_SET_ADC_MUX, (uint8_t *)&arg, sizeof(arg));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-07-16 04:31:19 +08:00
|
|
|
static int CmdStandalone(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw standalone",
|
|
|
|
"Start standalone mode",
|
|
|
|
"hw standalone -> start \n"
|
|
|
|
"hw standalone -a 1 -> start and send arg 1"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_u64_0("a", "arg", "<dec>", "argument byte"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
uint8_t arg = arg_get_u32(ctx, 1);
|
|
|
|
CLIParserFree(ctx);
|
2019-07-16 04:31:19 +08:00
|
|
|
clearCommandBuffer();
|
2020-08-09 05:45:09 +08:00
|
|
|
SendCommandNG(CMD_STANDALONE, (uint8_t *)&arg, sizeof(arg));
|
2019-07-16 04:31:19 +08:00
|
|
|
return PM3_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdTune(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw tune",
|
|
|
|
"Measure antenna tuning",
|
|
|
|
"hw tune"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
2014-12-18 05:26:16 +08:00
|
|
|
return CmdTuneSamples(Cmd);
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdVersion(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw version",
|
|
|
|
"Show version information about the connected Proxmark3",
|
|
|
|
"hw version"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
2019-08-21 18:52:59 +08:00
|
|
|
pm3_version(true, false);
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
2015-07-23 05:00:52 +08:00
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdStatus(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw status",
|
|
|
|
"Show runtime status information about the connected Proxmark3",
|
|
|
|
"hw status"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-04-18 18:43:35 +08:00
|
|
|
PacketResponseNG resp;
|
2019-05-08 01:51:33 +08:00
|
|
|
SendCommandNG(CMD_STATUS, NULL, 0);
|
2020-06-30 18:50:31 +08:00
|
|
|
if (WaitForResponseTimeout(CMD_STATUS, &resp, 2000) == false) {
|
|
|
|
PrintAndLogEx(WARNING, "Status command timeout. Communication speed test timed out");
|
|
|
|
return PM3_ETIMEOUT;
|
|
|
|
}
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
2015-07-23 05:00:52 +08:00
|
|
|
}
|
|
|
|
|
2020-10-16 01:29:54 +08:00
|
|
|
int handle_tearoff(tearoff_params_t *params, bool verbose) {
|
|
|
|
|
|
|
|
if (params == NULL)
|
|
|
|
return PM3_EINVARG;
|
|
|
|
|
|
|
|
clearCommandBuffer();
|
|
|
|
SendCommandNG(CMD_SET_TEAROFF, (uint8_t *)params, sizeof(tearoff_params_t));
|
|
|
|
PacketResponseNG resp;
|
|
|
|
if (WaitForResponseTimeout(CMD_SET_TEAROFF, &resp, 500) == false) {
|
|
|
|
PrintAndLogEx(WARNING, "Tear-off command timeout.");
|
|
|
|
return PM3_ETIMEOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (resp.status == PM3_SUCCESS) {
|
|
|
|
if (params->delay_us > 0 && verbose)
|
|
|
|
PrintAndLogEx(INFO, "Tear-off hook configured with delay of " _GREEN_("%i us"), params->delay_us);
|
|
|
|
|
|
|
|
if (params->on && verbose)
|
|
|
|
PrintAndLogEx(INFO, "Tear-off hook " _GREEN_("enabled"));
|
|
|
|
|
|
|
|
if (params->off && verbose)
|
|
|
|
PrintAndLogEx(INFO, "Tear-off hook " _RED_("disabled"));
|
2020-10-16 02:06:27 +08:00
|
|
|
} else if (verbose)
|
|
|
|
PrintAndLogEx(WARNING, "Tear-off command failed.");
|
2020-10-16 01:29:54 +08:00
|
|
|
return resp.status;
|
|
|
|
}
|
|
|
|
|
2020-10-09 07:52:42 +08:00
|
|
|
static int CmdTearoff(const char *Cmd) {
|
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw tearoff",
|
|
|
|
"Configure a tear-off hook for the next write command supporting tear-off\n"
|
2020-10-09 20:55:17 +08:00
|
|
|
"After having been triggered by a write command, the tear-off hook is deactivated\n"
|
|
|
|
"Delay (in us) must be between 1 and 43000 (43ms). Precision is about 1/3us.",
|
2020-10-09 07:52:42 +08:00
|
|
|
"hw tearoff --delay 1200 --> define delay of 1200us\n"
|
|
|
|
"hw tearoff --on --> (re)activate a previously defined delay\n"
|
|
|
|
"hw tearoff --off --> deactivate a previously activated but not yet triggered hook\n");
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
2020-10-09 20:55:17 +08:00
|
|
|
arg_int0(NULL, "delay", "<dec>", "Delay in us before triggering tear-off, must be between 1 and 43000"),
|
2020-10-09 07:52:42 +08:00
|
|
|
arg_lit0(NULL, "on", "Activate tear-off hook"),
|
|
|
|
arg_lit0(NULL, "off", "Deactivate tear-off hook"),
|
2020-10-11 07:09:31 +08:00
|
|
|
arg_lit0("s", "silent", "less verbose output"),
|
2020-10-09 07:52:42 +08:00
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
2020-10-16 02:06:27 +08:00
|
|
|
tearoff_params_t params;
|
2020-10-09 20:55:17 +08:00
|
|
|
int delay = arg_get_int_def(ctx, 1, -1);
|
2020-10-09 07:52:42 +08:00
|
|
|
params.on = arg_get_lit(ctx, 2);
|
|
|
|
params.off = arg_get_lit(ctx, 3);
|
2020-10-11 07:09:31 +08:00
|
|
|
bool silent = arg_get_lit(ctx, 4);
|
2020-10-09 07:52:42 +08:00
|
|
|
CLIParserFree(ctx);
|
2020-10-11 07:09:31 +08:00
|
|
|
|
2020-10-09 20:55:17 +08:00
|
|
|
if (delay != -1) {
|
|
|
|
if ((delay < 1) || (delay > 43000)) {
|
|
|
|
PrintAndLogEx(WARNING, "You can't set delay out of 1..43000 range!");
|
|
|
|
return PM3_EINVARG;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
delay = 0; // will be ignored by ARM
|
|
|
|
}
|
2020-10-11 07:09:31 +08:00
|
|
|
|
2020-10-09 20:55:17 +08:00
|
|
|
params.delay_us = delay;
|
2020-10-09 07:52:42 +08:00
|
|
|
if (params.on && params.off) {
|
|
|
|
PrintAndLogEx(WARNING, "You can't set both --on and --off!");
|
|
|
|
return PM3_EINVARG;
|
|
|
|
}
|
2020-10-11 07:09:31 +08:00
|
|
|
|
2020-10-16 02:06:27 +08:00
|
|
|
return handle_tearoff(¶ms, !silent);
|
2020-10-09 07:52:42 +08:00
|
|
|
}
|
|
|
|
|
2019-10-15 20:21:26 +08:00
|
|
|
static int CmdTia(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw tia",
|
|
|
|
"Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider",
|
|
|
|
"hw tia"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
2019-12-11 22:56:36 +08:00
|
|
|
PrintAndLogEx(INFO, "Triggering new Timing Interval Acquisition (TIA)...");
|
2020-06-30 18:50:31 +08:00
|
|
|
clearCommandBuffer();
|
2019-10-15 20:21:26 +08:00
|
|
|
SendCommandNG(CMD_TIA, NULL, 0);
|
2020-06-30 18:50:31 +08:00
|
|
|
PacketResponseNG resp;
|
|
|
|
if (WaitForResponseTimeout(CMD_TIA, &resp, 2000) == false) {
|
|
|
|
PrintAndLogEx(WARNING, "TIA command timeout. You probably need to unplug the Proxmark3.");
|
|
|
|
return PM3_ETIMEOUT;
|
|
|
|
}
|
2019-10-15 20:21:26 +08:00
|
|
|
PrintAndLogEx(INFO, "TIA done.");
|
|
|
|
return PM3_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdPing(const char *Cmd) {
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw ping",
|
|
|
|
"Test if the Proxmark3 is responsive",
|
|
|
|
"hw ping\n"
|
|
|
|
"hw ping --len 32"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_u64_0("l", "len", "<dec>", "length of payload to send"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
uint32_t len = arg_get_u32(ctx, 1);
|
|
|
|
CLIParserFree(ctx);
|
|
|
|
|
2019-05-01 03:10:11 +08:00
|
|
|
if (len > PM3_CMD_DATA_SIZE)
|
|
|
|
len = PM3_CMD_DATA_SIZE;
|
2021-01-05 04:58:50 +08:00
|
|
|
|
2019-05-08 05:35:09 +08:00
|
|
|
if (len) {
|
2021-01-05 04:58:50 +08:00
|
|
|
PrintAndLogEx(INFO, "Ping sent with payload len " _YELLOW_("%d"), len);
|
2019-05-08 05:35:09 +08:00
|
|
|
} else {
|
|
|
|
PrintAndLogEx(INFO, "Ping sent");
|
|
|
|
}
|
2021-01-05 04:58:50 +08:00
|
|
|
|
2019-04-16 16:01:08 +08:00
|
|
|
clearCommandBuffer();
|
2019-04-18 18:43:35 +08:00
|
|
|
PacketResponseNG resp;
|
2019-05-01 03:10:11 +08:00
|
|
|
uint8_t data[PM3_CMD_DATA_SIZE] = {0};
|
2021-01-05 04:58:50 +08:00
|
|
|
|
2019-04-18 04:08:10 +08:00
|
|
|
for (uint16_t i = 0; i < len; i++)
|
2019-04-17 05:15:23 +08:00
|
|
|
data[i] = i & 0xFF;
|
2021-01-05 04:58:50 +08:00
|
|
|
|
2019-04-19 04:19:28 +08:00
|
|
|
SendCommandNG(CMD_PING, data, len);
|
2019-04-18 03:30:01 +08:00
|
|
|
if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) {
|
2019-05-08 05:35:09 +08:00
|
|
|
if (len) {
|
2020-01-04 01:59:41 +08:00
|
|
|
bool error = (memcmp(data, resp.data.asBytes, len) != 0);
|
2020-04-22 08:22:55 +08:00
|
|
|
PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") " and content is %s", error ? _RED_("NOT ok") : _GREEN_("OK"));
|
2019-05-08 05:35:09 +08:00
|
|
|
} else {
|
2019-10-10 05:38:41 +08:00
|
|
|
PrintAndLogEx(SUCCESS, "Ping response " _GREEN_("received"));
|
2019-05-08 05:35:09 +08:00
|
|
|
}
|
2019-04-17 02:49:32 +08:00
|
|
|
} else
|
2019-05-08 05:35:09 +08:00
|
|
|
PrintAndLogEx(WARNING, "Ping response " _RED_("timeout"));
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
2019-04-16 16:01:08 +08:00
|
|
|
}
|
|
|
|
|
2019-05-07 17:05:05 +08:00
|
|
|
static int CmdConnect(const char *Cmd) {
|
|
|
|
|
2021-01-05 04:58:50 +08:00
|
|
|
CLIParserContext *ctx;
|
|
|
|
CLIParserInit(&ctx, "hw connect",
|
|
|
|
"Connects to a Proxmark3 device via specified serial port.\n"
|
|
|
|
"Baudrate here is only for physical UART or UART-BT, NOT for USB-CDC or blue shark add-on",
|
|
|
|
"hw connect -p "SERIAL_PORT_EXAMPLE_H"\n"
|
|
|
|
"hw connect -p "SERIAL_PORT_EXAMPLE_H" -b 115200"
|
|
|
|
);
|
|
|
|
|
|
|
|
void *argtable[] = {
|
|
|
|
arg_param_begin,
|
|
|
|
arg_str0("p", "port", NULL, "Serial port to connect to, else retry the last used one"),
|
|
|
|
arg_u64_0("b", "baud", "<dec>", "Baudrate"),
|
|
|
|
arg_param_end
|
|
|
|
};
|
|
|
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
|
|
|
|
|
|
|
int p_len = FILE_PATH_SIZE;
|
2019-05-19 03:35:46 +08:00
|
|
|
char port[FILE_PATH_SIZE] = {0};
|
2021-01-14 18:39:45 +08:00
|
|
|
CLIGetStrWithReturn(ctx, 1, (uint8_t *)port, &p_len);
|
2021-01-05 04:58:50 +08:00
|
|
|
uint32_t baudrate = arg_get_u32_def(ctx, 2, USART_BAUD_RATE);
|
|
|
|
CLIParserFree(ctx);
|
2019-06-08 03:40:33 +08:00
|
|
|
|
2021-01-05 04:58:50 +08:00
|
|
|
if (baudrate == 0) {
|
|
|
|
PrintAndLogEx(WARNING, "Baudrate can't be zero");
|
|
|
|
return PM3_EINVARG;
|
2019-05-19 00:06:14 +08:00
|
|
|
}
|
2019-06-08 03:40:33 +08:00
|
|
|
|
2019-05-07 17:42:36 +08:00
|
|
|
// default back to previous used serial port
|
2019-05-19 03:35:46 +08:00
|
|
|
if (strlen(port) == 0) {
|
2020-06-01 05:09:26 +08:00
|
|
|
if (strlen(conn.serial_port_name) == 0) {
|
2021-01-05 04:58:50 +08:00
|
|
|
PrintAndLogEx(WARNING, "Must specify a serial port");
|
|
|
|
return PM3_EINVARG;
|
2019-05-07 21:40:01 +08:00
|
|
|
}
|
2019-05-19 03:35:46 +08:00
|
|
|
memcpy(port, conn.serial_port_name, sizeof(port));
|
2019-05-07 21:40:01 +08:00
|
|
|
}
|
2019-05-07 18:28:17 +08:00
|
|
|
|
2019-05-08 07:35:51 +08:00
|
|
|
if (session.pm3_present) {
|
2020-05-28 08:13:21 +08:00
|
|
|
CloseProxmark(session.current_device);
|
2019-05-07 23:31:07 +08:00
|
|
|
}
|
2019-05-07 21:57:22 +08:00
|
|
|
|
2019-05-19 00:06:14 +08:00
|
|
|
// 10 second timeout
|
2020-05-28 08:13:21 +08:00
|
|
|
OpenProxmark(&session.current_device, port, false, 10, false, baudrate);
|
2019-05-07 17:05:05 +08:00
|
|
|
|
2020-05-28 08:13:21 +08:00
|
|
|
if (session.pm3_present && (TestProxmark(session.current_device) != PM3_SUCCESS)) {
|
2020-04-22 08:22:55 +08:00
|
|
|
PrintAndLogEx(ERR, _RED_("ERROR:") " cannot communicate with the Proxmark3\n");
|
2020-05-28 08:13:21 +08:00
|
|
|
CloseProxmark(session.current_device);
|
2019-09-26 22:39:02 +08:00
|
|
|
return PM3_ENOTTY;
|
2019-05-07 17:05:05 +08:00
|
|
|
}
|
|
|
|
return PM3_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-01-09 23:30:30 +08:00
|
|
|
static command_t CommandTable[] = {
|
2020-11-02 08:46:47 +08:00
|
|
|
{"-------------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Hardware") " -----------------------"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
2021-01-04 19:01:55 +08:00
|
|
|
{"connect", CmdConnect, AlwaysAvailable, "Connect Proxmark3 to serial port"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"dbg", CmdDbg, IfPm3Present, "Set Proxmark3 debug level"},
|
2021-01-04 19:01:55 +08:00
|
|
|
{"detectreader", CmdDetectReader, IfPm3Present, "Detect external reader field"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"fpgaoff", CmdFPGAOff, IfPm3Present, "Set FPGA off"},
|
2021-01-04 19:01:55 +08:00
|
|
|
{"lcd", CmdLCD, IfPm3Lcd, "Send command/data to LCD"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"lcdreset", CmdLCDReset, IfPm3Lcd, "Hardware reset LCD"},
|
|
|
|
{"ping", CmdPing, IfPm3Present, "Test if the Proxmark3 is responsive"},
|
2021-01-04 19:01:55 +08:00
|
|
|
{"readmem", CmdReadmem, IfPm3Present, "Read memory at decimal address from flash"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"reset", CmdReset, IfPm3Present, "Reset the Proxmark3"},
|
2021-01-05 04:58:50 +08:00
|
|
|
{"setlfdivisor", CmdSetDivisor, IfPm3Present, "Drive LF antenna at 12MHz / (divisor + 1)"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"setmux", CmdSetMux, IfPm3Present, "Set the ADC mux to a specific value"},
|
|
|
|
{"standalone", CmdStandalone, IfPm3Present, "Jump to the standalone mode"},
|
|
|
|
{"status", CmdStatus, IfPm3Present, "Show runtime status information about the connected Proxmark3"},
|
2020-10-09 07:52:42 +08:00
|
|
|
{"tearoff", CmdTearoff, IfPm3Present, "Program a tearoff hook for the next command supporting tearoff"},
|
2020-08-09 05:45:09 +08:00
|
|
|
{"tia", CmdTia, IfPm3Present, "Trigger a Timing Interval Acquisition to re-adjust the RealTimeCounter divider"},
|
|
|
|
{"tune", CmdTune, IfPm3Present, "Measure antenna tuning"},
|
|
|
|
{"version", CmdVersion, IfPm3Present, "Show version information about the connected Proxmark3"},
|
2019-05-02 02:48:15 +08:00
|
|
|
{NULL, NULL, NULL, NULL}
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
};
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
static int CmdHelp(const char *Cmd) {
|
|
|
|
(void)Cmd; // Cmd is not used so far
|
|
|
|
CmdsHelp(CommandTable);
|
2019-04-19 04:42:15 +08:00
|
|
|
return PM3_SUCCESS;
|
2019-04-14 03:54:04 +08:00
|
|
|
}
|
|
|
|
|
2019-03-10 18:20:22 +08:00
|
|
|
int CmdHW(const char *Cmd) {
|
2019-03-10 06:35:06 +08:00
|
|
|
clearCommandBuffer();
|
2019-04-19 04:42:15 +08:00
|
|
|
return CmdsParse(CommandTable, Cmd);
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|
|
|
|
|
2019-08-21 18:52:59 +08:00
|
|
|
void pm3_version(bool verbose, bool oneliner) {
|
|
|
|
|
2019-08-29 17:10:54 +08:00
|
|
|
#if defined(__MINGW64__)
|
|
|
|
# define PM3CLIENTCOMPILER "MinGW-w64 "
|
|
|
|
#elif defined(__MINGW32__)
|
|
|
|
# define PM3CLIENTCOMPILER "MinGW "
|
|
|
|
#elif defined(__clang__)
|
2019-08-29 05:28:28 +08:00
|
|
|
# define PM3CLIENTCOMPILER "Clang/LLVM "
|
2019-08-21 18:52:59 +08:00
|
|
|
#elif defined(__GNUC__) || defined(__GNUG__)
|
2019-08-29 05:28:28 +08:00
|
|
|
# define PM3CLIENTCOMPILER "GCC "
|
2019-08-29 17:10:54 +08:00
|
|
|
#else
|
|
|
|
# define PM3CLIENTCOMPILER "unknown compiler "
|
2019-08-21 18:52:59 +08:00
|
|
|
#endif
|
2019-08-29 05:28:28 +08:00
|
|
|
|
2019-08-29 13:45:09 +08:00
|
|
|
#if defined(__APPLE__) || defined(__MACH__)
|
2019-08-29 17:10:54 +08:00
|
|
|
# define PM3HOSTOS " OS:OSX"
|
|
|
|
#elif defined(__ANDROID__) || defined(ANDROID)
|
|
|
|
// must be tested before __linux__
|
|
|
|
# define PM3HOSTOS " OS:Android"
|
|
|
|
#elif defined(__linux__)
|
|
|
|
# define PM3HOSTOS " OS:Linux"
|
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
# define PM3HOSTOS " OS:FreeBSD"
|
2019-08-29 13:45:09 +08:00
|
|
|
#elif defined(__NetBSD__)
|
2019-08-29 17:10:54 +08:00
|
|
|
# define PM3HOSTOS " OS:NetBSD"
|
2019-08-29 13:45:09 +08:00
|
|
|
#elif defined(__OpenBSD__)
|
2019-08-29 17:10:54 +08:00
|
|
|
# define PM3HOSTOS " OS:OpenBSD"
|
|
|
|
#elif defined(__CYGWIN__)
|
|
|
|
# define PM3HOSTOS " OS:Cygwin"
|
2020-05-20 01:49:25 +08:00
|
|
|
#elif defined(_WIN64) || defined(__WIN64__)
|
2019-08-29 17:10:54 +08:00
|
|
|
// must be tested before _WIN32
|
|
|
|
# define PM3HOSTOS " OS:Windows (64b)"
|
2020-05-20 01:49:25 +08:00
|
|
|
#elif defined(_WIN32) || defined(__WIN32__)
|
2019-08-29 17:10:54 +08:00
|
|
|
# define PM3HOSTOS " OS:Windows (32b)"
|
|
|
|
#else
|
|
|
|
# define PM3HOSTOS " OS:unknown"
|
2019-08-29 13:45:09 +08:00
|
|
|
#endif
|
|
|
|
|
2019-08-29 17:10:54 +08:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
# define PM3HOSTARCH " ARCH:x86_64"
|
|
|
|
#elif defined(__i386__)
|
|
|
|
# define PM3HOSTARCH " ARCH:x86"
|
|
|
|
#elif defined(__aarch64__)
|
|
|
|
# define PM3HOSTARCH " ARCH:aarch64"
|
|
|
|
#elif defined(__arm__)
|
|
|
|
# define PM3HOSTARCH " ARCH:arm"
|
|
|
|
#elif defined(__powerpc64__)
|
|
|
|
# define PM3HOSTARCH " ARCH:powerpc64"
|
|
|
|
#elif defined(__mips__)
|
|
|
|
# define PM3HOSTARCH " ARCH:mips"
|
|
|
|
#else
|
|
|
|
# define PM3HOSTARCH " ARCH:unknown"
|
2019-08-29 15:53:28 +08:00
|
|
|
#endif
|
|
|
|
|
2019-08-29 05:28:28 +08:00
|
|
|
if (oneliner) {
|
2019-08-29 17:10:54 +08:00
|
|
|
// For "proxmark3 -v", simple printf, avoid logging
|
2020-05-20 21:53:47 +08:00
|
|
|
char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image
|
|
|
|
FormatVersionInformation(temp, sizeof(temp), "Client: ", &version_information);
|
2020-08-29 20:01:15 +08:00
|
|
|
PrintAndLogEx(NORMAL, "%s compiled with " PM3CLIENTCOMPILER __VERSION__ PM3HOSTOS PM3HOSTARCH "\n", temp);
|
2019-08-21 18:52:59 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-04-14 03:54:04 +08:00
|
|
|
if (!verbose)
|
|
|
|
return;
|
2019-05-08 07:35:51 +08:00
|
|
|
|
2019-04-18 18:43:35 +08:00
|
|
|
PacketResponseNG resp;
|
2019-04-14 03:54:04 +08:00
|
|
|
clearCommandBuffer();
|
2019-05-08 01:51:33 +08:00
|
|
|
SendCommandNG(CMD_VERSION, NULL, 0);
|
2019-05-08 07:35:51 +08:00
|
|
|
|
2019-05-20 16:28:34 +08:00
|
|
|
if (WaitForResponseTimeout(CMD_VERSION, &resp, 1000)) {
|
2020-05-20 21:53:47 +08:00
|
|
|
char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image
|
2020-08-21 23:58:07 +08:00
|
|
|
PrintAndLogEx(NORMAL, "\n [ " _CYAN_("Proxmark3 RFID instrument") " ]");
|
|
|
|
PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("CLIENT") " ]");
|
2020-05-20 21:53:47 +08:00
|
|
|
FormatVersionInformation(temp, sizeof(temp), " client: ", &version_information);
|
|
|
|
PrintAndLogEx(NORMAL, "%s", temp);
|
2019-08-29 17:10:54 +08:00
|
|
|
PrintAndLogEx(NORMAL, " compiled with " PM3CLIENTCOMPILER __VERSION__ PM3HOSTOS PM3HOSTARCH);
|
2019-09-26 22:39:02 +08:00
|
|
|
|
2020-09-25 22:39:07 +08:00
|
|
|
PrintAndLogEx(NORMAL, "\n [ " _YELLOW_("PROXMARK3") " ]");
|
2021-02-17 18:52:23 +08:00
|
|
|
if (IfPm3Rdv4Fw()) {
|
|
|
|
|
|
|
|
bool is_genuine_rdv4 = false;
|
|
|
|
// validate signature data
|
|
|
|
rdv40_validation_t mem;
|
|
|
|
if (rdv4_get_signature(&mem) == PM3_SUCCESS) {
|
|
|
|
if (rdv4_validate(&mem) == PM3_SUCCESS) {
|
|
|
|
is_genuine_rdv4 = true;
|
|
|
|
}
|
2019-09-26 22:39:02 +08:00
|
|
|
}
|
2021-02-17 18:52:23 +08:00
|
|
|
|
|
|
|
PrintAndLogEx(NORMAL, " device.................... %s", (is_genuine_rdv4) ? _GREEN_("RDV4") : _RED_("device / fw mismatch"));
|
2021-03-10 18:23:13 +08:00
|
|
|
PrintAndLogEx(NORMAL, " firmware.................. %s", (is_genuine_rdv4) ? _GREEN_("RDV4") : _YELLOW_("RDV4"));
|
2020-10-19 18:42:26 +08:00
|
|
|
PrintAndLogEx(NORMAL, " external flash............ %s", IfPm3Flash() ? _GREEN_("present") : _YELLOW_("absent"));
|
|
|
|
PrintAndLogEx(NORMAL, " smartcard reader.......... %s", IfPm3Smartcard() ? _GREEN_("present") : _YELLOW_("absent"));
|
|
|
|
PrintAndLogEx(NORMAL, " FPC USART for BT add-on... %s", IfPm3FpcUsartHost() ? _GREEN_("present") : _YELLOW_("absent"));
|
2021-02-17 18:52:23 +08:00
|
|
|
} else {
|
|
|
|
PrintAndLogEx(NORMAL, " firmware.................. %s", _YELLOW_("PM3 GENERIC"));
|
|
|
|
if (IfPm3FpcUsartHost()) {
|
|
|
|
PrintAndLogEx(NORMAL, " FPC USART for BT add-on... %s", _GREEN_("present"));
|
|
|
|
}
|
2020-09-25 22:39:07 +08:00
|
|
|
}
|
2021-02-17 18:52:23 +08:00
|
|
|
|
2020-09-25 22:39:07 +08:00
|
|
|
if (IfPm3FpcUsartDevFromUsb()) {
|
2020-10-19 18:42:26 +08:00
|
|
|
PrintAndLogEx(NORMAL, " FPC USART for developer... %s", _GREEN_("present"));
|
2019-09-26 22:39:02 +08:00
|
|
|
}
|
2019-05-08 07:35:51 +08:00
|
|
|
|
2019-05-04 04:30:17 +08:00
|
|
|
PrintAndLogEx(NORMAL, "");
|
2019-05-20 16:28:34 +08:00
|
|
|
|
|
|
|
struct p {
|
|
|
|
uint32_t id;
|
|
|
|
uint32_t section_size;
|
|
|
|
uint32_t versionstr_len;
|
|
|
|
char versionstr[PM3_CMD_DATA_SIZE - 12];
|
|
|
|
} PACKED;
|
|
|
|
|
|
|
|
struct p *payload = (struct p *)&resp.data.asBytes;
|
|
|
|
|
|
|
|
PrintAndLogEx(NORMAL, payload->versionstr);
|
|
|
|
|
|
|
|
lookupChipID(payload->id, payload->section_size);
|
2019-04-14 03:54:04 +08:00
|
|
|
}
|
2021-02-20 03:40:00 +08:00
|
|
|
PrintAndLogEx(NORMAL, "");
|
Client cleanup and restructuring. Stage 1...
Next Step is refactoring some of the giant functions which are
just copy/paste of some other ones with just a few line changes,
removing unnecessary 'goto' etc.
The MS Windows version is broken with this commit but will be fixed
soon. Everything can't be done all at once :P
The commands are now hierarchical, for example:
"hf 14a read" vs. "hf 14b read".
You can also request help:
"hf help", "data help", "hf 15 help" etc.
Indents are now space-based, not tab-based anymore. Hopefully
no one will be trolling about it, considering the suicide-prone work
being done here ;)
client/cmdhw.c, client/proxusb.c, client/cmdhw.h, client/proxusb.h,
client/cmdmain.c, client/cmdlfhid.c, client/cmdmain.h, client/cmdlfhid.h,
client/data.c, client/data.h, client/cmdhf.c, client/cmdlf.c,
client/cmdhf.h, client/cmdhf15.c, client/cmdhf14b.c, client/cmdlf.h,
client/cmdhf15.h, client/cmdhf14b.h, client/cmddata.c, client/cmddata.h,
client/ui.c, client/cmdparser.c, client/cmdlfti.c, client/ui.h,
client/cmdlfem4x.c, client/cmdparser.h, client/cmdlfti.h, client/cmdlfem4x.h,
client/graph.c, client/graph.h, client/cmdhf14a.c, client/cmdhf14a.h,
client/cmdhflegic.c, client/cmdhflegic.c: New files.
client/cli.c, client/flasher.c, client/snooper.c, client/proxmark3.c,
client/proxmark3.h, client/Makefile: Update accordingly.
client/flash.h, client/flash.c, client/proxgui.cpp: Cosmetic changes.
client/translate.h, client/command.c, client/gui.c,
client/usb.c, client/prox.h: Remove.
include/usb_cmd.h (CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM): Remove dead cmd.
common/crc16.h: New file.
common/crc16.c: Modify accordingly.
common/iso14443crc.h: New file.
common/iso14443_crc.c: Rename to
common/iso14443crc.c: and modify accordingly.
armsrc/lfops.c, armsrc/iso14443.c,
armsrc/iso14443a.c: include .h files from
the common directory instead of including the c files.
common/Makefile.common, armsrc/Makefile: Modify accordingly.
2010-02-04 09:27:07 +08:00
|
|
|
}
|