Juanola Posted February 2, 2009 Posted February 2, 2009 (edited) 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 February 2, 2009 by Juanola
Authenticity Posted February 2, 2009 Posted February 2, 2009 (edited) 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 February 2, 2009 by Authenticity
Juanola Posted February 2, 2009 Author Posted February 2, 2009 (edited) 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 February 2, 2009 by Juanola
Authenticity Posted February 2, 2009 Posted February 2, 2009 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.
Juanola Posted February 2, 2009 Author Posted February 2, 2009 (edited) 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 February 2, 2009 by Juanola
Authenticity Posted February 2, 2009 Posted February 2, 2009 http://www.ostrosoft.com/download/oswinsck.zipDownload this file, and register the .ocx or .dll library (Don't remember which one it has, both will work) using Start->Run and type regsvr32.exe "Path\To\Dll.ocx" and then you'll be able to use this object
Xand3r Posted February 2, 2009 Posted February 2, 2009 (edited) 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 February 2, 2009 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
Juanola Posted February 3, 2009 Author Posted February 3, 2009 (edited) 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 February 3, 2009 by Juanola
BrettF Posted February 3, 2009 Posted February 3, 2009 (edited) 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) NextOther return states can be found here:http://msdn.microsoft.com/en-us/library/ms740668(VS.85).aspx Edited February 3, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Authenticity Posted February 3, 2009 Posted February 3, 2009 (edited) 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 February 3, 2009 by Authenticity
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now