Beispiel #1
0
class BNPVirtKeyboard(MappedVirtKeyboard):
    symbols = {'0': '97a2b5816f2db74851fe05afd17dc9fe',
               '1': '0a24fe3a35efeb0a89aa5e7b098e6842',
               '2': '65ff550debf85eacf8efaadd6cd80aa5',
               '3': '2bd67143fcd4207ac14d0ea8afdf4ebb',
               '4': 'a46bfd21636805a31a579b253c3b23d5',
               '5': '3f644894037255bc0feaba9abb1facfa',
               '6': '40d91064a749563fa4dd31fb52e880f0',
               '7': 'cd3af65da74d57df1e6a91ca946c09b7',
               '8': '85b718e032a02e887c757a7745a1f0bd',
               '9': 'c2cdc08c8c68855d83c0899d7e8c6719',
               '-1': 'd41d8cd98f00b204e9800998ecf8427e',
               }

    color = 45

    def __init__(self, basepage):
        img = basepage.document.find("//img[@usemap='#MapGril']")
        imgdata = basepage.browser.openurl(img.attrib['src'])
        MappedVirtKeyboard.__init__(self, imgdata, basepage.document, img, self.color)
        self.check_symbols(self.symbols, basepage.browser.responses_dirname)

    def get_symbol_coords(self, (x1, y1, x2, y2)):
        # strip borders
        return MappedVirtKeyboard.get_symbol_coords(self, (x1+6, y1+1, x2-6, y2-4))
Beispiel #2
0
class VirtKeyboard(MappedVirtKeyboard):
    symbols = {
        '0': '18b66bc587a29742cbce4e10b7f1cb3f',
        '1': '8f21fb2dddd2e4751b3c2347e5b991cb',
        '2': 'ae90fc2f7e44ab03e8eb0a6f2a8fcdfd',
        '3': '35f1cc1a07dc1c1410761f56d37ac5f2',
        '4': '86f286828f95846f5cde187436e53855',
        '5': '6e08bc067ab243cb564226aba5e1ca1e',
        '6': 'ada513599ea3c98ad882ed9ffcd4b139',
        '7': 'ed13fea6185f3cbca43023374b5f41be',
        '8': 'ab4317d59ce2a7b1fd2e298af5785b10',
        '9': '8c165ad38c1eb72200e6011636c4c9b6'
    }

    color = (0xff, 0xff, 0xff)

    def __init__(self, page):
        img = page.document.find("//img[@usemap='#map']")
        img_file = page.browser.openurl(img.attrib['src'])
        MappedVirtKeyboard.__init__(self,
                                    img_file,
                                    page.document,
                                    img,
                                    self.color,
                                    map_attr='id')

        self.check_symbols(self.symbols, page.browser.responses_dirname)

    def get_symbol_code(self, md5sum):
        code = MappedVirtKeyboard.get_symbol_code(self, md5sum)
        return '%02d' % int(code.split('_')[-1])

    def get_string_code(self, string):
        code = ''
        for c in string:
            code += self.get_symbol_code(self.symbols[c])
        return code

    def get_symbol_coords(self, (x1, y1, x2, y2)):
        # strip borders
        return MappedVirtKeyboard.get_symbol_coords(
            self, (x1 + 3, y1 + 3, x2 - 3, y2 - 3))
Beispiel #3
0
class VirtKeyboard(MappedVirtKeyboard):
    symbols = {
        '0': 'daa52d75287bea58f505823ef6c8b96c',
        '1': 'f5da96c2592803a8cdc5a928a2e4a3b0',
        '2': '9ff78367d5cb89cacae475368a11e3af',
        '3': '908a0a42a424b95d4d885ce91bc3d920',
        '4': '3fc069f33b801b3d0cdce6655a65c0ac',
        '5': '58a2afebf1551d45ccad79fad1600fc3',
        '6': '7fedfd9e57007f2985c3a1f44fb38ea1',
        '7': '389b8ef432ae996ac0141a2fcc7b540f',
        '8': 'bf357ff09cc29ea544991642cd97d453',
        '9': 'b744015eb89c1b950e13a81364112cd6'
    }

    color = (0xff, 0xff, 0xff)

    def __init__(self, page):
        img = page.document.find("//img[@usemap='#map']")
        img_file = page.browser.openurl(img.attrib['src'])
        MappedVirtKeyboard.__init__(self,
                                    img_file,
                                    page.document,
                                    img,
                                    self.color,
                                    map_attr='id')

        self.check_symbols(self.symbols, page.browser.responses_dirname)

    def get_symbol_code(self, md5sum):
        code = MappedVirtKeyboard.get_symbol_code(self, md5sum)
        return '%02d' % int(code.split('_')[-1])

    def get_string_code(self, string):
        code = ''
        for c in string:
            code += self.get_symbol_code(self.symbols[c])
        return code

    def get_symbol_coords(self, (x1, y1, x2, y2)):
        # strip borders
        return MappedVirtKeyboard.get_symbol_coords(
            self, (x1 + 3, y1 + 3, x2 - 3, y2 - 3))
Beispiel #4
0
 def get_symbol_coords(self, coords):
     # strip borders
     x1, y1, x2, y2 = coords
     return MappedVirtKeyboard.get_symbol_coords(
         self, (x1 + 10, y1 + 10, x2 - 10, y2 - 10))
Beispiel #5
0
 def get_symbol_coords(self, coords):
     # strip borders
     x1, y1, x2, y2 = coords
     return MappedVirtKeyboard.get_symbol_coords(self, (x1 + 10, y1 + 10, x2 - 10, y2 - 10))