Created
July 18, 2014 16:45
-
-
Save Achifaifa/96d533dddcee2147c9e1 to your computer and use it in GitHub Desktop.
This code reads and displays data from Spanish social security magnetic cards.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, sys, termios, tty | |
def getch(): | |
fd = sys.stdin.fileno() | |
old = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
return sys.stdin.read(33) | |
finally: | |
termios.tcsetattr(fd, termios.TCSADRAIN, old) | |
os.system('clear') | |
while 1: | |
data=getch() | |
data=data.split(')') | |
print "\n?: %s" %data[0][:-8] | |
print "SSN: %s" %data[0][-8:] | |
print "?: %s" %data[1] | |
print "Expiry: W%s, %s" %(data[2][:-4],data[2][-4:]) | |
print "B date: %s/%s/%s" %(data[3][-4:],data[3][-2:],data[3][:-2]) | |
print "?: %s\n" %(data[4]) | |
print "===========================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment