hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

vnet576
Has anybody here seen or heard of a tool that could convert many hostnames into ip addresses. For example say i get it a list of 100 websites that i need converted into ip addresses. I know there are plenty of tools where u gotta convert each one indivioduly, but with alot of hostnames that could take a long time.
hulk
it would take a long time but u could ping each one and it would return the ip address from a web address
Gandalf^^
a simple bat file would make it. here is a start:

QUOTE

echo off
set file=%1
for /f %%i in (%file%) do ping %%i >> result.txt


I named it host_to_ip.bat
i tested it with a hostnames list host.txt so usage was
host_to_ip.bat host.txt
it outputs a file named result.txt that looks like this:
QUOTE

Pinging lns-p19-.......net [62.xxx.xxx.xxx] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 62.xxx.xxx.xxx:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Pinging A.......aol.com [172.xxx.xxx.xxx] with 32 bytes of data:

Reply from 172.xxx.xxx.xxx: bytes=32 time=611ms TTL=117
Reply from 172.xxx.xxx.xxx: bytes=32 time=643ms TTL=117
Reply from 172.xxx.xxx.xxx: bytes=32 time=681ms TTL=117
Reply from 172.xxx.xxx.xxx: bytes=32 time=660ms TTL=117
Ping statistics for 172.xxx.xxx.xxx:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 611ms, Maximum = 681ms, Average = 648ms


you can now easily extract automatically the IP and the host from the file by only selecting the first line of each ping : "Pinging A.......aol.com [172.xxx.xxx.xxx] with 32 bytes of data"
if you only need the ip and don't need anymore the host, it'll be easy to make another batch file that only outputs the ips.
hope it can help

edit: stupid @ removed behind echo
vnet576
Wow that was a good idea...thanks for your help. Haven't thought about using a batch file. It does everything that i need.
agamemnon
This should work like a dream, and produce far smoother output than Gandalf's. Sorry!

NAMES.BAT
CODE

for /f %%i in (ips.txt) do ping -a -n 1 %%i | FIND /i "Pinging" >> result.txt



IPS.TXT
CODE

192.168.0.11
192.168.0.12
192.168.0.13



Sample output:
Pinging TJA [192.168.0.11] with 32 bytes of data:
Pinging ROUTER [192.168.0.12] with 32 bytes of data:
Pinging fred [192.168.0.13] with 32 bytes of data:
Gandalf^^
thanks for the improvement, I never used the switches with ping.
vnet576
hehe..that one works even better, thanks.
Both of u saved me alot of time with these batch files.
woutiir
Here's a small perlscript i made for resolving.
just start it like this:

perl resolve.pl <file with ips>

CODE

#!/usr/bin/perl

use Socket;

open(FILE, $ARGV[0]);
@domains = <FILE>;
close(FILE);

foreach $domain (@domains) {
  chomp($domain);
  if($domain) {
/*      print $domain.' '; */
     $ipaddr = gethostbyname($domain);
     if($ipaddr) {
       printf "%s\n" , inet_ntoa($ipaddr);
     } else {
       print "Cannot be resolved\n";
     }
  }
}


And how the file should look like:
CODE

www.google.com
www.governmentsecurity.org
www.woutiir.org


etc.. smile.gif

Try it!

woutiir..

Output is as you'd like it smile.gif
vnet576
I've never used pearl before. What exactly do i have to install in order to run that script and how do i compile it.
woutiir
Just use linux. I dunno exactly how to use it under windows. I'd recommend:
http://www.google.com for those questions smile.gif Linux it's simple:
perl <program.pl> and it runs smile.gif

Greetings,
woutiir
agamemnon
You can download ActivePerl. It runs under windows. I use it all the time. Google for it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.