Magstripe Card Reader – 22/03/2025

 

I was browsing on EBay when I came across this listing:

A black cable with a black cord

AI-generated content may be incorrect.

I was intrigued and so I decided to purchase it.

By observing the device, the way it works is that there is a spring-loaded Magnetic reader, that when is pushed down by the swiping of a card, records the data.

This is the spring-loaded magnetic reader.

 

Once the device records the data, it enters the keystrokes of the data into the connect computer (via USB-A).

The device acts as a keyboard or HID (Human-Interface-Device). Once a card is swiped, it typesthe data really fast into the connected computer and then simulates pressing ENTER.

However, the data is sort of a jumbled mess. I swiped my debit card on it and here is what it typed (sensitive data redacted)

%B################^LASTNAME/FIRSTNAME.            ^YYMM********   ****************?;################=********************?

 

I have made a python program to parse/extract the relevant data (Card no, Cardholder name, Expiry) and display it.

Python Code:

import tkinter as tk

from tkinter import messagebox

 

def parse_magstripe(data):

    try:

        if data.startswith('%B') and '?' in data:

            # Split the data into tracks

            track1, track2 = data.split('?')[:2]

           

            # Parse Track 1

            track1_parts = track1.split('^')

            card_number = track1_parts[0][2:]  # Remove %B prefix

            cardholder_name = track1_parts[1].strip()

            exp_date = track1_parts[2][:4]

            exp_date = f'{exp_date[2:4]}/{exp_date[0:2]}'

           

            return card_number, exp_date, cardholder_name

        else:

            raise ValueError("Invalid magstripe data")

    except Exception as e:

        messagebox.showerror("Error", f"Failed to parse card data: {e}")

        return None, None, None

 

def on_card_swipe(event=None):

    data = entry.get()

    card_number, exp_date, cardholder_name = parse_magstripe(data)

    if card_number:

        card_number_label.config(text=f"Card Number: {card_number}")

        exp_date_label.config(text=f"Exp Date (MM/YY): {exp_date}")

        cardholder_name_label.config(text=f"Cardholder Name: {cardholder_name}")

    entry.delete(0, tk.END)

 

app = tk.Tk()

app.title("Magstripe Card Reader Parser")

app.geometry("400x200")

 

entry = tk.Entry(app, font=('Arial', 14))

entry.pack(pady=10)

entry.bind("<Return>", on_card_swipe)

 

card_number_label = tk.Label(app, text="Card Number:", font=('Arial', 12))

card_number_label.pack(pady=5)

 

exp_date_label = tk.Label(app, text="Exp Date (MM/YY):", font=('Arial', 12))

exp_date_label.pack(pady=5)

 

cardholder_name_label = tk.Label(app, text="Cardholder Name:", font=('Arial', 12))

cardholder_name_label.pack(pady=5)

 

app.mainloop()

A screenshot of a computer

AI-generated content may be incorrect.

 

 

 

 

 

 

When using the program, you should first click on the Text Input box at the top. Then all you need to do is swipe your Credit/Debit card in the Magstripe Card Reader and the relevant data should be displayed.

The downside of the magnetic strip is that it does not contain the CVC/CVV code, so you can not easily process online transactions using just the data from the Magnetic Strip.

 

You can also scan any other cards with a magnetic strip, such as gift cards. However the above program is only for Debit/Credit cards, so it is best to open a text editor such as Notepad or Notepad++ to see the data.

Once swiping, the device plays a short and sharp BEEP! sound.

 

Thank you for reading to the end, and please email any questions or feedback to [email protected]

Have a lovely day :)