Jump to content

cmdline ubound array


patrickb
 Share

Go to solution Solved by jguinch,

Recommended Posts

Hi there,

i'm fairly new to autoit and started with a simple portscanner with some code i found in the autoit forums. The thing i cannot get my head around is, how do i use $aports from the command line. I tried everything i could think of. I think it has something to do with constants and ubound.

The code below works like it is, but i would like to be able to parse the ports to scan from the command line. Simply replacing [80,85,587,25] with $cmdline[2] does not work.

My goal is to use it from the commandline with ipaddress as $cmdline[1] and a portrange (example) 80,443,139 as $cmdline[2]

Any help would be much appreciated

local $aports = [80,85,587,25]

TCPStartup()
For $i = 0 To UBound($aPorts) - 1
    $iSocket = TCPConnect($cmdline[1], $aPorts[$i])
    If @error Then
        ConsoleWrite("not connected" & @CRLF)
    Else
        ConsoleWrite("connected" & @CRLF)
    EndIf
Next
TCPShutdown()
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...