GtaSpider Posted May 17, 2006 Share Posted May 17, 2006 Hello I've written long time ago a script thats compfortable ping all PC's in your network. Its on German but i think its easy to understand Ok! here is it! I hope for suggestions and Praise expandcollapse popup;~ #include <GuiListView.au3> #include <GuiConstants.au3> $error = 0 Dim $from[5] Global Const $DebugIt = 1 Global Const $WM_NOTIFY = 0x00004000 Global $hIPAddress Global $WM_USER = 0x400 Global Const $LVM_SETCOLUMNWIDTH = 0x101E Global Const $LVM_FIRST = 0x1000 Global Const $LV_ERR = -1 Global Const $LVM_GETHOTITEM = ($LVM_FIRST + 61) Global $IPM_CLEARADDRESS = ($WM_USER + 100) Global $IPM_GETADDRESS = ($WM_USER + 102) Global $IPM_ISBLANK = ($WM_USER + 105) Global $IPM_SETADDRESS = ($WM_USER + 101) Global $IPM_SETFOCUS = ($WM_USER + 104) Global $IPM_SETRANGE = ($WM_USER + 103) Global $IPN_FIRST = (-860) Global $IPN_FIELDCHANGED = ($IPN_FIRST - 0) Global Const $THRESHOLD = Number(RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "DoubleClickSpeed")) Global $TIMER = TimerInit() FileInstall("nbtstat.exe", @SystemDir & "\nbtstat.exe") $startadressFirst = StringSplit(@IPAddress1, ".") $startadress = "" If @error Then Exit TCPStartup() $bb = GUICreate("Bitte Warten", 216, 95, 0, 0) $Checkbox1 = GUICtrlCreateCheckbox("Kann auf das Internet zugreifen", 8, 48, 193, 17) $Checkbox2 = GUICtrlCreateCheckbox("Bin im Netzwerk", 8, 72, 105, 17) GUICtrlCreateLabel("Bitte Warten... Ihre Netzwerkverbindung wird überprüft", 8, 8, 197, 25) $Avi1 = GUICtrlCreateAvi("shell32.dll", 152, 88, 24, 16, 16) GUICtrlSetState(-1, 1) GUISetState(@SW_SHOW) Ping("www.google.de", 5) If @error = 4 Then $error = 1 GUICtrlSetState($Checkbox1, $GUI_DISABLE) Else GUICtrlSetState($Checkbox1, $gui_checked) EndIf If $error = 1 And @IPAddress1 = "127.0.0.1" Then GUICtrlSetState($Checkbox2, $GUI_DISABLE) Else GUICtrlSetState($Checkbox2, $gui_checked) EndIf If $error = 1 And @IPAddress1 = "127.0.0.1" Then If MsgBox(276, "Netzwerk", "Bitte Stellen Sie sicher das Sie mit dem Netzwerk verbunden sind und Starten Sie das Programm neu!" & @CR & "Wenn Sie mit dem Netzwerk verbunden sind klicken Sie auf Ja!") = 7 Then Exit EndIf $adress = "" $ssr = StringSplit(_restart(1, 255, $startadressFirst[1], $startadressFirst[2], $startadressFirst[3]), "|") $from = $ssr[1] $to = $ssr[2] $startadress = $ssr[3] $sss = $ssr[1] + 1 $sss = $sss - 1 ;~ If $ssr < Global $name = $ssr[9] Global $macshow = $ssr[8] Global $VNC2 = $ssr[5] Global $RemoteDesktop2 = $ssr[6] Global $RAdim2 = $ssr[4] Global $YourPort2 = $ssr[7] $tolistview = "IP Adresse" If $ssr[9] = 1 Then $tolistview &= "|Computer-Name " If $ssr[8] = 1 Then $tolistview &= "|MAC-Adresse" If $ssr[5] <> 0 Then $tolistview &= "|VNC Port" If $ssr[6] <> 0 Then $tolistview &= "|WinXP Remotedesktop Port" If $ssr[4] <> 0 Then $tolistview &= "|RAdim Port" If $ssr[7] <> 0 Then $tolistview &= "|Port "&$YourPort2 ;~ Dim $ListIp[$to+1] GUIDelete($bb) SplashTextOn("", "Bitte Warten...", 120, 20, -1, -1, 1) GUICreate("IP Finder", 460, 330, (@DesktopWidth - 390) / 2, (@DesktopHeight - 310) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $List = GUICtrlCreateListView($tolistview, 10, 10, 440, 290) $Prog = GUICtrlCreateProgress(10, 300, -1, 10) $lab = GUICtrlCreateLabel("0% " & $startadress & $from, 10, 310, 120) $restart = GUICtrlCreateButton("Wiederholen", 120, 310, 70, 20) $mstc = GUICtrlCreateButton("RemoteDesktop", 195, 310, 120, 20) $copy = GUICtrlCreateButton("Kopieren", 320, 310, 60, 20) $IE = GUICtrlCreateButton("Öffnen", 385, 310, 65, 20) If Not @OSVersion = "Win_XP" Then GUICtrlSetState(-1, $GUI_DISABLE) GUISetCursor(15, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN _DoubleClickOnListView($List) Case $msg = $restart GUICtrlDelete($List) GUICtrlSetData($lab, "0% " & $startadress & "1") GUICtrlSetData($Prog, "0") $ssr = StringSplit(_restart(1, 255, $startadressFirst[1], $startadressFirst[2], $startadressFirst[3]), "|") SplashTextOn("", "Bitte Warten...", 120, 20, -1, -1, 1) $from = $ssr[1] $to = $ssr[2] $startadress = $ssr[3] $sss = $ssr[1] + 1 $sss = $sss - 1 ;~ If $ssr < Global $name = $ssr[9] Global $macshow = $ssr[8] Global $VNC2 = $ssr[5] Global $RemoteDesktop2 = $ssr[6] Global $RAdim2 = $ssr[4] Global $YourPort2 = $ssr[7] $tolistview = "IP Adresse" If $ssr[9] = 1 Then $tolistview &= "|Computer-Name " If $ssr[8] = 1 Then $tolistview &= "|MAC-Adresse" If $ssr[5] <> 0 Then $tolistview &= "|VNC Port" If $ssr[6] <> 0 Then $tolistview &= "|WinXP Remotedesktop Port" If $ssr[4] <> 0 Then $tolistview &= "|RAdim Port" If $ssr[7] <> 0 Then $tolistview &= "|Port "&$YourPort2 $List = GUICtrlCreateListView($tolistview, 10, 10, 440, 290) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $sss < $to $b = Ping($startadress & $sss, 100) If Not @error Then ;PortScan: If $VNC2 <> 0 Then Global $VNC = PortScan($VNC2, $startadress & $sss) & "|" Else Global $VNC = "" EndIf If $RemoteDesktop2 <> 0 Then Global $RemoteDesktop = PortScan($RemoteDesktop2, $startadress & $sss) & "|" Else Global $RemoteDesktop = "" EndIf If $RAdim2 <> 0 Then Global $RAdim = PortScan($RAdim2, $startadress & $sss) & "|" Else Global $RAdim = "" EndIf If $YourPort2 <> 0 Then Global $YourPort = PortScan($YourPort2, $startadress & $sss) & "|" Else Global $YourPort = "" EndIf If $macshow = 1 Then $getmac = _GetMACFromIP($startadress & $sss) & "|" Else $getmac = "" EndIf If $name = 1 Then If $startadress & $sss = @IPAddress1 Then $iptoname = @ComputerName & "(Dein PC)|" Else $iptoname = _IpToName($startadress & $sss) & "|" If @error Then _error("IpToName: " & @error) EndIf Else $iptoname = "" EndIf $adress = $adress & $startadress & $sss & @CR GUICtrlCreateListViewItem($startadress & $sss & "|" & $iptoname & $getmac & $VNC & $RemoteDesktop & $RAdim & $YourPort, $List) $iptoname = "" EndIf $sss = $sss + 1 If $sss = $from + 1 Then SplashOff() GUISetCursor(2, 1) EndIf $Progress = ($sss/ (($to - 1) / 100)) GUICtrlSetData($Prog, $Progress) GUICtrlSetData($lab, Round($Progress) & "% " & $startadress & $sss) Case $sss = $to GUICtrlSetData($Prog, 100) GUICtrlSetData($lab, "100% " & $startadress & $sss - 1) $sss = $sss + 1 Case $msg = $IE $listread = GUICtrlRead(GUICtrlRead($List)) $listread = StringSplit($listread, "|") _URL($listread[1]) Case $msg = $copy ClipPut(GUICtrlRead(GUICtrlRead($List))) Case $msg = $mstc $listread = GUICtrlRead(GUICtrlRead($List)) $listread = StringSplit($listread, "|") Run("mstsc /v " & $listread[1]) EndSelect WEnd Func _error($text) MsgBox(16, "ERROR!", $text) Exit EndFunc ;==>_error #region - ListView Func _GUICtrlListViewGetHotItem($h_listview) If IsHWnd($h_listview) Then Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_GETHOTITEM, "int", 0, "int", 0) Return $a_ret[0] Else Return GUICtrlSendMsg($h_listview, $LVM_GETHOTITEM, 0, 0) EndIf EndFunc ;==>_GUICtrlListViewGetHotItem Func _GUICtrlListViewGetCurSel($h_listview, $s_WindowTitle = "", $s_WindowText = "") If (StringLen($s_WindowTitle) == 0) Then $s_WindowTitle = WinGetTitle("") EndIf If (StringLen(ControlListView($s_WindowTitle, $s_WindowText, $h_listview, "GetSelected")) > 0) Then Return Int(ControlListView($s_WindowTitle, $s_WindowText, $h_listview, "GetSelected", 0)) Else Return $LV_ERR EndIf EndFunc ;==>_GUICtrlListViewGetCurSel #endregion - ListView Func _DoubleClickOnListView(ByRef $lvctrl) Dim $MousePos = GUIGetCursorInfo() If ($MousePos[4] == $lvctrl And GUICtrlRead($lvctrl) > 0 And _GUICtrlListViewGetHotItem($lvctrl) = _GUICtrlListViewGetCurSel($lvctrl)) Then $timerdiff = TimerDiff($TIMER) If $timerdiff <= $THRESHOLD Then $url = StringSplit(GUICtrlRead(GUICtrlRead($List)), "|") _URL($url[1]) EndIf $TIMER = TimerInit() EndIf EndFunc ;==>_DoubleClickOnListView Func OnAutoItExit() TCPShutdown() EndFunc ;==>OnAutoItExit Func _restart($from, $to, $1, $2, $3) $ipadress = $1 & "." & $2 & "." & $3 & ".1" $IpAusw = GUICreate("IP Auswahl", 255, 192, (@DesktopWidth - 392) / 2, (@DesktopHeight - 318) / 2) $to1 = GUICtrlCreateInput($to, 204, 8, 46, 21, $WS_THICKFRAME, $WS_EX_CLIENTEDGE) GUICtrlSetLimit(-1, 3) $Updown2 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 255, "1") GUICtrlCreateLabel("-", 190, 0, 15, 36) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("PortCheck", 8, 72, 240, 65) $portvnc = GUICtrlCreateCheckbox("VNC", 16, 88, 49, 17) GUICtrlSetState(-1, $gui_checked) $portra = GUICtrlCreateCheckbox("RAdim", 16, 104, 49, 17) $portwinxp = GUICtrlCreateCheckbox("WinXp Remote Desktop", 65, 88, 161, 17) GUICtrlSetState(-1, $gui_checked) $portselv = GUICtrlCreateCheckbox("Benutzerdef.", 65, 104, 81, 17) $selvport = GUICtrlCreateInput("Port", 148, 104, 85, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("Sonstige", 8, 144, 240, 41) $ShowName = GUICtrlCreateCheckbox("Namen Anzeigen", 16, 160, 105, 17) GUICtrlSetState(-1, $gui_checked) $ShowMac = GUICtrlCreateCheckbox("Mac Anzeigen", 120, 160, 105, 17) GUICtrlSetState(-1, $gui_checked) $weiter = GUICtrlCreateButton("&Weiter >>", 8, 32, 245, 25) GUICtrlSetState(-1, $GUI_ENABLE) $hIPAddress = _GuiCtrlIpAddressCreate($IpAusw, 8, 5, 136 + 41, 25, $WS_THICKFRAME) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_IPAdress_Events") _IPSetAddress($hIPAddress, $ipadress) _IPSetFocus($hIPAddress, 3) _IPSetRange($hIPAddress, 3, 1, 255) HotKeySet("{ENTER}", "IpRangeEnter") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $portselv If GUICtrlRead($portselv) = $gui_checked Then GUICtrlSetState($selvport, $GUI_ENABLE) Else GUICtrlSetState($selvport, $GUI_DISABLE) EndIf Case $msg = $weiter $selvportvar = "" If GUICtrlRead($portselv) = $gui_checked Then $selvportvar = GUICtrlRead($selvport) $portravar = 4899 $portvncvar = 5900 $portwinxpvar = 3389 $ShowMacVar = 1 $ShowNameVar = 1 If GUICtrlRead($portvnc) = 4 Then $portvncvar = 0 EndIf If GUICtrlRead($portwinxp) = 4 Then $portwinxpvar = 0 EndIf If GUICtrlRead($portra) = 4 Then $portravar = 0 EndIf If GUICtrlRead($portra) = 4 Then $portravar = 0 EndIf If GUICtrlRead($ShowMac) = 4 Then $ShowMacVar = 0 EndIf If GUICtrlRead($ShowName) = 4 Then $ShowNameVar = 0 EndIf $getipadress = _GetIPAdress($hIPAddress) $from = StringSplit($getipadress, ".") If $from[1] > 0 Then $from[1] = 255 - $from[1] If $from[1] > 0 Then $from[1] = "-" & $from[1] Else $from[1] += 1 EndIf ElseIf $from[1] = 0 Then $from[1] = -255 Else $from[1] += 1 EndIf If $from[2] > 0 Then $from[2] = 255 - $from[2] If $from[2] > 1 Then $from[2] = "-" & $from[2] Else $from[2] += 1 EndIf ElseIf $from[2] = 0 Then $from[2] = -255 Else $from[2] += 1 EndIf If $from[3] > 0 Then $from[3] = 255 - $from[3] If $from[3] > 1 Then $from[3] = "-" & $from[3] Else $from[3] += 1 EndIf ElseIf $from[3] = 0 Then $from[3] = -255 Else $from[3] += 1 EndIf $11 = 255 + $from[1] $22 = 255 + $from[2] $33 = 255 + $from[3] If $11 > 255 Then $11 = 255 If $22 > 255 Then $22 = 255 If $33 > 255 Then $33 = 255 $to = GUICtrlRead($to1) + 1 $from = $from[4] If $to > 256 Or $to < 1 Or $from > 256 Or $from < 1 Then MsgBox(16, "ERROR", "Bitte Nur Zahlen von 1 - 255 eingeben!") ContinueLoop EndIf If $to < $from Then MsgBox(16, "ERROR", "Die zahl bis wohin er pingen soll ist kleiner als die Zahl von wo er pingen soll, das ist unglogisch...") ContinueLoop EndIf If StringIsDigit($to) = 1 Then ExitLoop MsgBox(16, "", "Bitte Nur Zahlen eingeben!") EndSelect WEnd $startadress = $11 & "." & $22 & "." & $33 & "." GUIDelete($IpAusw) HotKeySet("{ENTER}") Return $from & "|" & $to & "|" & $startadress & "|" & $portravar & "|" & $portvncvar & "|" & $portwinxpvar & "|" & $selvportvar & "|" & $ShowMacVar & "|" & $ShowNameVar EndFunc ;==>_restart Func IpRangeEnter() If WinExists("IP Auswahl") Then ControlClick("IP Auswahl", "", "&Weiter >>") Else HotKeySet("{ENTER}") Send("{ENTER}") HotKeySet("{ENTER}", "IpRangeEnter") EndIf EndFunc ;==>IpRangeEnter Func _URL($site) $ffpath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe", "") If @error Then $disable = $GUI_DISABLE Else $disable = $GUI_ENABLE EndIf ;~ $iepath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "") If @error Then $disableie = $GUI_DISABLE Else $disableie = $GUI_ENABLE EndIf $OKRightDlg = GUICreate("Site Öffnen", 352, 130, 302, 218) GUISetBkColor(0xA6CAF0) GUICtrlCreateGroup("", 8, 0, 257, 100) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlCreateGroup("", -99, -99, 1, 1) $st = GUICtrlCreateButton("&Standard Br...", 272, 8, 75, 20) GUICtrlSetTip(-1, "Standard Browser") $expl = GUICtrlCreateButton("&Explorer", 272, 30, 75, 20) $ff = GUICtrlCreateButton("&FireFox", 272, 52, 75, 20) GUICtrlSetState(-1, $disable) $msgname = GUICtrlCreateButton("Zeige Name", 10, 105, 75, 20) $msgmac = GUICtrlCreateButton("Zeige Mac", 90, 105, 75, 20) $msgvnc = GUICtrlCreateButton("VNC", 170, 105, 50, 20) $msgradim = GUICtrlCreateButton("RAdim", 222, 105, 50, 20) $msgwinxp = GUICtrlCreateButton("WinXp", 275, 105, 50, 20) $internetexpl = GUICtrlCreateButton("&Internet Expl...", 272, 74, 75, 20) GUICtrlSetState(-1, $disableie) GUICtrlSetTip(-1, "Internet Explorer") GUICtrlCreateLabel("Bitte Wählen Sie aus mit welchem Explorer die Seite, " & $site & " geöfnet werden soll", 16, 16, 232, 73) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $msgvnc $VNC = PortScan($VNC2, $site) MsgBox(0, "VNC Port von " & $site, $VNC) Case $msg = $msgradim MsgBox(0, "RAdim Port von " & $site, PortScan($RAdim2, $site)) Case $msg = $msgwinxp MsgBox(0, "WinXp Port von " & $site, PortScan($RemoteDesktop2, $site)) Case $msg = $msgname SplashTextOn("", "Bitte Warten...", 120, 20, -1, -1, 1) $iptonamemsg = _IpToName($site) SplashOff() MsgBox(0, "Name von " & $site, $iptonamemsg) Case $msg = $msgmac MsgBox(0, "Mac von " & $site, _GetMACFromIP($site)) Case $msg = $st RunWait(@ComSpec & " /c start http://" & $site, "", @SW_HIDE) ExitLoop Case $msg = $expl Run("explorer \\" & $site) ExitLoop Case $msg = $ff Run($ffpath & " http://" & $site) ExitLoop Case $msg = $internetexpl Run($iepath & " http://" & $site) ExitLoop EndSelect WEnd GUIDelete($OKRightDlg) Return EndFunc ;==>_URL Func PortScan($port, $ip) $socket = TCPConnect($ip, $port) If $socket = -1 Then Return "Nein[0]" Else Return "Ja[1]" EndIf EndFunc ;==>PortScan 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 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 ;by gafrost! Func _GuiCtrlIpAddressCreate($h_Gui, $x, $y, $width, $heigth, $v_styles = -1, $v_exstyles = -1) Local $h_IPAdress, $style If $v_exstyles = -1 Then $v_exstyles = 0 If Not IsHWnd($h_Gui) Then $h_Gui = HWnd($h_Gui) $style = BitOR($WS_CHILD, $WS_VISIBLE, $WS_TABSTOP) If $v_styles <> - 1 Then $style = BitOR($style, $v_styles) $h_IPAdress = DllCall("user32.dll", "long", "CreateWindowEx", "long", $v_exstyles, _ "str", "SysIPAddress32", "str", "", _ "long", $style, "long", $x, "long", $y, "long", $width, "long", $heigth, _ "hwnd", $h_Gui, "long", 0, "hwnd", $h_Gui, "long", 0) If Not @error Then Return $h_IPAdress[0] Else SetError(1) EndIf Return 0 EndFunc ;==>_GuiCtrlIpAddressCreate Func _ClearIPAdress($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_CLEARADDRESS, "int", 0, "int", 0) EndFunc ;==>_ClearIPAdress Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWord Func _GetIPAdress($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) Local $dwd_IPAdress = DllStructCreate("dword") Local $Filled = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_GETADDRESS, "int", 0, "ptr", DllStructGetPtr($dwd_IPAdress)) Local $1stHalf = _HiWord(DllStructGetData($dwd_IPAdress, 1)) Local $2ndHalf = _LoWord(DllStructGetData($dwd_IPAdress, 1)) $dwd_IPAdress = 0 Return BitShift($1stHalf, 8) & "." & BitShift(BitRotate($1stHalf, 8), 8) & "." & BitShift($2ndHalf, 8) & "." & BitShift(BitRotate($2ndHalf, 8), 8) EndFunc ;==>_GetIPAdress Func _IPIsBlank($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) Local $lResult = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_ISBLANK, "int", 0, "int", 0) If Not @error Then Return $lResult[0] Else SetError(1) Return 0 EndIf EndFunc ;==>_IPIsBlank Func _IPSetFocus($h_IPAdress, $index) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETFOCUS, "int", $index, "int", 0) EndFunc ;==>_IPSetFocus Func _MakeWord($LoByte, $HiByte) Return BitOR($LoByte, 0x100 * $HiByte) EndFunc ;==>_MakeWord Func _IPSetRange($h_IPAdress, $field_index, $low_range = 0, $high_range = 255) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) If $low_range < 0 Or $low_range > $high_range Then SetError(1) Return 0 ElseIf $high_range > 255 Then SetError(2) Return 0 ElseIf $field_index < 0 Or $field_index > 3 Then SetError(3) Return 0 EndIf Local $lResult = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETRANGE, "int", $field_index, "int", _MakeWord($low_range, $high_range)) If Not @error Then Return $lResult[0] Else SetError(1) Return 0 EndIf EndFunc ;==>_IPSetRange Func _MakeIP($HiWord, $LoWord) Return BitOR($LoWord * 0x10000, BitAND($HiWord, 0xFFFF)) EndFunc ;==>_MakeIP Func _IPSetAddress($h_IPAdress, $s_address) Local $a_address = StringSplit($s_address, ".") If $a_address[0] = 4 Then DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETADDRESS, "int", 0, "int", _MakeIP(_MakeWord($a_address[4], $a_address[3]), _MakeWord($a_address[2], $a_address[1]))) EndIf EndFunc ;==>_IPSetAddress Func WM_NOTIFY_IPAdress_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $Field, $value, $hwndFrom, $idFrom, $code, $nmhdr, $NMIPADDRESS $nmhdr = DllStructCreate("int;int;int", $lParam) $hwndFrom = DllStructGetData($nmhdr, 1) Switch $hwndFrom Case $hIPAddress $NMIPADDRESS = DllStructCreate("int;int;int;int;int", $lParam) $hwndFrom = DllStructGetData($NMIPADDRESS, 1) $idFrom = DllStructGetData($NMIPADDRESS, 2) $code = DllStructGetData($NMIPADDRESS, 3) $Field = DllStructGetData($NMIPADDRESS, 4) $value = DllStructGetData($NMIPADDRESS, 5) Switch $code Case $IPN_FIELDCHANGED ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$IPN_FIELDCHANGED" & @LF) ;---------------------------------------------------------------------------------------------- EndSwitch EndSwitch $nmhdr = 0 $NMIPADDRESS = 0 EndFunc ;==>WM_NOTIFY_IPAdress_Events ;end bygafrost Sorry for my bad english www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
ptrex Posted May 17, 2006 Share Posted May 17, 2006 Very nice !! Only a pitty that it's not in English !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 17, 2006 Share Posted May 17, 2006 Hi, yeah very nice. Here a quick and dirty translation. Search for ;!!! maybe you have to change the following line, too. expandcollapse popup;~ #include <GuiListView.au3> #include <GuiConstants.au3> $error = 0 Dim $from[5] Global Const $DebugIt = 1 Global Const $WM_NOTIFY = 0x00004000 Global $hIPAddress Global $WM_USER = 0x400 Global Const $LVM_SETCOLUMNWIDTH = 0x101E Global Const $LVM_FIRST = 0x1000 Global Const $LV_ERR = -1 Global Const $LVM_GETHOTITEM = ($LVM_FIRST + 61) Global $IPM_CLEARADDRESS = ($WM_USER + 100) Global $IPM_GETADDRESS = ($WM_USER + 102) Global $IPM_ISBLANK = ($WM_USER + 105) Global $IPM_SETADDRESS = ($WM_USER + 101) Global $IPM_SETFOCUS = ($WM_USER + 104) Global $IPM_SETRANGE = ($WM_USER + 103) Global $IPN_FIRST = (-860) Global $IPN_FIELDCHANGED = ($IPN_FIRST - 0) Global Const $THRESHOLD = Number(RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "DoubleClickSpeed")) Global $TIMER = TimerInit() FileInstall("nbtstat.exe", @SystemDir & "\nbtstat.exe") $startadressFirst = StringSplit(@IPAddress1, ".") $startadress = "" If @error Then Exit TCPStartup() $bb = GUICreate("Bitte Warten", 216, 95, 0, 0) $Checkbox1 = GUICtrlCreateCheckbox("access to network", 8, 48, 193, 17) $Checkbox2 = GUICtrlCreateCheckbox("connected to network", 8, 72, 155, 17) GUICtrlCreateLabel("Please wait, checking network connection...", 8, 8, 197, 25) $Avi1 = GUICtrlCreateAvi("shell32.dll", 152, 88, 24, 16, 16) GUICtrlSetState(-1, 1) GUISetState(@SW_SHOW) Ping("www.google.de", 5) If @error = 4 Then $error = 1 GUICtrlSetState($Checkbox1, $GUI_DISABLE) Else GUICtrlSetState($Checkbox1, $gui_checked) EndIf If $error = 1 And @IPAddress1 = "127.0.0.1" Then GUICtrlSetState($Checkbox2, $GUI_DISABLE) Else GUICtrlSetState($Checkbox2, $gui_checked) EndIf If $error = 1 And @IPAddress1 = "127.0.0.1" Then If MsgBox(276, "Network", "Make sure, you are connected to the network. Start program again" & @CR & "If you are connected to network click YES!") = 7 Then Exit EndIf $adress = "" $ssr = StringSplit(_restart(1, 255, $startadressFirst[1], $startadressFirst[2], $startadressFirst[3]), "|") $from = $ssr[1] $to = $ssr[2] $startadress = $ssr[3] $sss = $ssr[1] + 1 $sss = $sss - 1 ;~ If $ssr < Global $name = $ssr[9] Global $macshow = $ssr[8] Global $VNC2 = $ssr[5] Global $RemoteDesktop2 = $ssr[6] Global $RAdim2 = $ssr[4] Global $YourPort2 = $ssr[7] $tolistview = "IP Adresse" If $ssr[9] = 1 Then $tolistview &= "|Computer-Name " If $ssr[8] = 1 Then $tolistview &= "|MAC-Adresse" If $ssr[5] <> 0 Then $tolistview &= "|VNC Port" If $ssr[6] <> 0 Then $tolistview &= "|WinXP Remotedesktop Port" If $ssr[4] <> 0 Then $tolistview &= "|RAdim Port" If $ssr[7] <> 0 Then $tolistview &= "|Port "&$YourPort2 ;~ Dim $ListIp[$to+1] GUIDelete($bb) SplashTextOn("", "Please wait...", 120, 20, -1, -1, 1) GUICreate("IP Finder", 460, 330, (@DesktopWidth - 390) / 2, (@DesktopHeight - 310) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $List = GUICtrlCreateListView($tolistview, 10, 10, 440, 290) $Prog = GUICtrlCreateProgress(10, 300, -1, 10) $lab = GUICtrlCreateLabel("0% " & $startadress & $from, 10, 310, 120) $restart = GUICtrlCreateButton("Repeat", 120, 310, 70, 20) $mstc = GUICtrlCreateButton("RemoteDesktop", 195, 310, 120, 20) $copy = GUICtrlCreateButton("Copy", 320, 310, 60, 20) $IE = GUICtrlCreateButton("Open", 385, 310, 65, 20) If Not @OSVersion = "Win_XP" Then GUICtrlSetState(-1, $GUI_DISABLE) GUISetCursor(15, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_PRIMARYDOWN _DoubleClickOnListView($List) Case $msg = $restart GUICtrlDelete($List) GUICtrlSetData($lab, "0% " & $startadress & "1") GUICtrlSetData($Prog, "0") $ssr = StringSplit(_restart(1, 255, $startadressFirst[1], $startadressFirst[2], $startadressFirst[3]), "|") SplashTextOn("", "Please wait...", 120, 20, -1, -1, 1) $from = $ssr[1] $to = $ssr[2] $startadress = $ssr[3] $sss = $ssr[1] + 1 $sss = $sss - 1 ;~ If $ssr < Global $name = $ssr[9] Global $macshow = $ssr[8] Global $VNC2 = $ssr[5] Global $RemoteDesktop2 = $ssr[6] Global $RAdim2 = $ssr[4] Global $YourPort2 = $ssr[7] $tolistview = "IP Adresse" If $ssr[9] = 1 Then $tolistview &= "|Computer-Name " If $ssr[8] = 1 Then $tolistview &= "|MAC-Adresse" If $ssr[5] <> 0 Then $tolistview &= "|VNC Port" If $ssr[6] <> 0 Then $tolistview &= "|WinXP Remotedesktop Port" If $ssr[4] <> 0 Then $tolistview &= "|RAdim Port" If $ssr[7] <> 0 Then $tolistview &= "|Port "&$YourPort2 $List = GUICtrlCreateListView($tolistview, 10, 10, 440, 290) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $sss < $to $b = Ping($startadress & $sss, 100) If Not @error Then ;PortScan: If $VNC2 <> 0 Then Global $VNC = PortScan($VNC2, $startadress & $sss) & "|" Else Global $VNC = "" EndIf If $RemoteDesktop2 <> 0 Then Global $RemoteDesktop = PortScan($RemoteDesktop2, $startadress & $sss) & "|" Else Global $RemoteDesktop = "" EndIf If $RAdim2 <> 0 Then Global $RAdim = PortScan($RAdim2, $startadress & $sss) & "|" Else Global $RAdim = "" EndIf If $YourPort2 <> 0 Then Global $YourPort = PortScan($YourPort2, $startadress & $sss) & "|" Else Global $YourPort = "" EndIf If $macshow = 1 Then $getmac = _GetMACFromIP($startadress & $sss) & "|" Else $getmac = "" EndIf If $name = 1 Then If $startadress & $sss = @IPAddress1 Then $iptoname = @ComputerName & "(Your PC)|" Else $iptoname = _IpToName($startadress & $sss) & "|" If @error Then _error("IpToName: " & @error) EndIf Else $iptoname = "" EndIf $adress = $adress & $startadress & $sss & @CR GUICtrlCreateListViewItem($startadress & $sss & "|" & $iptoname & $getmac & $VNC & $RemoteDesktop & $RAdim & $YourPort, $List) $iptoname = "" EndIf $sss = $sss + 1 If $sss = $from + 1 Then SplashOff() GUISetCursor(2, 1) EndIf $Progress = ($sss/ (($to - 1) / 100)) GUICtrlSetData($Prog, $Progress) GUICtrlSetData($lab, Round($Progress) & "% " & $startadress & $sss) Case $sss = $to GUICtrlSetData($Prog, 100) GUICtrlSetData($lab, "100% " & $startadress & $sss - 1) $sss = $sss + 1 Case $msg = $IE $listread = GUICtrlRead(GUICtrlRead($List)) $listread = StringSplit($listread, "|") _URL($listread[1]) Case $msg = $copy ClipPut(GUICtrlRead(GUICtrlRead($List))) Case $msg = $mstc $listread = GUICtrlRead(GUICtrlRead($List)) $listread = StringSplit($listread, "|") Run("mstsc /v " & $listread[1]) EndSelect WEnd Func _error($text) MsgBox(16, "ERROR!", $text) Exit EndFunc ;==>_error #region - ListView Func _GUICtrlListViewGetHotItem($h_listview) If IsHWnd($h_listview) Then Local $a_ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_GETHOTITEM, "int", 0, "int", 0) Return $a_ret[0] Else Return GUICtrlSendMsg($h_listview, $LVM_GETHOTITEM, 0, 0) EndIf EndFunc ;==>_GUICtrlListViewGetHotItem Func _GUICtrlListViewGetCurSel($h_listview, $s_WindowTitle = "", $s_WindowText = "") If (StringLen($s_WindowTitle) == 0) Then $s_WindowTitle = WinGetTitle("") EndIf If (StringLen(ControlListView($s_WindowTitle, $s_WindowText, $h_listview, "GetSelected")) > 0) Then Return Int(ControlListView($s_WindowTitle, $s_WindowText, $h_listview, "GetSelected", 0)) Else Return $LV_ERR EndIf EndFunc ;==>_GUICtrlListViewGetCurSel #endregion - ListView Func _DoubleClickOnListView(ByRef $lvctrl) Dim $MousePos = GUIGetCursorInfo() If ($MousePos[4] == $lvctrl And GUICtrlRead($lvctrl) > 0 And _GUICtrlListViewGetHotItem($lvctrl) = _GUICtrlListViewGetCurSel($lvctrl)) Then $timerdiff = TimerDiff($TIMER) If $timerdiff <= $THRESHOLD Then $url = StringSplit(GUICtrlRead(GUICtrlRead($List)), "|") _URL($url[1]) EndIf $TIMER = TimerInit() EndIf EndFunc ;==>_DoubleClickOnListView Func OnAutoItExit() TCPShutdown() EndFunc ;==>OnAutoItExit Func _restart($from, $to, $1, $2, $3) $ipadress = $1 & "." & $2 & "." & $3 & ".1" $IpAusw = GUICreate("Choose IP ", 255, 192, (@DesktopWidth - 392) / 2, (@DesktopHeight - 318) / 2) $to1 = GUICtrlCreateInput($to, 204, 8, 46, 21, $WS_THICKFRAME, $WS_EX_CLIENTEDGE) GUICtrlSetLimit(-1, 3) $Updown2 = GUICtrlCreateUpdown(-1) GUICtrlSetLimit(-1, 255, "1") GUICtrlCreateLabel("-", 190, 0, 15, 36) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("PortCheck", 8, 72, 240, 65) $portvnc = GUICtrlCreateCheckbox("VNC", 16, 88, 49, 17) GUICtrlSetState(-1, $gui_checked) $portra = GUICtrlCreateCheckbox("RAdim", 16, 104, 49, 17) $portwinxp = GUICtrlCreateCheckbox("WinXp Remote Desktop", 65, 88, 161, 17) GUICtrlSetState(-1, $gui_checked) $portselv = GUICtrlCreateCheckbox("User defined ", 65, 104, 81, 17) $selvport = GUICtrlCreateInput("Port", 148, 104, 85, 20, -1, $WS_EX_CLIENTEDGE) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("Sonstige", 8, 144, 240, 41) $ShowName = GUICtrlCreateCheckbox("Show name", 16, 160, 105, 17) GUICtrlSetState(-1, $gui_checked) $ShowMac = GUICtrlCreateCheckbox("Show MAC", 120, 160, 105, 17) GUICtrlSetState(-1, $gui_checked) $weiter = GUICtrlCreateButton("&Next >>", 8, 32, 245, 25) GUICtrlSetState(-1, $GUI_ENABLE) $hIPAddress = _GuiCtrlIpAddressCreate($IpAusw, 8, 5, 136 + 41, 25, $WS_THICKFRAME) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_IPAdress_Events") _IPSetAddress($hIPAddress, $ipadress) _IPSetFocus($hIPAddress, 3) _IPSetRange($hIPAddress, 3, 1, 255) HotKeySet("{ENTER}", "IpRangeEnter") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $portselv If GUICtrlRead($portselv) = $gui_checked Then GUICtrlSetState($selvport, $GUI_ENABLE) Else GUICtrlSetState($selvport, $GUI_DISABLE) EndIf Case $msg = $weiter $selvportvar = "" If GUICtrlRead($portselv) = $gui_checked Then $selvportvar = GUICtrlRead($selvport) $portravar = 4899 $portvncvar = 5900 $portwinxpvar = 3389 $ShowMacVar = 1 $ShowNameVar = 1 If GUICtrlRead($portvnc) = 4 Then $portvncvar = 0 EndIf If GUICtrlRead($portwinxp) = 4 Then $portwinxpvar = 0 EndIf If GUICtrlRead($portra) = 4 Then $portravar = 0 EndIf If GUICtrlRead($portra) = 4 Then $portravar = 0 EndIf If GUICtrlRead($ShowMac) = 4 Then $ShowMacVar = 0 EndIf If GUICtrlRead($ShowName) = 4 Then $ShowNameVar = 0 EndIf $getipadress = _GetIPAdress($hIPAddress) $from = StringSplit($getipadress, ".") If $from[1] > 0 Then $from[1] = 255 - $from[1] If $from[1] > 0 Then $from[1] = "-" & $from[1] Else $from[1] += 1 EndIf ElseIf $from[1] = 0 Then $from[1] = -255 Else $from[1] += 1 EndIf If $from[2] > 0 Then $from[2] = 255 - $from[2] If $from[2] > 1 Then $from[2] = "-" & $from[2] Else $from[2] += 1 EndIf ElseIf $from[2] = 0 Then $from[2] = -255 Else $from[2] += 1 EndIf If $from[3] > 0 Then $from[3] = 255 - $from[3] If $from[3] > 1 Then $from[3] = "-" & $from[3] Else $from[3] += 1 EndIf ElseIf $from[3] = 0 Then $from[3] = -255 Else $from[3] += 1 EndIf $11 = 255 + $from[1] $22 = 255 + $from[2] $33 = 255 + $from[3] If $11 > 255 Then $11 = 255 If $22 > 255 Then $22 = 255 If $33 > 255 Then $33 = 255 $to = GUICtrlRead($to1) + 1 $from = $from[4] If $to > 256 Or $to < 1 Or $from > 256 Or $from < 1 Then MsgBox(16, "ERROR", "Type number 1 - 255") ContinueLoop EndIf If $to < $from Then MsgBox(16, "ERROR", "The range is badly formatted...") ContinueLoop EndIf If StringIsDigit($to) = 1 Then ExitLoop MsgBox(16, "", "Only numbers allowed") EndSelect WEnd $startadress = $11 & "." & $22 & "." & $33 & "." GUIDelete($IpAusw) HotKeySet("{ENTER}") Return $from & "|" & $to & "|" & $startadress & "|" & $portravar & "|" & $portvncvar & "|" & $portwinxpvar & "|" & $selvportvar & "|" & $ShowMacVar & "|" & $ShowNameVar EndFunc ;==>_restart Func IpRangeEnter() If WinExists("Choose IP") Then ControlClick("Choose IP", "", "&Next >>") Else HotKeySet("{ENTER}") Send("{ENTER}") HotKeySet("{ENTER}", "IpRangeEnter") EndIf EndFunc ;==>IpRangeEnter Func _URL($site) $ffpath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe", "") If @error Then $disable = $GUI_DISABLE Else $disable = $GUI_ENABLE EndIf ;~ $iepath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "") If @error Then $disableie = $GUI_DISABLE Else $disableie = $GUI_ENABLE EndIf $OKRightDlg = GUICreate("Open site", 352, 130, 302, 218) GUISetBkColor(0xA6CAF0) GUICtrlCreateGroup("", 8, 0, 257, 100) GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlCreateGroup("", -99, -99, 1, 1) $st = GUICtrlCreateButton("&Standard Br...", 272, 8, 75, 20) GUICtrlSetTip(-1, "Standard Browser") $expl = GUICtrlCreateButton("&Explorer", 272, 30, 75, 20) $ff = GUICtrlCreateButton("&FireFox", 272, 52, 75, 20) GUICtrlSetState(-1, $disable) $msgname = GUICtrlCreateButton("Show name", 10, 105, 75, 20) $msgmac = GUICtrlCreateButton("Show mac", 90, 105, 75, 20) $msgvnc = GUICtrlCreateButton("VNC", 170, 105, 50, 20) $msgradim = GUICtrlCreateButton("RAdim", 222, 105, 50, 20) $msgwinxp = GUICtrlCreateButton("WinXp", 275, 105, 50, 20) $internetexpl = GUICtrlCreateButton("&Internet Expl...", 272, 74, 75, 20) GUICtrlSetState(-1, $disableie) GUICtrlSetTip(-1, "Internet Explorer") GUICtrlCreateLabel("Choose a browser which opens this site: " & $site, 16, 16, 232, 73) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $msgvnc $VNC = PortScan($VNC2, $site) MsgBox(0, "VNC Port from " & $site, $VNC) Case $msg = $msgradim MsgBox(0, "RAdim Port from " & $site, PortScan($RAdim2, $site)) Case $msg = $msgwinxp MsgBox(0, "WinXp Port from " & $site, PortScan($RemoteDesktop2, $site)) Case $msg = $msgname SplashTextOn("", "Please wait...", 120, 20, -1, -1, 1) $iptonamemsg = _IpToName($site) SplashOff() MsgBox(0, "Name from " & $site, $iptonamemsg) Case $msg = $msgmac MsgBox(0, "Mac from " & $site, _GetMACFromIP($site)) Case $msg = $st RunWait(@ComSpec & " /c start http://" & $site, "", @SW_HIDE) ExitLoop Case $msg = $expl Run("explorer \\" & $site) ExitLoop Case $msg = $ff Run($ffpath & " http://" & $site) ExitLoop Case $msg = $internetexpl Run($iepath & " http://" & $site) ExitLoop EndSelect WEnd GUIDelete($OKRightDlg) Return EndFunc ;==>_URL Func PortScan($port, $ip) $socket = TCPConnect($ip, $port) If $socket = -1 Then Return "No[0]" Else Return "Yes[1]" EndIf EndFunc ;==>PortScan Func _IpToName($ip) $outread = "ERROR: Can't find NbtStat.exe!" 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 = "(No name found)" 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 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 ;by gafrost! Func _GuiCtrlIpAddressCreate($h_Gui, $x, $y, $width, $heigth, $v_styles = -1, $v_exstyles = -1) Local $h_IPAdress, $style If $v_exstyles = -1 Then $v_exstyles = 0 If Not IsHWnd($h_Gui) Then $h_Gui = HWnd($h_Gui) $style = BitOR($WS_CHILD, $WS_VISIBLE, $WS_TABSTOP) If $v_styles <> - 1 Then $style = BitOR($style, $v_styles) $h_IPAdress = DllCall("user32.dll", "long", "CreateWindowEx", "long", $v_exstyles, _ "str", "SysIPAddress32", "str", "", _ "long", $style, "long", $x, "long", $y, "long", $width, "long", $heigth, _ "hwnd", $h_Gui, "long", 0, "hwnd", $h_Gui, "long", 0) If Not @error Then Return $h_IPAdress[0] Else SetError(1) EndIf Return 0 EndFunc ;==>_GuiCtrlIpAddressCreate Func _ClearIPAdress($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_CLEARADDRESS, "int", 0, "int", 0) EndFunc ;==>_ClearIPAdress Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWord Func _GetIPAdress($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) Local $dwd_IPAdress = DllStructCreate("dword") Local $Filled = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_GETADDRESS, "int", 0, "ptr", DllStructGetPtr($dwd_IPAdress)) Local $1stHalf = _HiWord(DllStructGetData($dwd_IPAdress, 1)) Local $2ndHalf = _LoWord(DllStructGetData($dwd_IPAdress, 1)) $dwd_IPAdress = 0 Return BitShift($1stHalf, 8) & "." & BitShift(BitRotate($1stHalf, 8), 8) & "." & BitShift($2ndHalf, 8) & "." & BitShift(BitRotate($2ndHalf, 8), 8) EndFunc ;==>_GetIPAdress Func _IPIsBlank($h_IPAdress) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) Local $lResult = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_ISBLANK, "int", 0, "int", 0) If Not @error Then Return $lResult[0] Else SetError(1) Return 0 EndIf EndFunc ;==>_IPIsBlank Func _IPSetFocus($h_IPAdress, $index) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETFOCUS, "int", $index, "int", 0) EndFunc ;==>_IPSetFocus Func _MakeWord($LoByte, $HiByte) Return BitOR($LoByte, 0x100 * $HiByte) EndFunc ;==>_MakeWord Func _IPSetRange($h_IPAdress, $field_index, $low_range = 0, $high_range = 255) If Not IsHWnd($h_IPAdress) Then $h_IPAdress = HWnd($h_IPAdress) If $low_range < 0 Or $low_range > $high_range Then SetError(1) Return 0 ElseIf $high_range > 255 Then SetError(2) Return 0 ElseIf $field_index < 0 Or $field_index > 3 Then SetError(3) Return 0 EndIf Local $lResult = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETRANGE, "int", $field_index, "int", _MakeWord($low_range, $high_range)) If Not @error Then Return $lResult[0] Else SetError(1) Return 0 EndIf EndFunc ;==>_IPSetRange Func _MakeIP($HiWord, $LoWord) Return BitOR($LoWord * 0x10000, BitAND($HiWord, 0xFFFF)) EndFunc ;==>_MakeIP Func _IPSetAddress($h_IPAdress, $s_address) Local $a_address = StringSplit($s_address, ".") If $a_address[0] = 4 Then DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_IPAdress, "int", $IPM_SETADDRESS, "int", 0, "int", _MakeIP(_MakeWord($a_address[4], $a_address[3]), _MakeWord($a_address[2], $a_address[1]))) EndIf EndFunc ;==>_IPSetAddress Func WM_NOTIFY_IPAdress_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID Local $Field, $value, $hwndFrom, $idFrom, $code, $nmhdr, $NMIPADDRESS $nmhdr = DllStructCreate("int;int;int", $lParam) $hwndFrom = DllStructGetData($nmhdr, 1) Switch $hwndFrom Case $hIPAddress $NMIPADDRESS = DllStructCreate("int;int;int;int;int", $lParam) $hwndFrom = DllStructGetData($NMIPADDRESS, 1) $idFrom = DllStructGetData($NMIPADDRESS, 2) $code = DllStructGetData($NMIPADDRESS, 3) $Field = DllStructGetData($NMIPADDRESS, 4) $value = DllStructGetData($NMIPADDRESS, 5) Switch $code Case $IPN_FIELDCHANGED ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$IPN_FIELDCHANGED" & @LF) ;---------------------------------------------------------------------------------------------- EndSwitch EndSwitch $nmhdr = 0 $NMIPADDRESS = 0 EndFunc ;==>WM_NOTIFY_IPAdress_Events ;end bygafrost So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Simucal Posted May 17, 2006 Share Posted May 17, 2006 Very slick. I like this a lot. I actually do a port scan on my network for radmin frequently.. so this is something I can actually use. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc) Link to comment Share on other sites More sharing options...
Micha1405 Posted May 17, 2006 Share Posted May 17, 2006 Nice Script einfach Klasse My TrayToolBar Link to comment Share on other sites More sharing options...
GtaSpider Posted May 18, 2006 Author Share Posted May 18, 2006 Hello! thanks for translating, th.meger! And thanks for the praises www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
nitekram Posted November 13, 2006 Share Posted November 13, 2006 I have tried running both versions and get the same errorZ:\New\ping_all.au3 (14) : ==> Can not redeclare a constant.: Global $WM_USER = 0x400 Global ^ ERRORWhen I comment out the declaration I getZ:\New\ping_all.au3(21,38) : WARNING: $WM_USER: possibly used before declaration.Global $IPM_CLEARADDRESS = ($WM_USER +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^Z:\New\ping_all.au3(21,38) : ERROR: $WM_USER: undeclared global variable.Global $IPM_CLEARADDRESS = ($WM_USER +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^Z:\New\ping_all.au3 - 1 error(s), 1 warning(s)Running: (3.1.1.133):C:\Program Files\AutoIt3\beta\autoit3.exe "Z:\New\ping_all.au3" Can someone see what I am doing wrong? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 13, 2006 Moderators Share Posted November 13, 2006 I have tried running both versions and get the same errorWhen I comment out the declaration I getRunning: (3.1.1.133):C:\Program Files\AutoIt3\beta\autoit3.exe "Z:\New\ping_all.au3" Can someone see what I am doing wrong?Well, when you get that error, that generally says it's being used elsewhere no? It's (Global $WM_USER = 0x400) in one of the includes now, so just delete the one in the script. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
IcyFerno Posted November 13, 2006 Share Posted November 13, 2006 lol great script, pretty long though Link to comment Share on other sites More sharing options...
nitekram Posted November 14, 2006 Share Posted November 14, 2006 Well, when you get that error, that generally says it's being used elsewhere no? It's (Global $WM_USER = 0x400) in one of the includes now, so just delete the one in the script.I do not understand - if I delete the global declaration, is not that the same as commenting the declaration out? I have commented the global variable out and I am getting the error - with version (3.1.1.133). I just tried it on my home computer - Running:(3.2.0.1) - and after commenting out the following - I was able to get it to work - wow this is really a neat addition to my scripts - thanks. ;Global $WM_USER = 0x400 ;Global Const $LVM_SETCOLUMNWIDTH = 0x101E ;Global Const $LVM_FIRST = 0x1000 ;Global Const $LV_ERR = -1 ;Global Const $LVM_GETHOTITEM = ($LVM_FIRST + 61) I would still like to see why it would not work from my work computer - its like a 'Catch 22' 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Paulie Posted November 14, 2006 Share Posted November 14, 2006 lol great script, pretty long though Not all good things come in small packages... Link to comment Share on other sites More sharing options...
IcyFerno Posted November 14, 2006 Share Posted November 14, 2006 lol i had a hard time reading the code Link to comment Share on other sites More sharing options...
GaryFrost Posted November 14, 2006 Share Posted November 14, 2006 Would suggest going with the latest beta, hard to help anyone using the old beta's. I believe 3.2.1.12 is the latest SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ptrex Posted November 14, 2006 Share Posted November 14, 2006 In order to run it you will have to comment out these lines. ;Global $WM_USER = 0x400 ;Global Const $LVM_SETCOLUMNWIDTH = 0x101E ;Global Const $LVM_FIRST = 0x1000 ;Global Const $LV_ERR = -1 ;Global Const $LVM_GETHOTITEM = ($LVM_FIRST + 61) Lines 13 to 18. Enjoy !! ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
lazy_guy Posted December 4, 2006 Share Posted December 4, 2006 Great script I think that Bitte Warten Translates to PLease Wait Link to comment Share on other sites More sharing options...
GtaSpider Posted December 4, 2006 Author Share Posted December 4, 2006 Hi! Thx for you comments to my scirpt Yeah.. ive written it bevor www.autoit.de exists d.h. longlong time ago (ca 2years) so there are no comments in the script and the script is a little bit.. öh.. unsorted ;-) maybe i'll rewrite it if i have in next time time (^^ can i say it so in english? )! Mfg/best regards Spider www.AutoIt.de - Moderator of the German AutoIt Forum Link to comment Share on other sites More sharing options...
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