Getting Started with MagSpoof using Arduino IDEThis guide covers the process of uploading code to the MagSpoof with Arduino IDE.
You will need the following items for this guide:
1. Install Arduino IDE.
2. Open Arduino IDE as root/administrator.
- Open a terminal application and navigate to the Arduino IDE folder. Run the following commands inside the Arduino folder.
- sudo ./arduino
- Enter your root password.
- Arduino IDE should now open.
- Navigate to the Arduino IDE folder.
- Right click and click run as administrator.
3. Download Samy's code from GitHub.
git clone https://github.com/samyk/magspoof.git
4. Copy the contents of magspoof.c into a new sketch. Save the new sketch.
5. Inside Arduino IDE click file –> preferences. In the settings tab at the very bottom you will see an option called "Additional Boards Manager URLs". Enter the following URL.
- Click OK
6. Click Tools –> Board –> Board Manager. Navigate to the bottom and click on the new entry called "attiny by David A. Mellis", select version 1.0.1 and click install. Then close Board Manager.
7. Configure the board settings.
- Click Tools –> Board and select ATtiny.
- Click Tools –> Processor select ATtiny85.
- Click Tools –> Clock select 8 MHz (internal).
8. Click Tools -> Programmer and select your programmer from the list shown. In this example we are using the Sparkfun AVR Pocket Programmer, and set the programmer to USBtinyISP.
9. Place the battery inside your MagSpoof and turn it on.
10. Verify the software by clicking the check mark in the top left hand corner.
11. Upload the code by clicking on the arrow. If it completes successfully your MagSpoof is now programmed.
12. Change the track information highlighted below as follows.
- Track 1
"%B4444444444444444^ABE/LINCOLN^291110100000931?\0", // Track 1
";4444444444444444=29111010000093100000?\0" // Track 2
Your code should now look something like this.
Upload the new code to the MagSpoof.
13. Open up a new text document and connect your MagStripe Reader. MagStripe readers pretend to be USB keyboards and will enter text in the document after completing a successful read. Try it by swiping a real credit card.
With your MagSpoof touching the reader, press the button. You should see output similar to the string shown below. Play around with the angle if you are getting different results.
14. There is a variable in the code called CLOCK_US that controls the speed at which the card data is transmitted. At the current CLOCK_US you only get the second track, if you change the CLOCK_US to 120 you should get the first track. This is due to the variable bit densities of track data.
15. Change the following code and add your credit card information below. We recommended swiping your card with the MagStripe Reader and copying and pasting the output.
If you have any questions related to this blog please email us at email@example.com.