ISSessions CTF 2021 Programming - SHA256

· 1 min read

Solving a timed SHA256 hashing challenge using bash scripting and sha256sum.

SHA256

Just like NATO, Morse, and the other quick prompt challenges, get something, hash it, return it.

Solution

Same as most others, just adding an extra filter after hashing to ensure that the digest is properly formatted. That pesky grep newline strikes again.

#!/bin/bash
data=$(curl -c cookies "http://progsha256.ctf.issessions.ca/" \
  | grep -oE "data\".*" \
  | grep -oE "[a-f0-9]{10}+" \
  | tr -d '\n' \
  | sha256sum \
  | grep -oE "[0-9a-f]+" \
  | tr -d '\n')
curl -b cookies "http://progsha256.ctf.issessions.ca/index.php?answer=$data"