ISSessions CTF 2021 Programming - Base64

· 1 min read

Solving a timed Base64 encoding challenge using bash scripting and curl.

Base64

Similar to the other challenges, take an input, base64 it, and then return it within 3 seconds.

Solution

The code breakdown is the same as the other bash solutions, but the key note is base64 -w0 to put the output all on one line instead of splitting it to fit in smaller terminals.

#!/bin/bash
data=$(curl -c base64cookies "http://progbase64.ctf.issessions.ca/" \
  | grep -oE "data\".*" \
  | grep -oE "[a-f0-9]{10}+" \
  | tr -d '\n' \
  | base64 -w0)
b64=$(echo $data | base64 -w0)
echo $b64
curl -b base64cookies "http://progbase64.ctf.issessions.ca/index.php?answer=$data"