Jump to content

Determining If Server Is Online And Application Is Running


Recommended Posts

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+.

Link to comment
Share on other sites

  • Moderators

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=

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.

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...