Last active
July 12, 2018 15:26
-
-
Save xenoscr/f326f0b585784b3045f8db646c11815b to your computer and use it in GitHub Desktop.
Quick 'n Dirty Outbound Port Tester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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