Basic CMD for Windows

Basic CMD for Pentesters

System info

Version and Patches info

wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get architecture
systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information
wmic computersystem LIST full #Get PC info

wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches
wmic qfe list brief #Updates

hostname

DRIVERQUERY #3rd party driver vulnerable?

Environment

set #List all environment variables

Some env variables to highlight:

  • COMPUTERNAME: Name of the computer

  • TEMP/TMP: Temp folder

  • USERNAME: Your username

  • HOMEPATH/USERPROFILE: Home directory

  • windir: C:\Windows

  • OS:Windos OS

  • LOGONSERVER: Name of domain controller

  • USERDNSDOMAIN: Domain name to use with DNS

  • USERDOMAIN: Name of the domain

Mounted disks

Recycle Bin

Processes, Services & Software

Domain info

Logs & Events

Users & Groups

Users

Groups

List sessions

Password Policy

Credentials

Persistence with users

Network

Interfaces, Routes, Ports, Hosts and DNSCache

Firewall

Shares

Wifi

SNMP

Network Interfaces

ARP table

Download

Bitsadmin.exe

CertReq.exe

Certutil.exe

Desktopimgdownldr.exe

Diantz.exe

Esentutl.exe

Expand.exe

Extrac32.exe

Findstr.exe

Ftp.exe

GfxDownloadWrapper.exe

Hh.exe

Ieexec.exe

Makecab.exe

MpCmdRun.exe

Replace.exe

Excel.exe

Powerpnt.exe

Squirrel.exe

Update.exe

Winword.exe

Wsl.exe

Misc

Bypass Char Blacklisting

DOSfuscation

Generates an obfuscated CMD line

Listen address ACLs

You can listen on http://+:80/Temporary_Listen_Addresses/ without being administrator.

Manual DNS shell

Attacker (Kali) must use one of these 2 options:

Victim

for /f tokens _**_technique: This allows us to execute commands, get the first X words of each line and send it through DNS to our server

You can also redirect the output, and then read it.

Calling CMD from C code

Alternate Data Streams CheatSheet (ADS/Alternate Data Stream)

Taken from https://gist.github.com/api0cradle/cdd2d0d0ec9abb686f0e89306e277b8f

Last updated