Leaderboard
Popular Content
Showing content with the highest reputation on 03/07/2018 in all areas
-
How to use while/do function in IE automation ?
Danp2 reacted to Earthshine for a topic
I would open the help file online or local, and search for While1 point -
Sorry, my mistake, I wanted to say to use this flag in _FTP_FileGet().1 point
-
When asking for help on an issue such as this, it would be beneficial to also include the results from the Scite output window so that we can see any errors that occurred. Looking at your code, I see several issues -- 1) Your calls to _IELoadWait are coded incorrectly. They should look like this -- _IELoadWait($oIE) 2) Similar issue with _IEGetObjById. It should instead look like this -- $btnnext = _IEGetObjById($oIE,"btnnext")1 point
-
nping - Console network pinger / network sweeper / network scanner
MLO reacted to jvanegmond for a topic
nping.exe is a console line portable application that scans a network based on a supplied network address from any Windows machine. It is designed for system administrators and other people who are inclined to have need for a simple network scanner. This is finished and complete software. Output: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\Jos>nping nping.exe scans a network based on a supplied network address. Usage: nping.exe [ipaddress] [local 1-4] [listlocal] Examples: nping.exe 192.168.0.0-1 will ping these addresses: 192.168.0.0 and 192.168.0.1 nping.exe 192.168.20.* will ping everything in the range from 192.168.20.1 to 192.168.20.255 nping listlocal gives you a list of local ipaddresses recognized by the program nping local pings your local network, if your ip addresses is 10.0.5.100 then it will p ing everything in 10.0.5.* C:\Users\Jos>nping 74.125.79.* Pinging 255 addresses in range of 74.125.79.* 74.125.79.4 has a roundtrip of 17 ms 74.125.79.5 has a roundtrip of 18 ms 74.125.79.6 has a roundtrip of 22 ms 74.125.79.18 has a roundtrip of 15 ms 74.125.79.27 has a roundtrip of 15 ms 74.125.79.32 has a roundtrip of 17 ms 74.125.79.47 has a roundtrip of 16 ms 74.125.79.52 has a roundtrip of 15 ms 74.125.79.53 has a roundtrip of 16 ms 74.125.79.54 has a roundtrip of 16 ms 74.125.79.57 has a roundtrip of 19 ms 74.125.79.58 has a roundtrip of 16 ms 74.125.79.77 has a roundtrip of 15 ms 74.125.79.79 has a roundtrip of 17 ms 74.125.79.81 has a roundtrip of 15 ms 74.125.79.82 has a roundtrip of 19 ms 74.125.79.84 has a roundtrip of 13 ms 74.125.79.85 has a roundtrip of 18 ms 74.125.79.86 has a roundtrip of 26 ms 74.125.79.91 has a roundtrip of 22 ms 74.125.79.111 has a roundtrip of 14 ms 74.125.79.114 has a roundtrip of 17 ms 74.125.79.116 has a roundtrip of 19 ms 74.125.79.118 has a roundtrip of 22 ms 74.125.79.142 has a roundtrip of 22 ms 74.125.79.143 has a roundtrip of 23 ms 74.125.79.147 has a roundtrip of 20 ms 74.125.79.149 has a roundtrip of 24 ms 74.125.79.161 has a roundtrip of 21 ms 74.125.79.166 has a roundtrip of 17 ms 74.125.79.184 has a roundtrip of 15 ms 74.125.79.206 has a roundtrip of 24 ms 74.125.79.222 has a roundtrip of 16 ms 74.125.79.223 has a roundtrip of 16 ms 74.125.79.224 has a roundtrip of 16 ms 74.125.79.225 has a roundtrip of 17 ms 74.125.79.226 has a roundtrip of 17 ms 74.125.79.231 has a roundtrip of 21 ms 74.125.79.237 has a roundtrip of 22 ms 74.125.79.230 has a roundtrip of 21 ms 74.125.79.250 has a roundtrip of 18 ms 74.125.79.252 has a roundtrip of 16 ms 74.125.79.254 has a roundtrip of 20 ms Ping statistics for 74.125.79.*: Total hosts pinged: 255 Total hosts UP: 43 [16.86%] Total hosts DOWN: 212 [83.14%] Average roundtrip: 18ms C:\Users\Jos> Tip ! Use the following command to write the results to a text file, you can then use a batch / AutoIt or VBS script to email you the results: nping 192.168.20.0-100 > networklog.txtIt will place the results in a file called networklog.txt Code: #NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\Windows\Installer\{B924C008-D667-3B26-84C6-BD70285F9BFC}\Icon_app.ico #AutoIt3Wrapper_outfile=nping.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Constants.au3> #include <Array.au3> Global Const $MAX_PROCESS = 25 ; A maximum number of processes Global Const $MAX_HOSTS = 16777216 ; A maximum number of hosts to ping due to AutoIt's array limit size, and yes, I can work around it but no, I won't Local $networkRange = "" Local $showLocal = False Local $numOfLocalIp = 1 If @Compiled Then If $CmdLine[0] > 0 Then For $n = 1 to UBound($CmdLine)-1 Switch $CmdLine[$n] Case "/?", "?", "/help", "/info" _showHelp() Exit 0 case "listlocal", "locallist" ConsoleWrite("Local IP addresses known to this machine: " & @CRLF) ConsoleWrite("1: " & @IPAddress1 & @CRLF) ConsoleWrite("2: " & @IPAddress2 & @CRLF) ConsoleWrite("3: " & @IPAddress3 & @CRLF) ConsoleWrite("4: " & @IPAddress4 & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Use: nping local # to ping all devices on these networks") Exit 0 case "local" $showLocal = True $n +=1 If $n < UBound($CmdLine) Then If $CmdLine[$n] = Number($CmdLine[$n]) Then $numOfLocalIp = Number($CmdLine[$n]) If $numOfLocalIp < 1 Or $numOfLocalIp > 4 Then ConsoleWrite("Local IP address index number must be between 1 and 4" & @CRLF) Exit 0 EndIf EndIf EndIf Case Else $networkRange = $CmdLine[1] EndSwitch Next Else _showHelp() Exit 0 EndIf EndIf If $showLocal Then $localIp = Execute("@IpAddress" & $numOfLocalIp) $ipParts = StringSplit($localIp, ".") $networkRange = $ipParts[1] & "." & $ipParts[2] & "." & $ipParts[3] & ".*" EndIf Local $tStart = TimerInit() $aArray = _GetIpAddressList($networkRange) If @error = 1 Then ConsoleWrite("There are no addresses to be scanned in this range. Check the syntax of your network range." & @CRLF & @CRLF) _showHelp() Exit 1 EndIf If @error = 2 Then ConsoleWrite("Maximum number of hosts to ping is " & $MAX_HOSTS & ", but you tried to ping " & @extended & " hosts" & @CRLF & @CRLF) _showHelp() Exit 1 EndIf Local $iTotal = UBound($aArray) If $iTotal = 1 Then ConsoleWrite("Pinging " & $iTotal & " address in range of " & $networkRange & @CRLF) Else ConsoleWrite("Pinging " & $iTotal & " addresses in range of " & $networkRange & @CRLF) EndIf ConsoleWrite(@CRLF) Local $aProcess[$MAX_PROCESS] ; An array to keep a reference to spawned processes, in the next loop we fill it with value 0 for reference For $i = 0 To UBound($aProcess) - 1 $aProcess[$i] = 0 Next Local $i = 0 ; which IP are we currently trying to ping ( based on array ) Local $iFinished = 0 ; how many processes have finished pinging Local $iUp = 0 ; Total hosts that are UP Local $iDown = 0 ; Total hosts that are DOWN Local $iTotalRoundTrip = 0 ; Total roundtrip (all the +ms added together) While 1 ; We check all the currently running processes For $n = 0 To UBound($aProcess) - 1 ; Check if we need a spot, and there is an existing spot here If ($i <> UBound($aArray) And $aProcess[$n] == 0) Then $aProcess[$n] = _MSPing($aArray[$i]) ; Spawn a new process in the available spot $i += 1 ; Increment $i so we can do the next process the next time around Else ; Check if this process has been spawned and the process is ready If ($aProcess[$n] <> 0 And _MSPingIsReady($aProcess[$n])) Then ; Get results from the command $sHostname = _MSPingGetHostname($aProcess[$n]) $sResult = _MSPingGetResult($aProcess[$n]) If ($sResult <> -1) Then ; Check if the host is up ConsoleWrite($sHostname & " has a roundtrip of " & $sResult & " ms" & @CRLF) $iUp += 1 $iTotalRoundTrip += $sResult Else $iDown += 1 EndIf ; Free up an empty space for the next address to Ping $aProcess[$n] = 0 ; Increment the total of processes that have finished $iFinished += 1 ; If the total number of finished processes If ($iFinished == UBound($aArray)) Then ExitLoop 2 ; Return EndIf EndIf Next Sleep(50) ; Give existing ping commands some time to process the request WEnd If $iUp = 0 Then ConsoleWrite("No devices replied to the ping in this range" & @CRLF) Exit 0 EndIf Local $percentageUp = Round($iUp / $iTotal * 100, 2) Local $percentageDown = 100-$percentageUp Local $tTotal = TimerDiff($tStart) Local $averageRoundTrip = Round($iTotalRoundTrip / $iUp) Local $sUpPad = "" Local $sDownPad = "" For $i = 0 To 6 - StringLen(String($iUp)) $sUpPad &= " " Next For $i = 0 To 6 - StringLen(String($iDown)) $sDownPad &= " " Next ConsoleWrite(@CRLF) ConsoleWrite("Ping statistics for " & $networkRange & ":" & @CRLF) ConsoleWrite(@TAB & "Total hosts pinged: " & $iTotal & @CRLF) ConsoleWrite(@TAB & "Total hosts UP: " & $iUp & $sUpPad & "[" & $percentageUp & "%]" & @CRLF) ConsoleWrite(@TAB & "Total hosts DOWN: " & $iDown & $sDownPad & "[" & $percentageDown & "%]" & @CRLF) ConsoleWrite(@TAB & "Average roundtrip: " & $averageRoundTrip & "ms" & @CRLF) Func _showHelp() ConsoleWrite("nping.exe scans a network based on a supplied network address." & @CRLF & @CRLF & _ "Usage: nping.exe [ipaddress] [local 1-4] [listlocal]" & @CRLF & @CRLF & _ "Examples: " & @CRLF & " nping.exe 192.168.0.0-1" & @CRLF & " will ping these addresses: 192.168.0.0 and 192.168.0.1" & @CRLF & _ " nping.exe 192.168.20.*" & @CRLF & " will ping everything in the range from 192.168.20.1 to 192.168.20.255" & @CRLF & _ " nping listlocal" & @CRLF & " gives you a list of local ipaddresses recognized by the program" & @CRLF & _ " nping local" & @CRLF & " pings your local network, if your ip addresses is 10.0.5.100 then it will ping everything in 10.0.5.*" & @CRLF) EndFunc Func _GetIpAddressList($ipFormat) If $ipFormat = "" Then Return SetError(1) EndIf $ipFormat = StringReplace($ipFormat, "*", "1-255") $ipSplit = StringSplit($ipFormat, ".") If $ipSplit[0] <> 4 Then TCPStartup() Local $ret[1] = [TCPNameToIP($ipFormat)] If @error Then Return SetError(1) Return $ret EndIf For $i = 1 To 4 If Not StringRegExp($ipSplit[$i], "[0-9\-]*") Then TCPStartup() Local $ret[1] = [TCPNameToIP($ipFormat)] If @error Then Return SetError(1) Return $ret EndIf Next Local $ipRange[4][2], $totalPermu = 1 For $i = 0 To 3 If StringInStr($ipSplit[$i + 1], "-") Then $m = StringSplit($ipSplit[$i + 1], "-") $ipRange[$i][0] = $m[1] $ipRange[$i][1] = $m[2] Else $n = Number($ipSplit[$i + 1]) $ipRange[$i][0] = $n $ipRange[$i][1] = $n EndIf $totalPermu *= $ipRange[$i][1] - $ipRange[$i][0] + 1 Next If $totalPermu > $MAX_HOSTS Then Return SetError(2, String($totalPermu)) EndIf Local $result[$totalPermu], $i = 0 For $a = $ipRange[0][0] To $ipRange[0][1] For $b = $ipRange[1][0] To $ipRange[1][1] For $c = $ipRange[2][0] To $ipRange[2][1] For $d = $ipRange[3][0] To $ipRange[3][1] $result[$i] = $a & "." & $b & "." & $c & "." & $d $i += 1 Next Next Next Next Return $result EndFunc ;==>_GetIpAddressList Func _Exit() Exit EndFunc ;==>_Exit Func _MSPing($sHostname, $timeout = 50) Local $return_struc[4] ; [0] = Result (in ms) ; [1] = The hostname originally used ; [2] = Process handle (for internal use only) ; [3] = Buffer (for internal use only) $return_struc[1] = $sHostname $return_struc[2] = Run("ping " & $sHostname & " -n 1 -w " & $timeout, "", @SW_HIDE, $STDOUT_CHILD) Return $return_struc EndFunc ;==>_MSPing Func _MSPingIsReady(ByRef $return_struc) Return ___MSPingReadOutput($return_struc) EndFunc ;==>_MSPingIsReady Func _MSPingGetResult($return_struc) Return $return_struc[0] EndFunc ;==>_MSPingGetResult Func _MSPingGetHostname($return_struc) Return $return_struc[1] EndFunc ;==>_MSPingGetHostname ; Internal use only Func ___MSPingReadOutput(ByRef $return_struc) $data = StdoutRead($return_struc[2]) If (@error) Then ___MSPingParseResult($return_struc) Return 1 Else $return_struc[3] &= $data Return 0 EndIf EndFunc ;==>___MSPingReadOutput ; Internal use only Func ___MSPingParseResult(ByRef $return_struc) $result = StringRegExp($return_struc[3], "([0-9]*)ms", 3) If @error Then $return_struc[0] = -1 Else $return_struc[0] = $result[0] EndIf EndFunc ;==>___MSPingParseResult Old version downloads: 180 Download: nping.exe1 point