📖
CTF Wiki
  • 🚩Arne's CTF Writeups!
  • 2025
    • TUCTF
      • Forensics - Security Rocks
    • San Diego CTF
      • Crypto - RustSA
      • Misc - Triglot
  • 2024
    • Lexington CTF
      • Misc - a little bit of tomcroppery
    • Imaginary CTF
      • Web - Journal
    • Space Heroes CTF
      • Web - Antikythera
    • HTB Cyber Apocalypse
      • Pwn - Sound of Silence
      • Misc - MultiDigilingual
  • 2023
    • NahamConCTF
      • Mobile - Red Light Green Light
    • BucketCTF
      • Rev - Schematic
      • Rev - Random security
    • HTB Cyber Apocalypse
      • Rev - Cave System
      • Rev - Somewhat Linear
      • Pwn - Void
  • 2022
    • DownUnderCTF 2022
      • Cloud - Jimmy Builds a Kite
    • Ã¥ngstromCTF 2022
      • Pwn - really obnoxious problem
      • Pwn - whatsmyname
    • Engineer CTF
      • Misc - Not really random
      • Misc - Broken Pieces
    • KnightCTF 2022
    • HTB CTF: Dirty Money
      • Forensics - Perseverance
  • 2021
    • MetaCTF CyberGames 2021
    • HTB - Cyber Santa
      • RE - Infiltration
    • Securebug CTF Thor 2021
      • Web - Tricks 1
      • Web - Tricks 2
      • RE - Hidden in Plain Sight
    • TFC CTF 2021
      • RE - Crackity
      • Pwn - Jumpy
      • Misc - Weird Friend
    • K3RN3L CTF 2021
      • Crypto - Pascal RSA
    • DamCTF 2021
      • Misc - library-of-babel
      • Pwn - cookie-monster
    • Killer Queen CTF 2021
      • Pwn - Tweety Birb
      • Forensics - Tippy Tappies
      • Pwn - I want to break free
    • BuckeyeCTF 2021
      • Web - pay2win
      • Misc - USB Exfiltration
Powered by GitBook
On this page
  • Description
  • Downloads
  • Solution
  • Bonus
  1. 2021
  2. TFC CTF 2021

Misc - Weird Friend

Easy | 95 solves | 87 points

Last updated 3 years ago

Description

My weird friend did it again! I gave him my list of questions and asked him for a quick response. He took things literally and this is what he gave me!? Can you make any sense of it?

Downloads

Solution

We are given a text file that contains a binary string.

I did not know how to approach this at first. There are 841 binary digits which was weird because it is not divisible by 8 so converting it to ASCII would not make sense. Towards the end of the CTF, the admin was hinting to focus on the word "quick response" which I did not immediately get but after some google searches, I realised that quick response is the acronym for QR. Now 841 binary digits make perfect sense because it is a square number (29x29=841).

During the CTF, I wrote a python script to form the QR code using the binary string.

from PIL import Image
import textwrap

binstring = "1111111001110110010000111111110000010000110100110101000001101110100111001110010010111011011101010110100000000101110110111010101010001101001011101100000100110001011000010000011111111010101010101010111111100000000010010000000100000000110001110110110101000000110000010010000100011000101011010111000110110110011110010111100101001010011001100000010110111001111101101011101101110011111010100001011111001011111000011101101100011110101101000000010000100000000101111010110001000010100101100110000110000101111010101010111101101110001101101011111001110100001100110011001010100101001111001000100100101110110001011111111000000000010110001001110001001111111110101010010110101011100100000101010100000011000110111011101001010011000111111000010111010010110111110110101001101110100110000111000001111101000001010010010000110101110111111110101111100101000000100"

# Print bits in 29x29 square
print(textwrap.fill(binstring,width=29))

# Make an image from the bits
outimg = Image.new( 'RGB', (29,29), "black") 
pixels_out = outimg.load() 

count=0 
for bit in binstring:    
    i=count%29
    j=count/29
    if bit == '0':
        pixels_out[(i,j)]=(255,255,255)
    count += 1
        
outimg = outimg.resize((100,100))
outimg.save("qrout.png","png")

Scanning the output QR code image will then give us the flag.

Flag: TFCCTF{why_ar3_QR_C0d3s_s0-complicated!?o00o0f}

Bonus

After the CTF, someone revealed that there is a website that can generate the QR code from the binary string. Link: https://bahamas10.github.io/binary-to-qrcode/

Should have totally googled more before starting any python scripting :|

842B
weird_friend.txt