Jump to content

Recommended Posts

Posted

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

Posted

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

 

Posted

Thank you for all the info! I just asked for where to start looking to do this functionality and with those respond I know where to start looking!

Much Appreciate!

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
  • Recently Browsing   0 members

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