UnderTheWire Century Guide

here's how to solve the Century level 8 → 9

Back to the Century Guides

Previous Level Guide: Century Level 7 → 8


Access

SSH: ssh century8@century.underthewire.tech -p 22

Password: 7points

Info

The password for Century9 is the number of unique entries within the file on the desktop.

Theory

To get the password the instructions don't really explain it well enough, but what I get from it is that there's a text file and we have to count every line that only appears once, hence find the amount of unique lines in the file. In linux this command is really simple, it's just sort text | uniq -u, but in powershell though, it's a little more interesting. The command is a little self explanatory because of the text commands, but to explain it really basically it gets the file's text and sorts it alphabetically, then starts like taking the lines one by one and counting them, if a line appears more than once, it is immediately excluded, and then outputs each unique line in alphabetical order:

Get-Content text.txt | Sort-Object | Group-Object | Where-Object { $_.Count -eq 1 } | ForEach-Object { $_.Name }
dir

Solution

Now that we are in the desktop, first we'll use dir to know the name of the file and put it in the command:

PS C:\users\century8\desktop> dir


    Directory: C:\users\century8\desktop


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        8/30/2018   3:33 AM          15858 unique.txt

PS C:\users\century8\desktop> Get-Content unique.txt | Sort-Object | Group-Object | Where-Object { $_.Count -eq 1 } | ForEach-Object { $_.Name }
aasvogel
abhorrer
accords
accurate
activity
acupunctuation
acylase
adicity
...

Oops! I accidentally forgot to put the part where it counts all of these and filled up my entire terminal. We can just fix this by surrounding the command with the Count property:

PS C:\users\century8\desktop> (Get-Content unique.txt | Sort-Object | Group-Object | Where-Object { $_.Count -eq 1 } | ForEach-Object { $_.Name }).Count
696

And that's the password! Now we should be good to go to the next level.

https://underthewire.tech/century-8
Next Level Guide: Century Level 9 → Level 10