Jump to content

Design Test port (Open/Closed)


Juanola
 Share

Recommended Posts

I want test one number port to verify if it is open or closed to Internet as the test of the Program Emule.

My Computer's IP is 192.168.1.2 and Router's IP is 192.168.1.1.

¿What IP test If I want have the port "4000" open to internet?

The Computer's IP or the Router's IP or Both??

First script

$ip="192.168.1.1"
$port="4000"

TCPStartup()

$MainSocket = TCPListen($ip, $port)

If $MainSocket = -1 Then 
    msgbox(1,"TEST PORT","Closed")
else
    msgbox(1,"TEST PORT","Open")
EndIf

TCPShutdown()oÝ÷ Ù'¢wlr¸©µ«­¢+ØÀÌØí¥ÀôÅÕ½ÐìÄäȸÄØà¸Ä¸ÄÅÕ½Ðì(ÀÌØíÁ½ÉÐôÅÕ½ÐìÐÀÀÀÅÕ½Ðì()Q
AMÑÉÑUÀ ¤((ÀÌØí¥ÀôÅÕ½ÐìÄäȸÄØà¸Ä¸ÄÅÕ½Ðì(ÀÌØíÁ½ÉÐôÅÕ½ÐìÐÀÀÀÅÕ½Ðì(ÀÌØíÑÁõQ
A
½¹¹Ð ÀÌØí¥À°ÀÌØíÁ½ÉФ((ÀÌØí͹ÑáÐõQ
AM¹ ÀÌØíÑÁ°ÅÕ½ÐíQMPA=IPÅÕ½Ðì¤()¥ ÀÌØí͹ÑáÐÐìÀ¤Q¡¸$(%µÍ½à Ä°ÅÕ½ÐíQMPA=IPÅÕ½Ðì°ÅÕ½Ðí=Á¸ÅÕ½Ðì¤)±Í(%µÍ½à Ä°ÅÕ½ÐíQMPA=IPÅÕ½Ðì°ÅÕ½Ðí
±½ÍÅÕ½Ðì¤$)¹%()Q
AM¡Õѽݸ

It 2 scripts doesn't working!!!!

I test and give "Port Open", but the ports are closed with one firewall and the test port Emule Program give "Port Closed"

¿Somebody can help me to design the same test port scanner of the program Emule ?

Greetings.

Edited by Juanola
Link to comment
Share on other sites

I believe that you open ports (in the router port forwarding option) only for the computer's ip like 192.168.1.2 because the real IP address get changed on each disconnection and reconnection so it's just the 192.168.1.2 address that the port is opened for.

About port scanner it's another story, find the topic named TCPConnect or TCPTimeout in the second page of this forum.

Edited by Authenticity
Link to comment
Share on other sites

Thanks for reply me!

But I'm newbie. ¿ Could you helme?¿

My Computer's IP Private is 192.168.1.2. (always the same IP)

My Router's IP Private is 192.168.1.1 (always the same IP)

If I want test if one number port is open to internet. ¿ What IP test? ¿Both?

I test my Computer's IP Private with my script and give "port open"

I test my Computer's IP Roter with my script and give "port open"

If I test with test program Emule give "port closed".

The port is really closed. I have closed the port manually forwarding of the options menu of the router for test the port.

Why my script test give "port open" if the port is really closed?

How can do I the same test port of the program Emule¿? One script test what give "Port closed".

Somebody could hel me to design the script?

Thank you.

Edited by Juanola
Link to comment
Share on other sites

Try the method that is posted on the topic name TCPConnect timeout I've posted above because I believe that it gives better results. Also I still think that it's your IP and not the router's because I have here router and the return value indicate that indeed my IP doesn't have an open port which is opened in the other machine. Just use the @IPAddress1 macro, it should return 192.168.1.2 which is your IP.

Link to comment
Share on other sites

Hi!

I have tried your script and it give error and I can't compile it.

Variable must be of type "Object".:
$oSocket.Protocol = $SCKTCPPROTOCOL
$oSocket^ ERROR

I have downloaded the library "OSWINSCK.dll" and "OSWINSCK.OCX" and have copied they in the scriptdir, but I have the same error.

How can I solve it?

Thank you!

Edited by Juanola
Link to comment
Share on other sites

if you want to see if the port is open to the internet... first try to TcpConnect to your pc's local ip address (192..) if it's closed then your program is closed and then tcpconnect to your INTERNET ip(not 192.168.1.1 or 192.168.1.2 but the one showed on sites like http://myipaddress.com/show-my-ip-address/ . Cheers

Edited by TheMadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

Thanks for reply me!

But It test doesn't working!!!

I have my router with the port X open.

I test it port with the test of the program Emule and it give "PORT OPEN"

If I use my scripts of my first post or the script of Mr. Authenticity for test the port it always give "PORT CLOSED" and i know what the port is OPEN!!!

I have tested with my IP PC PRIVATE, IP ROUTER PRIVATE and with IP PUBLIC INTERNET and always give "PORT CLOSED"

Please. HELP ME!

How can I with Autoit have the SAME TEST PORT what the Emule Program?

Thank you!!!!

Edited by Juanola
Link to comment
Share on other sites

How does something like this go?

Global $IP = @IPAddress1
Global $aPing[5][2]
$aPing[0][0] = UBound($aPing) - 1
;Creating random ports
For $i = 1 To $aPing[0][0]
    $aPing[$i][0] = $i * 80
Next
;Start up TCP
TCPStartup()

;Check all ports
For $i = 1 To $aPing[0][0]
    $ret = TCPConnect($IP, $aPing[$i][0])
    If Not @error Then
        $aPing[$i][1] = "Port is open!"
    Else
        $aPing[$i][1] = "Return code = " & @error & " Meaning: "
        Switch @error
            Case 1
                $aPing[$i][1] &= "ERROR- Incorrect IP Address"
            Case 2
                $aPing[$i][1] &= "ERROR- Incorrect Port"
            Case 10061
                $aPing[$i][1] &= "Connection Refused"
        EndSwitch
    EndIf
Next

ConsoleWrite("> Testing ports for " & $IP & @CRLF)
;Display data
For $i = 1 To $aPing[0][0]
    $prefix = "!>"
    If $aPing[$i][1] = "Port is open!" Then $prefix = "+>"
    ConsoleWrite($prefix & " Port (" & $aPing[$i][0] & ") state is " & $aPing[$i][1] & @CRLF)
Next

Other return states can be found here:

http://msdn.microsoft.com/en-us/library/ms740668(VS.85).aspx

Edited by BrettF
Link to comment
Share on other sites

Thanks for reply me!

But It test doesn't working!!!

I have my router with the port X open.

I test it port with the test of the program Emule and it give "PORT OPEN"

If I use my scripts of my first post or the script of Mr. Authenticity for test the port it always give "PORT CLOSED" and i know what the port is OPEN!!!

I have tested with my IP PC PRIVATE, IP ROUTER PRIVATE and with IP PUBLIC INTERNET and always give "PORT CLOSED"

Please. HELP ME!

How can I with Autoit have the SAME TEST PORT what the Emule Program?

Thank you!!!!

It's not my idea or script lol, but it does work. change the timeout value, although I doubt this is the case... You don't have to use this object if you find it to not work... I don't know how it behaves with Vista or what pre-requirements you should fulfill. Try the example with yahoo.com (ping it if you need the ip) and test the port 80 with maximum timeout value of 400 which I believe is enough to return a correct result, if this port is open then it's not the object for sure.

Edited by Authenticity
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...