---
description: Helped Write with ABBY
---

# DawgCTF 2021

## Cooking the Books - Crypto \[100 pts] <a href="#cooking-the-books" id="cooking-the-books"></a>

> If it's from GCHQ why do they call it the Swiss Army Knife??\
> )%|\&Ap\*!dq$#h8h:!xhx)7\_)b\_x:5!Cq:;>I4(;\`4x4b6Il\
> Author: Trashcanna

Doing a quick google search to find out that GCHQ is referring to CyberChef. From that point, I was clueless about what to do. I remembered that this is low points so I used a cipher that was used on Mr. Robot. Also, ROT47 came up which when ROT13 failed I decided to try with ROT47. \
`RXTMUpAYP5BSR9g9iPI9IXf0X30IidPrBijmxcWj1cIc3ex=`\
After that, I tried All of the base32 and base64 as the new text contained a "=" at the end. This ended up worse so I knew more was to this problem. I looked at the [Cryptogram Assistant](http://rumkin.com/tools/cipher/cryptogram.php) for some help, but that turned up empty, but it had a list of ciphers. I decided to plug them into the Chef and see if I recognized anything. So now my recipe is \
`Rot47 -> From Cipher x -> From Cipher y -> From Base64`\
After some brute force attempts the final recipe is \
`Rot47 -> Bifid cipher decode [keyword: '"] -> Rail Fence Decode [key: 2, offset: 0] -> From Base64`

**Flag: DawgCTF{j0r$@n\_b3lfort\_coUlD\_n3v3r}**

## Cookin the ramen - Crypto \[50 pts] <a href="#cookin-the-ramen" id="cookin-the-ramen"></a>

> Apparently we made cookin the books too hard, here's some ramen to boil as a warmup: .--- ...- ...- . ....- ...- ... ..--- .. .-. .-- --. -.-. .-- -.- -.-- -. -... ..--- ..-. -.-. ...- ...-- ..- --. .--- ... ..- .. --.. -.-. .... -- ...- -.- . ..- -- - . -. ...- -. ..-. --- -.-- --.. - .-.. .--- --.. --. --. ...-- ... -.-. -.- ..... .--- ..- --- -. -.- -..- -.- --.. -.- ...- ..- .-- - -.. .--- -... .... ..-. --. --.. -.- -..- .. --.. .-- ...- ... -- ...-- --.- --. ..-. ... .-- --- .--. .--- .....

First, we know this is Morse code so we go to the great site called [CyberChef](https://gchq.github.io/CyberChef). From their we decoded the data from morse and got `JVVE4VS2IRWGCWKYNB2FCV3UGJSUIZCHMVKEUMTENVNFOYZTLJZGG3SCK5JUONKXKZKVUWTDJBHFGZKXIZWVSM3QGFSWOPJ5`\
it looks like a lot of gibberish so putting it through magic and knowing that the phrase "DawgCTF" is in the result. \
The final algorithm is \
`From Morse Code -> From Base32 -> From Base64 -> From Base58`

**Flag: DawgCTF{0k@y\_r3al\_b@by's\_f1r5t}**



## Two truths and 1 fib - Misc \[100 pts] <a href="#two-truths-and-1-fib" id="two-truths-and-1-fib"></a>

> Can you catch the fibber?
>
> nc umbccd.io 6000
>
> Author: Trashcanna

The process to this one was simple. I reused some code for the past connections to the server and ran it on loop as it didn't just give 1 problem and the flag. One note when writing this code I did not waste my time doing a recursion because of how big the numbers are to start with.

```python
import sys
import socket
import time
import random

hostname = "umbccd.io"
port = 6000

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((hostname, port))
sock.settimeout(10)

def readall():
    global sock
    return sock.recv(100000)

def sendall(s):
    global sock
    sock.sendall((s + '\n'))

def dumpall(s):
    for line in s.split('\n'):
        print(line)

def isFib(n):
    a = 0
    b = 1
    i = 2
    n = int(n)
    while i < 200:
        c = a + b
        a = b
        b = c
        if c == n:
            return True
        if c > n:
            return False
        i += 1
    return False
    
# header
while (True):
    res = readall()

    print('-'*30)
    print(res)
    start = res.index('[')
    end = res.index(']')
    numbers = res[start+1:end].strip().split(",")
    print(numbers)
    time.sleep(.1)
    for n in numbers:
        n = n.strip()
        print("Checking " + str(n))

        if (isFib(int(n))):
            print("Sending " + str(n))
            sendall(n)
            time.sleep(.5)
            break

    print('-' * 30)

sock.shutdown(socket.SHUT_WR)
```

**Flag: DawgCTF{jU$T\_l1k3\_w3lc0me\_w33k}**
