diff --git a/misc/easy_qrcode/2qrcode.py b/misc/easy_qrcode/2qrcode.py new file mode 100644 index 0000000..a56acfa --- /dev/null +++ b/misc/easy_qrcode/2qrcode.py @@ -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") + diff --git a/misc/easy_qrcode/flag.txt b/misc/easy_qrcode/flag.txt new file mode 100644 index 0000000..2d3d5f4 --- /dev/null +++ b/misc/easy_qrcode/flag.txt @@ -0,0 +1 @@ +flag{It's_really_easy} \ No newline at end of file diff --git a/misc/easy_qrcode/qr.png b/misc/easy_qrcode/qr.png new file mode 100644 index 0000000..4edf5f0 Binary files /dev/null and b/misc/easy_qrcode/qr.png differ