示例#1
0
    def received(self, bytesarr):
        response = bytesarr

        if len(self.command) < 4:
            self.type = 0
            self.cla, self.ins, self.P1, self.P2 = (self.command + [None, None, None, None])[:4]
            
        if len(self.command) == 4:
            self.type = 1
            self.Lc = 0
            self.Le = 0
            self.cla, self.ins, self.P1, self.P2 = self.command
            
        elif (len(self.command) == 5) or ((self.command[4] == 0) and (len(self.command) == 7)):
            self.type = 2
            self.cla, self.ins, self.P1, self.P2 = self.command[:4]
            self.Lc = 0
            self.Le, lelength = self.getLe()
            
        elif len(self.command) == (self.getLc()[0] + 5):
            self.type = 3
            self.cla, self.ins, self.P1, self.P2 = self.command[:4]
            self.Lc, lclength = self.getLc()
            self.data_command = stringify(self.command[4+lclength:])
            self.Le = 0

        else:
            self.type = 4
            self.cla, self.ins, self.P1, self.P2 = self.command[:4]
            self.Lc, lclength = self.getLc()
            self.Le, lelength = self.getLe()
            self.data_command = stringify(self.command[4+lclength:-lelength])

            
        self.data_response = stringify(response[:-2])
        self.SW1, self.SW2 = (response[-2:] + [None, None])[:2]
示例#2
0
 def performed(self, hresult, **params):
     Operation.performed(self, hresult, **params)
     self.outbuffer = stringify(params['outbuffer'])
示例#3
0
文件: atr.py 项目: benallard/webscard
 def get(cls, bytes):
     potential = cls.query.filter_by(canonical=stringify(bytes)).first()
     return potential or cls(bytes)
示例#4
0
 def __init__(self, name, context, **params):
     Operation.__init__(self, name, context, **params)
     self.controlcode = params['dwControlCode']
     self.inbuffer = stringify(params['inbuffer'])
示例#5
0
文件: atr.py 项目: benallard/webscard
 def __init__(self, atr):
     self.bytes = atr
     self.canonical = stringify(atr)