Convert RAW data to its readable form

1.8k Views Asked by At

I have bought a MSR606 Mag-Stripe card reader. As you can see in its programmer's guidance document, it communicates with computer with standard RS232 signal voltage levels. Default, 9600 Baud, None Parity, 8 bits.

One of the commands that it support is Read RAW Data:

enter image description here

I tried to read my card with above command in python. These is results:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import serial
>>> encoder = serial.Serial("COM3", 9600, timeout = 3)
>>> encoder.write(b'\x1b\x6d')
2
>>> encoder.readline()
b'\x1bs\x1b\x01\x00\x1b\x02^\xd3C\x9eNp#y\x06\xf1\xb5\r\xa6\xd0\xd6\x01\x83y
\xc6\x84!\x08B\x10\x87\xed\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\x1b\x03\x00?\x1c\x1b0'
>>> 

And this is the result that the manufacturer's tool returns when I read the same card:

ISO Form : 6037991467167650=96051016776000000000
RAW Form : D3439E4E70237906F1B50DA6D0D6018379C6842108421087ED

This is manufacturer's tool output:

enter image description here

enter image description here

What is my problem?

I want to convert output of my Python program to the value that I see in manufacturer's tool, but I don't have any idea! I tried to convert the hex values to decimal, but didn't helped.

1

There are 1 best solutions below

0
On

It doesn't appear 'readline' is returning enough data to produce those ISO and RAW strings. I can't really test it myself, but check out the Python code here to see how they read and write data with that card reader:

https://www.triades.net/msr605-driver.html

Here's another library that may be useful:

https://github.com/0ki/libMSRx05