Skip to content

Instantly share code, notes, and snippets.

@xenoscr
Last active July 12, 2018 15:26
Show Gist options
  • Select an option

  • Save xenoscr/f326f0b585784b3045f8db646c11815b to your computer and use it in GitHub Desktop.

Select an option

Save xenoscr/f326f0b585784b3045f8db646c11815b to your computer and use it in GitHub Desktop.
Quick 'n Dirty Outbound Port Tester
$results = @()
$global:progressPreference = 'silentlyContinue'
For ($i = 1; $i -le 65535; $i++)
{
Write-Host "Testing Port: $i"
Try
{
$request = wget -TimeoutSec 1 http://portquiz.net:$i -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
If ($request)
{
If ($request.Content.Contains("<title>Outgoing Port Tester</title>"))
{
$i > "open-ports.txt"
$i
$results += $i
}
}
}
Catch
{
}
}
$results | export-csv -notype -path open-ports.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment