Created
October 12, 2015 15:10
-
-
Save arjan/25ab3f6175920c5b719b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import time | |
from smartcard.CardType import AnyCardType | |
from smartcard.CardRequest import CardRequest | |
from smartcard.util import toHexString | |
from smartcard.System import readers | |
print readers() | |
import webbrowser | |
cardtype = AnyCardType() | |
while True: | |
req = CardRequest( timeout=1, cardType=cardtype ) | |
svc = None | |
print "Waiting for card..." | |
while svc is None: | |
try: | |
svc = req.waitforcard() | |
except Exception, e: | |
pass | |
svc.connection.connect() | |
atr = toHexString( svc.connection.getATR() ).replace(" ", "") | |
uid = [0xFF, 0xCA, 0x00, 0x00, 0x00] | |
data, sw1, sw2 = svc.connection.transmit(uid) | |
tag = toHexString(data).replace(" ", "") | |
print "Got card:", tag | |
webbrowser.open("http://magik/?rfid=" + tag) | |
time.sleep(15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment