Product E:ngineer

E: is for the E-mpact. E-mpact is a pun for the impact an online service can have in our lives.

Solving Clmystery

March 14, 2021

What a brilliant game to play while refresh your rusty bash skills

Why I played this game

Lazy Sunday, and I was looking for material to refresh my rusty bash skills. Looking through the web, I found out about Clmystery. A github repo that utilizes roleplaying and storytelling, while helping you remember all the bash commands you forgot about.

Steps to solve this

Step 1: Clone the repo and print the instructions

As soon as you clone the repo, you can only use bash commands and nothing else! Not even a text editor like Vim if you are hardcore.

Now go to the root directory and print the instructions

.OOOOOOOOOOOOOOO @@                                   @@ OOOOOOOOOOOOOOOO.
OOOOOOOOOOOOOOOO @@                                    @@ OOOOOOOOOOOOOOOO
OOOOOOOOOO'''''' @@                                    @@ ```````OOOOOOOOO
OOOOO'' aaa@@@@@@@@@@@@@@@@@@@@"""                   """""""""@@aaaa `OOOO
OOOOO,""""@@@@@@@@@@@@@@""""                                     a@"" OOOA
OOOOOOOOOoooooo,                                            |OOoooooOOOOOS
OOOOOOOOOOOOOOOOo,                                          |OOOOOOOOOOOOC
OOOOOOOOOOOOOOOOOO                                         ,|OOOOOOOOOOOOI
OOOOOOOOOOOOOOOOOO @          THE                          |OOOOOOOOOOOOOI
OOOOOOOOOOOOOOO'a'            LINE                         |OOOOOOOOOOOOOy
OOOOOOOOOOOOOO''              MURDERS                      aa`OOOOOOOOOOOP
OOOOOOOOOOOOOOb,..                                          `@aa``OOOOOOOh
OOOOOOOOOOOOOOOOOOo                                           `@@@aa OOOOo
OOOOOOOOOOOOOOOOOOO|                                             @@@ OOOOe
OOOOOOOOOOOOOOOOOOO@                               aaaaaaa       @@',OOOOn
OOOOOOOOOOOOOOOOOOO@                        aaa@@@@@@@@""        @@ OOOOOi
OOOOOOOOOO~~ aaaaaa"a                 aaa@@@@@@@@@@""            @@ OOOOOx
OOOOOO aaaa@"""""""" ""            @@@@@@@@@@@@""               @@@|`OOOO'
OOOOOOOo`@@a                  aa@@  @@@@@@@""         a@        @@@@ OOOO9
OOOOOOO'  `@@a               @@a@@   @@""           a@@   a     |@@@ OOOO3
`OOOO'       `@    aa@@       aaa"""          @a        a@     a@@@',OOOO'

There's been a murder in Terminal City, and TCPD needs your help.

To figure out whodunit, go to the 'mystery' subdirectory and start working from there.

You'll want to start by collecting all the clues at the crime scene (the 'crimescene' file).

The officers on the scene are pretty meticulous, so they've written down EVERYTHING in their officer reports.

Fortunately the sergeant went through and marked the real clues with the word "CLUE" in all caps.

If you get stuck, open one of the hint files (from the CL, type 'cat hint1', 'cat hint2', etc.).

To check your answer or find out the solution, open the file 'solution' (from the CL, type 'cat solution').

To get started on how to use the command line, open or cheatsheet.pdf (from the command line, you can type 'nano').

Don't use a text editor to view any files except these instructions, the cheatsheet, and hints.

If you look close, you will notice the first clue, that all the clues have the word “CLUE” in all caps.

Fortunately the sergeant went through and marked the real clues with the word "CLUE" in all caps.

Step 2: Print the clues

Next step, go to mystery project and execute the below code to get all the lines that include the word CLUE

cat crimescene | grep CLUE
# or 
grep CLUE crimescene

Which returns

CLUE: Footage from an ATM security camera is blurry but shows that the perpetrator is a tall male, at least 6'.
CLUE: Found a wallet believed to belong to the killer: no ID, just loose change, and membership cards for AAA, Delta SkyMiles, the local library, and the Museum of Bash History. The cards are totally untraceable and have no name, for some reason.
CLUE: Questioned the barista at the local coffee shop. He said a woman left right before they heard the shots. The name on her latte was Annabel, she had blond spiky hair and a New Zealand accent.

Step 3: Read memberships

Now a fair way to continue is to read membership files from all the mentioned companies/organisations in the second clue and find people who belong to all those together.

To perform this, we can iterate one file (any file can do the job, as the name should be included in every file) and then iterate on each line.

Each line represents a name. So we can build a pipeline and search for that name in all the files, and if the name exists in every file we should then print the name.

The files we want to check are


Then to see how many people are members on all the above clubs execute

cat AAA | while read LINE;do num=$(grep -E "$LINE" AAA Delta_SkyMiles Museum_of_Bash_History Terminal_City_Library | wc -l); if [ $num -eq 4 ]; then echo $LINE>>../../Detective/memberships.txt;fi;done;

Which basically means, take the input of cat which prints the AAA file, then pass it in the pipe operator |, and for every input LINE, execute the grep command and if the result is 4 lines long, which means there were a match in each file then append the input name to the memberships.txt file.

We get the result line length with the wc -l command.

The result is promising, as we are down from 5020 suspects to 23!

Deron Estanguet
Stephanie Adlington
Aldo Nicolas
Sonata Raif
Jeremy Bowers
Didier Munoz
Nikolaus Milatz
Marina Murphy
Krystian Pen
Mary Tomashova
Kelly Kulish
Matt Waite
Monika Hwang
Emma Wei
Liangliang Miller
Jacqui Maher
Jamila Rodhe
Andrei Masna
Tamara Cafaro
Brian Boyer
Dalibor Vidal
Mike Bostock
Augustin Lozano

Step 4: Iterate the people list

cat ../Detective/memberships.txt | while read LINE;do res=$(grep "$LINE" people); echo $res>>../Detective/people.txt;done;

With the above code, we iterate the member’s list we created on the previous step, and create a new updated people.txt file, with augmented data about each person.

Here how the data look like now:

Deron Estanguet	M	71	L Street, line 401
Stephanie Adlington	F	28	Robeson Street, line 364
Aldo Nicolas	M	40	Corbet Street, line 400
Sonata Raif	F	50	Minnie Court, line 302
Jeremy Bowers	 M	34	Dunstable Road, line 284
Didier Munoz	M	42	Norman Street, line 37

Step 5: The hardest part

This step was not optimal, but the code did the job. If you have any recommendataion on how to solve this better feel free to ping me on my twitter.

What I did, was to check if the addresses exist in the street directory, all by my hand.

After I found which addresses exist I used sed to print the specific line that was mentioned in the people’s file.

# sed -n <number of line if file> <file>

sed -n 224p Andover_Road # SEE INTERVIEW #904020
# Result: Maher is not considered a suspect.
# Video evidence confirms that she was away at a professional soccer game on the morning in question, even though it was a workday.

sed -n 284p Dunstable_Road # SEE INTERVIEW #9620713
# Result: Home appears to be empty, no answer at the door.
# After questioning neighbors, appears that the occupant may have left for a trip recently.
# Considered a suspect until proven otherwise, but would have to eliminate other suspects to confirm.

sed -n 79p Alpine_Street # SEE INTERVIEW #862173
# Result: Matches our profile, except car does not match witness accounts. 
# Does Waite own a second car?  If so, he may be a suspect.  Otherwise is not a suspect.

sed -n 183p Harbor_Point_Boulevard # SEE INTERVIEW #628618
# Result: Fits the profile, except for the make of his car.
# Should be considered a suspect if and only if there is evidence Boyer owns a second car.

sed -n 287p Senders_Court # SEE INTERVIEW #290346
# Result: Drives a similar car to the description.
# Is a SkyMiles, TCPL, Museum of Bash History, and AAA member.
# Bostock is 6' 4", easily tall enough to match the camera footage.
# However, upon questioning, Bostock can prove that he was out of town on the morning of the murder, multiple witnesses and credit card transactions confirm.

Step 6: Print the suspects (Men)

So far we the suspects are Jeremy Bowers and Brian Boyer .

Regarding the vehicles:

grep -A 3 -B 2 "Jeremy Bowers" vehicles
# Make: Honda
# Color: Blue
# Owner: Jeremy Bowers
# Height: 6'1"
# Weight: 204 lbs

grep -A 3 -B 2 "Brian Boyer" vehicles
# Make: Jaguar
# Color: Blue
# Owner: Brian Boyer
# Height: 6'6"
# Weight: 201 lbs

grep -A 3 -B 2 "Matt Waite" vehicles
# Make: Toyota
# Color: Blue
# Owner: Matt Waite
# Height: 6'1"
# Weight: 190 lbs

# Not a suspect, printed for reassure I am on the right track
grep -A 3 -B 2 "Mike Bostock" vehicles
# Make: Honda
# Color: Teal
# Owner: Mike Bostock
# Height: 6'4"
# Weight: 173 lbs

Step 6: Print the suspects (Women)

cat people | grep Annabel
# Annabel Sun	F	26	Hart Place, line 40
# Oluwasegun Annabel	M	37	Mattapan Street, line 173
# Annabel Church	F	38	Buckingham Place, line 179
# Annabel Fuglsang	M	40	Haley Street, line 176

Again with sed I read the lines from interview that existed.

sed -n 40p Hart_Place # SEE INTERVIEW #47246024
# Result: Ms. Sun has brown hair and is not from New Zealand.  Not the witness from the cafe.

sed -n 173p Mattapan_Street # SEE INTERVIEW #9437737
# Result: Doesn't appear to be the witness from the cafe, who is female.

sed -n 179p Buckingham_Place # SEE INTERVIEW #699607
# Result: Interviewed Ms. Church at 2:04 pm.  Witness stated that she did not see anyone she could identify as the shooter, that she ran away as soon as the shots were fired. However, she reports seeing the car that fled the scene.  Describes it as a blue Honda, with a license plate that starts with "L337" and ends with "9"

sed -n 176p Haley_Street # SEE INTERVIEW #871877
# Result: Mr. Fuglsang is male and has brown hair.  Not the witness from the cafe.

And for the last step

grep -A 5 "L337.*9$" vehicles | grep -C 5 "Honda" | grep -C 5 "Blue"

License Plate L337QE9
Make: Honda
Color: Blue
Owner: Erika Owens
Height: 6'5"
Weight: 220 lbs

License Plate L337539
Make: Honda
Color: Blue
Owner: Aron Pilhofer
Height: 5'3"
Weight: 198 lbs

License Plate L337369
Make: Honda
Color: Blue
Owner: Heather Billings
Height: 5'2"
Weight: 244 lbs

License Plate L337DV9
Make: Honda
Color: Blue
Owner: Joe Germuska
Height: 6'2"
Weight: 164 lbs

License Plate L3375A9
Make: Honda
Color: Blue
Owner: Jeremy Bowers  <----- 🚨🚨🚨🚨🚨🚨
Height: 6'1"
Weight: 204 lbs

License Plate L337WR9
Make: Honda
Color: Blue
Owner: Jacqui Maher 
Height: 6'2"
Weight: 130 lbs

Looks like we found our murdered!