Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 670 Bytes

2018-01-11.md

File metadata and controls

40 lines (26 loc) · 670 Bytes

2018-01-11

RCA-CTF-Login

玩了一下,两个关于QR的CTF题目,使用PIL库

from PIL import Image

f = open("./data.txt", "r")
lines = f.readlines()
f.close()

x = len(lines[0])
y = len(lines)

print x,y

c = Image.new("RGB", (x, y))

for height in range(0, y):
    for width in range(0, x):
        if lines[height][width] == '1':
            c.putpixel([height, width], (0, 0, 0))
        elif lines[height][width] == '0':
            c.putpixel([height, width], (255, 255, 255))

c.save("xx.png")
c.show()

关于图片反色的操作:

import PIL.ImageOps

c = PIL.ImageOps.invert(c)