We are given a perl script that when executed tells us we are doing a thing and then says stahp.

$perl bowie.pl
You're doing a thing...

If we look at the script source, we can see that it has a series of nested if else conditions. At each layer, the script requests user input which it uses for the next if condition. If the if conditions are true, an additional base64 chunk is decoded and appended to the $a variable.

print "You're doing a thing...\\n";
my $input = <STDIN>;
$input = trim($input);
if ($input eq (chr(5156 - 5035) . chr(-4615 - -4716) . chr(3162 -
3047))) {
$a = $a . MIME::Base64::decode("…”)
This repeats many times until the last if condition which evals a base64
eval MIME::Base64::decode("…”)

We can use python to base64 decode each of these blocks ourselves. When we decode the eval block it has a block that is decoded and appended to the ‘$a’ variable and another block that is eval’d. This repeats over and over many times. If we grab each block that appends to the ‘$a’ variable, decode them, and write them to a file, we find that it is a jpg and contains the key.

from base64 import b64de
a = b64decode("R0lGODlh2
a = a + b64decode("KmZRg

a = a + b64decode("7w3jz
f = open("out.gif", "w")

When I was working the challenge, I manually kept decoding each block and writing it until I got enough of the picture for the key.

Jeff White solved the entire solution with a bash one liner that is a thing of beauty.

cp bowie.pl bowie_1 && for i in $(seq 1 50); do grep -E "\\$a|eval"
bowie_$i |cut -d"\\"" -f2 |base64 -D > bowie_\`expr $i + 1\` ;
done && for i in $(grep "\\$a" bowie_1 |cut -d"\\"" -f2); do echo $i
|base64 -D >> bowie.gif; done && for i in $(find . -size +2k -ls
|cut -d"/" -f2 |grep -vE "bowie_1$|bowie.pl" |sort -t _ -k 2 -n); do
grep "\\$a" $i |cut -d"\\"" -f2 |base64 -D >> bowie.gif; done &&
rm bowie_* && open bowie.gif && echo "D4rkCryst4lz"