easy_qrcode题目及附件
This commit is contained in:
25
misc/easy_qrcode/2qrcode.py
Normal file
25
misc/easy_qrcode/2qrcode.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import qrcode
|
||||
|
||||
def generate_qr(data, file_name="qr.png"):
|
||||
"""
|
||||
生成二维码并保存为文件
|
||||
:param data: 要编码的数据
|
||||
:param file_name: 保存的文件名
|
||||
"""
|
||||
qr = qrcode.QRCode( # type: ignore
|
||||
version=10,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_L, # type: ignore
|
||||
box_size=10,
|
||||
border=4,
|
||||
)
|
||||
qr.add_data(data)
|
||||
qr.make(fit=True)
|
||||
|
||||
img = qr.make_image(fill_color="black", back_color="white")
|
||||
img.save(file_name)
|
||||
|
||||
|
||||
with open("flag.txt","r") as f:
|
||||
text = f.read()
|
||||
generate_qr(text,"qr.png")
|
||||
|
1
misc/easy_qrcode/flag.txt
Normal file
1
misc/easy_qrcode/flag.txt
Normal file
@@ -0,0 +1 @@
|
||||
flag{It's_really_easy}
|
BIN
misc/easy_qrcode/qr.png
Normal file
BIN
misc/easy_qrcode/qr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user