patrickb Posted December 15, 2014 Posted December 15, 2014 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()
Solution jguinch Posted December 15, 2014 Solution Posted December 15, 2014 $sPortRange = $CmdLine[2] $aports = StringSplit ( StringReplace($sPortRange, " ", "") , ",", 2) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
patrickb Posted December 15, 2014 Author Posted December 15, 2014 thanx alot, that worked like a charm !
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