Beispiel #1
0
def test(card):
    aid = ''
    t = Terminal()
    ts = Transaction()
    for aid in l:
        adf = ADF(aid,'1001')
        apdu = APDU.APDU(card)
        t.tsAmount = '00000010'
        t.tsType = const.TTI_EP_LOAD
        t.key = Key('01','42EAF305CDE83EC62C67BCB44B946B65')
        ts.load(t, adf, apdu)
Beispiel #2
0
def test(card):
    aid = ''
    t = Terminal()
    ts = Transaction()
    for aid in l:
        adf = ADF(aid, '1001')
        apdu = APDU.APDU(card)
        t.tsAmount = '00000010'
        t.tsType = const.TTI_EP_LOAD
        t.key = Key('01', '42EAF305CDE83EC62C67BCB44B946B65')
        ts.load(t, adf, apdu)
Beispiel #3
0
def test(card):
    aid = ''
    t = Terminal()
    ts = Transaction()
    for aid in [l[0]]:
        adf = ADF(aid, '1001')
        apdu = APDU.APDU(card)
        #t.tsAmount = '0000'+Util.generateRnd(2)
        t.tsAmount = '0009DFFF'
        t.tsType = const.TTI_EP_PURCHASE
        t.key = Key('01', '0BA5B6D33FEC6DD73A5AA6CF81E818C7')
        ts.purchase(t, adf, apdu)
Beispiel #4
0
def test(card):
    aid = ''
    t = Terminal()
    ts = Transaction()
    for aid in [l[0]]:
        adf = ADF(aid,'1001')
        apdu = APDU.APDU(card)
        #t.tsAmount = '0000'+Util.generateRnd(2)
        t.tsAmount = '0009DFFF'
        t.tsType = const.TTI_EP_PURCHASE
        t.key = Key('01','0BA5B6D33FEC6DD73A5AA6CF81E818C7')
        ts.purchase(t, adf, apdu)
    def lexing(self, reader):
        ps = []
        lineArr = reader.readlines()
        keys = list(self.tokenBuilders.keys())
        lineno = 1

        for index in range(len(keys)):
            ps.append(re.compile(keys[index]))

        for line_idx in range(len(lineArr)):
            line = lineArr[line_idx].rstrip("\n")

            front_idx = 0
            while front_idx < len(line):
                for i in range(len(keys)):
                    regExp = keys[i]
                    p = ps[i]
                    matcher = p.match(line, front_idx)

                    if matcher:
                        startIdx = matcher.start()
                        endIdx = matcher.end()

                        mat_str = line[startIdx:endIdx]
                        tb = self.tokenBuilders[regExp]

                        front_idx = endIdx

                        if tb(mat_str):
                            self.terminalList.append(
                                Terminal(mat_str, tb(mat_str), startIdx,
                                         lineno))
                        break
                if i >= len(keys):
                    raise LexerException("No Pattern Matching " + front_idx +
                                         ", " + line[front_idx:])

            lineno += 1
        tb = self.tokenBuilders[self.endOfTok]
        self.terminalList.append(
            Terminal(self.endOfTok, tb(self.endOfTok), -1, -1))