# Create usernet user testuser */add# Delete usernet user testuser /delete# Disable/Enable user accountnet user testuser /active:nonet user testuser /active:yes# Display password policynet accounts# Most used groupsAdministrators: Full control over system.Network Operators: Allow to modify network settings (IP, DNS).Users: Allow access to needed functionality by most users.# Display groupsnet localgroup # List group membersnet localgroup administrators # Create groupnet localgroup testgroup /add# Add user to groupnet localgroup testgroup testuser /add# Delete user from groupnet localgroup testgroup testuser /del # Delete groupnet localgroup testgroup /del
UAC
UAC gives you administrator access for one command, you trigger it by clicking right click on any file then choose run as administrator.
Runas
# runas lets you run command as another user like in linux (su testuser -c whoami)runas /user:testuser whoami runas /user:testuser "ping google.com"
Credentials
Credentials (usernames & passwords) are stored in the SAM file.
SAM file location: C:\Windows\System32\config\SAM.
Mostly stores the users' passwords in the NTLM hash.
Registry stores configuration settings and there are 5 types of registry hives:
HKEY_Classes_Root (HKCR): settings for applications
HKEY_Current_User (HKCU): settings for the current user
HKEY_Local_Machine (HKLM): local machine settings
HKEY_USERS (HKU): Settings for every user
HKEY_Current_Config (HKCC): settings for hardware
# Print helpreg /?# Print help on specific functionreg query /?# Query specific registry hivesreg query hkcureg query hklmreg query hkcu\software# Print all startup apps recursivelyreg query hklm\software\microsoft\windows\currentversion\run /s# Add startup key called EvilTest which started the Calculator app at boot timereg add hklm\software\microsoft\windows\currentversion\run /v "EvilTest"/d "calc.exe"# Delete EvilTest keyreg delete hklm\software\microsoft\windows\currentversion\run /v "EvilTest"
Windows Sharing (SMB)
# Print helpnet /?# List all devices that is enable sharing on the networknet view# list all shared resources on specific systemnet view \\computer-name# mapping resource to drive letternet use z: \\computer-name\resource# show mapping resourcesnet use# delete mapping resourcenet use z: /delete
Services
# Display active servicessc query# Display info about spooler servicesc query spooler# Display inactive servicessc query state=inactive# Display all servicessc query state=all# Start/Stop the spooler servicesc start spoolersc stop spooler# Enable/Disable spooler service at boot timesc config spooler start=disabledsc config spooler start=auto
Processes
# List all taskstasklist# Find task by it’s name or idtasklist /fi "imagename eq calc*"tasklist /pid 4054# Force kill processtaskkill /f /pid 4054# List all taskswmic process list brief# Create calculator processwmic process call create calc.exe# Search for calculator processwmic processwhere (name ="calculator.exe") list briefwmic processwhere (name like "calc%") list brief# Delete calculator processwmic processwhere (name ="calculator.exe") delete
Task Scheduling
# Display all scheduled tasksschtasks# Create new task to run every minuteschtasks /create /sc minute /mo 1/tn eviloo /tr calc.exe# Display information about specific scheduled taskschtasks /query /tn eviloo# Delete scheduled taskschtasks /delete /tn eviloo