diff --git a/armsrc/Standalone/hf_bog.c b/armsrc/Standalone/hf_bog.c index 510d08d02..bea2a1877 100644 --- a/armsrc/Standalone/hf_bog.c +++ b/armsrc/Standalone/hf_bog.c @@ -57,10 +57,9 @@ void EraseMemory() { SpinDelay(100); } +// This is actually copied from SniffIso14443a void RAMFUNC SniffAndStore(uint8_t param) { - /* This is actually copied from SniffIso14443a */ - iso14443a_setup(FPGA_HF_ISO14443A_SNIFFER); // Allocate memory from BigBuf for some buffers @@ -269,7 +268,16 @@ void RAMFUNC SniffAndStore(uint8_t param) { } void RunMod() { - Dbprintf("Sniffing started"); + + Dbprintf(">> Bogiton 14a Sniff UL/UL-EV1/NTAG a.k.a BogitoRun Started <<"); + Dbprintf("Starting to sniff"); + + SpinDown(50); + SpinOff(50); + SpinUp(50); + SpinOff(50); + SpinDown(50); + SpinDelay(500); // param: // bit 0 - trigger from first card answer @@ -277,4 +285,5 @@ void RunMod() { SniffAndStore(0); LEDsoff(); SpinDelay(300); + Dbprintf("- [ End ] -> You can take shell back ..."); } diff --git a/armsrc/Standalone/hf_colin.c b/armsrc/Standalone/hf_colin.c index 18547ee12..c91c05766 100644 --- a/armsrc/Standalone/hf_colin.c +++ b/armsrc/Standalone/hf_colin.c @@ -87,74 +87,6 @@ void cjPrintKey(uint64_t key, uint8_t *foundKey, uint16_t sectorNo, uint8_t type DbprintfEx(FLAG_NOLOG, "SEC: %02x | KEY : %s | TYP: %d", sectorNo, tosendkey, type); } -void SpinOff(uint32_t pause) -{ - LED_A_OFF(); - LED_B_OFF(); - LED_C_OFF(); - LED_D_OFF(); - SpinDelay(pause); -} - -// 0=A, 1=B, 2=C, 3=D -void SpinErr(uint8_t led, uint32_t speed, uint8_t times) -{ - SpinOff(speed); - NTIME(times) - { - switch (led) - { - case 0: - LED_A_INV(); - break; - case 1: - LED_B_INV(); - break; - case 2: - LED_C_INV(); - break; - case 3: - LED_D_INV(); - break; - } - SpinDelay(speed); - } -} - -void SpinDown(uint32_t speed) -{ - SpinOff(speed); - LED_D_ON(); - SpinDelay(speed); - LED_D_OFF(); - LED_C_ON(); - SpinDelay(speed); - LED_C_OFF(); - LED_B_ON(); - SpinDelay(speed); - LED_B_OFF(); - LED_A_ON(); - SpinDelay(speed); - LED_A_OFF(); -} - -void SpinUp(uint32_t speed) -{ - SpinOff(speed); - LED_A_ON(); - SpinDelay(speed); - LED_A_OFF(); - LED_B_ON(); - SpinDelay(speed); - LED_B_OFF(); - LED_C_ON(); - SpinDelay(speed); - LED_C_OFF(); - LED_D_ON(); - SpinDelay(speed); - LED_D_OFF(); -} - void ReadLastTagFromFlash() { SpinOff(0); diff --git a/armsrc/Standalone/hf_colin.h b/armsrc/Standalone/hf_colin.h index 028c7b5b6..2b7879b6b 100644 --- a/armsrc/Standalone/hf_colin.h +++ b/armsrc/Standalone/hf_colin.h @@ -38,8 +38,6 @@ #define _WHITE_ "\x1b[0m" #define _ORANGE_ _YELLOW_ -#define NTIME(n) for (int _index = 0; _index < n; _index++) - int cjat91_saMifareChkKeys(uint8_t blockNo, uint8_t keyType, bool clearTrace, uint8_t keyCount, uint8_t *datain, uint64_t *key); void e_MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain); void saMifareMakeTag(void); diff --git a/armsrc/util.c b/armsrc/util.c index b5be57923..77ef3a494 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -154,6 +154,70 @@ void LED(int led, int ms) { LED_D_OFF(); } +void SpinOff(uint32_t pause) { + LED_A_OFF(); + LED_B_OFF(); + LED_C_OFF(); + LED_D_OFF(); + SpinDelay(pause); +} + +// 0=A, 1=B, 2=C, 3=D +void SpinErr(uint8_t led, uint32_t speed, uint8_t times) { + SpinOff(speed); + NTIME(times) + { + switch (led) { + case 0: + LED_A_INV(); + break; + case 1: + LED_B_INV(); + break; + case 2: + LED_C_INV(); + break; + case 3: + LED_D_INV(); + break; + } + SpinDelay(speed); + } +} + +void SpinDown(uint32_t speed) { + SpinOff(speed); + LED_D_ON(); + SpinDelay(speed); + LED_D_OFF(); + LED_C_ON(); + SpinDelay(speed); + LED_C_OFF(); + LED_B_ON(); + SpinDelay(speed); + LED_B_OFF(); + LED_A_ON(); + SpinDelay(speed); + LED_A_OFF(); +} + +void SpinUp(uint32_t speed) { + SpinOff(speed); + LED_A_ON(); + SpinDelay(speed); + LED_A_OFF(); + LED_B_ON(); + SpinDelay(speed); + LED_B_OFF(); + LED_C_ON(); + SpinDelay(speed); + LED_C_OFF(); + LED_D_ON(); + SpinDelay(speed); + LED_D_OFF(); +} + + // Determine if a button is double clicked, single clicked, // not clicked, or held down (for ms || 1sec) // In general, don't use this function unless you expect a diff --git a/armsrc/util.h b/armsrc/util.h index 77fd81ee4..cc613b273 100644 --- a/armsrc/util.h +++ b/armsrc/util.h @@ -39,6 +39,10 @@ # define ARRAYLEN(x) (sizeof(x)/sizeof((x)[0])) #endif +#ifndef NTIME +# define NTIME(n) for (int _index = 0; _index < n; _index++) +#endif + size_t nbytes(size_t nbits); extern uint32_t reflect(uint32_t v, int b); // used in crc.c ... @@ -53,7 +57,12 @@ int32_t le24toh (uint8_t data[3]); uint8_t hex2int(char hexchar); void LED(int led, int ms); -void LEDsoff(); +void LEDsoff(void); +void SpinOff(uint32_t pause); +void SpinErr(uint8_t led, uint32_t speed, uint8_t times); +void SpinDown(uint32_t speed); +void SpinUp(uint32_t speed); + int BUTTON_CLICKED(int ms); int BUTTON_HELD(int ms); void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_information);