powershell
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| powershell [2022/11/10 18:34] – [ActiveDirectory Commandlets] baumi | powershell [2022/11/20 10:19] (current) – [Convert to PCAP] baumi | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| <code powershell> | <code powershell> | ||
| Get-EventLog System -Newest 10000 | ` | Get-EventLog System -Newest 10000 | ` | ||
| - | Where EventId -in 41, | + | Where EventId -In 41, |
| - | Format-Table TimeGenerated, | + | Format-Table TimeGenerated, |
| </ | </ | ||
| Line 16: | Line 16: | ||
| </ | </ | ||
| + | ===== Simple TCP Portscan ===== | ||
| + | <code powershell> | ||
| + | $target = " | ||
| + | $firstport = 1 | ||
| + | $lastport = 65535 | ||
| + | for($port=$firstport; | ||
| + | Test-NetConnection -ComputerName $target -Port $port | ||
| + | } | ||
| + | </ | ||
| + | ===== Packet Capture ===== | ||
| + | ==== Capture ==== | ||
| + | <code powershell> | ||
| + | $duration=90 | ||
| + | $env:HostIP = ( | ||
| + | Get-NetIPConfiguration | | ||
| + | Where-Object { | ||
| + | $_.IPv4DefaultGateway -ne $null -and | ||
| + | $_.NetAdapter.Status -ne " | ||
| + | } | ||
| + | ).IPv4Address.IPAddress | ||
| + | |||
| + | netsh trace start capture=yes IPv4.Address=$env: | ||
| + | Start-Sleep $duration | ||
| + | netsh trace stop | ||
| + | </ | ||
| + | ==== Convert to PCAP ==== | ||
| + | https:// | ||
| + | <code powershell> | ||
| + | Invoke-Webrequest -O etl2pcapng.exe https:// | ||
| + | ./ | ||
| + | </ | ||
| ===== Useful Commandlets ===== | ===== Useful Commandlets ===== | ||
| <code powershell> | <code powershell> | ||
| Line 27: | Line 58: | ||
| <code powershell> | <code powershell> | ||
| $file=" | $file=" | ||
| - | Get-ADGroup -Filter * -Properties Member | Select-Object Name, | + | Get-ADGroup -Filter * -Properties Member |
| + | | ||
| + | | ||
| </ | </ | ||
powershell.1668101648.txt.gz · Last modified: by baumi
