proxmark3/armsrc/Standalone/readme.md

103 lines
3.4 KiB
Markdown
Raw Normal View History

2017-10-22 23:00:53 +08:00
# StandAlone Modes
2017-08-26 19:01:35 +08:00
2017-10-22 23:00:53 +08:00
This contains functionality for different StandAlone modes. The fullimage will be built given the correct compiler flags used. Build targets for these files are contained in `armsrc/Makefile`.
2017-08-26 19:01:35 +08:00
2017-10-22 23:00:53 +08:00
If you want to implement a new standalone mode, you need to implement the methods provided in `standalone.h`.
2017-08-26 19:01:35 +08:00
2017-10-22 23:00:53 +08:00
## Implementing a standalone mode
2017-08-26 19:01:35 +08:00
2018-09-04 04:36:43 +08:00
Each standalone mod needs to have its own compiler flag to be added in `armsrc\makefile` and inside the function `AppMain` inside AppMain.c. Inside Appmain a call to RunMod is needed. It looks strange because of what kinds of dependencies your mode will have.
2018-09-04 04:45:01 +08:00
The RunMod function is your "main" function when running. You need to check for Usb commands, in order to let the pm3 client break the standalone mode. See this basic skeleton of main function RunMod().
````
void RunMod() {
// led show
StandAloneMode();
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
// main loop
for (;;) {
WDT_HIT();
// exit from standalone mode, just send a usbcommand
if (usb_poll_validate_length()) break;
// do your standalone stuff..
}
2018-09-04 04:45:01 +08:00
````
2017-08-26 19:01:35 +08:00
2017-10-22 23:00:53 +08:00
As it is now, you can only have one standalone mode installed at the time.
## Name
2017-08-26 19:01:35 +08:00
Use HF/LF to denote which frequence your mod is targeting.
Use you own github name/similar for perpetual honour to denote your mod
2018-09-04 04:36:43 +08:00
Samples of directive flag used in the `armsrc\makefile`:
2018-09-04 04:45:01 +08:00
```
2017-10-22 23:00:53 +08:00
### -DWITH_LF_ICERUN
### -DWITH_LF_SAMYRUN
### -DWITH_LF_PROXBRUTE
2017-10-29 10:47:00 +08:00
### -DWITH_LF_HIDBRUTE
2018-09-04 04:36:43 +08:00
### -DWITH_HF_COLIN
2017-10-22 23:00:53 +08:00
### -DWITH_HF_YOUNG
### -DWITH_HF_MATTYRUN
2018-09-04 04:45:01 +08:00
```
2018-09-04 04:36:43 +08:00
Add your source code file like the following sample in the `armsrc\makefile`
```
# WITH_HF_COLIN
ifneq (,$(findstring WITH_HF_COLIN,$(APP_CFLAGS)))
SRC_STANDALONE = hf_colin.c vtsend.c
2018-09-04 04:36:43 +08:00
else
SRC_STANDALONE =
2018-09-04 04:36:43 +08:00
endif
```
2017-10-22 23:00:53 +08:00
## Adding identification of your mode
2017-08-26 19:01:35 +08:00
Do please add a identification string in the function `printStandAloneModes` inside `armsrc\appmain.c`
2017-10-22 23:00:53 +08:00
This will enable an easy way to detect on client side which standalone mods has been installed on the device.
2018-09-04 04:45:01 +08:00
```
#if defined(WITH_HF_COLIN)
DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)");
#endif
````
2018-09-04 04:36:43 +08:00
Once all this is done, you and others can now easily compile different standalone modes by just swapping the -D directive in `armsrc\makefile`
2018-09-04 04:45:01 +08:00
````
#remove one of the following defines and comment out the relevant line
#in the next section to remove that particular feature from compilation.
# NO space,TABs after the "\" sign.
2018-09-04 04:45:01 +08:00
APP_CFLAGS = -DWITH_CRC \
-DON_DEVICE \
-DWITH_LF \
-DWITH_HITAG \
-DWITH_ISO15693 \
-DWITH_LEGICRF \
-DWITH_ISO14443b \
-DWITH_ISO14443a \
-DWITH_ICLASS \
-DWITH_FELICA \
-DWITH_FLASH \
-DWITH_SMARTCARD \
-DWITH_HFSNOOP \
-DWITH_HF_COLIN\
-DWITH_FPC \
-fno-strict-aliasing -ffunction-sections -fdata-sections
2018-09-04 04:45:01 +08:00
### IMPORTANT - move the commented variable below this line
# -DWITH_LCD \
# -DWITH_EMV \
# -DWITH_FPC \
2018-09-04 04:45:01 +08:00
#
# Standalone Mods
#-------------------------------------------------------
# -DWITH_LF_ICERUN
# -DWITH_LF_SAMYRUN
# -DWITH_LF_PROXBRUTE
# -DWITH_LF_HIDBRUTE
# -DWITH_HF_YOUNG
# -DWITH_HF_MATTYRUN
# -DWITH_HF_COLIN
2018-09-04 04:45:01 +08:00
````