Logo

dev-resources.site

for different kinds of informations.

TryHackMe | Windows Command Line | RSCyberTech

Published at
12/24/2024
Categories
tryhackme
cybersecurity
windows
cmd
Author
rscybertech
Author
11 person written this
rscybertech
open
TryHackMe | Windows Command Line | RSCyberTech

āž”ļø By @RSCyberTech


Platform: TryHackMe

Learning Path: Cyber Security 101

Room: Windows Command Line


1ļøāƒ£ TaskĀ 1 - Introduction

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

Answer āœ…

  • cmd.exe

Justification / Source

  • ā€œThe purpose of this room is to teach you how to use MS Windows Command PromptĀ cmd.exe, the default command-line interpreter in the Windows environment.ā€
  • Mentioned in the sectionā€™s text.

Steps

  • n/a

2ļøāƒ£ TaskĀ 2 - Basic System Information

What is the OS version of the Windows VM?

Answer āœ…

  • 10.0.20348.2655

Justification / Source

  • ā€œLetā€™s use theĀ verĀ command to determine the operating system (OS) version.ā€
  • Mentioned in the sectionā€™s text.

Steps

-

```
user@WINSRV2022-CORE C:\Users\user>ver

Microsoft Windows [Version 10.0.20348.2655]
```
Enter fullscreen mode Exit fullscreen mode

What is the hostname of the Windows VM?

Answer āœ…

  • WINSRV2022-CORE

Justification / Source

  • ā€œWe can run theĀ systeminfoĀ command to list various information about the system such asĀ OSĀ information, system details, processor and memory.ā€
  • Mentioned in the sectionā€™s text.

Steps

-

user@WINSRV2022-CORE C:\Users\user>systeminfo

Host Name:                 WINSRV2022-CORE
OS Name:                   Microsoft Windows Server 2022 Datacenter
OS Version:                10.0.20348 N/A Build 20348
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Server
OS Build Type:             Multiprocessor Free
Registered Owner:          Windows User
Registered Organization:   
Product ID:                00454-60000-00001-AA763
Original Install Date:     4/23/2024, 7:36:29 PM
System Boot Time:          12/24/2024, 11:11:47 AM
System Manufacturer:       Amazon EC2
System Model:              t3a.micro
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: AMD64 Family 23 Model 1 Stepping 2 AuthenticAMD ~2200 Mhz
BIOS Version:              Amazon EC2 1.0, 10/16/2017
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC+00:00) Dublin, Edinburgh, Lisbon, London
Total Physical Memory:     980 MB
Available Physical Memory: 127 MB
Virtual Memory: Max Size:  1,300 MB
Virtual Memory: Available: 357 MB
Virtual Memory: In Use:    943 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    WORKGROUP
Logon Server:              N/A
Hotfix(s):                 3 Hotfix(s) Installed.
                           [01]: KB5041948
                           [02]: KB5041160
                           [03]: KB5041590
Network Card(s):           1 NIC(s) Installed.
                           [01]: Amazon Elastic Network Adapter
                                 Connection Name: Ethernet
                                 DHCP Enabled:    Yes
                                 DHCP Server:     10.10.0.1
                                 IP address(es)
                                 [01]: 10.10.151.7
                                 [02]: fe80::8d9b:8b8f:6409:e143
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.
Enter fullscreen mode Exit fullscreen mode

3ļøāƒ£ TaskĀ 3 - Network Troubleshooting

Which command can we use to look up the serverā€™s physical address (MAC address)?

Answer āœ…

  • ipconfig /all

Justification / Source

  • ā€œYou can also useĀ ipconfig /allĀ for more information about your network configuration.ā€
  • Mentioned in the sectionā€™s text.

Steps

-

