AntiVirusGuy Posted March 15, 2006 Share Posted March 15, 2006 Sorry if this is posted somewhere but I must be looking with the wrong key words. Does anyone know how to feed a list of ip addresses into a scrip and then stop at the end ex ping iplist.txt where the ip list is 10.0.0.1 10.0.0.2 192.168.0.1 etc I know this can not be to hard....just to hard for me Link to comment Share on other sites More sharing options...
Developers Jos Posted March 15, 2006 Developers Share Posted March 15, 2006 Sorry if this is posted somewhere but I must be looking with the wrong key words. Does anyone know how to feed a list of ip addresses into a scrip and then stop at the endex ping iplist.txtwhere the ip list is10.0.0.110.0.0.2192.168.0.1etc I know this can not be to hard....just to hard for melook at FileOpen() and Filereadline() examples and replace the msgbox of the ping function SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
neogia Posted March 15, 2006 Share Posted March 15, 2006 Be careful though, it looks like you're trying to ping the global range of IP addresses, and some places don't like to be pinged. A friend got in trouble with the FBI for attempting to peek at a certain range of IPs, can't remember the range though. Be warned! [u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted March 15, 2006 Author Share Posted March 15, 2006 ok let me clerify. Ping was just an example, also note all addresses are private addrersses. the problem with the read line option is I still ahve to create a script line for each line in the text file I am looking for a way to add a whole file reguardless of the number of entries Link to comment Share on other sites More sharing options...
seandisanti Posted March 15, 2006 Share Posted March 15, 2006 ok let me clerify. Ping was just an example, also note all addresses are private addrersses.the problem with the read line option is I still ahve to create a script line for each line in the text file I am looking for a way to add a whole file reguardless of the number of entriesread up on StringSplit() _FileReadToArray(), and FileRadLine Link to comment Share on other sites More sharing options...
Xenobiologist Posted March 15, 2006 Share Posted March 15, 2006 Hi, hmh, something like that? #include <file.au3> #include<Array.au3> $file = FileOpen("c:\Downloads\AutoIt-Skripte\Entwicklung\iplist.txt", 0) Dim $aRecords If Not _FileReadToArray("c:\Downloads\AutoIt-Skripte\Entwicklung\iplist.txt" ,$aRecords) Then MsgBox(4096,"Error", "Ip-list error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Next _ArrayDisplay($aRecords, "IPList") FileClose($file) 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...
nfwu Posted March 16, 2006 Share Posted March 16, 2006 Be careful though, it looks like you're trying to ping the global range of IP addresses, and some places don't like to be pinged. A friend got in trouble with the FBI for attempting to peek at a certain range of IPs, can't remember the range though. Be warned!Those are all reserved IP addresses... they are reserved for Local Area Networks...No problem if you ping those, just watch out for the Class D and Class E ranges. (Reserved for Multicast and Experimental Purposes respectively) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted March 16, 2006 Author Share Posted March 16, 2006 hey thanks I am almost there, now how do I say ping each of those ip addresses? _______________________________________________ #include <file.au3> #include<Array.au3> $file = FileOpen("\iplist.txt", 0) Dim $aRecords If Not _FileReadToArray("iplist.txt" ,$aRecords) Then MsgBox(4096,"Error", "Ip-list error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] Next _ArrayDisplay($aRecords, "IPList") FileClose($file) Link to comment Share on other sites More sharing options...
blindwig Posted March 16, 2006 Share Posted March 16, 2006 faster & easier from DOS: FOR /f "tokens=*" %%A in (iplist.txt) do PING %%A My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted March 16, 2006 Author Share Posted March 16, 2006 ping was just an example auctually I am backing up switches I need to run sftp login@iplist......... for each switch Link to comment Share on other sites More sharing options...
Lapo Posted March 16, 2006 Share Posted March 16, 2006 ping was just an example auctually I am backing up switchesI need to run sftp login@iplist......... for each switch$file = FileOpen("test.txt", 0); Check if file opened for reading OKIf $file = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIf; Read in lines of text until the EOF is reachedWhile 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line); Your ftp command hereWendFileClose($file) 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