From 0c40415d3de1c5833b4dd0407e64bfd559d28639 Mon Sep 17 00:00:00 2001 From: Abel Stuker Date: Mon, 25 Nov 2024 22:25:13 +0100 Subject: [PATCH] feat: add 200B200C challenge --- 200B200C/README.md | 7 +++++++ 200B200C/SOLUTION.md | 8 ++++++++ 200B200C/flag.txt | 1 + 200B200C/writeup.rkt | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 200B200C/README.md create mode 100644 200B200C/SOLUTION.md create mode 100644 200B200C/flag.txt create mode 100644 200B200C/writeup.rkt diff --git a/200B200C/README.md b/200B200C/README.md new file mode 100644 index 0000000..0f45e86 --- /dev/null +++ b/200B200C/README.md @@ -0,0 +1,7 @@ +# 200B200C +## Text +Here is your flag `IGCTF{Th1‌​‌‌​‌‌​‌​‌‌‌​​​‌​‌‌‌‌​​‌​‌​‌​‌‌‌​‌‌‌​​‌‌​​​​‌​​‌​‌​‌​‌‌‌​​‌​‌‌‌‌‌​​‌‌​​‌​‌​​​​​‌‌​​‌‌‌‌‌​​‌​​​‌‌​​‌​​‌‌‌​​​​‌‌​s_1s_th3_‌​‌​​​​​‌​​‌‌‌​​‌‌​​‌‌‌‌‌​​​‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​​‌‌‌​​‌​​​‌​‌‌‌​‌​​​​​‌​​‌‌​​‌‌​​‌​​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌​​​​​‌​wr0ng_fl4g}`. +## Files +n/a +## How to Deploy +n/a \ No newline at end of file diff --git a/200B200C/SOLUTION.md b/200B200C/SOLUTION.md new file mode 100644 index 0000000..1d03d7e --- /dev/null +++ b/200B200C/SOLUTION.md @@ -0,0 +1,8 @@ +## Difficulty +Easy +## Category +Miscellaneous +## How To Solve +Copy the flag and open it in Vim. You will see that there are a lot of Zero Width Unicode Characters `U+200B` and `U+200C` between the letters. Decode every `U+200C` as a `0` and every `U+200B` as a `1`. Then interpret the obtained row as a sequence of ASCII characters (by converting every 8 bits to an ASCII character) to get the flag. Example [write-up script in Racket](./writeup.rkt). +## Flag +`IGCTF{Th3_0nly_c0rr3ct_fl4g}` \ No newline at end of file diff --git a/200B200C/flag.txt b/200B200C/flag.txt new file mode 100644 index 0000000..770255a --- /dev/null +++ b/200B200C/flag.txt @@ -0,0 +1 @@ +IGCTF{Th1‌​‌‌​‌‌​‌​‌‌‌​​​‌​‌‌‌‌​​‌​‌​‌​‌‌‌​‌‌‌​​‌‌​​​​‌​​‌​‌​‌​‌‌‌​​‌​‌‌‌‌‌​​‌‌​​‌​‌​​​​​‌‌​​‌‌‌‌‌​​‌​​​‌‌​​‌​​‌‌‌​​​​‌‌​s_1s_th3_‌​‌​​​​​‌​​‌‌‌​​‌‌​​‌‌‌‌‌​​​‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​​‌‌‌​​‌​​​‌​‌‌‌​‌​​​​​‌​​‌‌​​‌‌​​‌​​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌​​​​​‌​wr0ng_fl4g} diff --git a/200B200C/writeup.rkt b/200B200C/writeup.rkt new file mode 100644 index 0000000..e1b6657 --- /dev/null +++ b/200B200C/writeup.rkt @@ -0,0 +1,35 @@ +#lang racket + +(define (get-input) + (display "Enter your string ") + (read-line (current-input-port) 'any)) + +(define (decode input) + (define bits '()) + (for/list ((c (string->list input))) + (cond ((equal? c #\u200C) (set! bits (append bits '(0)))) + ((equal? c #\u200B) (set! bits (append bits '(1)))))) + (bits->text bits)) + +(define (bits->text bits) + (define bytes (collect-bytes bits)) + (apply string (map (lambda (byte) + (integer->char (bits->number byte))) + bytes))) + +(define (collect-bytes bits) + (define (collect-bytes-iter bits acc) + (cond ((null? bits) (reverse acc)) + ((>= (length bits) 8) (collect-bytes-iter (drop bits 8) (cons (take bits 8) acc))) + (else (error "Invalid bits")))) + (collect-bytes-iter bits '())) + +(define (bits->number bits) + (let ((binary-string (apply string (map (lambda (bit) (if (= bit 1) #\1 #\0)) bits)))) + (string->number binary-string 2))) + +(define (main) + (let ((input (get-input))) + (displayln (decode input)))) + +(main) \ No newline at end of file