Giter VIP home page Giter VIP logo

zacharyweiss / magspoof_flipper Goto Github PK

View Code? Open in Web Editor NEW
514.0 29.0 26.0 331 KB

Port of Samy Kamkar's MagSpoof project (http://samy.pl/magspoof/) to the Flipper Zero. Enables wireless emulation of magstripe data, primarily over GPIO, with additional experimental internal TX.

Home Page: https://lab.flipper.net/apps/magspoof

License: MIT License

C 100.00%
flipper-plugin flipper-plugins flipper-zero flipperzero flipper stm32 rfid flipper-app flipper0 flipperapp

magspoof_flipper's Introduction

MagSpoof for the Flipper Zero

MagSpoof-ing, as coined / invented by Samy Kamkar, is the use of an electromagnet to emulate the data on a traditional magstripe card — wirelessly!

This app ports the original MagSpoof project to the Flipper Zero, adding file management and emulation controls, along with some experimental features. Visit the Wiki for information on getting started.

Tip

After the first launch of the app, the /apps_data/magspoof/ folder will be created on your Flipper's SD card, and populated with sample .mag files. Place your own files here, using the sample files as a template.

Warning

Use responsibly, and at your own risk. MagSpoof is intended solely for authorized security audits and educational purposes. Ensure legal compliance and obtain necessary permissions before using this tool.

I neither condone nor am sympathetic to malicious uses of my code.

TX Module

The GPIO module is a simple electromagnet consisting of an H-bridge, a capacitor, and a coil. One can build the pictured circuit, or purchase a MagSpoof board from the community. There is no "official board", but the following are popular choices:

Important

The linked boards do not read magstripes, they solely emulate.

Tip

Positioning can be finicky, especially on readers with significant EMF shielding. Situating the corner of one's coil over the read-head tends to give the most consistent results; try a few different angles / depths / positions until you find the sweet spot for your module.

Wiring diagram

A7, A6, and A4 are the default pins used by the app, but can be changed in the app's settings for custom boards.

Skunkworks and Experimental Features

Additional efforts have been made towards internal TX over the RFID / NFC / RF / Piezo systems. While there has been some success with internal TX being picked up/detected by more compact mag readers such as Square, it typically cannot produce a strong enough field for any reader I've tested to decode/parse all the transmitted data properly; as such, all alternate internal TX options are hidden behind debug mode. Old testing, notes, ideas, and planning can be found in NOTES.md.

There exists a Read scene in the app courtesy of hummusec. This is untested, and exclusively for use with UART magstripe readers; hence, as with the experimental internal TX, it is locked behind debug mode and intended only for developers. There do not exist any purchase-able / manufactured boards that include a reader. Independently, I am working on creating a general USB host for the Flipper using a MAX3421E; if and when this is completed one will be able to use a generic USB magstripe reader with the app, however, there is still much to do before this is ready.

Caution

If using experimental internal TX — while in my testing I've seen no reason to believe this could damage the RFID (or other) hardware, this is inherently using those systems in ways they were neither designed nor intended for; I take no responsibility for fried/bricked Flippers.

Credits

This project interpolates work from Samy Kamkar's original MagSpoof project, Alexey D. (dunaevai135) & Alexandr Yaroshevich's Flipper hackathon project, and the Flipper team's LF RFID and SubGhz apps.

Many thanks to everyone who has helped in addition to those above, most notably:

  • arha for bitmapping work, skunkworks testing, and innumerable suggestions/ideas/feedback (now a collaborator!)
  • Zalán Kórósi (Z4urce) for an earlier app icon
  • Salvatore Sanfilippo (antirez) for bitmapping suggestions and general C wisdom
  • skotopes for RFID consultation
  • Tiernan (NVX) + dlz for NFC consultation
  • davethepirate for EE insight and acting as a sounding board
  • cool4uma for their work on custom text_input scenes
  • hummusec for testing of UART RX
  • xMasterX and WillyJL for keeping the app updated across API changes while I was away!
  • Everyone else I've had the pleasure of chatting with!

