TenableCTF 2022 Characters of Shakespeare's Plays Writeup
For this challenge we got a text file that was around 508KB large.
The first few lines of the file are
Project Gutenberg's Characters of Shakespeare's Plays, by William Hazlitt
This eBook is for the use of anyone anywhere at no cost and with
almost no restrictions whatsoever. You may copy it, give it away or
re-use it under the terms of the Project Gutenberg License included
with this eBook or online at www.gutenberg.org
Because of these lines, we know where this text is from and where we can get it (Project Gutenberg).
So, we get the original text from here. We can select “Plain Text UTF-8” and we get a similar file to the one that we already have.
Now, let’s compare them.
It looks like the original file is larger, having 518KB.
We compare the two files with diff and differences are detected but diff might not be the right tool for this.
Note: Later on, I leared about kdiff3, which might’ve made this easier.
For now, let’s take a look at the content of the smaller file (the one from the challenge). In the first few lines we alread notice something.
Title: Characters of Shakespeare's Plays
Author: William Hazlitt
Release Date: January 29, 2011 [EBook #5085]
Language: English
*** START OF THIS PROJECT GUTENBERG EBOOK CHARACTERS OF SHAKESPEARE'S PLAYS ***
Produced by Steve Harris, Charles Franks and the Online
Distributed Prooreading Team.
The last line has “Prooreading” instead of “Proofreading” as we’d expect.
The missing character (f) is also the first character of the message that we’re looking for (flag{…).
By looking at the next few lines, the first four missing characters are “flag”. This is probably the right path.
My solution to check this was to make a Python script that finds the differences between the two files, puts them in a string and displays them.
For finding the differences, I used difflib
We run this and see that we get a flag for this challenge.