user@WINSRV2022-CORE C:\Users\user>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : WINSRV2022-CORE
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : eu-west-1.compute.internal
                                       eu-west-1.ec2-utilities.amazonaws.com

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : eu-west-1.compute.internal
   Description . . . . . . . . . . . : Amazon Elastic Network Adapter
   Physical Address. . . . . . . . . : 02-75-36-8B-3C-DF
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::8d9b:8b8f:6409:e143%5(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.10.151.7(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Tuesday, December 24, 2024 11:12:18 AM
   Lease Expires . . . . . . . . . . : Tuesday, December 24, 2024 12:42:18 PM
   Default Gateway . . . . . . . . . : 10.10.0.1
   DHCP Server . . . . . . . . . . . : 10.10.0.1
   DHCPv6 IAID . . . . . . . . . . . : 84601211
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-B9-B7-EF-00-0C-29-FF-E5-C8
   DNS Servers . . . . . . . . . . . : 10.0.0.2
   NetBIOS over Tcpip. . . . . . . . : Enabled
Enter fullscreen mode Exit fullscreen mode

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

Answer āœ…

  • TermService

Justification / Source

  • ā€œThe final networking command we will cover in this room isĀ netstat. This command displays current network connections and listening ports. ā€¦ -aĀ displays all established connections and listening ports -bĀ shows the program associated with each listening port and established connectionā€
  • Mentioned in the sectionā€™s text.

Steps

-

user@WINSRV2022-CORE C:\Users\user>netstat -ab   

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:22             WINSRV2022-CORE:0      LISTENING
 [sshd.exe]
  TCP    0.0.0.0:135            WINSRV2022-CORE:0      LISTENING
  RpcSs
 [svchost.exe]
  TCP    0.0.0.0:445            WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:3389           WINSRV2022-CORE:0      LISTENING
  TermService
 [svchost.exe]
  TCP    0.0.0.0:5985           WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:47001          WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:49664          WINSRV2022-CORE:0      LISTENING
 [lsass.exe]
  TCP    0.0.0.0:49665          WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:49666          WINSRV2022-CORE:0      LISTENING
  EventLog
 [svchost.exe]
  TCP    0.0.0.0:49667          WINSRV2022-CORE:0      LISTENING
  Schedule
 [svchost.exe]
  TCP    0.0.0.0:49668          WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    10.10.151.7:22         ip-10-11-34-174:46794  ESTABLISHED
 [sshd.exe]
  TCP    10.10.151.7:139        WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    [::]:22                WINSRV2022-CORE:0      LISTENING
 [sshd.exe]
  TCP    [::]:135               WINSRV2022-CORE:0      LISTENING
  RpcSs
 [svchost.exe]
  TCP    [::]:445               WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    [::]:3389              WINSRV2022-CORE:0      LISTENING
  TermService
 [svchost.exe]
  TCP    [::]:5985              WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    [::]:47001             WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    [::]:49664             WINSRV2022-CORE:0      LISTENING
 [lsass.exe]
  TCP    [::]:49665             WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  TCP    [::]:49666             WINSRV2022-CORE:0      LISTENING
  EventLog
 [svchost.exe]
  TCP    [::]:49667             WINSRV2022-CORE:0      LISTENING
  Schedule
 [svchost.exe]
  TCP    [::]:49668             WINSRV2022-CORE:0      LISTENING
 Can not obtain ownership information
  UDP    0.0.0.0:123            *:*
  W32Time
 [svchost.exe]
  UDP    0.0.0.0:500            *:*
  IKEEXT
 [svchost.exe]
  UDP    0.0.0.0:3389           *:*
  TermService
 [svchost.exe]
  UDP    0.0.0.0:4500           *:*
  IKEEXT
 [svchost.exe]
  UDP    0.0.0.0:5353           *:*
  Dnscache
 [svchost.exe]
  UDP    0.0.0.0:5355           *:*
  Dnscache
 [svchost.exe]
  UDP    0.0.0.0:50180          *:*
  Dnscache
 [svchost.exe]
  UDP    0.0.0.0:50377          *:*
  Dnscache
 [svchost.exe]
  UDP    10.10.151.7:137        *:*
 Can not obtain ownership information
  UDP    10.10.151.7:138        *:*
 Can not obtain ownership information
  UDP    127.0.0.1:61602        127.0.0.1:61602
  iphlpsvc
 [svchost.exe]
  UDP    [::]:123               *:*
  W32Time
 [svchost.exe]
  UDP    [::]:500               *:*
  IKEEXT
 [svchost.exe]
  UDP    [::]:3389              *:*
  TermService
 [svchost.exe]
  UDP    [::]:4500              *:*
  IKEEXT
 [svchost.exe]
  UDP    [::]:5353              *:*
  Dnscache
 [svchost.exe]
  UDP    [::]:5355              *:*
  Dnscache
 [svchost.exe]
  UDP    [::]:50180             *:*
  Dnscache
 [svchost.exe]
  UDP    [::]:50377             *:*
  Dnscache
 [svchost.exe]
Enter fullscreen mode Exit fullscreen mode

What is the subnet mask?

Answer āœ…

  • 255.255.0.0

Justification / Source

  • ā€œYou can also useĀ ipconfig /allĀ for more information about your network configuration.ā€
  • Mentioned in the sectionā€™s text.

Steps

-

user@WINSRV2022-CORE C:\Users\user>ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : WINSRV2022-CORE
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : eu-west-1.compute.internal
                                       eu-west-1.ec2-utilities.amazonaws.com

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : eu-west-1.compute.internal
   Description . . . . . . . . . . . : Amazon Elastic Network Adapter
   Physical Address. . . . . . . . . : 02-75-36-8B-3C-DF
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::8d9b:8b8f:6409:e143%5(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.10.151.7(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Tuesday, December 24, 2024 11:12:18 AM
   Lease Expires . . . . . . . . . . : Tuesday, December 24, 2024 12:42:18 PM
   Default Gateway . . . . . . . . . : 10.10.0.1
   DHCP Server . . . . . . . . . . . : 10.10.0.1
   DHCPv6 IAID . . . . . . . . . . . : 84601211
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2D-B9-B7-EF-00-0C-29-FF-E5-C8
   DNS Servers . . . . . . . . . . . : 10.0.0.2
   NetBIOS over Tcpip. . . . . . . . : Enabled
Enter fullscreen mode Exit fullscreen mode

4ļøāƒ£ TaskĀ 4 - File and Disk Management

What are the fileā€™s contents in C:\Treasure\Hunt?

Answer āœ…

  • THM{CLI_POWER}

Justification / Source

  • ā€œYou can easily view text files with the commandĀ type.ā€
  • Mentioned in the sectionā€™s text.

Steps

-

SRV2022-CORE C:\Users\user>type C:\Treasure\Hunt\flag.txt 

THM{CLI_POWER}
Enter fullscreen mode Exit fullscreen mode

5ļøāƒ£ TaskĀ 5 - Task and Process Management

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

Answer āœ…

  • tasklist /FI "imagename eq notepad.exeā€

Justification / Source

  • ā€œLetā€™s say that we want to search for tasks related toĀ sshd.exe, we can do that with the commandĀ tasklist /FI "imagename eq sshd.exe". Note thatĀ /FIĀ is used to set the filterĀ image name equalsĀ sshd.exe.ā€
  • Mentioned in the sectionā€™s text.

Steps

  • n/a

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

Answer āœ…

  • taskkill /PID 1516

Justification / Source

  • ā€œWith the process ID (PID) known, we can terminate any task usingĀ taskkill /PIDĀ target_pid. For example, if we want to kill the process withĀ PIDĀ 4567, we would issue the commandĀ taskkill /PIDĀ 4567.ā€
  • Mentioned in the sectionā€™s text.

Steps

  • n/a

6ļøāƒ£ TaskĀ 6 - Conclusion

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

Answer āœ…

  • shutdown /r

Justification / Source

  • n/a

Steps

-

user@WINSRV2022-CORE C:\Users\user>shutdown /?
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /sg        Shutdown the computer. On the next boot, if Automatic Restart Sign-On
               is enabled, automatically sign in and lock last interactive user.
               After sign in, restart any registered applications.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is rebooted,
               if Automatic Restart Sign-On is enabled, automatically sign in and
               lock last interactive user.
               After sign in, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
               Combine with /fw to clear any pending boots to firmware.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.
               Must be used with /s option.
    /fw        Combine with a shutdown option to cause the next boot to go to the
               firmware user interface.
    /e         Document the reason for an unexpected shutdown of a computer.
    /o         Go to the advanced boot options menu and restart the computer.
               Must be used with /r option.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).
Failed to get retrieve reasons.
Enter fullscreen mode Exit fullscreen mode

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

Answer āœ…

  • shutdown /a

Justification / Source

  • n/a

Steps

-

user@WINSRV2022-CORE C:\Users\user>shutdown /?
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /sg        Shutdown the computer. On the next boot, if Automatic Restart Sign-On
               is enabled, automatically sign in and lock last interactive user.
               After sign in, restart any registered applications.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is rebooted,
               if Automatic Restart Sign-On is enabled, automatically sign in and
               lock last interactive user.
               After sign in, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
               Combine with /fw to clear any pending boots to firmware.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.
               Must be used with /s option.
    /fw        Combine with a shutdown option to cause the next boot to go to the
               firmware user interface.
    /e         Document the reason for an unexpected shutdown of a computer.
    /o         Go to the advanced boot options menu and restart the computer.
               Must be used with /r option.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).
Failed to get retrieve reasons.
Enter fullscreen mode Exit fullscreen mode

āž”ļø By @RSCyberTech

cmd Article's
30 articles in total
Favicon
Windows äøŠ VSCode ēš„ C/C++ 延ä¼øęØ”ēµ„處ē†ē·Øē¢¼ēš„問锌
Favicon
TryHackMe | Windows Command Line | RSCyberTech
Favicon
50+ Most Useful CMD Commands to Boost Your Windows Productivity
Favicon
Video: Enable IIS using CMD and PowerShell
Favicon
Video: List All Available Windows Features on Windows 11 using CMD & PowerShell
Favicon
šŸš€ Arch Linux Cheat Sheet: Essential Commands for new Users
Favicon
RIME Input | curl: (6) Could not resolve host: raw.githubusercontent.com
Favicon
Rename Multiple Files in Sequence with Just One Click Using PowerShell in Windows! šŸš€
Favicon
Maximizing IT Service Excellence with ServiceNow CMDB
Favicon
šŸ‘understanding windows Command Line Interface
Favicon
Comandos Avanzados
Favicon
Comandos de Red
Favicon
Comandos de Fecha
Favicon
Comandos para Manipular Archivos y Directorios
Favicon
Tech notes 02 - Most Important Command Line Notes
Favicon
Comandos BƔsicos
Favicon
Bash Scripting Fundamentals
Favicon
Decoding the Linux Command Line: 75 Indispensable Utilities Explained
Favicon
How to restore a Mysql backup with XAMP
Favicon
Remotely Control Raspberry Pi via SSH from External Network
Favicon
SSH Raspberry Pi via Cell Phone
Favicon
Enhancing Internet Speed Through CMD Commands
Favicon
Install Oh-My-Posh On Windows Command Prompt (cmd) Via Clink
Favicon
Important CMD Commands
Favicon
Title: A Beginner's Guide to Command-Line File and Directory Manipulation
Favicon
Mastering Deployments in Kubernetes
Favicon
SetEnv å·„å…·ē؋式
Favicon
My K8s Cheatsheet
Favicon
Membuat Database Melalui CMD Pada Laragon
Favicon
Perbedaan perintah RUN dan CMD di dalam Docker

Featured ones: