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:42] – [Ping with Timestamps] baumi | powershell [2022/11/20 10:19] (current) – [Convert to PCAP] baumi | ||
|---|---|---|---|
| Line 19: | Line 19: | ||
| <code powershell> | <code powershell> | ||
| $target = " | $target = " | ||
| - | for($i=1; $i -le 65535; $i++) { | + | $firstport = 1 |
| - | Test-NetConnection -ComputerName $target -Port $i | + | $lastport = 65535 |
| + | for($port=$firstport; $port -le $lastport; $port++) { | ||
| + | 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 ===== | ||
powershell.1668102164.txt.gz · Last modified: by baumi
