Sign in to follow this  
Followers 0
PerryRaptor

Determining If Server Is Online And Application Is Running

10 posts in this topic

Any way to test to see if a specific port is open on a remote server? Ping() doesn't determine open ports.

Because of Firewall and Router PING isn't telling me that the server is online. If I use NMAP.exe and test to see if a specific port is open I then know the server is available and that the particular application is available.

I do not want to use NMAP in my script.

Anyone know of another free lightweight alternative to NMAP that is scriptable?

Also interested in C+ call too. I'd like to try AutoIT calls to C+.

Share this post


Link to post
Share on other sites



Any way to test to see if a specific port is open on a remote server? Ping() doesn't determine open ports.

Because of Firewall and Router PING isn't telling me that the server is online. If I use NMAP.exe and test to see if a specific port is open I then know the server is available and that the particular application is available.

I do not want to use NMAP in my script.

Anyone know of another free lightweight alternative to NMAP that is scriptable?

Also interested in C+ call too. I'd like to try AutoIT calls to C+.

Have you seen this thread to see if it was what you were looking for? http://www.autoitscript.com/forum/index.ph...topic=22343&hl=

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

@SmOke N,

I'm not interested in hidden or cloaked web pages...I want to know if the server is online and that a particular application is running.

Game Servers behind firewalls and/or routers that have not forwarded port 445, allow incoming echo requests ICMP, are not pingable.

Share this post


Link to post
Share on other sites

Sorry, that must have been the wrong post, I remember it not talking about cloaking the the pages, but in fact telling you if the server was online. Maybe I misunderstood the thread, sorry it was of no use.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I'm looking at it right now...PortQry.exe...rather slow in comparision to NMAP but hey, I'm only checking one port.

Share this post


Link to post
Share on other sites

I'm looking at it right now...PortQry.exe...rather slow in comparision to NMAP but hey, I'm only checking one port.

I actually use cyberkit, but came across this and thought it might work for you.

Share this post


Link to post
Share on other sites

$IpAddress = "127.0.0.1"
$PortNumber = 1700

$var = Ping($IpAddress, 250)
If $var Then; Ping OK
    TCPStartup()
    $socket = TCPConnect($IpAddress, $PortNumber);Try to connect to port
    TCPShutdown()
    
    If $socket == -1 Then
        MsgBox(0, @ScriptName, "port is closed")
    Else
        MsgBox(0, @ScriptName, "port is open")
    EndIf
Else
    MsgBox(0, @ScriptName, "host not pingable")
EndIf

Share this post


Link to post
Share on other sites

Thanks Geert

Share this post


Link to post
Share on other sites

Well the only problem with IF $socket == -1 is the fact that the Port could be FILTERED or CLOAKED. Also, if the IP/Url is offline you will also get a -1 result.

$IpAddress = InputBox("IP/URL Port Status", "Enter IP/URL")
$PortNumber = InputBox("IP/URL Port Status","Enter TCP Port Number")
TCPStartup()
    $socket = TCPConnect($IpAddress, $PortNumber)
TCPShutdown()
If $socket == -1 Then
    MsgBox(0, IP/URL Port Status",  "Port is closed or filtered...Socket Result: " & $Socket)
Else
    MsgBox(0, IP/URL Port Status",  "Port is open...Socket Result: " & $Socket)
EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0