Przeglądaj źródła

Squashed 'magspoof/' changes from 2e91ae384..5aa622016

5aa622016 New naming fixes part 1
a26aa0fa8 fix 5v power mag
d67a68987 update apps
7ad525986 move apps
REVERT: 2e91ae384 Fixed compilation, uart
REVERT: c732f08bb Reader message, missing free
REVERT: 8284fa979 Update README.md
REVERT: be79a9e8c MagSpoof read PoC
REVERT: a4df68cdd Merge pull request #3 from zacharyweiss/alt_tx
REVERT: c954330f0 Bump ver
REVERT: 312355e85 Fixed zero playback bug, initial wiggling tests
REVERT: 474b29a7b HF tests pt2 (unfruitful)
REVERT: 21a3a06b3 Merge pull request #2 from zacharyweiss/alt_tx
REVERT: 3330b8f96 Numerous updates
REVERT: 17c8e3bbc File loading fix
REVERT: 5785c7542 Missed a spot
REVERT: cb247c7b0 Initial piezo tests
REVERT: 83bd29d8d More brainstorming, better credits attribution
REVERT: dadb4b625 Typo + link
REVERT: 8d0e3367f Ver bump, new icon, RX brainstorming
REVERT: 156a41538 Icon update
REVERT: c6f16c6d2 Create wiring_diagram.png
REVERT: 2941854f0 Update README.md
REVERT: 982a92624 Bump version, new file icon, small fixes
REVERT: c64394247 Minor cleanup
REVERT: acc3de904 Update README.md
REVERT: c347fc529 Merge pull request #1 from arha/arha-bitwise
REVERT: 33fcf4408 timing fix for rf emulation
REVERT: a9dac27cd experimental emulation over RF. slow down bit time for better RXing on a sdr
REVERT: 81ae28b53 process bits before emulating them, implement them with bitwise operations + remove magic pattern
REVERT: 727a0093e process bits before emulating them, implement them with bitwise operations
REVERT: fd112e3a3 Gone bug-huntin'
REVERT: 7f0b477ce UI improvements, precompute bug found
REVERT: f5f09f6d6 Update README.md
REVERT: c489477e4 Emulate scene UI improvements
REVERT: ee15eb7b5 Added About scene, updated Info scene
REVERT: 92a601d55 Misc cleanup and README updates
REVERT: 366030e8f Debug logging and minor cleanup
REVERT: d84391b3b Update README.md
REVERT: bb8df8e74 Update README.md
REVERT: 461cb55b1 Update FUNDING.yml
REVERT: 5035f1d04 Create FUNDING.yml
REVERT: 79550cf66 Create LICENSE
REVERT: 5410ddb45 Update README.md
REVERT: 3d56fb25a Add sample file
REVERT: 692fac84f Update README.md
REVERT: ecf253af5 Saved emulate 90% functional
REVERT: d0faf3519 File format overhaul, config backend
REVERT: 9d20ab6d3 Update application.fam
REVERT: 00fdfceda Quick value_index import fixes?
REVERT: 436db4bc4 Quick saved track2 emulate tests
REVERT: 52c51f6eb WIP saved emulate+config scenes
REVERT: 7f3f3ade1 Config scene initial testing
REVERT: 90804b121 Add manually, emulate refactor WIP
REVERT: f36b54d25 Update README.md
REVERT: f02ad7954 README typo
REVERT: 5d6168e14 Notes, improved info scene
REVERT: 3e646d93b Info & delete scenes
REVERT: ca5a553d3 Remove debugging gunk
REVERT: 8f642dfaa mag_device overhaul, file loading
REVERT: 0187d204a Missed a spot!
REVERT: 9d92e652b Quick HF tests, initial mag_device commit
REVERT: 8770ff6e1 Update README.md
REVERT: d12fff7cd NFC notes
REVERT: 018c19017 README addition, disable string_element test
REVERT: 5c8557f39 Remove unused file, name input boilerplate
REVERT: 376436cc5 Additional README notes
REVERT: 258e46b09 Update mag_scene_emulate_test.c
REVERT: 3a13a51da Quick messy emulation edits/fixes
REVERT: 844970622 README typo fix
REVERT: 8f957295e Update README.md
REVERT: ef1cb1b63 Added historical spoofing implementation to the hardcoded emulation test ground
REVERT: f23ac31ed Update README.md
REVERT: 9bea56c92 Create README.md
REVERT: 3556b956c Initial commit

git-subtree-dir: magspoof
git-subtree-split: 5aa622016ea3f207b5cd23a889a081156c49ab17
Willy-JL 2 lat temu
rodzic
commit
56c42d1d30

+ 1 - 10
README.md

@@ -1,17 +1,8 @@
-# magspoof_flipper by Zachary Weiss
+# magspoof_flipper
 WIP of MagSpoof for the Flipper Zero. Basic TX of saved files confirmed working against an MSR90 with an external H-bridge module mirroring Samy Kamkar's design. RFID coil output weaker; able to be picked up/detected by more compact mag readers such as Square, but yet to have success with it being decoded/parsed properly. Additional investigation into alternate internal TX options (CC1101, ST25R3916, piezo) underway; tentatively, RFID coil + speaker (`LF + P` config setting) results in the strongest internal TX tested to date but still weaker than a dedicated external module or an actual card swipe (and sounds like a dial-up modem from hell). Sample files with test data are included in `assets` for anyone wishing to experiment.
 
 Disclaimer: use responsibly, and at your own risk. While in my testing, I've seen no reason to believe this could damage the RFID (or other) hardware, this is inherently driving the coil in ways it was not designed or intended for; I take no responsibility for fried/bricked Flippers. Similarly, please only use this with magstripe cards and mag readers you own — this is solely meant as a proof of concept for educational purposes. I neither condone nor am sympathetic to malicious uses of my code.
 
