一、0和255
题目给了俩个文件,一个.txt,一个.py
.txt文件中包含0和255
一个字节有八位,每一位只能储存1或0,计算机只懂二进制,所以就是2的八次方,又计算机规定从0开始计数,所以是0至255
考虑用编码转换工具将其中的255都变为1,删除无用字符,只留下1和0
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000001000010001100000001111111101111101011010011101111101111111101000101100110001101000101111111101000101001001000101000101111111101000101011111111101000101111111101111101011101101101111101111111100000001010101010100000001111111111111111100011111111111111111111111101101111000011110001001111111111101110010000111001110001111111101011101101010100111111001111111111100110001100011111011001111111110110100111111110001111011111111110011011110000101100100001111111101101100111010000100100101111111110000110111000110010011011111111100011101000010000000000101111111111111111000010010111001011111111100000001110000110101011001111111101111101111010000111010101111111101000101111000110000000011111111101000101011100111010010011111111101000101111101011101000101111111101111101101001101000111111111111100000001100011101110110001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
得到一串字符,0和1杂乱无章,网上查阅
二维码的生成原理,就是由0和1组成的
编写一段python代码,使用pillow包(Pillow是一个Python图像处理库)
试着得到二维码(MAX处填行列数,str填代码)
from PIL import Image MAX = # 每行每列数 # 二维码大小 pic = Image.new("RGB", (MAX, MAX)) str = "" i = 0 for y in range(0, MAX): for x in range(0, MAX): if (str[i] == "0"): pic.putpixel([x, y], (255, 255, 255)) else: pic.putpixel([x, y], (0, 0, 0)) i = i + 1 pic.show() pic.save("flag.png")
python文件中提示分辨率为33*33,则MAX处为33
之后解析二维码,得到字符串Polar_Night
之后看提示:
得到密码
0f46d4b056acb49f06b1090bab56189d
二、01
题目给了俩个文件
一个压缩zip文件和一个.txt文件
.txt文件中有
《0和255》的思路:01二维码的实现
将代码粘贴到python实现二维码的模版中
.txt文件中像素是25*25
所以MAX处填25
from PIL import Image MAX = 25 # 每行每列数 # 二维码大小 pic = Image.new("RGB", (MAX, MAX)) str = "1111111011111001001111111100000100000000110100000110111010001000101010111011011101010011110001011101101110100111001010101110110000010001110010010000011111111010101010101111111000000000011000100000000000101110110111010100010011110100111100111010101001011000110001000011011101100001001000010101111000100001001111110100110001001000100011000010111010101010011110000101111010110110101010001010010100000010100100101110011111111100100000000110111001000100011111111001100010101011011100000101111100110001100010111010110010101111110001011101000001110010111010101110101100100011111010110000010011010010011100101111111000010001000011011" i = 0 for y in range(0, MAX): for x in range(0, MAX): if (str[i] == "0"): pic.putpixel([x, y], (255, 255, 255)) else: pic.putpixel([x, y], (0, 0, 0)) i = i + 1 pic.show() pic.save("flag.png")
得到第一个密码:p@ssw0rd!
解压.zip文件得到flag.txt
很明显,是兽语解密
得到flag
flag{8a8c0a039c3bd6fb50e84b047e42e8e6}