<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rumana Pervin on Medium]]></title>
        <description><![CDATA[Stories by Rumana Pervin on Medium]]></description>
        <link>https://medium.com/@ruumpu?source=rss-fb89ad190bc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Rumana Pervin on Medium</title>
            <link>https://medium.com/@ruumpu?source=rss-fb89ad190bc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:50:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ruumpu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[John the Ripper: The Basics — TryHackMe]]></title>
            <link>https://medium.com/@ruumpu/john-the-ripper-the-basics-tryhackme-643d4b5bf868?source=rss-fb89ad190bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/643d4b5bf868</guid>
            <category><![CDATA[basics]]></category>
            <category><![CDATA[tryhackme-walkthrough]]></category>
            <category><![CDATA[cracking-hashes]]></category>
            <category><![CDATA[john-the-ripper]]></category>
            <dc:creator><![CDATA[Rumana Pervin]]></dc:creator>
            <pubDate>Fri, 02 Oct 2026 07:04:38 GMT</pubDate>
            <atom:updated>2026-10-02T07:05:37.584Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever wonder how cybercriminals — and penetration testers — crack passwords so quickly? They usually aren’t guessing them manually; they rely on powerful automation tools like <strong>John the Ripper</strong>. Today, we are breaking down the <strong>TryHackMe: John the Ripper — The Basics</strong> room. This hands-on lab takes you from absolute beginner to confidently cracking Linux shadow files, password-protected ZIPs, and SSH private keys. Let’s dive in and see how modern hashing stands up against one of the industry’s most iconic cracking tools!</p><h3>Task 1 — Introduction</h3><p>John the Ripper is a well-known, well-loved, and versatile hash-cracking tool. It combines a fast cracking speed with an extraordinary range of compatible hash types.</p><h4>Learning Prerequisites</h4><p>For maximum benefit, we recommend you attempt this room after the first three introductory rooms about cryptography.</p><ul><li><a href="https://tryhackme.com/r/room/cryptographybasics">Cryptography Basics</a></li><li><a href="https://tryhackme.com/r/room/publickeycrypto">Public Key Cryptography Basics</a></li><li><a href="https://tryhackme.com/r/room/hashingbasics">Hashing Basics</a></li></ul><p>There are no other learning prerequisites except basic command line abilities.</p><h4>Learning Objectives</h4><p>Upon the completion of this room, you learn about using John for:</p><ul><li>Cracking Windows authentication hashes</li><li>Crack /etc/shadow hashes</li><li>Cracking password-protected Zip files</li><li>Cracking password-protected RAR files</li><li>Cracking SSH keys</li></ul><p>Starting with Task 4, you need to apply either on the attached VM, the AttackBox, or your own system. For your convenience, you can download the required task files as a single Zip file from this task by pressing the <strong>Download Task Files</strong> button below.</p><p><strong>Q.1: Let’s begin!</strong></p><p><strong>Ans.:</strong> <em>No answer needed!</em></p><p>Click the Download Task Files Button if you are using your own machine (VPN)</p><h3>Task 2 — Basic Terms</h3><p>This room requires basic knowledge of various cryptography terms. For your convenience, we review the most relevant terms and concepts before we move into practical hash cracking.</p><h4>What are Hashes?</h4><p>A hash is a way of taking a piece of data of any length and representing it in another fixed-length form. This process masks the original value of the data. The hash value is obtained by running the original data through a hashing algorithm. Many popular hashing algorithms exist, such as MD4, MD5, SHA1 and NTLM. Let’s try and show this with an example:</p><p>If we take “polo”, a string of four characters, and run it through an MD5 hashing algorithm, we end up with an output of b53759f3ce692de7aff1b5779d3964da, a standard 32-character MD5 hash.</p><p>Likewise, if we take “polomints”, a string of 9 characters, and run it through the same MD5 hashing algorithm, we end up with an output of 584b6e4f4586e136bc280f27f9c64f3b, another standard 32-character MD5 hash.</p><h4>What Makes Hashes Secure?</h4><p>Hashing functions are designed as one-way functions. In other words, it is easy to calculate the hash value of a given input; however, it is a hard problem to find the original input given the hash value. In simple terms, a hard problem quickly becomes computationally infeasible in computer science. This computational problem has its roots in mathematics as P vs NP.</p><p>In computer science, P and NP are two classes of problems that help us understand the efficiency of algorithms:</p><ul><li><strong>P (Polynomial Time)</strong>: Class P covers the problems whose solution can be found in polynomial time. Consider sorting a list in increasing order. The longer the list, the longer it would take to sort; however, the increase in time is not exponential.</li><li><strong>NP (Non-deterministic Polynomial Time)</strong>: Problems in the class NP are those for which a given solution can be checked quickly, even though finding the solution itself might be hard. In fact, we don’t know if there is a fast algorithm to find the solution in the first place.</li></ul><p>While this is a fascinating mathematical concept that proves fundamental to computing and cryptography, it is entirely outside the scope of this room. But abstractly, the algorithm to hash the value will be “P” and can, therefore, be calculated reasonably. However, an “un-hashing” algorithm would be “NP” and intractable to solve, meaning that it cannot be computed in a reasonable time using standard computers.</p><h4>Where John Comes in</h4><p>Even though the algorithm is not feasibly reversible, that doesn’t mean cracking the hashes is impossible. If you have the hashed version of a password, for example, and you know the hashing algorithm, you can use that hashing algorithm to hash a large number of words, called a dictionary. You can then compare these hashes to the one you’re trying to crack to see if they match. If they do, you know what word corresponds to that hash- you’ve cracked it!</p><p>This process is called a <strong>dictionary attack</strong>, and John the Ripper, or John as it’s commonly shortened, is a tool for conducting fast brute force attacks on various hash types.</p><h4>Learning More</h4><p>For some more in-depth material on encryption and decryption, we recommend the <a href="https://tryhackme.com/r/room/cryptographybasics">Cryptography Basics</a> and the <a href="https://tryhackme.com/r/room/publickeycrypto">Public Key Cryptography Basics</a> rooms; moreover, for hashing, we recommend the <a href="https://tryhackme.com/r/room/hashingbasics">Hashing Basics</a> room.</p><p>This room will focus on the most popular extended version of John the Ripper, <strong>Jumbo John</strong>.</p><p>Q.1: What is the most popular extended version of John the Ripper?</p><p>Ans.: Jumbo John</p><p>It says so on, literally, the very last sentnece of the task content!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*53NZuLdXYmUTO14A7bSjAA.png" /></figure><h3>Task 3 — Setting Up Your System</h3><p>Throughout the tasks of this room, we will be using the following :</p><ul><li>The “Jumbo John” version of John the Ripper</li><li>The RockYou password list</li></ul><p>If you use the attached lab machine or the AttackBox, you don’t need to install John the Ripper on your system. Consequently, feel free to skip through the installation section. If you prefer to use your system to follow along, please read along to learn how to proceed with the installation. We should note that if you use a version of John the Ripper other than Jumbo John, you might not have some of the required tools, such as zip2john and rar2john.</p><h4>Installation</h4><p>John the Ripper is supported on many Operating Systems, not just Linux Distributions. Before we go through this, there are multiple versions of John, the standard “core” distribution, and multiple community editions, which extend the feature set of the original John distribution. The most popular of these distributions is the “<strong>Jumbo John</strong>,” which we will use specific features of later.</p><p><strong>AttackBox and Kali</strong></p><p>Jumbo John is already installed on the attached lab machine and on the AttackBox, so if you plan to use either one, you need not take any further action. Furthermore, offensive Linux distributions like Kali are shipped with Jumbo John installed.</p><p>You can double-check this by typing john into the terminal. You should be met with a usage guide for John, with the first line reading “John the Ripper 1.9.0-jumbo-1” or something similar with a different version number.</p><p><strong>Other Linux Distributions</strong></p><p>Many Linux distributions have John the Ripper available for installation from their official repositories. For instance, on Fedora Linux, you can install John the Ripper with sudo dnf install john, while on Ubuntu, you can install it with sudo apt install john. Unfortunately, at the time of writing, these versions provided core functionality and missed some of the tools available through Jumbo John.</p><p>Consequently, you need to consider building from the source to access all the tools available via Jumbo John. The <a href="https://github.com/openwall/john/blob/bleeding-jumbo/doc/INSTALL">official installation guide(opens in new tab)</a> provides detailed installation and build configuration instructions.</p><p><strong>Installing on Windows</strong></p><p>To install Jumbo John the Ripper on Windows, you need to download and install the zipped binary for either 64-bit systems <a href="https://www.openwall.com/john/k/john-1.9.0-jumbo-1-win64.zip">here(opens in new tab)</a> or for 32-bit systems <a href="https://www.openwall.com/john/k/john-1.9.0-jumbo-1-win32.zip">here(opens in new tab)</a>.</p><h4>Wordlists</h4><p>Now that we have john ready, we must consider another indispensable component: wordlists.</p><p>As we mentioned earlier, to use a dictionary attack against hashes, you need a list of words to hash and compare; unsurprisingly, this is called a wordlist. There are many different wordlists out there, and a good collection can be found in the <a href="https://github.com/danielmiessler/SecLists">SecLists(opens in new tab)</a> repository. There are a few places you can look for wordlists for attacking the system of choice; we will quickly run through where you can find them.</p><p>On the AttackBox and Kali Linux distributions, the /usr/share/wordlists directory contains a series of great wordlists.</p><p><strong>RockYou</strong></p><p>For all of the tasks in this room, we will use the infamous rockyou.txt wordlist, a very large common password wordlist obtained from a data breach on a website called rockyou.com in 2009. If you are not using any of the above distributions, you can get the rockyou.txt wordlist from the <a href="https://github.com/danielmiessler/SecLists">SecLists(opens in new tab)</a> repository under the /Passwords/Leaked-Databases subsection. You may need to extract it from the .tar.gz format using tar xvzf rockyou.txt.tar.gz.</p><p>Now that we have our hash cracker and wordlists all set up, let’s move on to some hash cracking!</p><p>To follow along, first, let’s start the <strong>Lab Machine</strong> by pressing the Start <strong>Machine button</strong> below.</p><p>The machine will start in <strong>Split-Screen</strong> view. In case the VM is not visible, use the blue <strong>Show Split View</strong> button at the top of the page.</p><p>You can also access the lab machine using SSH at the IP address MACHINE_IP using the following credentials:</p><ul><li>Username: user</li><li>Password: Tryhackme123!</li></ul><p><strong>Q.1: Which website’s breach was the </strong><strong>rockyou.txt wordlist created from?</strong></p><p><strong>Ans.: </strong>rockyou.com</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dABqhc_C6FPglCADhujjAg.png" /></figure><p>If you are using the AttackBox or VPN, please use this command to SSH into the machine:</p><pre>ssh user@MACHINE-IP<br><br># Replace MACHINE-IP with your lab machine&#39;s IP Address.</pre><p>I will be using the lab machine itself, where everything is set up.</p><p>Press Ctrl+L to clear everything and you can see a clear command line:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*m2w2Zudw5mvXEbZX4YjJMg.png" /></figure><h3>Task 4 — Cracking Basic Hashes</h3><p>There are multiple ways to use John the Ripper to crack simple hashes. We’ll walk through a few before moving on to cracking some ourselves.</p><h4>John Basic Syntax</h4><p>The basic syntax of John the Ripper commands is as follows. We will cover the specific options and modifiers used as we use them.</p><p>john [options] [file path]</p><ul><li>john: Invokes the John the Ripper program</li><li>[options]: Specifies the options you want to use</li><li>[file path]: The file containing the hash you’re trying to crack; if it’s in the same directory, you won’t need to name a path, just the file.</li></ul><h4>Automatic Cracking</h4><p>John has built-in features to detect what type of hash it’s being given and to select appropriate rules and formats to crack it for you; this isn’t always the best idea as it can be unreliable, but if you can’t identify what hash type you’re working with and want to try cracking it, it can be a good option! To do this, we use the following syntax:</p><p>john --wordlist=[path to wordlist] [path to file]</p><ul><li>--wordlist=: Specifies using wordlist mode, reading from the file that you supply in the provided path</li><li>[path to wordlist]: The path to the wordlist you’re using, as described in the previous task</li></ul><p><strong>Example Usage:</strong></p><p>john --wordlist=/usr/share/wordlists/rockyou.txt hash_to_crack.txt</p><h4>Identifying Hashes</h4><p>Sometimes, John won’t play nicely with automatically recognising and loading hashes, but that’s okay! We can use other tools to identify the hash and then set John to a specific format. There are multiple ways to do this, such as using an online hash identifier like <a href="https://hashes.com/en/tools/hash_identifier">this site(opens in new tab)</a>. I like to use a tool called <a href="https://gitlab.com/kalilinux/packages/hash-identifier/-/tree/kali/master">hash-identifier(opens in new tab)</a>, a Python tool that is super easy to use and will tell you what different types of hashes the one you enter is likely to be, giving you more options if the first one fails.</p><p>To use hash-identifier, you can use wget or curl to download the Python file hash-id.py from its GitLab <a href="https://gitlab.com/kalilinux/packages/hash-identifier/-/raw/kali/master/hash-id.py">page(opens in new tab)</a>. Then, launch it with python3 hash-id.py and enter the hash you’re trying to identify. It will give you a list of the most probable formats. These two steps are shown in the terminal below.</p><pre>user@TryHackMe$ wget https://gitlab.com/kalilinux/packages/hash-identifier/-/raw/kali/master/hash-id.py<br>$ python3 hash-id.py<br>   #########################################################################<br>   #     __  __                     __           ______    _____           #<br>   #    /\ \/\ \                   /\ \         /\__  _\  /\  _ `\         #<br>   #    \ \ \_\ \     __      ____ \ \ \___     \/_/\ \/  \ \ \/\ \        #<br>   #     \ \  _  \  /&#39;__`\   / ,__\ \ \  _ `\      \ \ \   \ \ \ \ \       #<br>   #      \ \ \ \ \/\ \_\ \_/\__, `\ \ \ \ \ \      \_\ \__ \ \ \_\ \      #<br>   #       \ \_\ \_\ \___ \_\/\____/  \ \_\ \_\     /\_____\ \ \____/      #<br>   #        \/_/\/_/\/__/\/_/\/___/    \/_/\/_/     \/_____/  \/___/  v1.2 #<br>   #                                                             By Zion3R #<br>   #                                                    www.Blackploit.com #<br>   #                                                   Root@Blackploit.com #<br>   #########################################################################<br>--------------------------------------------------<br> HASH: 2e728dd31fb5949bc39cac5a9f066498<br><br>Possible Hashs:<br>[+] MD5<br>[+] Domain Cached Credentials - MD4(MD4(($pass)).(strtolower($username)))</pre><h4>Format-Specific Cracking</h4><p>Once you have identified the hash that you’re dealing with, you can tell John to use it while cracking the provided hash using the following syntax:</p><p>john --format=[format] --wordlist=[path to wordlist] [path to file]</p><ul><li>--format=: This is the flag to tell John that you’re giving it a hash of a specific format and to use the following format to crack it</li><li>[format]: The format that the hash is in</li></ul><p><strong>Example Usage:</strong></p><p>john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt hash_to_crack.txt</p><p><strong>A Note on Formats:</strong></p><p>When you tell John to use formats, if you’re dealing with a standard hash type, e.g. md5 as in the example above, you have to prefix it with raw- to tell John you’re just dealing with a standard hash type, though this doesn’t always apply. To check if you need to add the prefix or not, you can list all of John’s formats using john --list=formats and either check manually or grep for your hash type using something like john --list=formats | grep -iF &quot;md5&quot;.</p><h4>Practical</h4><p>Now that you know the syntax, modifiers, and methods for cracking basic hashes, try it yourself! The files are located in ~/John-the-Ripper-The-Basics/Task04/ on the attached lab machine.</p><p><strong>Q.1: What type of hash is hash1.txt?</strong></p><p><strong>Ans.:</strong> MD5</p><p>Use the change directory command to enter the directory mentioned with this command:</p><pre>cd John-the-Ripper-The-Basics/Task04</pre><p>Type ls and you’ll be able to see the files in this directory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*Kw7pl-aDZZH8LzN_3USc6Q.png" /></figure><p>In the Lab Machine, hash-id.py is already installed so I won’t bother installing it, but if it isn’t, just install it with wget; the command is mentioned in the task. Now run:</p><pre>cat hash1.txt<br># To read a text file (recognizable because of tis ending .txt extension)</pre><p>The hash will be displayed as the content. After you know the hash, run</p><pre>python3 hash-id.py<br># We use Python3 to run a Python file (recognizable because of the files .py <br># ending extension); Python is a programming language.</pre><p>And you’ll be prompted to enter the hash. Paste it, by selecting the hash and right clicking on the selected hash, press enter, and the file will tell you the hash type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*IeTNyj3IHy0jDLmuE_JgqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*DY5Mbkfh55Wb26qXSu_ulA.png" /></figure><p>I had thought the first result was more convincing, as it is widely used in many encryptions, so I went for that, and it was correct.</p><p><strong>Q.2: What is the cracked value of hash1.txt?</strong></p><p>Now that we know the hash type of the file, we can easily use it in the — format option of John the Ripper and crack it from rockyou.txt!</p><blockquote>Note: While the path of rockyou.txt is generally the same for every computer, it is best to check where it is located using the locate command.</blockquote><p>Exit the hash-id.py file with Ctrl+C and it’ll say Bye! MD5 is a standard hash type, so I’ll be using the &lt;raw-&gt; prefix before I type in the format name, to help the search be a little more specific. Run this command:</p><pre>john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt hash1.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*oRxJ70x8baAEd45rWQjeaQ.png" /></figure><p><strong>Ans.: </strong>biscuit</p><p><strong>Q.3: What type of hash is hash2.txt?</strong></p><p>Again, perform the exact same steps as Q.1, but change hash1.txt to hash2.txt</p><blockquote>Remember, the first results are most convincing, so try them first.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*2Ubml9qVRR4Q7J5Nocqx9Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*MNY1yvfCyJbQXbjfBdsnww.png" /></figure><p><strong>Ans.:</strong> SHA1</p><p><strong>Q.4: What is the cracked value of hash2.txt?</strong></p><p>Run the john command again, but this time, make the format as raw-sha1 and run this command:</p><pre>john --format=raw-sha1 --wordlist=/usr/share/wordlists/rockyou.txt hash2.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*ZDa2zrugkqqtrnAKVhwL6A.png" /></figure><p><strong>Ans.:</strong> kangeroo</p><p><strong>Q.5: What type of hash is hash3.txt?</strong></p><p><strong>Ans.: </strong>sha256</p><p><strong>Q.6: What is the cracked value of hash3.txt?</strong></p><p>This is also a common hash, so you can use the raw- prefix</p><p><strong>Ans.:</strong> microphone</p><p><strong>Q.7: What type of hash is hash4.txt?</strong></p><p><strong>Ans.:</strong> whirlpool</p><p>This time, the second possible hash is the correct one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*2L89Qqn3sbMZBsQkURgoQQ.png" /></figure><p><strong>Q.8: What is the cracked value of hash4.txt?</strong></p><p>Whirlpool is not a common hash type, so don’t add the raw- prefix. Run this command:</p><pre> john --format=whirlpool --wordlist=/usr/share/wordlists/rockyou.txt hash4.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*U7TBpvrtelK3T4BLds34Dw.png" /></figure><p><strong>Ans.: </strong>colossal</p><h3>Task 5 — Cracking Windows Authentication Hashes</h3><p>Now that we understand the basic syntax and usage of John the Ripper, let’s move on to cracking something a little bit more complicated, something that you may even want to attempt if you’re on an actual Penetration Test or Red Team engagement. Authentication hashes are the hashed versions of passwords stored by operating systems; it is sometimes possible to crack them using our brute-force methods. To get your hands on these hashes, you must often already be a privileged user, so we will explain some of the hashes we plan on cracking as we attempt them.</p><h4>NTHash / NTLM</h4><p>NThash is the hash format modern Windows operating system machines use to store user and service passwords. It’s also commonly referred to as NTLM, which references the previous version of Windows format for hashing passwords known as LM, thus NT/LM.</p><p>A bit of history: the NT designation for Windows products originally meant New Technology. It was used starting with Windows NT to denote products not built from the MS-DOS Operating System. Eventually, the “NT” line became the standard Operating System type to be released by Microsoft, and the name was dropped, but it still lives on in the names of some Microsoft technologies.</p><p>In Windows, SAM (Security Account Manager) is used to store user account information, including usernames and hashed passwords. You can acquire NTHash/NTLM hashes by dumping the SAM database on a Windows machine, using a tool like Mimikatz, or using the Active Directory database: NTDS.dit. You may not have to crack the hash to continue privilege escalation, as you can often conduct a “pass the hash” attack instead, but sometimes, hash cracking is a viable option if there is a weak password policy.</p><h4>Practical</h4><p>Now that you know the theory behind it, see if you can use the techniques we practised in the last task and the knowledge of what type of hash this is to crack the ntlm.txt file! The file is located in ~/John-the-Ripper-The-Basics/Task05/.</p><p><strong>Q.1: What do we need to set the </strong><strong>--format flag to in order to crack this hash?</strong></p><p>First things first, exit this directory and enter the Task05 directory. I’m too lazy for running seperate commands so I’ll use &amp;&amp; to join the two commands, but they’ll run in the sequence first one and then the other. Run:</p><pre>cd .. &amp;&amp; cd Task05 &amp;&amp; ls<br># For changing the directory and viewing the files inside Task06</pre><p>You’ll directly enter the Task05 directory, and immediately see the files in here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*13GZpBoL31h-rz52d1m6Rg.png" /></figure><p>Now, read the file with cat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*W36H-EumrPLCkffgxwr73Q.png" /></figure><p>and run the hash-id.py file from the other directory with this command:</p><pre>python3 ~/John-the-Ripper-The-Basics/Task04/hash-id.py</pre><p>This time, it is a little tricky. Our file is called ntlm.txt, so the has type is definitely supposed to be NTLM, which is written as the 2nd least possible hash type. But the hint says that the format namefor NTLM hashes only has two charaters, so it must be the FIRST two. And yeah, it is nt.</p><p><strong>Ans.: </strong>nt</p><p><strong>Q.2: What is the cracked value of this password?</strong></p><p>Now we know how to structure the command so run:</p><pre>john --format=nt --wordlist=/usr/share/wordlists/rockyou.txt ntlm.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*6OCto6MxJ43dwQpFt5iAkg.png" /></figure><p><strong>Ans.:</strong> mushroom</p><h3>Task 6 — Cracking /etc/shadow Hashes</h3><h4>Cracking Hashes from /etc/shadow</h4><p>The /etc/shadow file is the file on Linux machines where password hashes are stored. It also stores other information, such as the date of last password change and password expiration information. It contains one entry per line for each user or user account of the system. This file is usually only accessible by the root user, so you must have sufficient privileges to access the hashes. However, if you do, there is a chance that you will be able to crack some of the hashes.</p><h4>Unshadowing</h4><p>John can be very particular about the formats it needs data in to be able to work with it; for this reason, to crack /etc/shadow passwords, you must combine it with the /etc/passwd file for John to understand the data it’s being given. To do this, we use a tool built into the John suite of tools called unshadow. The basic syntax of unshadow is as follows:</p><p>unshadow [path to passwd] [path to shadow]</p><ul><li>unshadow: Invokes the unshadow tool</li><li>[path to passwd]: The file that contains the copy of the /etc/passwd file you’ve taken from the lab machine</li><li>[path to shadow]: The file that contains the copy of the /etc/shadow file you’ve taken from the lab machine</li></ul><p><strong>Example Usage:</strong></p><p>unshadow local_passwd local_shadow &gt; unshadowed.txt</p><p><strong>Note on the files</strong></p><p>When using unshadow, you can either use the entire /etc/passwd and /etc/shadow files, assuming you have them available, or you can use the relevant line from each, for example:</p><p><strong>FILE 1 — local_passwd</strong></p><p>Contains the /etc/passwd line for the root user:</p><p>root:x:0:0::/root:/bin/bash</p><p><strong>FILE 2 — local_shadow</strong></p><p>Contains the /etc/shadow line for the root user: root:$6$2nwjN454g.dv4HN/$m9Z/r2xVfweYVkrr.v5Ft8Ws3/YYksfNwq96UL1FX0OJjY1L6l.DS3KEVsZ9rOVLB/ldTeEL/OIhJZ4GMFMGA0:18576::::::</p><h4>Cracking</h4><p>We can then feed the output from unshadow, in our example use case called unshadowed.txt, directly into John. We should not need to specify a mode here as we have made the input specifically for John; however, in some cases, you will need to specify the format as we have done previously using: --format=sha512crypt</p><p>john --wordlist=/usr/share/wordlists/rockyou.txt --format=sha512crypt unshadowed.txt</p><h4>Practical</h4><p>Now, see if you can follow the process to crack the password hash of the root user provided in the etchashes.txt file. Good luck! The files are located in ~/John-the-Ripper-The-Basics/Task06/.</p><p><strong>Q.1: What is the root password?</strong></p><p>Again, exit this directory and enter Task06 with</p><pre>cd .. &amp;&amp; cd Task06 &amp;&amp; ls<br># For changing the directory and viewing the files inside Task06</pre><p>There are 3 files: etc_hashes.txt, as expected, local_passwd and local_shadow, which look like the files we need to use with unshadow. As the task said, lets first unshadow th shadowed files and store them in a text file, which I’ll name as pwd_hashes.txt. You can name it anything, but I’m comfortable with this, so there. Run</p><pre>unshadow local_passwd local_shadow &gt; pwd_hashes.txt<br># We&#39;re combining the /etc/shadow file with its password file so that John can<br># understand the data.</pre><p>Now type ls and you should see a new file called pwd_hashes.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*l0ksyLc9GTpzidDhgepS_Q.png" /><figcaption>This file will contain our outputs which we’ll feed to John</figcaption></figure><p>Now run</p><pre>john --wordlist=/usr/share/wordlists/rockyou.txt --format=sha512crypt pwd_hashes.txt</pre><p>Sha512crypt is the <strong>standard password hashing algorithm</strong> used by most modern Linux distributions (such as Ubuntu and Debian) to protect user passwords inside the /etc/shadow file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*FYCfBm2JseqZ5Xa2QPXU0g.png" /></figure><p><strong>Ans.:</strong> 1234</p><h3>Task 7 — Single Crack Mode</h3><p>So far, we’ve been using John’s wordlist mode to brute-force simple and not-so-simple hashes. But John also has another mode, called the <strong>Single Crack</strong> mode. In this mode, John uses only the information provided in the username to try and work out possible passwords heuristically by slightly changing the letters and numbers contained within the username.</p><h4>Word Mangling</h4><p>The best way to explain Single Crack mode and word mangling is to go through an example:</p><p>Consider the username “Markus”.</p><p>Some possible passwords could be:</p><ul><li>Markus1, Markus2, Markus3 (etc.)</li><li>MArkus, MARkus, MARKus (etc.)</li><li>Markus!, Markus$, Markus* (etc.)</li></ul><p>This technique is called word mangling. John is building its dictionary based on the information it has been fed and uses a set of rules called “mangling rules,” which define how it can mutate the word it started with to generate a wordlist based on relevant factors for the target you’re trying to crack. This exploits how poor passwords can be based on information about the username or the service they’re logging into.</p><h4>GECOS</h4><p>John’s implementation of word mangling also features compatibility with the GECOS field of the UNIX operating system, as well as other UNIX-like operating systems such as Linux. GECOS stands for General Electric Comprehensive Operating System. In the last task, we looked at the entries for both /etc/shadow and /etc/passwd. Looking closely, you will notice that the fields are separated by a colon :. The fifth field in the user account record is the GECOS field. It stores general information about the user, such as the user’s full name, office number, and telephone number, among other things. John can take information stored in those records, such as full name and home directory name, to add to the wordlist it generates when cracking /etc/shadow hashes with single crack mode.</p><h4>Using Single Crack Mode</h4><p>To use single crack mode, we use roughly the same syntax that we’ve used so far; for example, if we wanted to crack the password of the user named “Mike”, using the single mode, we’d use:</p><p>john --single --format=[format] [path to file]</p><ul><li>--single: This flag lets John know you want to use the single hash-cracking mode</li><li>--format=[format]: As always, it is vital to identify the proper format.</li></ul><p><strong>Example Usage:</strong></p><p>john --single --format=raw-sha256 hashes.txt</p><p><strong>A Note on File Formats in Single Crack Mode:</strong></p><p>If you’re cracking hashes in single crack mode, you need to change the file format that you’re feeding John for it to understand what data to create a wordlist from. You do this by prepending the hash with the username that the hash belongs to, so according to the above example, we would change the file hashes.txt</p><p><strong>From</strong> 1efee03cdcb96d90ad48ccc7b8666033</p><p><strong>To</strong> mike:1efee03cdcb96d90ad48ccc7b8666033</p><h4>Practical</h4><p>Now that you’re familiar with the Syntax for John’s single crack mode, access the hash and crack it, assuming that the user it belongs to is called “Joker”. The file is located in ~/John-the-Ripper-The-Basics/Task07/.</p><p><strong>Q.1: What is Joker’s password?</strong></p><p>As usual, run</p><pre>cd .. &amp;&amp; cd Task07 &amp;&amp; ls<br># For changing the directory and viewing the files inside Task07</pre><p>You’ll see that there is a file called hash07.txt, so lets see what the hash is.</p><pre>cat hash07.txt<br># Reading the contents of hash07.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*inFTodmeq4CSPw-jbclU7g.png" /></figure><p>As the task said, in Single Crack Mode, you’ll have to tag the username of the user with the hash. First of all, find out what type of hash this is using the hash-id.py from Task04. Since it is not in the same directory as our present working one, we have to write its complete file path. Run</p><pre>python3 ~/John-the-Ripper-The-Basics/Task04/hash-id.py</pre><p>Paste our hash in. Like I said, first possible hash = more convincing. Use that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*thJ86-6oNbiXClIAAncx5w.png" /><figcaption>It is possibly an MD5 ahsh, so put the format with the raw- prefix!</figcaption></figure><p>Our file only has the hash written in it, but we also need to add the username, in the case of single crack. So run</p><pre>nano hash07.txt<br># Editing hash07.txt to add Joker&#39;s username.</pre><p>And at the starting, type <strong>joker:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*ftgtgBSFSgRqLjo_KV0iZA.png" /></figure><p>Press Ctrl+X and when they prompt if you want to save, type Y and enter.</p><p>Now we know that the hash is an MD5 one, and our file can be ran aginst John’s single crack mode as we have attached the username, which was, provided in the practical section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*8AVhmIZq_Z1P1FB2FxNnWA.png" /></figure><p>Run</p><pre>john --single --format=raw-md5 hash07.txt<br># We&#39;re using the Single Crack Mode to store the plaintext passsword inside<br># hash07.txt, although it won&#39;t be visible when you read the file.</pre><p>and if the cracked password isn’t loaded into the output, execute this command afterwards:</p><pre>john --show --format=raw-md5 hash07.txt<br># It&#39;ll successfully display your ctacked password from hash07.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*ztZWc3b-bk-Q7q64Y25nZA.png" /></figure><p><strong>Ans.:</strong> Jok3r</p><h3>Task 8 — Custom Rules</h3><h4>What are Custom Rules?</h4><p>As we explored what John can do in Single Crack Mode, you may have some ideas about some good mangling patterns or what patterns your passwords often use that could be replicated with a particular mangling pattern. The good news is that you can define your rules, which John will use to create passwords dynamically. The ability to define such rules is beneficial when you know more information about the password structure of whatever your target is.</p><h4>Common Custom Rules</h4><p>Many organisations will require a certain level of password complexity to try and combat dictionary attacks. In other words, when creating a new account or changing your password, if you attempt a password like polopassword, it will most likely not work. The reason would be the enforced password complexity. As a result, you may receive a prompt telling you that passwords have to contain at least one character from each of the following:</p><ul><li>Lowercase letter</li><li>Uppercase letter</li><li>Number</li><li>Symbol</li></ul><p>Password complexity is good! However, we can exploit the fact that most users will be predictable in the location of these symbols. For the above criteria, many users will use something like the following:</p><p>Polopassword1!</p><p>Consider the password with a capital letter first and a number followed by a symbol at the end. This familiar pattern of the password, appended and prepended by modifiers (such as capital letters or symbols), is a memorable pattern that people use and reuse when creating passwords. This pattern can let us exploit password complexity predictability.</p><p>Now, this does meet the password complexity requirements; however, as attackers, we can exploit the fact that we know the likely position of these added elements to create dynamic passwords from our wordlists.</p><h4>How to create Custom Rules</h4><p>Custom rules are defined in the john.conf file. This file can be found in /opt/john/john.conf on the TryHackMe Attackbox. It is usually located in /etc/john/john.conf if you have installed John using a package manager or built from source with make.</p><p>Let’s go over the syntax of these custom rules, using the example above as our target pattern. Note that you can define a massive level of granular control in these rules. I suggest looking at the wiki <a href="https://www.openwall.com/john/doc/RULES.shtml">here(opens in new tab)</a> to get a full view of the modifiers you can use and more examples of rule implementation.</p><p>The first line:</p><p>[List.Rules:THMRules] is used to define the name of your rule; this is what you will use to call your custom rule a John argument.</p><p>We then use a regex style pattern match to define where the word will be modified; again, we will only cover the primary and most common modifiers here:</p><ul><li>Az: Takes the word and appends it with the characters you define</li><li>A0: Takes the word and prepends it with the characters you define</li><li>c: Capitalises the character positionally</li></ul><p>These can be used in combination to define where and what in the word you want to modify.</p><p>Lastly, we must define what characters should be appended, prepended or otherwise included. We do this by adding character sets in square brackets [ ] where they should be used. These follow the modifier patterns inside double quotes &quot; &quot;. Here are some common examples:</p><ul><li>[0-9]: Will include numbers 0-9</li><li>[0]: Will include only the number 0</li><li>[A-z]: Will include both upper and lowercase</li><li>[A-Z]: Will include only uppercase letters</li><li>[a-z]: Will include only lowercase letters</li></ul><p>Please note that:</p><ul><li>[a]: Will include only a</li><li>[!£$%@]: Will include the symbols !, £, $, %, and @</li></ul><p>Putting this all together, to generate a wordlist from the rules that would match the example password Polopassword1! (assuming the word polopassword was in our wordlist), we would create a rule entry that looks like this:</p><p>[List.Rules:PoloPassword]</p><p>cAz&quot;[0-9] [!£$%@]&quot;</p><p>Utilises the following:</p><ul><li>c: Capitalises the first letter</li><li>Az: Appends to the end of the word</li><li>[0-9]: A number in the range 0-9</li><li>[!£$%@]: The password is followed by one of these symbols</li></ul><h4>Using Custom Rules</h4><p>We could then call this custom rule a John argument using the --rule=PoloPassword flag.</p><p>As a full command: john --wordlist=[path to wordlist] --rule=PoloPassword [path to file]</p><p>As a note, I find it helpful to talk out the patterns if you’re writing a rule; as shown above, the same applies to writing RegEx patterns.</p><p>Jumbo John already has an extensive list of custom rules containing modifiers for use in almost all cases. If you get stuck, try looking at those rules [around line 678] if your syntax isn’t working correctly.</p><p>Now, it’s time for you to have a go!</p><p><strong>Q.1: What do custom rules allow us to exploit?</strong></p><p><strong>Ans.: </strong>Password complexity predictability</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*mfGaJT0IrT0yknxSCwZ-qQ.png" /></figure><p><strong>Q.2: What rule would we use to add all capital letters to the end of the word?</strong></p><p><strong>Ans.:</strong> Az”[A-Z]”</p><p>It breaks down into three simple components that execute from left to right:</p><ol><li><strong>A (Append/Insert):</strong> This command tells John to insert characters into the word.</li><li><strong>z (At the End):</strong> This specifies <em>where</em> to put them. Combined, Az means <em>&quot;Append text to the absolute end of the word.&quot;</em></li><li><strong>&quot;[A-Z]&quot; (The Payload):</strong> The quotation marks &quot;&quot; contain the exact characters we want to append. Inside the quotes, [A-Z] is a standard regular expression (regex) range that represents <strong>all capital letters</strong> from A to Z.</li></ol><p><strong>Q.3: What flag would we use to call a custom rule called </strong><strong>THMRules?</strong></p><p><strong>Ans.: -</strong>-rule=THMRules</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*E6YGlVnZ07L1OTmJn8n53g.png" /></figure><h3>Task 9 — Cracking Password Protected Zip Files</h3><p>Yes! You read that right. We can use John to crack the password on password-protected Zip files. Again, we’ll use a separate part of the John suite of tools to convert the Zip file into a format that John will understand, but we’ll use the syntax you’re already familiar with for all intents and purposes.</p><h4>Zip2John</h4><p>Similarly to the unshadow tool we used previously, we will use the zip2john tool to convert the Zip file into a hash format that John can understand and hopefully crack. The primary usage is like this:</p><p>zip2john [options] [zip file] &gt; [output file]</p><ul><li>[options]: Allows you to pass specific checksum options to zip2john; this shouldn’t often be necessary</li><li>[zip file]: The path to the Zip file you wish to get the hash of</li><li>&gt;: This redirects the output from this command to another file</li><li>[output file]: This is the file that will store the output</li></ul><p><strong>Example Usage</strong></p><p>zip2john zipfile.zip &gt; zip_hash.txt</p><h4>Cracking</h4><p>We’re then able to take the file we output from zip2john in our example use case, zip_hash.txt, and, as we did with unshadow, feed it directly into John as we have made the input specifically for it.</p><p>john --wordlist=/usr/share/wordlists/rockyou.txt zip_hash.txt</p><h4>Practical</h4><p>Now, have a go at cracking a “secure” Zip file! The file is located in ~/John-the-Ripper-The-Basics/Task09/.</p><p><strong>Q.1: What is the password for the secure.zip file?</strong></p><pre>cd .. &amp;&amp; cd Task09 &amp;&amp; ls<br># For changing the directory and viewing the files inside Task09</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/1*Ns91QGa1Yy9ydYOr-NrF-Q.png" /></figure><p>Use Zip2John to crack this one, run</p><pre>zip2john secure.zip &gt; secure_hash.txt<br># Converting the ZIP file into a hash format that John can use, and storing the<br># output inside a file called secure_hash.txt</pre><p>This command will extract the password hash to a file named secure_hash.txt</p><p>Type ls and you’ll see our extracted output’s file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*htCxbBT49HLsNU-ydT0wTA.png" /></figure><p>Now run</p><pre>john --wordlist=/usr/share/wordlists/rockyou.txt secure_hash.txt<br># Cracking the output hash which was extracted from secure.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*IRPkSFOQB7dC9FvsafDSqA.png" /></figure><p><strong>Ans.:</strong> pass123</p><p><strong>Q.2: What is the contents of the flag inside the zip file?</strong></p><p>Now we’ll have to unzip the zip file with the password we found. Run</p><pre>unzip secure.zip</pre><p>They’ll prompt you for the password, so type pass123. Then, when you type ls, you’ll see a new directory called zippy. Enter it and type ls. Read the file that you find</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*yeF2uDpMJMSGoNQTEXufoA.png" /></figure><p><strong>Ans.:</strong> <em>Slow but steady wins the race! So work it out yourself!</em></p><h3>Task 10 — Cracking Password-Protected RAR Archives</h3><h4>Cracking a Password-Protected RAR Archive</h4><p>We can use a similar process to the one we used in the last task to obtain the password for RAR archives. If you aren’t familiar, RAR archives are compressed files created by the WinRAR archive manager. Like Zip files, they compress folders and files.</p><h4>Rar2John</h4><p>Almost identical to the zip2john tool, we will use the rar2john tool to convert the RAR file into a hash format that John can understand. The basic syntax is as follows:</p><p>rar2john [rar file] &gt; [output file]</p><ul><li>rar2john: Invokes the rar2john tool</li><li>[rar file]: The path to the RAR file you wish to get the hash of</li><li>&gt;: This redirects the output of this command to another file</li><li>[output file]: This is the file that will store the output from the command</li></ul><p><strong>Example Usage</strong></p><p>/opt/john/rar2john rarfile.rar &gt; rar_hash.txt</p><h4>Cracking</h4><p>Once again, we can take the file we output from rar2john in our example use case, rar_hash.txt, and feed it directly into John as we did with zip2john.</p><p>john --wordlist=/usr/share/wordlists/rockyou.txt rar_hash.txt</p><h4>Practical</h4><p>Now, have a go at cracking a “secure” RAR file! The file is located in ~/John-the-Ripper-The-Basics/Task10/.</p><p><strong>Q.1: What is the password for the secure.rar file?</strong></p><p>This is just like extracting passwords from a zip file, only, by replacing the word ‘zip’ with ‘rar’.</p><pre>cd .. &amp;&amp; cd Task10 &amp;&amp; ls<br># For changing the directory and viewing the files inside Task10</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*aHLlXujK6gG1W0PTI57IOQ.png" /></figure><p>Run these commands one after the other:</p><pre>rar2john secure.rar &gt; rar_loot.txt<br># Just like zip2john, only, for RAR archives.</pre><pre>john --wordlist=/usr/share/wordlists/rockyou.txt rar_loot.txt<br># We&#39;re rying to crack the password from the output file where the hash is<br># stored.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*g8KdMYIO7KCYo4O6icyztg.png" /></figure><p><strong>Ans.:</strong> password</p><p><strong>Q.2: What are the contents of the flag inside the rar file?</strong></p><p>Just like we did with the .zip file, we also need to unrar this file, with the password we just cracked.</p><p>Run:</p><pre>unrar x secure.rar</pre><p>Here is the exact breakdown of each component:</p><ul><li><strong>unrar</strong>: This calls the command-line utility responsible for handling and extracting .rar archive files.</li><li><strong>x (e</strong>X<strong>tract with full path)</strong>: This is the specific command flag. Unlike the e flag (which dumps all files loosely into one folder), x tells the utility to unpack everything exactly how it was packed, keeping all internal folders, subfolders, and paths intact.</li><li><strong>secure.rar</strong>: This is the target RAR archive file you are extracting. <em>(Note: Even if you omit the </em><em>.rar extension in the terminal, the utility will automatically look for </em><em>secure.rar in your current directory).</em></li></ul><blockquote>Note: If <strong>unrar</strong>isn’t installed, then install it by running &lt;sudo apt update&gt; and/or &lt;sudo apt install unrar&gt;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*AwpzNuHZrSdu-CyPKX3CqA.png" /></figure><p><strong>Ans.: </strong><em>Slow but steady wins the race! So work it out yourself!</em></p><h3>Task 11 — Cracking SSH Key with John</h3><h4>Cracking SSH Key Passwords</h4><p>Okay, okay, I hear you. There are no more file archives! Fine! Let’s explore one more use of John that comes up semi-frequently in CTF challenges — using John to crack the SSH private key password of id_rsa files. Unless configured otherwise, you authenticate your SSH login using a password. However, you can configure key-based authentication, which lets you use your private key, id_rsa, as an authentication key to log in to a remote machine over SSH. However, doing so will often require a password to access the private key; here, we will be using John to crack this password to allow authentication over SSH using the key.</p><h4>SSH2John</h4><p>Who could have guessed it, another conversion tool? Well, that’s what working with John is all about. As the name suggests, ssh2john converts the id_rsa private key, which is used to log in to the SSH session, into a hash format that John can work with. Jokes aside, it’s another beautiful example of John’s versatility. The syntax is about what you’d expect. Note that if you don’t have ssh2john installed, you can use ssh2john.py, located in the /opt/john/ssh2john.py. If you’re doing this on the AttackBox, replace the ssh2john command with python3 /opt/john/ssh2john.py or on Kali, python /usr/share/john/ssh2john.py.</p><p>ssh2john [id_rsa private key file] &gt; [output file]</p><ul><li>ssh2john: Invokes the ssh2john tool</li><li>[id_rsa private key file]: The path to the id_rsa file you wish to get the hash of</li><li>&gt;: This is the output director. We’re using it to redirect the output from this command to another file.</li><li>[output file]: This is the file that will store the output from</li></ul><p><strong>Example Usage</strong></p><p>/opt/john/ssh2john.py id_rsa &gt; id_rsa_hash.txt</p><h4>Cracking</h4><p>For the final time, we’re feeding the file we output from ssh2john, which in our example use case is called id_rsa_hash.txt and, as we did with rar2john, we can use this seamlessly with John:</p><p>john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa_hash.txt</p><h4>Practical</h4><p>Now, I’d like you to crack the hash of the id_rsa file relevant to this task! The file is located in ~/John-the-Ripper-The-Basics/Task11/.</p><p><strong>Q.1: What is the SSH private key password?</strong></p><p>Run these commands one after the other.</p><pre>cd .. &amp;&amp; cd Task11 &amp;&amp; ls <br># For changing the directory and viewing the files inside Task11</pre><pre>/opt/john/ssh2john.py id_rsa &gt; ssh_priv.txt<br># In case you don&#39;t have ssh2john installed, use ssh2john.py and please check<br># where it is located, first!</pre><pre>john --wordlist=/usr/share/wordlists/rockyou.txt ssh_priv.txt<br># ssh_priv.txt is where our cracked SSH key&#39;s hash is.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*ttf1duds4quMvwEN53qt_g.png" /></figure><p><strong>Ans.:</strong> mango</p><h3>Task 12 — Further Reading</h3><p>Thank you for completing this room on John the Ripper! I hope you’ve learnt a lot along the way. I’m sure you understand the basic principles and pattern of using John with even the most obscure supported hashes by now. I’d recommend checking out the Openwall Wiki <a href="https://www.openwall.com/john/">here(opens in new tab)</a> for more information about using John and advice, updates, or news about the tool.</p><p><strong>Q.1: Time for a new challenge!</strong></p><p><strong>Ans.:</strong> <em>No answer needed!</em></p><p><strong>Summary</strong><br>The <strong>John the Ripper: The Basics</strong> room provides an essential foundation for offline credential auditing. By completing this lab, we successfully demonstrated:</p><ul><li>Identifying and cracking various single-hash formats.</li><li>Cracking Linux system passwords using the unshadow utility.</li><li>Utilizing helper tools (zip2john, rar2john, ssh2john) to extract and crack hashes from protected files.</li></ul><p>These skills are fundamental to vulnerability assessments and password strength verification in enterprise environments.</p><h4>— — — — — — — — — — — — — — — — — — — — — —Happy Hacking!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=643d4b5bf868" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NIS-Linux Part I— TryHackMe]]></title>
            <link>https://medium.com/@ruumpu/nis-linux-part-i-tryhackme-1c7758c1b17f?source=rss-fb89ad190bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c7758c1b17f</guid>
            <category><![CDATA[tryhackme-writeup]]></category>
            <dc:creator><![CDATA[Rumana Pervin]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 10:45:37 GMT</pubDate>
            <atom:updated>2026-07-20T12:46:36.587Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome! In this write-up, we are tackling <strong>NIS — Linux Part I</strong> on TryHackMe. Whether you are preparing for a penetration testing certification or just starting your cybersecurity journey, mastering the Linux command line is an absolute non-negotiable skill. In this lab, we dive straight into practical terminal usage, covering essential text-processing tools (like cat, grep, and xxd), file searching, and archive management. Let&#39;s fire up our AttackBox and Target Machine, and dive in!</p><h3>Task 1 — What is this room about?</h3><p>In this task, we will be looking back at Linux Fundamentals and a few other topics that seem to cause some trouble around beginners. A requirement for this room is to finish the <a href="https://tryhackme.com/room/linuxfundamentalspart1">Linux Fundamentals rooms</a>.</p><p>As it covers all the basic requirements and this is just a follow up to it in order to strengthen the understanding you gained throughout the room. In order to do so.<br>Below I will be asking a few questions related to that room, so please, make sure to complete it first :). If you didn’t feel free to go through the tasks and come back to this once you finished the room.</p><p>The commands you are allowed to use in this room are:</p><ul><li>cat</li><li>tac</li><li>head</li><li>tail</li><li>xxd</li><li>base64</li><li>find</li><li>grep</li><li>echo</li><li>xargs</li><li>hexeditor</li><li>tar</li><li>gzip</li><li>7zip</li><li>binwalk</li></ul><p><strong>Bear in mind, commands such as cd are not allowed.</strong></p><ul><li><strong>** The SSH credentials are chad:Infinity121 ***</strong></li></ul><p><strong>Q.1: What is the user you are logged in to in the first room of Linux Fundamentals Part 1?</strong></p><p><strong>Ans.:</strong> tryhackme</p><p>In the Linux Fundamentals Part 1 room, once you start the machine, you should see that in the command line, the prompt shows the User as tryhackme and the Host as linux1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/324/1*hM5y_N08FMNuheazsL4VMg.png" /></figure><p><strong>Q.2: What badge do you receive when you complete all the Linux Fundamentals rooms?</strong></p><p><strong>Ans.:</strong> cat linux.txt</p><p>By <em>all</em>, they mean not just the <strong><em>Part 1</em></strong> room, but <strong><em>2 &amp; 3</em></strong> as well. But you can receive it by just completing one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZmxNhdrUVTmhO09do4byA.png" /></figure><h3>Task 2 — ls</h3><p>This task should give you a better understanding of the command ls and a few of the switches that the command can take and what are some of the more efficient ones. Below is a screenshot of the help menu, however, feel free to use the <em>man</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*hzLf4EtiIaQQ-cOu.png" /></figure><p>Hopefully, the above screenshot should help you go through a few of the tasks below, however further research is required. A good thing to know is that ls supports multiple ways of chaining switches. Such as:</p><ul><li>ls -x -y -z</li><li>ls -xyz</li></ul><p>In some cases, you would need to keep evidence of your findings. Below we will start with some basic commands you should be familiar with.</p><p><strong>Q.1: How do you run the ls command?</strong></p><p><strong>Ans.:</strong> ls</p><p>Why, you simply type ls to run the ls command, or else it’s not even an ls command!</p><p><strong>Q.2: How do you run the ls command to show all the files inside the folder?</strong></p><p><strong>Ans.: </strong>ls -a</p><p><strong>‘ls’ </strong>normally shows <strong>single worded</strong> file names, but if you add a <strong>-a</strong> switch, your results will also include the hidden files that have a ‘.’ or the parent directories with ‘..’</p><p>The ‘a’ literally stands for all.</p><p><strong>Q.3: How do you run the ls command to not show the current directory and the previous directory in the output? (almost everything)</strong></p><p><strong>Ans.:</strong> -A</p><p>A works just like -a, but it excludes the current directory (which is represented by a single ‘.’) and the previous directory (which is represented by double ‘..’), so -A means Almost All.</p><p><strong>Q.4: How do you show the information in a long listing format using ls?</strong></p><p><strong>Ans.:</strong> ls -l</p><p>In the screenshot, they actually wrote -<em>1</em>, which give on file per column and is, therefore, called one column output, they also gave -<em>l</em> for long listing. It’s just a problem with the terminal font, so if you thought they, err, <em>mistakenly</em> put <strong>two ‘-<em>l</em>’</strong>s, it’s not what you think it is. You can try it for yourself in your device’s terminal! Type -1 and you’ll receive 1 file per column. Type -l, and you’ll get a detailed information about each file. Or you can run the help command in your terminal and fish both of them out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*517mUqrlMJpKBESz6DqsQQ.png" /></figure><p><strong>Q.5: How do you show the size in readable format? e.g. k, Mb, etc</strong></p><p><strong>Ans.:</strong> ls -h</p><p>This one wasn’t mentioned in the screenshot so I ran ls — help in my VMWare and found -h, which stands for human-readable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fmrwf2HOChTlN-Pg21X90A.png" /></figure><p><strong>Q.6: How do you do a recursive ls?</strong></p><p><strong>Ans.:</strong> ls --recursive</p><p>They wrote -R in the screenshot, but it was too short, so I looked in my VM helpline for -R and saw that it can also be alternated for --recursive:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ftqOm3TVmHW3IWPWtExCng.png" /></figure><p><strong>Q.7: How many files did you locate in the home folder of the user?(non-hidden and not inside other folders)</strong></p><p>I guess your machine’s must have booted up by now and you must have SSHed into the machine with the credentials provided.</p><p>If you haven’t, then start the machines and open a terminal in the AttackBox. Type:</p><pre>ssh chad@&lt;YOUR_MACHINE_IP&gt;</pre><p>Type ‘yes’ when they ask if you’re sure if you want to continue connecting. Type in Chad’s password: Infinity121.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*XWPXs5ANp7xMF2Q6jtKpMQ.png" /></figure><p>You’re in! Now, just type a simple, nice ls, and count the files that come as the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*sBpw2bHEhqe0vj9w1G4-Rw.png" /><figcaption>13 in total, count the white spots, it’ll be easier</figcaption></figure><p><strong>Ans.: </strong>13</p><h3>Task 3 — cat</h3><p>The cat command is one of the most common Linux commands that people use, however, in some instances, the cat command cannot be used as it’s removed.</p><p>Below is a screenshot of the <strong>cat </strong>command’s help menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/0*hHwhxS5uY_zdAaWz.png" /></figure><p>But, as we are professionals we know about a few alternatives of going around it:</p><p>The first command we are going to learn about is <strong>tac</strong>. Yes, cat spelt backwards. It is similar to the command, with the downside of less functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*nqCcJ4ruhDMaZ3ne.png" /></figure><p>Thus being a good tool to add to your toolbelt when you are limited by your reverse shell.</p><p>Another tool that can be used is <strong>head</strong>. This is usually used to get the beginning part of a file, however, you can use it to your heart’s content and grab as many lines as you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*pcVCGK9ueE2M_1bz.png" /></figure><p>One more tool that can be used to grab the content of a file is <strong>tail</strong>. This is similar to the head command, however, as the name implies it will grab the last part of a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*6aY2MP7ATLsdgnNs.png" /></figure><p>Another useful command is <strong>xxd</strong>. this can be used to generate a hex dump of the content of a file. Then, if you want you can either just read the text from the right-hand side or convert from hex to ASCII.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*uNDql2UFXtd2_zdc.png" /></figure><p>Similar to the above you can use the <strong>base64 </strong>command to convert the text to base64 and then convert it back to ASCII.</p><p><strong>Q.1: What is the content of cat.txt?</strong></p><p>Now, this is what I call ‘Mega Flag Time (MFT)’!!!</p><p>We just need to type cat and the file’s name, and the flag is caught red-handed.</p><p>They’ve told us which file we need to read to get the flags for each question, so first, for this question, type in this command:</p><pre>cat cat.txt</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*FPRLpW5HrmmkucxFUF-LZw.png" /></figure><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><p><em>Note: Just a quick heads up, after finding flags, let’s avoid posting them in the comments so others have a chance to find it themselves!</em></p><p><strong>Q.2: What is the content of tac.txt?</strong></p><p>Run the same command (except, instead of cat.txt, type the name of the file you need to read) for the next questions.</p><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><p><strong>Q.3: What is the content of head.txt?</strong></p><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><p><strong>Q.4: What is the content of tail.txt?</strong></p><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><p><strong>Q.5: What is the content of the xxd.txt?</strong></p><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><p><strong>Q.6: What is the content of base64.txt?</strong></p><p><strong>Ans.:</strong><em> It’s easy, try it yourself!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*HHMrIRRbLiHdRqSpGfSjWA.png" /></figure><h3>Task 4 — find</h3><p>The find command is one of the most useful commands on a Linux operating system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/0*0Fi3ro25wo0wo5PX.png" /></figure><p>This command can help us find specific files that match a pattern like:</p><p>find . -name *.txt</p><p>Or we can use it to find files that have a specific extension:</p><p>find / -type f -name &quot;*.bak&quot;</p><p>This simple command will start browsing the machine directory, finding all the files with extension .bak (backup).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/0*pYb2-PNJqnX_8SUF.png" /></figure><p>But we can also use it to find files that have the SUID or SGID bit set like so:</p><p>find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls -l {} \;</p><p>This command combines permissions 4000 (SUID) and 2000 (SGID)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/0*DVzWljHmW34JfN0M.png" /></figure><p><strong>Q.1: How many .txt files did you find in the current folder?</strong></p><p>To find files that match a specific extension (in this case it’s <strong>.txt</strong>) the task content shares a simple command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*AVN0KiQS_bdjE8kYIodxSA.png" /></figure><p>run the command</p><pre>find ~ -type f -name &quot;*.txt&quot;</pre><p>This command will find all the files with the .txt extension from the ~ (home) directory, in which we are located right now.</p><p>Count the number of files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*ljVRXxjmdpBKUMIf2dRbsg.png" /><figcaption>8 in total</figcaption></figure><p><strong>Ans.:</strong> 8</p><p><strong>Q.2: How many SUID files have you found inside the home folder?</strong></p><p>The task content says:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*49FtSkzn6YSBv0OCy8lQVQ.png" /></figure><p>We only need SUID files, so we don’t need the permissions 2000. So run the command:</p><pre>find ~ -type f \( -perm -4000 \) -exec ls -l {} \;</pre><p>This command will search for files with SUID permissions inside the ~ (home) folder, and it finds any, it’ll execute the ls -l command to list the files it found. But the command returns nothing which means there aren’t any files with SUID permissions. Nothing means 0, so…</p><p><strong>Ans.:</strong> 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*3tL92pNonxJ3H5jrFAr80g.png" /></figure><h3>Task 5 — grep</h3><p>grep is a really useful command to grab text from files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/0*PkfiQWYK25tmn3b3.png" /></figure><p>Let’s read through a few examples of grep commands and see how we can use them for our own benefit in a scenario.</p><p>grep &quot;word&quot; file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/0*vtIqos02h5M7LC8G.png" /></figure><p>Grep not only allows us to check if a certain word exists in the file but also outputs us the context in which the word had appeared. As you can see on the screenshot above, we were able to find an exact match to the word ‘if’ in the file script.py.</p><p>We can also compare two files with similar names using.</p><p>grep &quot;word&quot; file*</p><p><strong>Q.1: How many times does the word “hacker” appear in the grep files? (including variations)</strong></p><p>So, I’ll show you a very easy way to get this, no need to count the words and things!!!</p><p>First, let’s type ls to find the files with names that have grep in them. We found 2, grep1.txt and grep.txt:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*etHb4fdP3UAaUqUAXbLKqw.png" /></figure><p>Now, the real thing. Use this command:</p><pre>cat grep1.txt grep.txt | grep -oiE &#39;\bhack[a-z]*\b&#39; | grep -n &quot;&quot; | cat -n</pre><p>Here’s a breakthrough of this command, step by step:</p><p>Step 1: cat grep1.txt grep.txt</p><ul><li><strong>What it does:</strong> Opens both files and smashes their contents together into one single stream of text.</li><li><strong>Why we use it:</strong> It reads both files at the exact same time so you do not have to run separate commands for each file.</li></ul><p>Step 2: | grep -oiE &#39;\bhack[a-z]*\b&#39;</p><p>This is the smartest part of the command. It filters the massive stream of text from Step 1.</p><ul><li><strong>-o (Only matching):</strong> Instead of printing the whole line, it extracts <em>only</em> the matching word and puts it on its own new line. If a line has &quot;hacker hacking&quot;, it splits them onto two separate lines.</li><li><strong>-i (Ignore case):</strong> Matches hack, Hacker, HACKING, or hAcKeR.</li><li><strong>-E (Extended Regex):</strong> Activates advanced pattern matching.</li></ul><p><strong>\bhack[a-z]*\b</strong>:</p><ul><li>\b forces it to start at the beginning of a word.</li><li>hack looks for the root letters.</li><li>[a-z]* matches any letters that come after it (like er, ers, ing, ed).</li><li>\b forces it to stop perfectly at the end of the word.</li></ul><p>Step 3: | grep -n &quot;&quot;</p><ul><li><strong>What it does:</strong> It searches for <em>anything</em> (&quot;&quot; means &quot;match every line&quot;) and adds a line number to the front of it.</li><li><strong>Why we use it:</strong> Since the system blocked the word-counting tool (wc), we have to trick the system into numbering the words for us. (You can try using wc -l, but my sytem blocked it, so I’m not using it)</li></ul><p>Step 4: | cat -n</p><ul><li><strong>What it does:</strong> The -n flag tells cat to number every line it displays.</li><li><strong>The Trick:</strong> By passing our numbered list through cat -n, it counts the total number of lines we generated.</li></ul><p>The very final line of the output will show you the highest number on the last line. That highest number is your <strong>exact, total word count</strong> across both files!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QO_uF6w5AZpj23N6lOoAg.png" /></figure><p><strong>Ans.:</strong> 15</p><h3>Task 6 — sudo</h3><p>sudo command allows certain users to execute a command as another user, according to settings in the /etc/sudoers file. By default, <strong>sudo </strong>requires that users authenticate themselves with a password of another user.</p><p>In the real-life scenario, <strong>sudo</strong> is mostly used to switch to root account and gain an ability to fully interact with the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/0*fvEorA0oI190aNi1.png" /></figure><p>sudo -l appears to be the most commonly used switch. It can always tell you which commands are you allowed to run as another user on the following system, and in some cases, can give you a clue to root access.</p><p><strong>Q.1: Is the user allowed to run the above command? (Yay/Nay)</strong></p><p>Just type sudo -l in the terminal and see if the user gets escalated, or switches to the root user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aKlIwHfbOs6V-odYkXFzzg.png" /></figure><p>No, the user Chad isn’t allowed to.</p><p><strong>Ans.:</strong> Nay</p><h3>Task 7 — chmod</h3><p>The <strong>chmod </strong>command sets the permissions of files or directories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*7cKjzQX0ktXPm7pd.png" /></figure><p>Those permissions are divided between three main characters:</p><ol><li>User</li><li>Group</li><li>Other</li></ol><p>All of them can rather read, write or execute a file. Permission to do so can be granted using chmod.</p><p>It can be done rather using letter notation or numerical values.</p><p>Let’s take a look at the following command:</p><p>chmod u=rwx,g=rx,o=rw myfile</p><ul><li>u = user is being giver read, write and execute permission</li><li>g = group can now read and execute</li><li>o = other can read and write</li></ul><p>This long notion can be eliminated by numerical values for permission. There are exactly four of them:</p><p>0 stands for “no permission.”</p><p>1 stands for “execute”;</p><p>2 stands for “write”;</p><p>4 stands for “read”.</p><p>Those values can be easily combined by adding them up.</p><p>For example, permission to read, write and execute would be 7 (1 + 2 + 4).</p><p>chmod 777 file</p><p>The following command will grant full file access to everyone on the system. (Those numerical values can be easily calculated using an interactive <a href="http://chmod-calculator.com/">chmod-calculator</a>).</p><p><strong>chmod </strong>command comes in handy with ssh key files (id_rsa). By editing their permissions to ‘user read-write only’ we can use other people’s id_rsa files to connect via ssh.</p><p>chmod 600 id_rsa</p><p><strong>Q.1: Read the above.</strong></p><p><strong>Ans.:</strong> <em>No answer needed!</em></p><h3>Task 8 — echo</h3><p>echo is the most fundamental command found in most operating systems. It used to prints text to standard output, for example, terminal. It is mostly used in bash scripts in order to display output directly to user’s console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*nikTIIfJutualW5g.png" /></figure><p>echo can also be used to interact with other system commands and pass some value to them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*5Q_khjgph6YaoPAP.png" /></figure><p>echo also has a small trick which allows to print out any command output to console.</p><p>echo &quot;$( [command] )&quot;</p><p><strong>Q.1: What command would you use to echo the word “Hackerman” ?</strong></p><p><strong>Ans.:</strong> echo “Hackerman”</p><p>Simple logics!</p><h3>Task 9 — xargs</h3><p><strong>xargs </strong>command builds and executes command lines from standard input. It allows you to run the same command on a large number of files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*B3J9HTVDOmWQS1Yp.png" /></figure><p>xargs is often used with the find command, in order to easily interact with its input.</p><p>Let’s take a look at the given command:</p><p>find /tmp -name test -type f -print | xargs /bin/rm -f</p><p>On the left side, we can see a command which should technically display all files under a name ‘test’. <strong>xargs </strong>command on the left allows us to execute rm (remove) on those files and easily delete all of them.</p><p>Same can be done with reading all the files under the name ‘test’.</p><p><strong>Q.1: How would you read all files with extension .bak using xargs?</strong></p><p><strong>Ans.:</strong> find / -name *.bak -type f -print | xargs /bin/cat</p><p>Here’s a breakthrough of the command, step by step.</p><p>Step 1: find / -name *.bak -type f -print</p><p>This part searches your computer for specific files.</p><ul><li><strong>find</strong>: The tool used to walk through directories and hunt for files.</li><li><strong>/</strong>: Tells it to start searching from the absolute root directory (the very bottom of the system) and look everywhere.</li><li><strong>-name *.bak</strong>: Filters the search to only look for files that end with the .bak extension (backup files).</li><li><strong>-type f</strong>: Restricts the search to regular files only, skipping folders/directories.</li><li><strong>-print</strong>: Explicitly tells the system to output the full path of every matching file it finds.</li></ul><p>Step 2: The Pipe (|)</p><ul><li><strong>What it does:</strong> It takes the list of file paths generated by find and passes that list directly into the next command as text.</li></ul><p>Step 3: xargs /bin/cat</p><p>This part takes the list of filenames and reads them.</p><ul><li><strong>xargs</strong>: This is a utility builder. It takes the text list of files from the pipe and breaks them down into arguments that another command can understand.</li><li><strong>/bin/cat</strong>: This is the absolute path to the cat command. xargs takes the file paths from find and executes them like this: cat file1.bak file2.bak file3.bak.</li></ul><h3>Task 10 — hexeditor</h3><p>Hexeditor is an awesome tool designed to read and modify hex of a file, this comes in handy especially when it comes to troubleshooting magic numbers for files such as JPG, WAV and any other types of files. This tool is also helpful when it comes to CTFs and text is hidden inside a file or when the magic number of a file was altered.</p><p>Another tool that is good for this kind of scenarios is called strings but we won&#39;t be talking about it in this part of our course.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/0*bZyJWpGxo1rG8toN.png" /></figure><p>For this task, I will be providing you with resources to help you along your journey around challenges you might be facing in which you need the <strong>hexeditor </strong>tool.</p><p>A few resources I use for tasks that involve analysing files and fixing the magic number I use the following resources:</p><p><a href="https://en.wikipedia.org/wiki/List_of_file_signatures">https://en.wikipedia.org/wiki/List_of_file_signatures(opens in new tab)</a></p><p><a href="https://en.wikipedia.org/wiki/List_of_file_signatures">(opens in new tab)</a></p><p><a href="https://gist.github.com/leommoore/f9e57ba2aa4bf197ebc5">https://gist.github.com/leommoore/f9e57ba2aa4bf197ebc5(opens in new tab)(opens in new tab)</a></p><p><a href="https://www.garykessler.net/library/file_sigs.html">https://www.garykessler.net/library/file_sigs.html</a></p><p><strong>Q.1: Read the above.</strong></p><p><strong>Ans.:</strong> <em>No answer needed!</em></p><h3>Task 11 — curl</h3><p>The <strong>curl </strong>command transfers data to or from a network server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). It is designed to work without any user interaction, so could be ideally used in a shell script.</p><p><strong>curl </strong>is a huge tool with a lot of switches and possibilities. Let’s take a look at some of the most important ones.</p><p>curl <a href="http://www.ismycomputeron.com/">http://www.ismycomputeron.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/0*_GFCI-y-1tQJVEYl.png" /></figure><p>The most basic command. Fetches data from the website using the HTTP protocol, and display it using standard HTML code. This is essentially the same as “viewing the source” of the webpage.</p><p>The following command will limit the connection speed to 1,234 bytes/second:</p><p>curl --limit-rate 1234B <a href="http://www.ismycomputeron.com/">http://www.ismycomputeron.com/</a></p><p>Another example is saving the output to a file using either:</p><p>-o to save the file under a different name</p><p>curl -o loginpage.html <a href="https://tryhackme.com/login">https://tryhackme.com/login</a></p><p>-O to save the file under the same name:</p><p>curl -O <a href="https://tryhackme.com/login">https://tryhackme.com/login</a></p><p>Or, you might be interested in fetching the headers silently?</p><p>curl -I -s <a href="https://tryhackme.com/">https://tryhackme.com</a></p><p><strong>Q.1: How would you grab the headers silently of </strong><a href="https://tryhackme.com/"><strong>https://tryhackme.com</strong></a><strong> but grepping only the HTTP status code?</strong></p><p><strong>Ans.:</strong> curl -I -s <a href="https://tryhackme.com/">https://tryhackme.com</a> | grep HTTP</p><p>On the very last line of the task content, they mention how to grab headers silently:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*BiHyA3zkerl1J34LiAC3kQ.png" /></figure><p>So we use <strong><em>curl -I -s</em></strong> to grab the headers silently. Next, we mention the link of the website we want to fetch the headers from, i.e.<strong><em> </em></strong><a href="https://tryhackme.com./"><strong><em>https://tryhackme.com</em></strong>.</a> And since we only want HTTP headers, we’ll grep HTTP ones using <strong><em>grep HTTP</em></strong>.</p><h3>Task 12 — wget</h3><p>The<strong> wget </strong>command downloads files from HTTP, HTTPS, or FTP connection a network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/0*rAe9bQ3UmJ04vfRs.png" /></figure><p>wget <a href="http://somewebsite.com/files/images.zip">http://somewebsite.com/files/images.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/0*-nrLQuMvuiUwXWTf.png" /></figure><p>Adding a -b switch will allow us to run wget in the background and return the terminal to its initial state.</p><p>wget -b <a href="http://www.example.org/files/images.zip">http://www.example.org/files/images.zip</a></p><p><strong>Q.1: What command would you run to get the flag.txt from </strong><a href="https://tryhackme.com/"><strong>https://tryhackme.com/</strong></a><strong> ?</strong></p><p><strong>Ans.:</strong> wget <a href="https://tryhackme.com/flag.txt">https://tryhackme.com/flag.txt</a></p><p>Just a simple wget can do many wonders. Since we want to get the flag.txt file from <a href="https://tryhackme.com,/">https://tryhackme.com,</a> I suppose the link would be /flag.txt.</p><p>And yeah…</p><p><strong>Q.2: What command would you run to download recursively up to level 5 from </strong><a href="https://tryhackme.com/"><strong>https://tryhackme.com</strong></a><strong> ?</strong></p><p><strong>Ans.:</strong> wget -r -l 10 <a href="https://tryhackme.com/">https://tryhackme.com</a></p><p>We know that you use the -r switch to recurse, so the first part is wget -r. Then since we want a level (this is not the level of a kind of game, it’s the recursion depth level), -l 10 for setting a maximum level of 10, and <a href="https://tryhackme.com/">https://tryhackme.com</a> because it is the starting website URL (Level 0) The reason we write level 10 instead of 5 is because most platforms use heavy authentication, and we don’t want to hit a dead end before we even reach the actual room data. Another reason is because we don’t want wget to get cut off by CDN subdomains or structural redirects. Setting it to 10 provides a massive “buffer” to ensure the crawler goes deep enough into the backend directories to actually scrape the files you want.</p><h3>Task 13 — tar</h3><p><strong>tar </strong>is a command that allows creating, maintain, modify, and extracts files that are archived in the tar format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*l2BttjXhhoRrWwiU.png" /></figure><p>The most common example for tar extraction would be:</p><p>tar -xf archive.tar</p><p>-x tells tar to extract files from an archive.</p><p>-f tells tar that the next argument will be the name of the archive to operate on.</p><p><strong>Q.1: What is the flag from the tar file?</strong></p><p>Now we’ve come back to an actual flag hunting!!</p><p>We need to find a file that ends with .tar, because we need a tar file, so type ls in the terminal, and you should find a file called <strong>tarball.tar</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*jlKMtu63o0rSXiWAlWNHnA.png" /></figure><p>Now, the task has told us how to extract a tar file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*-pbqeOVXYUfVHo3gBo1EPw.png" /></figure><p>So type this command in the terminal:</p><pre>tar -xf tarball.tar</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*P7vFKDkts1NILTVoETQ16Q.png" /></figure><p>Nothing seems to have happened. Maybe a new file got extracted? Type <em>ls</em> to check.</p><p>Yes, 4 new files seem to have been extracted:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Jg7mR323bX8tIdVFDfVew.png" /></figure><p>3 of them don’t seem interesting, but flag.txt? Let’s read it. Type:</p><pre>cat flag.txt</pre><p>YES!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*QTqBvkWHfQiBWz-IDfEJLg.png" /></figure><p><strong>Ans.:</strong> <em>It’s easy, try it yourself!</em></p><h3>Task 14 — gzip</h3><p><strong>gzip </strong>— a file format and a software application used for file compression and decompression. gzip-compressed files have .gz extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/0*Inhaynt-UeT1_Gq7.png" /></figure><p>A gzip file can be decompressed using a simple gzip -d file.gz command, where -d stands for decompress.</p><p><strong>Q.1: What is the content of gzip.txt?</strong></p><p>From our recent ls results, there is no file named gzip.txt, but there is one named gzip.txt.gz. Looks like the file is in there and we have to do some flag extraction.</p><p>The task has already told us how a .gz file can be extracted:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*UrJPV1DFhI7L4znQDgddsg.png" /></figure><p>So type this command in the terminal:</p><pre>gzip -d gzip.txt.gz</pre><p>Sure enough, after running this command and receiving nothing, I typed ls and found gzip.txt in the place of the gzip.txt.gz one.</p><p>Read it with</p><pre>cat gzip.txt</pre><p>Hooray!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tc4I1IrfKsTAvzsBzVdncA.png" /></figure><p><strong>Ans.:</strong> <em>It’s easy, try it yourself!</em></p><h3>Task 15–7zip</h3><p><strong>7-Zip</strong> is a free and open-source file archiver, a utility used to place groups of files within compressed containers known as “archives”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/0*3HrxbLzBgxwl8PDb.png" /></figure><p><strong>7z</strong> is as simple as the <strong>gzip </strong>or <strong>tar </strong>and you can use the following command:</p><p>7z x file.zip to extract the file</p><p>This tool comes in handy as it works with a lot more file extensions than other tools. You name the archive extension and 7z should be the tool for you.</p><p><strong>Q.1: What is the flag inside the 7zip file?</strong></p><p>We know how to extract a 7z file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*6S6SRsSWzQfZPCGfnHfgmA.png" /></figure><p>In the terminal, there is a file called zip.7z, and although it isn’t a .zip file, it should still be extractable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-1JYfzrOBzM8Uakk_UzHQ.png" /></figure><p>It was. Type ls again and now there is a file called <strong>7zip.txt</strong>! Read it and there, the flag is staring at you!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3v5yjMLS7ieknB3yIXiDBw.png" /></figure><p><strong>Ans.:</strong> <em>It’s easy, try it yourself!</em></p><h3>Task 16 — binwalk</h3><p><strong>binwalk </strong>allows users to analyze and extract firmware images and helps in identifying code, files, and other information embedded in those, or inside another file, taking as an example steganography.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*2WzpuMiAn-QdZKA0.png" /></figure><p>A simple command such as binwalk file allows us to perform a simple file scan and identify code information.</p><p>binwalk -e file allows us to extract files from firmware. This method is usually used in CTFs, where some important information can be hidden within the file.</p><p>binwalk -Me file does the same as-e, but recursively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*gi16_jUa4yazhHSt.png" /></figure><p><strong>Q.1: What is the content of binwalk.txt?</strong></p><p>Looks like another extraction case.</p><p>There is a file called binwalk.png, so I guess that’s the file we ought to be extracting.</p><p>Since we know we need to extract a file, we’ll try either these 2 switches, -e or -Me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uYmN9tkcMf_jJuzEE8hxQ.png" /></figure><p>First let’s try the<em> -e</em> switch.</p><pre>binwalk -e binwalk.png</pre><p>Wow, it already worked. And yes, it does have binwalk.txt in it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJidWtBEO6DLUseLRlzCEg.png" /></figure><p>Now type <strong><em>ls</em></strong>. Interesting, there’s no binwalk.txt but a <strong>_binwalk.png.extracted</strong>! I tried reading it but they said that it’s a directory. So I tried entering it using cd (Change Directory) but we were restricted by rbash. So I just viewed the files inside it using</p><pre>ls _binwalk.png.extracted</pre><p>Inside of it was binwalk.txt!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sruvUgbZvRD_8rAev0ZATw.png" /></figure><p>Even if we can’t enter the file, the cat command is allowed and cat can read files from different directories, even if we aren’t inside them. Just type in the location of the file you want to read and it’s ready! So type in this command:</p><pre>cat _binwalk.png.extracted/binwalk.txt</pre><p>Yes!! We got the final flag!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*ucUV-_S3IO_guzzSLwDKxA.png" /></figure><p>Looking back at this lab, it is clear how much impact a few specialized Linux utilities can have on your efficiency. Navigating through all 16 tasks reminded me that cybersecurity isn’t always about complex exploits; often, it is about knowing how to parse information quickly using the built-in system tools. Documenting this room helped solidify my own workflow, and I hope this walkthrough saved you some troubleshooting time. What was the trickiest task for you? Let me know in the responses, and keep testing your limits on the command line!</p><p>Also, just a friendly remainder, avoid posting the flags in the comments so everyone can try solving this lab by themselves!!</p><blockquote><strong>Happy Hacking!</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c7758c1b17f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>