feat: add 200B200C challenge
This commit is contained in:
commit
0c40415d3d
7
200B200C/README.md
Normal file
7
200B200C/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 200B200C
|
||||||
|
## Text
|
||||||
|
Here is your flag `IGCTF{Th1s_1s_th3_wr0ng_fl4g}`.
|
||||||
|
## Files
|
||||||
|
n/a
|
||||||
|
## How to Deploy
|
||||||
|
n/a
|
8
200B200C/SOLUTION.md
Normal file
8
200B200C/SOLUTION.md
Normal file
@ -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}`
|
1
200B200C/flag.txt
Normal file
1
200B200C/flag.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
IGCTF{Th1s_1s_th3_wr0ng_fl4g}
|
35
200B200C/writeup.rkt
Normal file
35
200B200C/writeup.rkt
Normal file
@ -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)
|
Loading…
Reference in New Issue
Block a user