-## Hummus's Fork
-I made this fork initially to add reading capability using UART magnetic card readers.
-
-Things that changed in this fork:
-- Added a basic card reading ability
-- Added a function to parse a new MagDevice from a Card String (%Track1?;Track2;Track3?;)
-- Swapped the pins between A6 to A7 on the card that I'm using, might add this to configuration scene later on
-- Adapted some of the APIs to the most recent firmware changes.
-
 ## Optional GPIO TX Module
 For those desiring better TX than the internal RFID coil can offer, one can build the module below, consisting of an H-bridge, a capacitor, and a coil.
 

+ 5 - 6
helpers/mag_helpers.c

@@ -126,8 +126,6 @@ void play_track(uint8_t* bits_manchester, uint16_t n_bits, MagSetting* setting,
 void tx_init_rfid() {
     // initialize RFID system for TX
 
-    // OTG needed for RFID? Or just legacy from GPIO?
-    // furi_hal_power_enable_otg();
     furi_hal_ibutton_pin_configure();
 
     // furi_hal_ibutton_start_drive();
@@ -155,7 +153,6 @@ void tx_deinit_rfid() {
     furi_hal_gpio_write(RFID_PIN_OUT, 0);
 
     furi_hal_rfid_pins_reset();
-    furi_hal_power_disable_otg();
 }
 
 void tx_init_rf(int hz) {
@@ -189,7 +186,6 @@ bool tx_init(MagSetting* setting) {
         tx_init_rfid();
         break;
     case MagTxStateGPIO:
-        furi_hal_power_enable_otg();
         // gpio_item_configure_all_pins(GpioModeOutputPushPull);
         furi_hal_gpio_init(GPIO_PIN_A, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
         furi_hal_gpio_init(GPIO_PIN_B, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
@@ -234,9 +230,12 @@ bool tx_deinit(MagSetting* setting) {
         furi_hal_gpio_write(GPIO_PIN_B, 0);
         furi_hal_gpio_write(GPIO_PIN_ENABLE, 0);
 
-        // set back to analog output mode?
+        // set back to analog output mode? - YES
+        furi_hal_gpio_init(GPIO_PIN_A, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
+        furi_hal_gpio_init(GPIO_PIN_B, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
+        furi_hal_gpio_init(GPIO_PIN_ENABLE, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
+
         //gpio_item_configure_all_pins(GpioModeAnalog);
-        furi_hal_power_disable_otg();
         break;
     case MagTxStatePiezo:
         tx_deinit_piezo();

+ 13 - 0
mag.c

@@ -179,11 +179,24 @@ int32_t mag_app(void* p) {
 
     mag_make_app_folder(mag);
 
+    // Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
+    uint8_t attempts = 0;
+    bool otg_was_enabled = furi_hal_power_is_otg_enabled();
+    while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
+        furi_hal_power_enable_otg();
+        furi_delay_ms(10);
+    }
+
     view_dispatcher_attach_to_gui(mag->view_dispatcher, mag->gui, ViewDispatcherTypeFullscreen);
     scene_manager_next_scene(mag->scene_manager, MagSceneStart);
 
     view_dispatcher_run(mag->view_dispatcher);
 
+    // Disable 5v power
+    if(furi_hal_power_is_otg_enabled() && !otg_was_enabled) {
+        furi_hal_power_disable_otg();
+    }
+
     mag_free(mag);
 
     return 0;

+ 2 - 2
scenes/mag_scene_input_name.c

@@ -1,4 +1,4 @@
-#include <lib/toolbox/random_name.h>
+#include <toolbox/name_generator.h>
 #include "../mag_i.h"
 
 void mag_scene_input_name_on_enter(void* context) {
@@ -13,7 +13,7 @@ void mag_scene_input_name_on_enter(void* context) {
 
     if(name_is_empty) {
         furi_string_set(mag->file_path, MAG_APP_FOLDER);
-        set_random_name(mag->text_store, MAG_TEXT_STORE_SIZE);
+        name_generator_make_auto(mag->text_store, MAG_TEXT_STORE_SIZE, "Mag");
         furi_string_set(folder_path, MAG_APP_FOLDER);
     } else {
         // TODO: compatible types etc

+ 1 - 1
scenes/mag_scene_read.c

@@ -182,4 +182,4 @@ void mag_scene_read_on_exit(void* context) {
     // furi_hal_console_enable();
 
     notification_message(mag->notifications, &sequence_blink_stop);
-}
+}

+ 0 - 2
scenes/mag_scene_saved_menu.c

@@ -17,8 +17,6 @@ void mag_scene_saved_menu_on_enter(void* context) {
     Mag* mag = context;
     Submenu* submenu = mag->submenu;
 
-    notification_message(mag->notifications, &sequence_blink_cyan_10);
-
     // messy code to quickly check which tracks are available for emulation/display
     // there's likely a better spot to do this, but the MagDevice functions don't have access to the full mag struct...
     bool is_empty_t1 = furi_string_empty(mag->mag_dev->dev_data.track[0].str);