What is the easiest way to get track data off a simple USB HID magnetic card reader?

BuyTheBid picture BuyTheBid · Oct 12, 2010 · Viewed 16.2k times · Source

I need to get Track 1 and Track 2 data off magnetic cards and send them over the network to a waiting server. What is an easy way to get the track data from a USB HID magnetic card reader?

In case it helps, I have a MAGTEK Mini Swipe Magnetic Strip Reader (part no. 21040140)

I'm OS agnostic -- a solution for Windows, Mac or Linux would be great. Preferably no .NET, but if that's the easiest way I'll go for it.

What do you all think?

Thanks!

Answer

PaulG picture PaulG · Oct 12, 2010

Every card reader I've seen has had a keyboard emulator, so you swipe the card and it sends characters through the keyboard buffer. Looks like this one also does that (documentation : http://www.magtek.com/documentation/public/99875206-16.01.pdf)

Page 14 describes the data sent after a swipe, which is again, fairly standard across card readers:
[Tk1 SS] [Tk1 Data] [ES] [Tk2 SS] [Tk2 Data] [ES] [Tk3 SS] [Tk3 Data] [ES] [CR]

So your track one data starts with % and ends with ?
Track two data starts with ; and ends with ?

I noticed the question was tagged credit-card though, so it would be worth making sure you know the consequences of sending raw card-data across a network (even an internal network). Take a look at the Payment Card Industry Data Security Standards (PCI-DSS) : https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml


There is a demo program for that specific reader that comes with VB source.
http://www.magtek.com/support/software/demo_programs/usb_swipe_insert.asp