Created
June 1, 2015 15:14
-
-
Save qbantek/5757ac1d1fb243698ef9 to your computer and use it in GitHub Desktop.
Test outbound ports - it was useful to determine which outbound ports were opened at a given shared host
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
<% | |
Server.ScriptTimeout=60*15 | |
Dim address | |
address = "http://portquiz.net:" | |
Function TCPPing( address, port ) | |
Dim xhr | |
Set xhr = Server.CreateObject("MSXML2.ServerXMLHTTP") | |
xhr.SetTimeouts 8000,8000,8000,8000 | |
On Error Resume Next | |
xhr.Open "GET", address & port, False | |
xhr.Send | |
Dim msg | |
Select Case Err.Number | |
Case 0, -2147012744, -2147024891 | |
msg = "OK" | |
Case -2147012867 | |
msg = "Connection Rejected" | |
Case -2147012894 | |
msg = "Timed out" | |
Case -2147012889 | |
msg = "Could not resolve address" | |
Case -2147467259 | |
msg = "Cannot test that port with this tool" | |
Case Else | |
msg = "Unknown error " & Err.Number | |
End Select | |
On Error Goto 0 | |
Set xhr = Nothing | |
TCPPing = msg | |
End Function | |
Dim i | |
For i = 1 to 16000 | |
If TCPPing( address, i) = "OK" Then | |
Response.Write "<p>Port: "& i &" is opened</p>" | |
End If | |
Next | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment