From: حب الحسين أجنني on 24 Jan 2010 06:12 On Jan 20, 5:19 pm, Corey Thomas <coreytho...(a)gmail.com> wrote: > It's not the most elegant code but will get the job done.  Pass it an > IP and it will do a ping -a and return back the resolved machine name > or blank if it can't resolve. > Caveat:.  This does NOT verify the machine is online.  It is possible > to return the resolved name but not actually ping it. > > Function getMachineFromIP(sstrIP) > 'Input: sstrIP= IP Address of machine > 'Output: String = machine name > >  getMachineFromIP="" >  strMachine = Trim(sstrIP) >  Set sobjShell = WScript.CreateObject("WScript.Shell") >  Set sobjExecObject = sobjShell.Exec("ping -a " & sstrIP) >  Do While Not sobjExecObject.StdOut.AtEndOfStream >    strText = sobjExecObject.StdOut.ReadLine() >    If Instr(strText, "Pinging") > 0 Then >    arrString = Split(strText," ") >      getMachineFromIP=arrString(1) >      Exit Do >    End If >  Loop >  Set sobjShell = Nothing > End Function > > On Jan 20, 12:56 am, Øب اÙØسÙ٠أجÙÙÙ <amne...(a)gmail.com> wrote: > > > Good day, > > > I need a script to read IPs from a text file and provide me with the > > hostname for each IP. Can anyone help me in that? > > > Thanks in advance many thanks to all of you. it was helpful code.
From: p byers on 25 Jan 2010 02:12 mayayana wrote: > One option here: > > http://www.jsware.net/jsware/scripts.php5#jshttp > > This is a free component. In addition to doing hostname > translation it has functions to use a publicly available > database from MaxMind.com to provide geo-location > data. In other words, from an IP address it can return > both the hostname and the server location in terms > of city/state/country. > The download comes with a sample script for translating > raw server log entries. (See IPInfo.vbs) It just requires > slight editing to match the formatting/syntax of your > particular text file. If memory serves, I think I wrote it > to deal with Apache logs that put each GET on a line > starting like so: 100.100.100.100 -- > > You may also be able to do hostname resolution with > built-in Windows functionality, but I'm not sure about > that. (If so, someone should be along shortly to explain > it. :) > Thank you for your work and for telling us about it. I have downloaded the .CSV file and put a copy of it in several folders BUT the VBS still tells me that it is missing !! Can you remember enough about it to give me a clue where to put it Please ?? Pete (Northolt UK)
From: mayayana on 25 Jan 2010 09:54 > I have downloaded the .CSV file and put a copy of it in several folders BUT > the VBS still tells me that it is missing !! > > Can you remember enough about it to give me a clue where to put it Please ?? > The IPInfo.vbs file? By CSV you mean the MaxMind file? Don't download the CSV. Download the binary file. You have to set up a few things. Then edit the script to point to the database. If you look in the help file for jsHTTP2.exe you'll find a section named: "Using jsHTTP2.IPInfo". There are detailed, step-by-step directions there. (In the "red-boxed" area, starting with the bold red line that says: "Important: Requirements for location information functions") I suppose you could use the CSV file with your own database, but if you do it that way then you're on your own in terms of getting the geo-location info. out of that. You'd need to write the script/SQL to do that job. jsHTTP2 is using the MaxMind automation interface. It requires a bit of work to set it up. It has the two dependencies of the DAT and DLL files. The DLL has to be registered. (That's in the jsHTTP2 download.)The DAT has to be named GeoIPCity.dat. jsHTTP2 doesn't control that. (Oddly, the MaxMind needs the DAT file to be named with a specific name that is not the way it's named in the download! That's why jsHTTP2 has that requirement.) But once you have it set up you can use easy jsHTTP2 calls to get geo-location data for an IP. And you can download free updates from MaxMind. When you do that, just replace the existing .dat file with the new one, naming it the same way. http://www.maxmind.com/app/geolitecity
From: p byers on 26 Jan 2010 01:56 mayayana wrote: > > I have downloaded the .CSV file and put a copy of it in several folders > BUT > > the VBS still tells me that it is missing !! > > > > Can you remember enough about it to give me a clue where to put it Please > ?? > > > > The IPInfo.vbs file? > > By CSV you mean the MaxMind file? Don't download > the CSV. Download the binary file. You have > to set up a few things. Then edit the script to point to the > database. If you look in the help file for jsHTTP2.exe > you'll find a section named: "Using jsHTTP2.IPInfo". > There are detailed, step-by-step directions there. > (In the "red-boxed" area, starting with the bold red > line that says: "Important: Requirements for location > information functions") > > I suppose you could use the CSV file with your own > database, but if you do it that way then you're on > your own in terms of getting the geo-location info. > out of that. You'd need to write the script/SQL to > do that job. > > jsHTTP2 is using the MaxMind automation interface. > It requires a bit of work to set it up. It has the > two dependencies of the DAT and DLL files. The > DLL has to be registered. (That's in the jsHTTP2 > download.)The DAT has to be named > GeoIPCity.dat. jsHTTP2 doesn't control that. (Oddly, > the MaxMind needs the DAT file to be named with a > specific name that is not the way it's named in the > download! That's why jsHTTP2 has that requirement.) > > But once you have it set up you can use easy jsHTTP2 calls > to get geo-location data for an IP. And you can download > free updates from MaxMind. When you do that, just > replace the existing .dat file with the new one, naming > it the same way. > > http://www.maxmind.com/app/geolitecity Thank you Pete (Northolt UK)
First
|
Prev
|
Pages: 1 2 Prev: Help with VBS Script to open and login to a Citrix Web Interface s Next: Rename files |