题目链接
下载题目后是一堆整齐的01字符串,猜测是生成二维码,将0变成白色方块,1变成黑色方块。
0000000001110010000000000
0000000000011110100000000
0000000001110001000000000
0000000010111100000000000
0000000010101010000000000
0000000001100010100000000
0000000010101010100000000
0000000001000001100000000
1100011101110110100011000
0001000010110010010010100
0100111101000011101110011
0011110100101011001001001
1000001001100001001101000
1111000111111011100101000
1011011111001101111110111
1000110110010010101101100
1000111100111111111110111
0000000010110001100010100
0000000010010100101010001
0000000010101010100011001
0000000000100111111110010
0000000000011001011110111
0000000001001100100100001
0000000011000011011011001
0000000011010000101110101
python代码实现生成二维码。
from PIL import Image
def string_to_qr_code(data_string, block_size=10, margin=10):
# 将字符串按宽度分割成行
data_lines = data_string.strip().split('\n')
width = len(data_lines[0])
height = len(data_lines)
# 创建一个白色背景的图像
img = Image.new('1', (width * block_size + 2 * margin, height * block_size + 2 * margin), 'white')
# 绘制二维码
for y, line in enumerate(data_lines):
for x, char in enumerate(line):
for i in range(block_size):
for j in range(block_size):
if char == '1':
img.putpixel((x * block_size + margin + i, y * block_size + margin + j), 0) # 0 为黑色
return img
# 示例字符串
data_string = """0000000001110010000000000
0000000000011110100000000
0000000001110001000000000
0000000010111100000000000
0000000010101010000000000
0000000001100010100000000
0000000010101010100000000
0000000001000001100000000
1100011101110110100011000
0001000010110010010010100
0100111101000011101110011
0011110100101011001001001
1000001001100001001101000
1111000111111011100101000
1011011111001101111110111
1000110110010010101101100
1000111100111111111110111
0000000010110001100010100
0000000010010100101010001
0000000010101010100011001
0000000000100111111110010
0000000000011001011110111
0000000001001100100100001
0000000011000011011011001
0000000011010000101110101"""
# 生成二维码图像,您可以通过修改 block_size 来调整黑白块的大小
qr_code_image = string_to_qr_code(data_string, block_size=20) # 假设您想要每个块的大小为20像素
# 显示图像
qr_code_image.show()
# 保存图像
qr_code_image.save('qr_code.png')
生成的结果没有定位图,所以百度了一个二维码定位图片,用电脑自带的画图软件将定位符粘上去,得到了一个可以扫描的二维码
使用QR Research扫码得到flag{QR_c0de_1s_1nterest1n9}