From 7220653ccdab4934f02dfc2c9c503d6cdcef0c2e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 25 Apr 2019 21:44:34 +0200 Subject: [PATCH] chg: refactor standalone mode info string add: icerun - skeleton standalone mode for ppl to use as base for their new modes. --- armsrc/Makefile | 2 +- armsrc/Standalone/hf_bog.c | 4 +++ armsrc/Standalone/hf_colin.c | 4 +++ armsrc/Standalone/hf_mattyrun.c | 4 +++ armsrc/Standalone/hf_young.c | 4 +++ armsrc/Standalone/lf_hidbrute.c | 4 +++ armsrc/Standalone/lf_icerun.c | 41 +++++++++++++++++++++++++ armsrc/Standalone/lf_icerun.h | 17 +++++++++++ armsrc/Standalone/lf_proxbrute.c | 4 +++ armsrc/Standalone/lf_samyrun.c | 4 +++ armsrc/Standalone/standalone.h | 1 + armsrc/appmain.c | 52 ++++++-------------------------- 12 files changed, 97 insertions(+), 44 deletions(-) create mode 100644 armsrc/Standalone/lf_icerun.c create mode 100644 armsrc/Standalone/lf_icerun.h diff --git a/armsrc/Makefile b/armsrc/Makefile index ed129c950..498453755 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -103,7 +103,7 @@ endif SRC_STANDALONE = # WITH_LF_ICERUN ifneq (,$(findstring WITH_LF_ICERUN,$(APP_CFLAGS))) - SRC_STANDALONE = + SRC_STANDALONE = lf_icerun.c endif # WITH_LF_SAMYRUN ifneq (,$(findstring WITH_LF_SAMYRUN,$(APP_CFLAGS))) diff --git a/armsrc/Standalone/hf_bog.c b/armsrc/Standalone/hf_bog.c index 36e600392..151282f3a 100644 --- a/armsrc/Standalone/hf_bog.c +++ b/armsrc/Standalone/hf_bog.c @@ -281,6 +281,10 @@ void RAMFUNC SniffAndStore(uint8_t param) { } } +void ModInfo(void) { + DbpString(" HF 14a sniff standalone with ULC/ULEV1/NTAG auth storing in flashmem - aka BogitoRun (Bogito)"); +} + void RunMod() { StandAloneMode(); diff --git a/armsrc/Standalone/hf_colin.c b/armsrc/Standalone/hf_colin.c index d8c1063e3..681223a02 100644 --- a/armsrc/Standalone/hf_colin.c +++ b/armsrc/Standalone/hf_colin.c @@ -195,6 +195,10 @@ void WriteTagToFlash(uint8_t index, size_t size) { return; } +void ModInfo(void) { + DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); +} + void RunMod() { StandAloneMode(); FpgaDownloadAndGo(FPGA_BITSTREAM_HF); diff --git a/armsrc/Standalone/hf_mattyrun.c b/armsrc/Standalone/hf_mattyrun.c index de22d11f9..9bcfd63d3 100644 --- a/armsrc/Standalone/hf_mattyrun.c +++ b/armsrc/Standalone/hf_mattyrun.c @@ -191,6 +191,10 @@ static int saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, ui return -1; } +void ModInfo(void) { + DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)"); +} + void RunMod() { StandAloneMode(); Dbprintf(">> Matty mifare chk/dump/sim a.k.a MattyRun Started <<"); diff --git a/armsrc/Standalone/hf_young.c b/armsrc/Standalone/hf_young.c index 24e20dd7f..f09a5eaa0 100644 --- a/armsrc/Standalone/hf_young.c +++ b/armsrc/Standalone/hf_young.c @@ -18,6 +18,10 @@ typedef struct { } __attribute__((__packed__)) card_clone_t; +void ModInfo(void) { + DbpString(" HF Mifare sniff/simulation - (Craig Young)"); +} + void RunMod() { StandAloneMode(); Dbprintf(">> Craig Young Mifare sniff UID/clone uid 2 magic/sim a.k.a YoungRun Started <<"); diff --git a/armsrc/Standalone/lf_hidbrute.c b/armsrc/Standalone/lf_hidbrute.c index 8571c0ce1..fbd71a704 100644 --- a/armsrc/Standalone/lf_hidbrute.c +++ b/armsrc/Standalone/lf_hidbrute.c @@ -26,6 +26,10 @@ //----------------------------------------------------------------------------------- #include "lf_hidbrute.h" +void ModInfo(void) { + DbpString(" LF HID corporate 1000 bruteforce - aka Corporatebrute (Federico dotta & Maurizio Agazzini)"); +} + // samy's sniff and repeat routine for LF void RunMod() { StandAloneMode(); diff --git a/armsrc/Standalone/lf_icerun.c b/armsrc/Standalone/lf_icerun.c new file mode 100644 index 000000000..b9a87e397 --- /dev/null +++ b/armsrc/Standalone/lf_icerun.c @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Christian Herrmann, 2019 +// +// 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. +//----------------------------------------------------------------------------- +// main code for skeleton aka IceRun by Iceman +//----------------------------------------------------------------------------- +#include "lf_icerun.h" + +void ModInfo(void) { + DbpString(" LF skeleton mode - aka IceRun (iceman)"); +} + +// samy's sniff and repeat routine for LF +void RunMod() { + StandAloneMode(); + Dbprintf("[=] LF skeleton code a.k.a IceRun started"); + FpgaDownloadAndGo(FPGA_BITSTREAM_LF); + + // the main loop for your standalone mode + for (;;) { + WDT_HIT(); + + // exit from IceRun, send a usbcommand. + if (usb_poll_validate_length()) break; + + // Was our button held down or pressed? + int button_pressed = BUTTON_HELD(1000); + + Dbprintf("button %d", button_pressed); + + if ( button_pressed ) + break; + } + +out: + DbpString("[=] exiting"); + LEDsoff(); +} diff --git a/armsrc/Standalone/lf_icerun.h b/armsrc/Standalone/lf_icerun.h new file mode 100644 index 000000000..50427320a --- /dev/null +++ b/armsrc/Standalone/lf_icerun.h @@ -0,0 +1,17 @@ +//----------------------------------------------------------------------------- +// Iceman, Christian Herrmann, 2019 +// +// 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. +//----------------------------------------------------------------------------- +// StandAlone Mod +//----------------------------------------------------------------------------- + +#ifndef __LF_ICERUN_H +#define __LF_ICERUN_H + +#include "standalone.h" // standalone definitions +#include "apps.h" // debugstatements, lfops? + +#endif /* __LF_ICERUN_H */ diff --git a/armsrc/Standalone/lf_proxbrute.c b/armsrc/Standalone/lf_proxbrute.c index 178ce98fb..c9fce3ac6 100644 --- a/armsrc/Standalone/lf_proxbrute.c +++ b/armsrc/Standalone/lf_proxbrute.c @@ -11,6 +11,10 @@ //----------------------------------------------------------------------------- #include "lf_proxbrute.h" +void ModInfo(void) { + DbpString(" LF HID ProxII bruteforce - aka Proxbrute (Brad Antoniewicz)"); +} + // samy's sniff and repeat routine for LF void RunMod() { StandAloneMode(); diff --git a/armsrc/Standalone/lf_samyrun.c b/armsrc/Standalone/lf_samyrun.c index b4530fa2f..8b3ae5360 100644 --- a/armsrc/Standalone/lf_samyrun.c +++ b/armsrc/Standalone/lf_samyrun.c @@ -10,6 +10,10 @@ //----------------------------------------------------------------------------- #include "lf_samyrun.h" +void ModInfo(void) { + DbpString(" LF HID26 standalone - aka SamyRun (Samy Kamkar)"); +} + // samy's sniff and repeat routine for LF void RunMod() { StandAloneMode(); diff --git a/armsrc/Standalone/standalone.h b/armsrc/Standalone/standalone.h index 334bbc2b4..217c7b4cf 100644 --- a/armsrc/Standalone/standalone.h +++ b/armsrc/Standalone/standalone.h @@ -15,5 +15,6 @@ #include // PRIu64 void RunMod(); +void ModInfo(); #endif /* __STANDALONE_H */ diff --git a/armsrc/appmain.c b/armsrc/appmain.c index e7887b9af..ca64d008f 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -411,7 +411,15 @@ void SendStatus(void) { Dbprintf(" ToSendMax...............%d", ToSendMax); Dbprintf(" ToSendBit...............%d", ToSendBit); Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE); - printStandAloneModes(); + DbpString("Installed StandAlone Mode"); + ModInfo(); + + //DbpString("Running "); + //Dbprintf(" Is Device attached to USB| %s", USB_ATTACHED() ? "Yes" : "No"); + //Dbprintf(" Is Device attached to FPC| %s", send_using_0 ? "Yes" : "No"); + //Dbprintf(" Is USB_reconnect value | %d", GetUSBreconnect() ); + //Dbprintf(" Is USB_configured value | %d", GetUSBconfigured() ); + cmd_send(CMD_ACK, 1, 0, 0, 0, 0); } @@ -427,48 +435,6 @@ void StandAloneMode(void) { SpinDown(50); SpinDelay(500); } -// detection of which Standalone Modes is installed -// (iceman) -void printStandAloneModes(void) { - - DbpString("Installed StandAlone Mode"); - -#if defined(WITH_LF_ICERUN) - DbpString(" LF sniff/clone/simulation - aka IceRun (iceman)"); -#endif -#if defined(WITH_HF_YOUNG) - DbpString(" HF Mifare sniff/simulation - (Craig Young)"); -#endif -#if defined(WITH_LF_SAMYRUN) - DbpString(" LF HID26 standalone - aka SamyRun (Samy Kamkar)"); -#endif -#if defined(WITH_LF_PROXBRUTE) - DbpString(" LF HID ProxII bruteforce - aka Proxbrute (Brad Antoniewicz)"); -#endif -#if defined(WITH_LF_HIDBRUTE) - DbpString(" LF HID corporate 1000 bruteforce - aka Corporatebrute (Federico dotta & Maurizio Agazzini)"); -#endif -#if defined(WITH_HF_MATTYRUN) - DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)"); -#endif -#if defined(WITH_HF_COLIN) - DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); -#endif -#if defined(WITH_HF_BOG) - DbpString(" HF 14a sniff standalone with ULC/ULEV1/NTAG auth storing in flashmem - aka BogitoRun (Bogito)"); -#endif - - //DbpString("Running "); - //Dbprintf(" Is Device attached to USB| %s", USB_ATTACHED() ? "Yes" : "No"); - //Dbprintf(" Is Device attached to FPC| %s", 0 ? "Yes" : "No"); - //Dbprintf(" Is USB_reconnect value | %d", GetUSBreconnect() ); - //Dbprintf(" Is USB_configured value | %d", GetUSBconfigured() ); - - //.. add your own standalone detection based on with compiler directive you are used. - // don't "reuse" the already taken ones, this will make things easier when trying to detect the different modes - // 2017-08-06 must adapt the makefile and have individual compilation flags for all mods - // -} /* OBJECTIVE