Sitemap

Command Line

5 min readOct 27, 2024

--

Press enter or click to view image in full size

Command Line

Learn the command line and MS PowerShell in Windows by practising various essential commands. Then, discover the use of Bash in the Linux OS.

Cyber Security 101

Command Line

  • Windows Command Line
  • Windows PowerShell
  • Linux Shells
  • Complete Command Line walkthrough

Windows Command Line

Learn the essential Windows commands.

Press enter or click to view image in full size

Task 1 :- Introduction

Q1)What is the default command line interpreter in the Windows environment?

Answer:- cmd.exe

Task 2 :- Basic System Information

Q2)What is the OS version of the Windows VM?

Answer:- 10.0.20348.2655

Q3)What is the hostname of the Windows VM?

Answer:- WINSRV2022-CORE

Task 3 :-Network Troubleshooting

Q4)Which command can we use to look up the server’s physical address (MAC address)?

Answer :- ipconfig /all

Q5)What is the name of the process listening on port 3389?

Answer :- TermService

Q6) What is the IP address of your gateway?

Answer :- 10.10.0.1

Task 4 :- File and Disk Management

Q7)What are the file’s contents in C:\Treasure\Hunt?

Answer :- THM{CLI_POWER}

Task 5 :- Task and Process Management

Q8)What command would you use to find the running processes related to notepad.exe?

Answer :- tasklist /FI “imagename eq notepad.exe”

Q9)What command can you use to kill the process with PID 1516?

Answer :- taskkill /PID 1516

Task 6 :- Conclusion

Q10)The command shutdown /s can shut down a system. What is the command you can use to restart a system?

Answer :- shutdown /r

Q11)What command can you use to abort a scheduled system shutdown?

Answer :- shutdown /a

Windows PowerShell

Discover the “Power” in PowerShell and learn the basics.

Press enter or click to view image in full size

Task 1 :- Introduction

Q1)Raise the anchor, hoist the sails — it’s time to set sail!?

Answer :- No answer needed

Task 2 :- What Is PowerShell

Q2)What do we call the advanced approach used to develop PowerShell?

Answer :- object-oriented

Task 3 :- PowerShell Basics

Q3)How would you retrieve a list of commands that start with the verb Remove? [for the sake of this question, avoid the use of quotes (" or ') in your answer]

Answer :- Get-Command -Name Remove*

Q4)What cmdlet has its traditional counterpart echo as an alias?

Answer :- Write-Output

Q5)What is the command to retrieve some example usage for the cmdlet New-LocalUser?

Answer :- Get-Help New-LocalUser -examples

Task 4 :-Navigating the File System and Working with Files

Q6)What cmdlet can you use instead of the traditional Windows command type?

Answer :- Get-Content

Q7)What PowerShell command would you use to display the content of the “C:\Users” directory? [for the sake of this question, avoid the use of quotes (“ or ‘) in your answer]

Answer :- Get-ChildItem -Path C:\Users

Q8)How many items are displayed by the command described in the previous question?

Get TRedEye’s stories in your inbox

Join Medium for free to get updates from this writer.

Answer :- 4

Task 5 :-Piping, Filtering, and Sorting Data

Q9)How would you retrieve the items in the current directory with size greater than 100? [for the sake of this question, avoid the use of quotes (“ or ‘) in your answer]

Answer :- Get-ChildItem | Where-Object -Property Length -gt 100

Task 6 :-System and Network Information

Q10)Other than your current user and the default “Administrator” account, what other user is enabled on the target machine?

Answer :- p1r4t3

Q11)This lad has hidden his account among the others with no regard for our beloved captain! What is the motto he has so bluntly put as his account’s description?

Answer :- A merry life and a short one

Q12)Now a small challenge to put it all together. This shady lad that we just found hidden among the local users has his own home folder in the “C:\Users” directory.
Can you navigate the filesystem and find the hidden treasure inside this pirate’s home?

Answer :- THM{p34rlInAsh3ll}

Task 7 :- Real-Time System Analysis

Q13)In the previous task, you found a marvellous treasure carefully hidden in the target machine. What is the hash of the file that contains it?

Answer :- 71FC5EC11C2497A32F8F08E61399687D90ABE6E204D2964DF589543A613F3E08

Q14)What property retrieved by default by Get-NetTCPConnection contains information about the process that has started the connection?

Answer :- OwningProcess

Q15)It’s time for another small challenge. Some vital service has been installed on this pirate ship to guarantee that the captain can always navigate safely. But something isn’t working as expected, and the captain wonders why. Investigating, they find out the truth, at last: the service has been tampered with! The shady lad from before has modified the service DisplayName to reflect his very own motto, the same that he put in his user description.

With this information and the PowerShell knowledge you have built so far, can you find the service name?

Answer :- p1r4t3-s-compass

Task 8 :- Scripting

Q16)What is the syntax to execute the command Get-Service on a remote computer named "RoyalFortune"? Assume you don't need to provide credentials to establish the connection. [for the sake of this question, avoid the use of quotes (" or ') in your answer]

Answer :- Invoke-Command -ComputerName RoyalFortune -ScriptBlock { Get-Service }

Task 9:-Conclusion

Q17)I’m ready to go on to the next adventure!

Answer :- No answer needed

Linux Shells

Learn about scripting and the different types of Linux shells.

Press enter or click to view image in full size

Task 1 :- Introduction to Linux Shells

Q1)Who is the facilitator between the user and the OS?

Answer :- Shell

Task 2 :-How To Interact With a Shell?

Q2)What is the default shell in most Linux distributions?

Answer :- Bash

Q3)Which command utility is used to list down the contents of a directory?

Answer :- ls

Q4)Which command utility can help you search for anything in a file?

Answer :- grep

Task 3 :- Types of Linux Shells

Q5)Which shell comes with syntax highlighting as an out-of-the-box feature?

Answer :- Fish

Q6)Which shell does not have auto spell correction?

Answer :- Bash

Q7)Which command displays all the previously executed commands of the current session

Answer :- history

Task 4 :-Shell Scripting and Components

Q8)What is the shebang used in a Bash script?

Answer :- #!/bin/bash

Q9)Which command gives executable permissions to a script?

Answer :- chmod +x

Q10)Which scripting functionality helps us configure iterative tasks?

Answer :- loops

Task 5 :- The Locker Script

Q11)What would be the correct PIN to authenticate in the locker script?

Answer :- 7385

Task 6 :- Practical Exercise

Q12)Which file has the keyword?

Answer :- authentication.log

Q13)Where is the cat sleeping?

Answer :- under the table

Task 7 :- Conclusion

Q14)Complete the room.

Answer :- No answer needed

Happy hacking! 🧑‍💻 Follow for more walkthrough…@TRedEye

--

--

TRedEye
TRedEye

Written by TRedEye

I'm a Penetration Tester, Cyber security researcher & Top 2% in Tryhackme