Jump to content

Check For FTP Port


Recommended Posts

Hi! Im currently new to AutoIT Script, and programming in general. I just started doing some script during my free time at my job( Computer IT ). Im currently making a manager to see if everything is correct on some computer and one of them is the FTP. Im trying to get the info if the Port is open, passive and transfer IN/OUT.  I just don't understand at all the FTP in AutoIT! I try the FTP_CONNECT function but all im able to do is connect without getting the info I need. I only need to know if the port is open for exemple. If someone could explain me a little it would be much appreciate! I love AutoIT and I would like to understand more to help the community!

Thank You!

PS: Sry for my bad english, it my second language. :S

Link to comment
Share on other sites

i suggest :  if  you send  a  code  is much better  for comunity , help you (use a tag ) , for your problem i suggest , before read this

https://stackoverflow.com/questions/20861843/check-if-ftp-server-is-passive-or-active-using-telnet

and after  use winscp you can bind in autoit , winscp is much powerful  and support also sftp 

https://winscp.net/eng/docs/ftp_modes

 

 

Link to comment
Share on other sites

you could connect to its port to see if it is open

ConsoleWrite(@CR)
ConsoleWrite(IpPortTest(@IPAddress1,21)&@CR)
ConsoleWrite(IpPortTest(@IPAddress1,139)&@CR)
ConsoleWrite(IpPortTest('192.168.100.300',21)&@CR)
ConsoleWrite(IpPortTest(@IPAddress1,'tAsd')&@CR&@CR)

func IpPortTest($ip,$port)
    TCPStartup()
    $socket = TCPConnect($ip,$port)
    $error = @error
    if $error then
        if $error = 10060 then Return 'Error : Connection timed out on ip:'&$ip&', port:'&$port
        if $error = 1 then Return '!Error : IPAddr: '&$ip&' is incorrect.'
        if $error = 2 then Return '!Error : port: '&$port&' is incorrect.'
        if $error = -2 then Return 'not connected.'; not sure when this one will trigger, no network conection?
    Else
        TCPCloseSocket($socket)
        Return '+Port:'&$port&' is open on IPAddr: '&$ip&' socket:'&$socket
    EndIf
    TCPShutdown()
EndFunc

 

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