[英]Authentication on website using smart card in python
So I have a smart card provided by the company which looks like a credit card with a chip.所以我有一张公司提供的智能卡,它看起来像一张带有芯片的信用卡。 This card logins on a website after the card is inserted into the card reader.
此卡插入读卡器后登录网站。
Now I have to write a program in python which can read the card and login on that website using Requests
module.现在我必须用 python 编写一个程序,它可以读取卡并使用
Requests
模块登录该网站。 I tried to find out how to retrieve this authentication data from the card using python script and then use this data but I am partially successful.我试图找出如何使用 python 脚本从卡中检索此身份验证数据,然后使用此数据,但我取得了部分成功。 I installed the
pyscard
:我安装了
pyscard
:
from smartcard.System import readers
from smartcard.util import toHexString
r=readers()
print(r)
connection = r[0].createConnection()
connection.connect()
SELECT = [0xA0, 0x88, 0x00, 0x00] # CLA, INS, P1, P2
DF_TELECOM = [ 0x02, 0x7F, 0x10] # Lc, Data, Le
data, sw1, sw2 = connection.transmit( SELECT + DF_TELECOM )
So far I am able to transmit data and retrieve some data from card.到目前为止,我能够传输数据并从卡中检索一些数据。 I sent the command 88 in INS (Source : ISO 7816) which is for some sort of internal authentication( I assume this authentication data is used to login on the website) but I get below response :
我在 INS (来源:ISO 7816)中发送了命令 88,它用于某种内部身份验证(我假设此身份验证数据用于登录网站),但我得到以下响应:
data = []
sw1 = 110
sw2 = 00
I couldn't find the meaning of this response in ISO 7816. Can somebody tell me whether I have the right approach or hint to proceed further from here?我在 ISO 7816 中找不到这个响应的含义。有人能告诉我我是否有正确的方法或暗示从这里进一步进行? In short, i want to know how to login on the website using python script and smart card?
总之,我想知道如何使用python脚本和智能卡登录网站?
基本上,您得到的响应基本上是“6E00”,这意味着“不支持类”,只需将“INS”值替换为 0x00 就可以了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.