The post provides an in-depth walkthrough of a TryHackMe room focused on Linux Strength Training, targeting beginner to intermediate users.

OSCP Study Notes

HackTheBox Certified Penetration Testing Specialist Study Notes

Introduction

The room focuses on improving Linux command-line skills, specifically:

  • File searching with find.
  • Grepping content.
  • Working with encryption, decryption, and hashing.
  • Exploring SQL databases.

Target Audience: Users familiar with Linux Fundamentals who want to transition to intermediate concepts.

Tasks and Key Concepts

1. File Searching Using the find Command

  • Command Breakdown:
    • Search files in a directory: find /path -type f.
    • Search based on user: find /path -user username.
    • Search files of specific size: find /path -size 52k.
  • Practical Demonstrations:
    • Locate a file named readme_if_stuck.txt
find /home/dobson -type f -name "readme_if_stuck.txt"

Search for files modified on a specific date:

find /path -type f -newermt "2016-09-11" ! -newermt "2016-09-13"

Use quotes for file names with spaces.

Escape spaces in directories using backslashes (\).

2. Reading and Searching File Content

  • Using less:
    • View large files in chunks.
    • Search for keywords within the file using /keyword.
  • Example:
    • Search for the word “keyword” in a file:bashCopy code
less filename
/keyword

3. Moving and Renaming Files

  • Command for Moving Files:
mv /source/* /destination/

Renaming Files or Folders:

  • Standard renaming:
mv old_name new_name

Handling special characters (e.g., names starting with -):

mv -- -old_name new_name

4. Transferring Files Using scp

  • Transfer a file to a remote machine using SSH:
scp /path/to/file username@ip_address:/destination_path

Examples and Scenarios

  1. Find files owned by a specific user and of a particular size:
    • Example: find /home/francis -type f -user francis -size 52k.
  2. Search for specific text in logs:
grep -irl "keyword" /home/dobson/chat_logs/

Working with modified files:

  • Locate files modified between two dates:
find /home/workflows -type f -newermt "2016-09-11" ! -newermt "2016-09-13"

General Takeaways

  • Command Mastery:
    • The room is ideal for honing skills in navigating and manipulating Linux systems.
    • Includes practical examples and hands-on tasks for real-world scenarios.
  • Practical Application:
    • Tools like find, grep, and scp are indispensable for file management and system administration.
  • Next Steps:
    • Dive deeper into topics like encryption, decryption, and working with SQL databases in subsequent tasks.

TryHackMe Linux Strength Training | Room Answers

I have read and understood
No answer needed

What is the correct option for finding files based on group

-group

What is format for finding a file with the user named Francis and with a size of 52 kilobytes in the directory /home/francis/

find /home/francis -type f -user francis -size 52k

SSH as topson using his password topson. Go to the /home/topson/chatlogs directory and type the following: grep -iRl ‘keyword’. What is the name of the file that you found using this command?

2019-10-11
Type: less [filename] to open the file. Then, before anything, type / before typing: keyword followed by [ENTER]. Notice how that allowed us to search for the first instance of that word in the entire document. For much larger documents this can be useful and if there are many more instances of that word in the document, we would be able to hit enter again to find the next instance in the document.
No answer needed
What are the characters subsequent to the word you found?

ttitor
Read the file named ‘ReadMeIfStuck.txt’. What is the Flag?

Flag{81726350827fe53g}

Hypothetically, you find yourself in a directory with many files and want to move all these files to the directory of /home/francis/logs. What is the correct command to do this?

mv * /home/francis/logs

Hypothetically, you want to transfer a file from your /home/james/Desktop/ with the name script.py to the remote machine (192.168.10.5) directory of /home/john/scripts using the username of john. What would be the full command to do this?

scp /home/james/Desktop/script.py john@192.168.10.5:/home/john/scripts

How would you rename a folder named -logs to -newlogs

mv — -logs -newlogs

How would you copy the file named encryption keys to the directory of /home/john/logs

cp “encryption keys” /home/john/logs

Find a file named readME_hint.txt inside topson’s directory and read it. Using the instructions it gives you, get the second flag.

Flag{234@i4s87u5hbn$3}

Download the hash file attached to this task and attempt to crack the MD5 hash. What is the password?
secret123

SSH as sarah using: sarah@[MACHINE_IP] and use the password: rainbowtree1230x

What is the hash type stored in the file hashA.txt

MD4

Crack hashA.txt using john the ripper, what is the password?
admin

What is the hash type stored in the file hashB.txt

SHA-1

Find a wordlist with the file extention of ‘.mnf’ and use it to crack the hash with the filename hashC.txt. What is the password?
unacvaolipatnuggi

Crack hashB.txt using john the ripper, what is the password?

letmein

what is the name of the tool which allows us to decode base64 strings?
base64

find a file called encoded.txt. What is the special answer?

john

Now try it for yourself. Make a random text file and enter some readable sentences in there before encrypting and decrypting it as illustrated above.
No answer needed

You wish to encrypt a file called history_logs.txt using the AES-128 scheme. What is the full command to do this?
gpg –cipher-algo AES-128 –symmetric history_logs.txt

What is the command to decrypt the file you just encrypted?
gpg history_logs.txt.gpg

Find an encrypted file called layer4.txt, its password is bob. Use this to locate the flag. What is the flag?

Flag{B07$f854f5ghg4s37}

Now try it yourself! Encrypt a file and use a common password contained in the wordlist you wish to use. Follow the instructions above to decrypt as if you are a hacker. If it worked, well done.
No answer needed

Find an encrypted file called personal.txt.gpg and find a wordlist called data.txt. Use tac to reverse the wordlist before brute-forcing it against the encrypted file. What is the password to the encrypted file?
valamanezivonia

What is written in this now decrypted file?
getting stronger in linux

Find a file called employees.sql and read the SQL database. (Sarah and Sameer can log both into mysql using the password: password). Find the flag contained in one of the tables. What is the flag?
Flag{13490AB8}


Go to the /home/shared/chatlogs directory and read the first chat log named: LpnQ. Use this to help you to proceed to the next task.

No answer needed

What is Sameer’s SSH password?

thegreatestpasswordever000

What is the password for the sql database back-up copy

ebqattle

Find the SSH password of the user James. What is the password?
vuimaxcullings

SSH as james and change the user to root?

No answer needed

What is the root flag?

Flag{6$8$hyJSJ3KDJ3881}






Video Walkthrough

About the Author

Mastermind Study Notes is a group of talented authors and writers who are experienced and well-versed across different fields. The group is led by, Motasem Hamdan, who is a Cybersecurity content creator and YouTuber.

View Articles