magspoof_flipper's People

Contributors

arha avatar hummusec avatar willy-jl avatar zacharyweiss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magspoof_flipper's Issues

Test the RF coil for me please

Can you please run a test against your MSR with the new MagTxLFCarrier TX method? Perhaps do a few sanity checks yourself if the messages are fine. There's a new branch with a rather crude implementation which pulses the LF coil at 125k for LF_PULSE_US microseconds:tx-lf-carrier. Still waiting on Amazon for my stuff, sadly, otherwise I would have done this myself.

Current RF emulation on a 125khz tuned coil + track 1 gives me about 4Vpp
image

Charging the LF coil for 60us (with a 200us bit clock) boosts my reading to about 9V, that's 33% duty cycle, that should be about ~5 times of a stronger field. Note this is track 2 of Samy's test card.
image

Counting past the 25 zeroes, splitting the count at every zero bit, we should be getting the original track again (5, 3, 1, 1, 3, 1, 1, 3, 1...). This is posted as a sanity check for myself.
image

On a 50% duty cycle I get about 12Vpp on average, that should be about 9x more power.
image

I'm not holding my fingers crossed yet.

External coil test

Is the external coil option confirmed to work? I built a coil and I can't seem to get it to work.
20230209_184509
20230209_183048
20230209_183859

Build fails

Trying to build this against the latest firmware release gives the following:

scons: Entering directory `/home/rhys/.ufbt/current/scripts/ufbt'
	CC	/tmp/tmptmp/magspoof_flipper/helpers/mag_helpers.c
	CC	/tmp/tmptmp/magspoof_flipper/helpers/mag_text_input.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_about.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_delete_confirm.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_delete_success.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_emulate.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_emulate_config.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_exit_confirm.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_file_select.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_input_name.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_input_value.c
	CC	/tmp/tmptmp/magspoof_flipper/scenes/mag_scene_save_success.c
/tmp/tmptmp/magspoof_flipper/helpers/mag_text_input.c:3:10: fatal error: assets_icons.h: No such file or directory
    3 | #include <assets_icons.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
scons: *** [/home/rhys/.ufbt/build/mag/helpers/mag_text_input.o] Error 1
/tmp/tmptmp/magspoof_flipper/helpers/mag_helpers.c: In function 'tx_init_rfid':
/tmp/tmptmp/magspoof_flipper/helpers/mag_helpers.c:131:5: error: implicit declaration of function 'furi_hal_ibutton_start_drive'; did you mean 'furi_hal_ibutton_pin_write'? [-Werror=implicit-function-declaration]
  131 |     furi_hal_ibutton_start_drive();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     furi_hal_ibutton_pin_write
/tmp/tmptmp/magspoof_flipper/helpers/mag_helpers.c:132:5: error: implicit declaration of function 'furi_hal_ibutton_pin_low'; did you mean 'furi_hal_ibutton_pin_write'? [-Werror=implicit-function-declaration]
  132 |     furi_hal_ibutton_pin_low();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
      |     furi_hal_ibutton_pin_write
cc1: all warnings being treated as errors
scons: *** [/home/rhys/.ufbt/build/mag/helpers/mag_helpers.o] Error 1

Am I doing something wrong?

Exiting magspoof wip clears tracks

So I can add entries and track info. I can attempt to emulate this info. Once I leave magspoof and come back, I'll try to load a saved entry and find all the tack data is missing.

Inconsistent Results based on magstripe data length in track 2

I have done testing in the past and was unable to send track 2 with lengths of less than 17 characters. When sending for example a 16-digit ID number, the application would require padding prior to the start sentinel to see a result from the reader.

i.e.

;1234123412341234? = failure
0;1234123412341234? = successfully sends 1234123412341234

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.