Windows command to get system informations

useful Windows command

After you got a shell or simply put, get xp_cmdshell using the injection point, we can only run the Windows command line to get the target system information.

the command line or Windows command line is a user interface that is navigated by typing commands at prompts, instead of using the mouse. For example, the Windows folder in a Windows command line (MS-DOS) is C:\Windows> (as shown in the picture) and in Unix or Linux, it may be % or >. Unlike a GUI operating system, a command line only uses a keyboard to navigate by entering commands and does not utilize a mouse for navigating.

This article focuses on command line knowledge related to information gathering.

 

Windows command to get System information

  • Complete computer information
    C:\Users\Username>systeminfo

  • Check the computer name
    C:\Users\Username>hostname

  • View the environment variables
    C:\Users\Username>SET
  • View detailed information of all users and individual users (here my user is Username)
    C:\Users\Username>net user
    C:\Users\Username>net user Username

  • View the current online users
    C:\Users\Username>query user

  • Query terminal port (telnet port)
    C:\Users\Username>REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal” “Server\WinStations\RDP-Tcp /v PortNumber

Windows command to get Network information collection

  • Check ip details
    C:\Users\Username>ipconfig /all

  • Check the routing table
    C:\Users\Username>route print

  • View arp table cache
    C:\Users\Username>arp -a

  • Check the network connection port number
    C:\Users\Username>netstat -ano
  • Check the firewall status and configuration
    C:\Users\Username>netsh firewall show state
    C:\Users\Username>netsh firewall show config

Windows command to get Application Information Collection

  • View process and process PID
    C:\Users\Username>tasklist
    C:\Users\Username>tasklist /SVC

  • Check the installed kernel driver information
    C:\Users\Username>DRIVERQUERY

  • View started windows service
    C:\Users\Username>net start

Windows command to get Directory file operation

  • List all the files on d drive
    C:\Users\Username>for /d %i in (d:\*) do @echo %i

  • List the name of the folder with the name of -3 in the current directory
    C:\Users\Username>for /d %i in (???) do @echo %i

  • List all the current directory of the exe file
    C:\Users\Username>for /r %i in (*.exe) do @echo %i

  • Read a txt file content
    C:\Users\Username>for /f %i in (c:\.txt) do echo %i