Moved directories

This commit is contained in:
2023-12-18 16:48:13 +01:00
parent 697849f63e
commit fbd69c1109
21 changed files with 0 additions and 0 deletions

View File

Binary file not shown.

32
Day 01/decode.py Normal file
View File

@@ -0,0 +1,32 @@
import string
from bs4 import BeautifulSoup
from PIL import Image
from pyzbar.pyzbar import decode
qr_size = 25
pix_size = 10
img_size = pix_size * qr_size
with open("templates/santa.j2", "r") as f:
soup = BeautifulSoup(f.read(), "html.parser")
img = Image.new("RGB", (img_size, img_size), "white")
y = 0
for c in string.ascii_lowercase:
bin_str = ""
x = 0
for e in soup.find_all("span"):
if e.text.strip() == "{{" + c + "}}":
if "a" in e["class"]:
color = (0, 0, 0)
else:
color = (255, 255, 255)
for xi in range(x, x+pix_size):
for yi in range(y, y+pix_size):
img.putpixel((xi, yi), color)
x += pix_size
y += pix_size
print("[+] Flag:", decode(img)[0].data.decode())

View File

File diff suppressed because one or more lines are too long