Пример #1
0
 def get_qr_data(self, img):
     # Get Date of Picture
     self.decoded = qrcode.Decoder()
     if self.decoded.decode(img):
         print('result: ' + self.decoded.result)
     else:
         print('error: ' + self.decoded.error)
     pass
Пример #2
0
def post_process_frames():
    # The .tar where things are stored
    storage = open("storage.tar", "w+")
    for frame in range(6):
        d = qrcode.Decoder()
        framePath = str(frame) + ".png"
        fullFramePath = "frame-" + framePath.zfill(11)
        d.decode(fullFramePath)
        print(d.result)
        storage = open("storage.tar", "a+")
        storage.write(d.result)
Пример #3
0
#!/usr/bin/env python

# coding: utf-8

#

# pyqrcode sample decoder

import sys, qrcode

d = qrcode.Decoder()

if d.decode('qrcode.png'):

    print 'result: ' + d.result

else:

    print 'error: ' + d.error
Пример #4
0
import qrcode
from pwn import *


def qrimg(lines, filename):
    font = ImageFont.truetype('clacon.ttf')
    img = Image.new("RGBA", (380, 380), (255, 255, 255))
    draw = ImageDraw.Draw(img)
    y_text = 8
    for line in lines:
        line = unicode(line, "utf-8")
        width, height = font.getsize(line)
        draw.text((0, y_text), line, (0, 0, 0), font=font)
        y_text += height
        draw = ImageDraw.Draw(img)
    img.save(filename)


conn = remote('hack.bckdr.in', 8010)
for messagenum in range(1, 100 + 1):
    input = conn.recvlines(47)
    print "[+] Got challenge number " + str(messagenum)
    qrimg(input, "qrtmp.png")
    thedata = qrcode.Decoder()
    if thedata.decode("qrtmp.png"):
        conn.send(thedata.result)

flag = conn.recvall()
print "Flag message: " + flag
conn.close()