autoitxp Posted April 9, 2008 Posted April 9, 2008 Hi well my home computer connected to LAN with 12 users . we r using outlook messegner for chat purpose now i want to make tool that tell which pc is online and goes offline using PING command. but not only 1 ip . i want to monitor ip range like 192.168.1.1 to 192.168.1.254 . how can i accomplish this ? Regards
GEOSoft Posted April 9, 2008 Posted April 9, 2008 (edited) Hi well my home computer connected to LAN with 12 users . we r using outlook messegner for chat purpose now i want to make tool that tell which pc is online and goes offline using PING command. but not only 1 ip . i want to monitor ip range like 192.168.1.1 to 192.168.1.254 . how can i accomplish this ? RegardsSomething along the line of $bAddr = like 192.168.1 For $I = .1 To .254 Ping($bAddr & $I);; Or whatever function you decide to use. Next Edited April 9, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
jlorenz1 Posted April 9, 2008 Posted April 9, 2008 (edited) Hi well my home computer connected to LAN with 12 users . we r using outlook messegner for chat purpose now i want to make tool that tell which pc is online and goes offline using PING command. but not only 1 ip . i want to monitor ip range like 192.168.1.1 to 192.168.1.254 . how can i accomplish this ?RegardsMake on each pc a shared folder and then use Stdout() and the Dos-command net view. This works faster then pinging all possible IPs of the PCs. But if you want to ping, then please use their hostname e.g. ping -n 2 xp-host Johannes Edited April 9, 2008 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
weaponx Posted April 9, 2008 Posted April 9, 2008 There was a similar question a while back:http://www.autoitscript.com/forum/index.ph...888&hl=ping
autoitxp Posted April 9, 2008 Author Posted April 9, 2008 (edited) Well its taking lots off time not fast enough ? jlorenz1 ur right While 1 For $i=1 To 254 If Ping("192.168.1."&$i,1000)<>0 Then MsgBox(0,"","192.168.1."&$i&" is online") EndIf Next WEnd Edited April 9, 2008 by autoitxp
GEOSoft Posted April 9, 2008 Posted April 9, 2008 Well its taking lots off time not fast enough ? jlorenz1 ur right While 1 For $i=1 To 254 If Ping("192.168.1."&$i,1000)<>0 Then MsgBox(0,"","192.168.1."&$i&" is online") EndIf Next WEndPing is very slow at any time. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
jlorenz1 Posted April 9, 2008 Posted April 9, 2008 (edited) While 1 For $i=1 To 254 If Ping("192.168.1."&$i,1000)<>0 Then MsgBox(0,"","192.168.1."&$i&" is online") EndIf Next WEnd better & faster $aArray('PC1|PC2|PC3', '|') While 1 For $i=1 to $aArray[0] If Ping($aArray[$i],1000)<>0 Then MsgBox(0,"", $aArray & " is online") EndIf Next WEnd Edited April 9, 2008 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
spudw2k Posted April 9, 2008 Posted April 9, 2008 (edited) better & faster $aArray('PC1|PC2|PC3', '|') While 1 For $i=1 to $aArray[0] If Ping($aArray[$i],1000)<>0 Then MsgBox(0,"", $aArray & " is online") EndIf Next WEndWhy/how is it faster to declare/define a array rather than just pinging a range of ips? I believe he wants to scan a whole subnet. so making an array with every host/ip is just extra work. Edited April 9, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
weaponx Posted April 9, 2008 Posted April 9, 2008 (edited) Of course its going to be slow with a timeout that big. Active computers should only take a few milliseconds to respond, the invalid IP's are going to use that entire timeout. For $i=1 To 254 $result = Ping("192.168.1."&$i,1) If NOT @ERROR Then ConsoleWrite("192.168.1."&$i & " ONLINE" & @CRLF) Else ConsoleWrite("192.168.1."&$i & " OFFLINE" & @CRLF) EndIf Next Edited April 9, 2008 by weaponx
autoitxp Posted April 9, 2008 Author Posted April 9, 2008 (edited) yaa this one is pretty better and faster then previous but still thread is about real time monitoring ips ? now there is problem how to detect if pc goes offline for this we need to scan all ip again and it take lots of time to scan and tell user these pc offline or online so think we need to change method then ip ping scan ? can we do this using netbios or netstat ?Make on each pc a shared folder and then use Stdout() and the Dos-command net view. This works faster then pinging all possible IPs of the PCs. But if you want to ping, then please use their hostname e.g. ping -n 2 xp-host Johannesyaa IPc$ scan or admin$ would be better but how can we accomplish this seem better option Edited April 9, 2008 by autoitxp
autoitxp Posted April 9, 2008 Author Posted April 9, 2008 (edited) I found nbtstat -c and nbtstat -r command very usefull it shows netbios name currently online users scanning nbstat -r every xxx sec sounds faster and more relaible any suggestions ? . Edited April 9, 2008 by autoitxp
autoitxp Posted April 10, 2008 Author Posted April 10, 2008 (edited) Hi This wat i have done so far this will show current online users but have some problems in it First : GUICtrlSetImage set images wrong way donno why? Second: some time it show half users online even my name doesnt appear code need optimization any one like to optimize and correct this will be very appreciated expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Constants.au3> #include "array.au3" #include <GUIConstants.au3> Dim $line Dim $item $GUI = GUICreate("My GUI" , 800 , 600) $listview = GuiCtrlCreateListView ("Indication|Computer|Ip|Status ", 40,40,400,500) GUISetState (@SW_SHOW) $foo = Run(@ComSpec & " /c net view ", @SystemDir, @SW_HIDE,2) While 1 $sActiveLine = StdoutRead($foo) If @error Then ExitLoop If StringLeft($sActiveLine, 2) = "\\" Then $line &= StringReplace($sActiveLine, "\\" , "") & @CRLF EndIf Wend ;$line = StringReplace($line, "\\" , "") $line = StringReplace($line, " " , "") $line = StringReplace($line, @LF,"") $line = StringSplit ($line, @CR) ;ConsoleWrite($line[0]) TCPStartup() For $i = 1 To $line[0] - 1 $result = Ping($line[$i] ,1) If NOT @ERROR Then $line[$i] = GuiCtrlCreateListViewItem(GUICtrlSetImage(-1, "shell32.dll",21) & "|" & $line[$i] & "|" & TCPNameToIP($line[$i]) &"|ONLINE",$listview) ;ConsoleWrite($line[$i] & " " & TCPNameToIP($line[$i]) & " ONLINE" & @CRLF) Else $line[$i]= GuiCtrlCreateListViewItem( GUICtrlSetImage(-1, "shell32.dll",22) & "|" & $line[$i] & "|" & TCPNameToIP($line[$i]) &"|OFFLINE",$listview) ; ConsoleWrite($line[$i] & " OFFLINE" & @CRLF) EndIf Next while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Edited April 10, 2008 by autoitxp
evilertoaster Posted April 10, 2008 Posted April 10, 2008 Try this- expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Constants.au3> #include "array.au3" #include <GUIConstants.au3> Dim $line Dim $item $GUI = GUICreate("My GUI" , 800 , 600) $listview = GuiCtrlCreateListView ("Indication|Computer|Ip|Status ", 40,40,400,500) GUISetState (@SW_SHOW) $foo = Run(@ComSpec & " /c net view ", @SystemDir, @SW_HIDE,2) While 1 $sActiveLine = StdoutRead($foo) If @error Then ExitLoop If StringLeft($sActiveLine, 2) = "\\" Then $line &= StringReplace($sActiveLine, "\\" , "") & @CRLF EndIf Wend $line = StringReplace($line, " " , "") $line = StringReplace($line, @LF,"") $line = StringSplit ($line, @CR) TCPStartup() For $i = 1 To $line[0] - 1 $result = Ping($line[$i] ,1) If NOT @ERROR Then $line[$i] = GuiCtrlCreateListViewItem($line[$i] & "|" & TCPNameToIP($line[$i]) &"|ONLINE",$listview) GUICtrlSetImage(-1, "shell32.dll",21) Else $line[$i] = GuiCtrlCreateListViewItem($line[$i] & "|" & TCPNameToIP($line[$i]) &"|OFFLINE",$listview) GUICtrlSetImage(-1, "shell32.dll",22) EndIf Next TCPShutdown() while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd
jlorenz1 Posted April 11, 2008 Posted April 11, 2008 (edited) If you want convert hostname in IPs then you should use the dos command nslookup. Better than net view and afterwards ping. Johannes Edited April 11, 2008 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
Triblade Posted April 11, 2008 Posted April 11, 2008 See my post <Link> for hints.I had the same slow timeout problem. This is because Autoit ping has a default timeout of 4000ms (4sec)I got a suggestion (read the topic) for a dos command. I've implemented this as a feature in my program.I now use a default of 1000ms because when I set it to 15ms it gives a lot of timeout's. My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger)
jlorenz1 Posted April 13, 2008 Posted April 13, 2008 (edited) @JellyFish666Yes, nslookup (convert IP into Hostname and reverse), net view (shows shared folder in the network) and ping are all cmd commands. Greetings Johannes@TribladeForget the next words, I saw that you are using the -w switch of ping.You want wait longer for a ping. Well, look in the help of the ping command. In german you'll get this help:CODESyntax: ping [-t] [-a] [-n Anzahl] [-l Größe] [-f] [-i Gültigkeitsdauer] [-v Diensttyp] [-r Anzahl] [-s Anzahl] [[-j Hostliste] | [-k Hostliste]] [-w Zeitlimit] ZielnameOptionen: -t Sendet fortlaufend Ping-Signale zum angegebenen Host. Geben Sie STRG-UNTRBR ein, um die Statistik anzuzeigen. Geben Sie STRG-C ein, um den Vorgang abzubrechen. -a Löst Adressen in Hostnamen auf. -n n Anzahl Anzahl zu sendender Echoanforderungen -l Länge Pufferlänge senden -f Setzt Flag für "Don't Fragment". -i TTL Gültigkeitsdauer (Time To Live) -v TOS Diensttyp (Type Of Service) -r Anzahl Route für Anzahl der Abschnitte aufzeichnen -s Anzahl Zeiteintrag für Anzahl Abschnitte -j Hostliste "Loose Source Route" gemäß Hostliste -k Hostliste "Strict Source Route" gemäß Hostliste -w Zeitlimit Zeitlimit in Millisekunden für eine Rückmeldunge.g. ping -w 6000 www.google.com will wait 6000 Milliseconds for a reply of google. Is this what you mean? Johannes Edited April 13, 2008 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
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