; ############################################################################## $ipstart = "192.168.178.1" $ipend = "192.168.178.30" While 1 $GUIMSG = GUIGetMsg() Switch $GUIMSG Case $GUI_Event_close Exit Case $button _PingAll( "192.168.178.1" , "192.168.178.225" ) ;_ArrayDisplay( $x , "ghj" ) ;MsgBox( 1 , "test" , $ipadress[1][1] ) EndSwitch WEnd ; ############################################################################## ; ############################################################################## ; ############################################################################## ; ############################################################################## ; ### PING ALL ################################################################# ; ############################################################################## Func _PingAll($ipstart, $ipend, $iprange = "", $port01 = "", $port02 = "", $port03 = "", $port04 = "", $radim = 0, $winxp = 1, $vnc = 1, $ShowName = 1, $ShowMac = 1, $dealy = 100, $slash = "|", $yes = 1, $no = 0, $showprog = 1, $showbevore = 1) If $iprange = "" Then $iprange = StringSplit(@IPAddress1, ".") $iprange = $iprange[1] & "." & $iprange[2] & "." & $iprange[3] & "." EndIf Local $ipadress[$ipend + 1] = [1, ""] $ip = $ipstart If $showprog = 1 Then ProgressOn("IP", "IP Check") Global $ra, $xp, $VNC3, $MAC1, $name1 If $showbevore = 1 Then $ra = "Ra:" $xp = "XP:" $VNC3 = "VNC:" $MAC1 = "Mac:" $name1 = "Name:" EndIf $i = 0 Do If $showprog = 1 Then ProgressSet(($ip * 100) / $ipend, $iprange & $ip) $ip += 1 Ping($iprange & $ip, $dealy) If Not @error Then $i += 1 $ipadress[$i] &= $iprange & $ip & $slash If $port01 <> "" Then $ipadress[$i] &= $port01 & ":" & PortScan($port01, $iprange & $ip, $yes, $no) & $slash If $port02 <> "" Then $ipadress[$i] &= $port02 & ":" & PortScan($port02, $iprange & $ip, $yes, $no) & $slash If $port03 <> "" Then $ipadress[$i] &= $port03 & ":" & PortScan($port03, $iprange & $ip, $yes, $no) & $slash If $port04 <> "" Then $ipadress[$i] &= $port04 & ":" & PortScan($port04, $iprange & $ip, $yes, $no) & $slash If $radim <> 0 Then $ipadress[$i] &= $ra & PortScan(4899, $iprange & $ip, $yes, $no) & $slash If $winxp <> 0 Then $ipadress[$i] &= $xp & PortScan(3389, $iprange & $ip, $yes, $no) & $slash If $vnc <> 0 Then $ipadress[$i] &= $VNC3 & PortScan(5900, $iprange & $ip, $yes, $no) & $slash If $ShowMac <> 0 Then $ipadress[$i] &= $MAC1 & _GetMACFromIP($iprange & $ip) & $slash If $ShowName <> 0 Then $ipadress[$i] &= $name1 & _IpToName($iprange & $ip) & $slash EndIf $ipadress[$ip] = StringTrimRight($ipadress[$ip], 1) ;~ MsgBox(0,$ipstart&" "&$ipend,$iprange&$ip) If $showprog = 1 Then ProgressSet(($ip * 100) / $ipend) If $showprog <> 0 And $showprog <> 1 Then GUICtrlSetData($showprog, ($ip * 100) / $ipend) Until $ip >= $ipend $ipadress[0] = $i ProgressOff() _ArrayDisplay( $ipadress , "" ) Return $ipadress EndFunc ;==>_PingAll Func PortScan($port, $ip, $1, $2) $socket = TCPConnect($ip, $port) If $socket = -1 Then Return $2 Else Return $1 EndIf EndFunc ;==>PortScan Func _GetMACFromIP($sIP) Local $MAC, $MACSize Local $i, $s, $r, $iIP $MAC = DllStructCreate("byte[6]") $MACSize = DllStructCreate("int") DllStructSetData($MACSize, 1, 6) $r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIP) $iIP = $r[0] $r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize)) $s = "" For $i = 0 To 5 If $i Then $s = $s & ":" $s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2) Next Return $s EndFunc ;==>_GetMACFromIP Func _IpToName($ip) $outread = "ERROR: Kann Programm NbtStat.exe nicht finden!" Ping($ip, 50) If @error Then ;~ MsgBox(16,"Ping error","Die adresse "&$ip&" konnte nich gefunden werden, stellen Sie sicher das der Rechner online ist!") ;~ Exit Return @error EndIf $run = Run(@ComSpec & " /c nbtstat -a " & $ip, @SystemDir, @SW_HIDE, 6) Sleep(500) $stdoutread = StdoutRead($run) If Not @error = -1 Then $outread = $stdoutread $stderrRead = StderrRead($run) If Not @error = -1 Then $outread = $stderrRead $ss = StringSplit($outread, @CRLF) If $ss[0] < 23 Then $outread = "(Kein Name Vorhanden)" Else $outread = $ss[23] $outread = StringReplace($outread, Chr(129), "ü") $outread = StringReplace($outread, Chr(154), "Ü") $outread = StringReplace($outread, Chr(142), "Ä") $outread = StringReplace($outread, Chr(132), "ä") $outread = StringReplace($outread, Chr(153), "Ö") $outread = StringReplace($outread, Chr(148), "ö") $outreadlen = StringLen(" LAN-Verbindung:Knoten-IP-Adresse: [] Bereichskennung: [] NetBIOS-Namentabelle des Remotecomputers Name Typ Status --------------------------------------------- ") + StringLen($ip) $outread = StringTrimLeft($outread, 4) $outread = StringSplit($outread, " ") $outread = $outread[1] $outread = StringReplace($outread, " ", "", 0) EndIf Return $outread EndFunc ;==>_IpToName ; ############################################################################## ; ############################################################################## ; ##############################################################################