Today we have very friendly mission – qr codes and simple calculations.
More details here: link
Okay – how I started?
I always start the same way – from my mobile device…., I opened website, and url from description, there was a QR code, so I saved it to my device, but my Iphone app could’nt read from this file. So… I got second phone (Android) and scanned QR code from Iphone display, and sent it by whatsapp:
OK – how to calculate this? Value by value or with math rules?
I’ve tried both
way, but…. it wasn’t work, cos….
If you have bad tools, your result will be the same….
In Python it looks differen:
So… I’ve got next QR code, next calculation, and again, and again, and again….
Libraries:
pip install pyzbar pip install Pillow |
Code:
from pyzbar.pyzbar import decode from PIL import Image import requests url="http://gynvael.coldwind.pl/qrmaze/" fileName = "e:\python\\" fn = "start" ext = '.png' while fn != '': req = requests.get(''.join([url, fn, ext])) file = open(''.join([fileName, fn, ext]), 'wb') for chunk in req.iter_content(100000): file.write(chunk) file.close() qrData = decode(Image.open(''.join([fileName, fn, ext]))) item = qrData[0][0].decode("utf-8") fn = '' if "Calc value, add .png, repeat: " in item: x = item[30:].split(',') print(x) value = x[0].__str__() for a in x[1:]: tmp = ''.join([value, a]) value = eval(tmp).__str__() print(value) fn = ''.join(value) else: print(item) |
Flag:
Yeah! – 1001 Dalmatians 🙂